[3/3] net/virtio: reject unsupported Rx multi queue modes

Message ID 1569944672-24754-3-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series [1/3] net/virtio: reject deferred start Rx queue setup |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko Oct. 1, 2019, 3:44 p.m. UTC
  From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>

This driver supports none of DCB, RSS or VMDQ modes,
therefore must check and return error if configured incorrectly.

Fixes: c1f86306a026 ("virtio: add new driver")
Cc: stable@dpdk.org

Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/virtio/virtio_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Tiwei Bie Oct. 8, 2019, 5:46 a.m. UTC | #1
On Tue, Oct 01, 2019 at 04:44:31PM +0100, Andrew Rybchenko wrote:
> From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
> 
> This driver supports none of DCB, RSS or VMDQ modes,
> therefore must check and return error if configured incorrectly.
> 
> Fixes: c1f86306a026 ("virtio: add new driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 7261109dd..0af4fc392 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2071,6 +2071,13 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>  	PMD_INIT_LOG(DEBUG, "configure");
>  	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
>  
> +	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
> +		PMD_DRV_LOG(ERR,
> +			"Unsupported Rx multi queue mode %d",
> +			rxmode->mq_mode);
> +		return -EINVAL;
> +	}

We need similar checks for Tx as well.

Thanks,
Tiwei

> +
>  	if (dev->data->dev_conf.intr_conf.rxq) {
>  		ret = virtio_init_device(dev, hw->req_guest_features);
>  		if (ret < 0)
> -- 
> 2.17.1
>
  
Andrew Rybchenko Oct. 9, 2019, 8:04 a.m. UTC | #2
On 10/8/19 8:46 AM, Tiwei Bie wrote:
> On Tue, Oct 01, 2019 at 04:44:31PM +0100, Andrew Rybchenko wrote:
>> From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
>>
>> This driver supports none of DCB, RSS or VMDQ modes,
>> therefore must check and return error if configured incorrectly.
>>
>> Fixes: c1f86306a026 ("virtio: add new driver")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> ---
>>   drivers/net/virtio/virtio_ethdev.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
>> index 7261109dd..0af4fc392 100644
>> --- a/drivers/net/virtio/virtio_ethdev.c
>> +++ b/drivers/net/virtio/virtio_ethdev.c
>> @@ -2071,6 +2071,13 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>>   	PMD_INIT_LOG(DEBUG, "configure");
>>   	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
>>   
>> +	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
>> +		PMD_DRV_LOG(ERR,
>> +			"Unsupported Rx multi queue mode %d",
>> +			rxmode->mq_mode);
>> +		return -EINVAL;
>> +	}
> We need similar checks for Tx as well.

OK, I'll add.

However, I'm not 100% sure about RSS. Yes, I know that virtio has
no RSS configuration support, but it looks possible to have multi queue
in vhost-net case.
  
Tiwei Bie Oct. 9, 2019, 8:43 a.m. UTC | #3
On Wed, Oct 09, 2019 at 11:04:38AM +0300, Andrew Rybchenko wrote:
> On 10/8/19 8:46 AM, Tiwei Bie wrote:
> > On Tue, Oct 01, 2019 at 04:44:31PM +0100, Andrew Rybchenko wrote:
> > > From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
> > > 
> > > This driver supports none of DCB, RSS or VMDQ modes,
> > > therefore must check and return error if configured incorrectly.
> > > 
> > > Fixes: c1f86306a026 ("virtio: add new driver")
> > > Cc: stable@dpdk.org
> > > 
> > > Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
> > > Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > > ---
> > >   drivers/net/virtio/virtio_ethdev.c | 7 +++++++
> > >   1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> > > index 7261109dd..0af4fc392 100644
> > > --- a/drivers/net/virtio/virtio_ethdev.c
> > > +++ b/drivers/net/virtio/virtio_ethdev.c
> > > @@ -2071,6 +2071,13 @@ virtio_dev_configure(struct rte_eth_dev *dev)
> > >   	PMD_INIT_LOG(DEBUG, "configure");
> > >   	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
> > > +	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
> > > +		PMD_DRV_LOG(ERR,
> > > +			"Unsupported Rx multi queue mode %d",
> > > +			rxmode->mq_mode);
> > > +		return -EINVAL;
> > > +	}
> > We need similar checks for Tx as well.
> 
> OK, I'll add.
> 
> However, I'm not 100% sure about RSS. Yes, I know that virtio has
> no RSS configuration support, but it looks possible to have multi queue
> in vhost-net case.

