[dpdk-dev] net/vhost: convert to new Rx offload API

Message ID 20180522113639.32233-1-maxime.coquelin@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Maxime Coquelin May 22, 2018, 11:36 a.m. UTC
  Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit May 22, 2018, 11:41 a.m. UTC | #1
On 5/22/2018 12:36 PM, Maxime Coquelin wrote:
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Ferruh Yigit May 22, 2018, 11:49 a.m. UTC | #2
On 5/22/2018 12:41 PM, Ferruh Yigit wrote:
> On 5/22/2018 12:36 PM, Maxime Coquelin wrote:
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.
  
Tiwei Bie May 22, 2018, 11:53 a.m. UTC | #3
On Tue, May 22, 2018 at 01:36:39PM +0200, Maxime Coquelin wrote:
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index f473bbbb3..aadb2327c 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -491,9 +491,9 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
>  	struct pmd_internal *internal = dev->data->dev_private;
>  	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
>  
> -	internal->vlan_strip = rxmode->hw_vlan_strip;
> +	internal->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
>  
> -	if (rxmode->hw_vlan_filter)
> +	if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
>  		VHOST_LOG(WARNING,
>  			"vhost(%s): vlan filtering not available\n",
>  			internal->dev_name);

To better align with the new offload API, I think we
also need to announce those features in dev_infos_get.

Best regards,
Tiwei Bie
  
Tiwei Bie May 22, 2018, 12:09 p.m. UTC | #4
On Tue, May 22, 2018 at 07:53:57PM +0800, Tiwei Bie wrote:
> On Tue, May 22, 2018 at 01:36:39PM +0200, Maxime Coquelin wrote:
> > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> > ---
> >  drivers/net/vhost/rte_eth_vhost.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> > index f473bbbb3..aadb2327c 100644
> > --- a/drivers/net/vhost/rte_eth_vhost.c
> > +++ b/drivers/net/vhost/rte_eth_vhost.c
> > @@ -491,9 +491,9 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
> >  	struct pmd_internal *internal = dev->data->dev_private;
> >  	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> >  
> > -	internal->vlan_strip = rxmode->hw_vlan_strip;
> > +	internal->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
> >  
> > -	if (rxmode->hw_vlan_filter)
> > +	if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
> >  		VHOST_LOG(WARNING,
> >  			"vhost(%s): vlan filtering not available\n",
> >  			internal->dev_name);
> 
> To better align with the new offload API, I think we
> also need to announce those features in dev_infos_get.

I mean offloads (I'm too used to say features recently...).
Besides, maybe we can also take this chance to announce the
DEV_TX_OFFLOAD_MULTI_SEGS offload. How do you think?

Best regards,
Tiwei Bie
  
Maxime Coquelin May 22, 2018, 12:12 p.m. UTC | #5
On 05/22/2018 02:09 PM, Tiwei Bie wrote:
> On Tue, May 22, 2018 at 07:53:57PM +0800, Tiwei Bie wrote:
>> On Tue, May 22, 2018 at 01:36:39PM +0200, Maxime Coquelin wrote:
>>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>>> ---
>>>   drivers/net/vhost/rte_eth_vhost.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
>>> index f473bbbb3..aadb2327c 100644
>>> --- a/drivers/net/vhost/rte_eth_vhost.c
>>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>>> @@ -491,9 +491,9 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
>>>   	struct pmd_internal *internal = dev->data->dev_private;
>>>   	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
>>>   
>>> -	internal->vlan_strip = rxmode->hw_vlan_strip;
>>> +	internal->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
>>>   
>>> -	if (rxmode->hw_vlan_filter)
>>> +	if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
>>>   		VHOST_LOG(WARNING,
>>>   			"vhost(%s): vlan filtering not available\n",
>>>   			internal->dev_name);
>>
>> To better align with the new offload API, I think we
>> also need to announce those features in dev_infos_get.

I'm looking at it, and agree we have to announce support for these
offload features.

> I mean offloads (I'm too used to say features recently...).
> Besides, maybe we can also take this chance to announce the
> DEV_TX_OFFLOAD_MULTI_SEGS offload. How do you think?

Yes, and also DEV_TX_OFFLOAD_VLANiINSERT. Right?

> Best regards,
> Tiwei Bie
>
  
Tiwei Bie May 22, 2018, 12:16 p.m. UTC | #6
On Tue, May 22, 2018 at 02:12:36PM +0200, Maxime Coquelin wrote:
> On 05/22/2018 02:09 PM, Tiwei Bie wrote:
> > On Tue, May 22, 2018 at 07:53:57PM +0800, Tiwei Bie wrote:
> > > On Tue, May 22, 2018 at 01:36:39PM +0200, Maxime Coquelin wrote:
> > > > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> > > > ---
> > > >   drivers/net/vhost/rte_eth_vhost.c | 4 ++--
> > > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> > > > index f473bbbb3..aadb2327c 100644
> > > > --- a/drivers/net/vhost/rte_eth_vhost.c
> > > > +++ b/drivers/net/vhost/rte_eth_vhost.c
> > > > @@ -491,9 +491,9 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
> > > >   	struct pmd_internal *internal = dev->data->dev_private;
> > > >   	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> > > > -	internal->vlan_strip = rxmode->hw_vlan_strip;
> > > > +	internal->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
> > > > -	if (rxmode->hw_vlan_filter)
> > > > +	if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
> > > >   		VHOST_LOG(WARNING,
> > > >   			"vhost(%s): vlan filtering not available\n",
> > > >   			internal->dev_name);
> > > 
> > > To better align with the new offload API, I think we
> > > also need to announce those features in dev_infos_get.
> 
> I'm looking at it, and agree we have to announce support for these
> offload features.
> 
> > I mean offloads (I'm too used to say features recently...).
> > Besides, maybe we can also take this chance to announce the
> > DEV_TX_OFFLOAD_MULTI_SEGS offload. How do you think?
> 
> Yes, and also DEV_TX_OFFLOAD_VLANiINSERT. Right?

Yeah!

Best regards,
Tiwei Bie
  
Ferruh Yigit May 22, 2018, 12:34 p.m. UTC | #7
On 5/22/2018 12:49 PM, Ferruh Yigit wrote:
> On 5/22/2018 12:41 PM, Ferruh Yigit wrote:
>> On 5/22/2018 12:36 PM, Maxime Coquelin wrote:
>>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>>
>> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Applied to dpdk-next-net/master, thanks.

Dropped back from tree in favor of v2 of patch
  

Patch

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index f473bbbb3..aadb2327c 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -491,9 +491,9 @@  eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
 	struct pmd_internal *internal = dev->data->dev_private;
 	const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 
-	internal->vlan_strip = rxmode->hw_vlan_strip;
+	internal->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
 
-	if (rxmode->hw_vlan_filter)
+	if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
 		VHOST_LOG(WARNING,
 			"vhost(%s): vlan filtering not available\n",
 			internal->dev_name);