Yeah, it's possible to have MQ in virtio.
The RSS support in virtio is still WIP.
https://github.com/oasis-tcs/virtio-spec/issues/48
  
Andrew Rybchenko Oct. 9, 2019, 9 a.m. UTC | #4
On 10/9/19 11:43 AM, Tiwei Bie wrote:
> On Wed, Oct 09, 2019 at 11:04:38AM +0300, Andrew Rybchenko wrote:
>> On 10/8/19 8:46 AM, Tiwei Bie wrote:
>>> On Tue, Oct 01, 2019 at 04:44:31PM +0100, Andrew Rybchenko wrote:
>>>> From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
>>>>
>>>> This driver supports none of DCB, RSS or VMDQ modes,
>>>> therefore must check and return error if configured incorrectly.
>>>>
>>>> Fixes: c1f86306a026 ("virtio: add new driver")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>>> ---
>>>>    drivers/net/virtio/virtio_ethdev.c | 7 +++++++
>>>>    1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
>>>> index 7261109dd..0af4fc392 100644
>>>> --- a/drivers/net/virtio/virtio_ethdev.c
>>>> +++ b/drivers/net/virtio/virtio_ethdev.c
>>>> @@ -2071,6 +2071,13 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>>>>    	PMD_INIT_LOG(DEBUG, "configure");
>>>>    	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
>>>> +	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
>>>> +		PMD_DRV_LOG(ERR,
>>>> +			"Unsupported Rx multi queue mode %d",
>>>> +			rxmode->mq_mode);
>>>> +		return -EINVAL;
>>>> +	}
>>> We need similar checks for Tx as well.
>> OK, I'll add.
>>
>> However, I'm not 100% sure about RSS. Yes, I know that virtio has
>> no RSS configuration support, but it looks possible to have multi queue
>> in vhost-net case.
> Yeah, it's possible to have MQ in virtio.
> The RSS support in virtio is still WIP.
> https://github.com/oasis-tcs/virtio-spec/issues/48

Thanks for the link. So, may be ETH_MQ_RX_RSS should be accepted
as well, but attempts to configure RSS rejected?
Yes, it is a bit strange to accept RSS with empty rss_hf etc, but
at least it is exactly what net/virtio can do.

And one more thought...
It looks like if more than one Rx queue is configured, mq_mode must
be ETH_MQ_RX_RSS and must not be ETH_MQ_RX_NONE.
  
Tiwei Bie Oct. 9, 2019, 10:41 a.m. UTC | #5
On Wed, Oct 09, 2019 at 12:00:28PM +0300, Andrew Rybchenko wrote:
> On 10/9/19 11:43 AM, Tiwei Bie wrote:
> > On Wed, Oct 09, 2019 at 11:04:38AM +0300, Andrew Rybchenko wrote:
> > > On 10/8/19 8:46 AM, Tiwei Bie wrote:
> > > > On Tue, Oct 01, 2019 at 04:44:31PM +0100, Andrew Rybchenko wrote:
> > > > > From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
> > > > > 
> > > > > This driver supports none of DCB, RSS or VMDQ modes,
> > > > > therefore must check and return error if configured incorrectly.
> > > > > 
> > > > > Fixes: c1f86306a026 ("virtio: add new driver")
> > > > > Cc: stable@dpdk.org
> > > > > 
> > > > > Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
> > > > > Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > > > > ---
> > > > >    drivers/net/virtio/virtio_ethdev.c | 7 +++++++
> > > > >    1 file changed, 7 insertions(+)
> > > > > 
> > > > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> > > > > index 7261109dd..0af4fc392 100644
> > > > > --- a/drivers/net/virtio/virtio_ethdev.c
> > > > > +++ b/drivers/net/virtio/virtio_ethdev.c
> > > > > @@ -2071,6 +2071,13 @@ virtio_dev_configure(struct rte_eth_dev *dev)
> > > > >    	PMD_INIT_LOG(DEBUG, "configure");
> > > > >    	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
> > > > > +	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
> > > > > +		PMD_DRV_LOG(ERR,
> > > > > +			"Unsupported Rx multi queue mode %d",
> > > > > +			rxmode->mq_mode);
> > > > > +		return -EINVAL;
> > > > > +	}
> > > > We need similar checks for Tx as well.
> > > OK, I'll add.
> > > 
> > > However, I'm not 100% sure about RSS. Yes, I know that virtio has
> > > no RSS configuration support, but it looks possible to have multi queue
> > > in vhost-net case.
> > Yeah, it's possible to have MQ in virtio.
> > The RSS support in virtio is still WIP.
> > https://github.com/oasis-tcs/virtio-spec/issues/48
> 
> Thanks for the link. So, may be ETH_MQ_RX_RSS should be accepted
> as well, but attempts to configure RSS rejected?
> Yes, it is a bit strange to accept RSS with empty rss_hf etc, but
> at least it is exactly what net/virtio can do.
> 
> And one more thought...
> It looks like if more than one Rx queue is configured, mq_mode must
> be ETH_MQ_RX_RSS and must not be ETH_MQ_RX_NONE.

Some apps in DPDK will set mq_mode to ETH_MQ_RX_NONE while
enabling multiple queue pairs, e.g.:

https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L137
https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L181-L182
https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L3938-L3948

Testpmd will also set mq_mode to ETH_MQ_RX_NONE when multiple
Rx queues are enabled but rss_hf is empty:

https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2935-L2938
https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2945-L2948
(the flow_type_rss_offloads reported by virtio-PMD is zero)

My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
no method is enforced on how to route packets to MQs.
It looks that ETH_MQ_RX_NONE is the best fit for virtio currently.
  
Andrew Rybchenko Oct. 9, 2019, 11:24 a.m. UTC | #6
@Thomas, @Ferruh, please see small question below.

On 10/9/19 1:41 PM, Tiwei Bie wrote:
> On Wed, Oct 09, 2019 at 12:00:28PM +0300, Andrew Rybchenko wrote:
>> On 10/9/19 11:43 AM, Tiwei Bie wrote:
>>> On Wed, Oct 09, 2019 at 11:04:38AM +0300, Andrew Rybchenko wrote:
>>>> On 10/8/19 8:46 AM, Tiwei Bie wrote:
>>>>> On Tue, Oct 01, 2019 at 04:44:31PM +0100, Andrew Rybchenko wrote:
>>>>>> From: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
>>>>>>
>>>>>> This driver supports none of DCB, RSS or VMDQ modes,
>>>>>> therefore must check and return error if configured incorrectly.
>>>>>>
>>>>>> Fixes: c1f86306a026 ("virtio: add new driver")
>>>>>> Cc: stable@dpdk.org
>>>>>>
>>>>>> Signed-off-by: Dilshod Urazov <Dilshod.Urazov@oktetlabs.ru>
>>>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>>>>> ---
>>>>>>     drivers/net/virtio/virtio_ethdev.c | 7 +++++++
>>>>>>     1 file changed, 7 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
>>>>>> index 7261109dd..0af4fc392 100644
>>>>>> --- a/drivers/net/virtio/virtio_ethdev.c
>>>>>> +++ b/drivers/net/virtio/virtio_ethdev.c
>>>>>> @@ -2071,6 +2071,13 @@ virtio_dev_configure(struct rte_eth_dev *dev)
>>>>>>     	PMD_INIT_LOG(DEBUG, "configure");
>>>>>>     	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
>>>>>> +	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
>>>>>> +		PMD_DRV_LOG(ERR,
>>>>>> +			"Unsupported Rx multi queue mode %d",
>>>>>> +			rxmode->mq_mode);
>>>>>> +		return -EINVAL;
>>>>>> +	}
>>>>> We need similar checks for Tx as well.
>>>> OK, I'll add.
>>>>
>>>> However, I'm not 100% sure about RSS. Yes, I know that virtio has
>>>> no RSS configuration support, but it looks possible to have multi queue
>>>> in vhost-net case.
>>> Yeah, it's possible to have MQ in virtio.
>>> The RSS support in virtio is still WIP.
>>> https://github.com/oasis-tcs/virtio-spec/issues/48
>> Thanks for the link. So, may be ETH_MQ_RX_RSS should be accepted
>> as well, but attempts to configure RSS rejected?
>> Yes, it is a bit strange to accept RSS with empty rss_hf etc, but
>> at least it is exactly what net/virtio can do.
>>
>> And one more thought...
>> It looks like if more than one Rx queue is configured, mq_mode must
>> be ETH_MQ_RX_RSS and must not be ETH_MQ_RX_NONE.
> Some apps in DPDK will set mq_mode to ETH_MQ_RX_NONE while
> enabling multiple queue pairs, e.g.:
>
> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L137
> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L181-L182
> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L3938-L3948
>
> Testpmd will also set mq_mode to ETH_MQ_RX_NONE when multiple
> Rx queues are enabled but rss_hf is empty:
>
> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2935-L2938
> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2945-L2948
> (the flow_type_rss_offloads reported by virtio-PMD is zero)
>
> My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
> no method is enforced on how to route packets to MQs.

I'm not sure. It is definitely a place to be improved in
ethdev documentation. Thomas, Ferruh, what do you think?
Is it really a definition of ETH_MQ_RX_NONE?

> It looks that ETH_MQ_RX_NONE is the best fit for virtio currently.

Anyway I agree and I think it is better to go this way in the patch.

Thanks,
Andrew.
  
Thomas Monjalon Oct. 10, 2019, 7:42 a.m. UTC | #7
09/10/2019 13:24, Andrew Rybchenko:
> On 10/9/19 1:41 PM, Tiwei Bie wrote:
> > On Wed, Oct 09, 2019 at 12:00:28PM +0300, Andrew Rybchenko wrote:
> >> And one more thought...
> >> It looks like if more than one Rx queue is configured, mq_mode must
> >> be ETH_MQ_RX_RSS and must not be ETH_MQ_RX_NONE.
> > Some apps in DPDK will set mq_mode to ETH_MQ_RX_NONE while
> > enabling multiple queue pairs, e.g.:
> >
> > https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L137
> > https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L181-L182
> > https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L3938-L3948
> >
> > Testpmd will also set mq_mode to ETH_MQ_RX_NONE when multiple
> > Rx queues are enabled but rss_hf is empty:
> >
> > https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2935-L2938
> > https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2945-L2948
> > (the flow_type_rss_offloads reported by virtio-PMD is zero)
> >
> > My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
> > no method is enforced on how to route packets to MQs.
> 
> I'm not sure. It is definitely a place to be improved in
> ethdev documentation. Thomas, Ferruh, what do you think?
> Is it really a definition of ETH_MQ_RX_NONE?

I think it means everything go to queue 0.
The comment says no DCB, RSS or VMDQ.
It looks like the "NONE" value has been abused for some custom steering.
We have two options:
	- document NONE as a possible case of custom steering
	- add a new CUSTOM value
  
Andrew Rybchenko Oct. 10, 2019, 8:13 a.m. UTC | #8
On 10/10/19 10:42 AM, Thomas Monjalon wrote:
> 09/10/2019 13:24, Andrew Rybchenko:
>> On 10/9/19 1:41 PM, Tiwei Bie wrote:
>>> On Wed, Oct 09, 2019 at 12:00:28PM +0300, Andrew Rybchenko wrote:
>>>> And one more thought...
>>>> It looks like if more than one Rx queue is configured, mq_mode must
>>>> be ETH_MQ_RX_RSS and must not be ETH_MQ_RX_NONE.
>>> Some apps in DPDK will set mq_mode to ETH_MQ_RX_NONE while
>>> enabling multiple queue pairs, e.g.:
>>>
>>> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L137
>>> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L181-L182
>>> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test/test_link_bonding.c#L3938-L3948
>>>
>>> Testpmd will also set mq_mode to ETH_MQ_RX_NONE when multiple
>>> Rx queues are enabled but rss_hf is empty:
>>>
>>> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2935-L2938
>>> https://github.com/DPDK/dpdk/blob/5b5bb56532fd5dea5d6260c0a0e405c0e32da2a0/app/test-pmd/testpmd.c#L2945-L2948
>>> (the flow_type_rss_offloads reported by virtio-PMD is zero)
>>>
>>> My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
>>> no method is enforced on how to route packets to MQs.
>> I'm not sure. It is definitely a place to be improved in
>> ethdev documentation. Thomas, Ferruh, what do you think?
>> Is it really a definition of ETH_MQ_RX_NONE?
> I think it means everything go to queue 0.

I understand it this way as well.

> The comment says no DCB, RSS or VMDQ.
> It looks like the "NONE" value has been abused for some custom steering.
> We have two options:
> 	- document NONE as a possible case of custom steering
> 	- add a new CUSTOM value

I'd prefer to say that ETH_MQ_RX_RSS with rss_hf equal to 0 means
unspecified/unknown steering. If application just want to spread
traffic across many Rx queues, it is natural choice to say that
it want RSS, but do not care about spreading algorithm etc.
It allows driver use recommended defaults if rss_hf is controllable,
or just spread in virtio case.

Yes, it means that testpmd should be fixed for this specific case
to be able to enable RSS with rss_hf equal to 0.
  
David Marchand Oct. 10, 2019, 8:23 a.m. UTC | #9
On Thu, Oct 10, 2019 at 10:14 AM Andrew Rybchenko
<arybchenko@solarflare.com> wrote:
>
> On 10/10/19 10:42 AM, Thomas Monjalon wrote:
> > 09/10/2019 13:24, Andrew Rybchenko:
> >> On 10/9/19 1:41 PM, Tiwei Bie wrote:
> >>> My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
> >>> no method is enforced on how to route packets to MQs.
> >> I'm not sure. It is definitely a place to be improved in
> >> ethdev documentation. Thomas, Ferruh, what do you think?
> >> Is it really a definition of ETH_MQ_RX_NONE?
> > I think it means everything go to queue 0.
>
> I understand it this way as well.
>
> > The comment says no DCB, RSS or VMDQ.
> > It looks like the "NONE" value has been abused for some custom steering.
> > We have two options:
> >       - document NONE as a possible case of custom steering
> >       - add a new CUSTOM value
>
> I'd prefer to say that ETH_MQ_RX_RSS with rss_hf equal to 0 means
> unspecified/unknown steering. If application just want to spread
> traffic across many Rx queues, it is natural choice to say that
> it want RSS, but do not care about spreading algorithm etc.
> It allows driver use recommended defaults if rss_hf is controllable,
> or just spread in virtio case.

RSS is about maintaining affinity of a "flow" (as in packets sharing
the same l3/l4 tuples) to a specific queue.
Here, we can have packets from a same flow on any queue depending on
what happened on the vhost side.

I prefer we describe this behavior as something else than RSS.
  
Andrew Rybchenko Oct. 10, 2019, 8:27 a.m. UTC | #10
On 10/10/19 11:23 AM, David Marchand wrote:
> On Thu, Oct 10, 2019 at 10:14 AM Andrew Rybchenko
> <arybchenko@solarflare.com> wrote:
>> On 10/10/19 10:42 AM, Thomas Monjalon wrote:
>>> 09/10/2019 13:24, Andrew Rybchenko:
>>>> On 10/9/19 1:41 PM, Tiwei Bie wrote:
>>>>> My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
>>>>> no method is enforced on how to route packets to MQs.
>>>> I'm not sure. It is definitely a place to be improved in
>>>> ethdev documentation. Thomas, Ferruh, what do you think?
>>>> Is it really a definition of ETH_MQ_RX_NONE?
>>> I think it means everything go to queue 0.
>> I understand it this way as well.
>>
>>> The comment says no DCB, RSS or VMDQ.
>>> It looks like the "NONE" value has been abused for some custom steering.
>>> We have two options:
>>>        - document NONE as a possible case of custom steering
>>>        - add a new CUSTOM value
>> I'd prefer to say that ETH_MQ_RX_RSS with rss_hf equal to 0 means
>> unspecified/unknown steering. If application just want to spread
>> traffic across many Rx queues, it is natural choice to say that
>> it want RSS, but do not care about spreading algorithm etc.
>> It allows driver use recommended defaults if rss_hf is controllable,
>> or just spread in virtio case.
> RSS is about maintaining affinity of a "flow" (as in packets sharing
> the same l3/l4 tuples) to a specific queue.
> Here, we can have packets from a same flow on any queue depending on
> what happened on the vhost side.

Interesting. I'd like to know a bit more about it. I didn't know that
it is so unstable. Could someone who knows the topic well add
a bit more information about it.

> I prefer we describe this behavior as something else than RSS.
  
Tiwei Bie Oct. 10, 2019, 9:10 a.m. UTC | #11
On Thu, Oct 10, 2019 at 11:27:53AM +0300, Andrew Rybchenko wrote:
> On 10/10/19 11:23 AM, David Marchand wrote:
> > On Thu, Oct 10, 2019 at 10:14 AM Andrew Rybchenko
> > <arybchenko@solarflare.com> wrote:
> > > On 10/10/19 10:42 AM, Thomas Monjalon wrote:
> > > > 09/10/2019 13:24, Andrew Rybchenko:
> > > > > On 10/9/19 1:41 PM, Tiwei Bie wrote:
> > > > > > My understanding is that, setting mq_mode to ETH_MQ_RX_NONE means
> > > > > > no method is enforced on how to route packets to MQs.
> > > > > I'm not sure. It is definitely a place to be improved in
> > > > > ethdev documentation. Thomas, Ferruh, what do you think?
> > > > > Is it really a definition of ETH_MQ_RX_NONE?
> > > > I think it means everything go to queue 0.
> > > I understand it this way as well.
> > > 
> > > > The comment says no DCB, RSS or VMDQ.
> > > > It looks like the "NONE" value has been abused for some custom steering.
> > > > We have two options:
> > > >        - document NONE as a possible case of custom steering
> > > >        - add a new CUSTOM value
> > > I'd prefer to say that ETH_MQ_RX_RSS with rss_hf equal to 0 means
> > > unspecified/unknown steering. If application just want to spread
> > > traffic across many Rx queues, it is natural choice to say that
> > > it want RSS, but do not care about spreading algorithm etc.
> > > It allows driver use recommended defaults if rss_hf is controllable,
> > > or just spread in virtio case.
> > RSS is about maintaining affinity of a "flow" (as in packets sharing
> > the same l3/l4 tuples) to a specific queue.
> > Here, we can have packets from a same flow on any queue depending on
> > what happened on the vhost side.
> 
> Interesting. I'd like to know a bit more about it. I didn't know that
> it is so unstable. Could someone who knows the topic well add
> a bit more information about it.

The spec defined automatic steering [1], but it's not very strict
for the device. So it depends on the implementation.

[1] https://github.com/oasis-tcs/virtio-spec/commit/f7020384521e5938cdd1351270b32b143f070d00
  

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 7261109dd..0af4fc392 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2071,6 +2071,13 @@  virtio_dev_configure(struct rte_eth_dev *dev)
 	PMD_INIT_LOG(DEBUG, "configure");
 	req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
 
+	if (rxmode->mq_mode != ETH_MQ_RX_NONE) {
+		PMD_DRV_LOG(ERR,
+			"Unsupported Rx multi queue mode %d",
+			rxmode->mq_mode);
+		return -EINVAL;
+	}
+
 	if (dev->data->dev_conf.intr_conf.rxq) {
 		ret = virtio_init_device(dev, hw->req_guest_features);
 		if (ret < 0)