All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/testpmd:vlan filter fail
@ 2018-02-01  1:26 Yanglong Wu
  2018-02-01  2:07 ` Thomas Monjalon
  2018-02-01  5:57 ` Shahaf Shuler
  0 siblings, 2 replies; 7+ messages in thread
From: Yanglong Wu @ 2018-02-01  1:26 UTC (permalink / raw)
  To: dev; +Cc: shahafs, wenzhuo.lu, Yanglong Wu

And-operartion with a constant will
always lead to fail for vlan filter.

fix:0074d02fc(convert to new Rx offloads API)
Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f285ba278..d468bb4a1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2288,7 +2288,7 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	if (!(dev->data->dev_conf.rxmode.offloads &
+	if (!(dev->data->dev_conf.rxmode.offloads ||
 	      DEV_RX_OFFLOAD_VLAN_FILTER)) {
 		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
 		return -ENOSYS;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] app/testpmd:vlan filter fail
  2018-02-01  1:26 [PATCH] app/testpmd:vlan filter fail Yanglong Wu
@ 2018-02-01  2:07 ` Thomas Monjalon
  2018-02-01  5:57 ` Shahaf Shuler
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-02-01  2:07 UTC (permalink / raw)
  To: Yanglong Wu; +Cc: dev, shahafs, wenzhuo.lu

01/02/2018 02:26, Yanglong Wu:
> And-operartion with a constant will
> always lead to fail for vlan filter.
> 
> fix:0074d02fc(convert to new Rx offloads API)
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
[...]
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -2288,7 +2288,7 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
>  
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> -	if (!(dev->data->dev_conf.rxmode.offloads &
> +	if (!(dev->data->dev_conf.rxmode.offloads ||
>  	      DEV_RX_OFFLOAD_VLAN_FILTER)) {
>  		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
>  		return -ENOSYS;

This patch is wrong.

If you are trying to use VLAN filtering with testpmd,
you must enable it with --enable-hw-vlan-filter.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] app/testpmd:vlan filter fail
  2018-02-01  1:26 [PATCH] app/testpmd:vlan filter fail Yanglong Wu
  2018-02-01  2:07 ` Thomas Monjalon
@ 2018-02-01  5:57 ` Shahaf Shuler
  2018-02-02  3:37   ` Wu, Yanglong
  1 sibling, 1 reply; 7+ messages in thread
From: Shahaf Shuler @ 2018-02-01  5:57 UTC (permalink / raw)
  To: Yanglong Wu, dev; +Cc: wenzhuo.lu

Thursday, February 1, 2018 3:27 AM, Yanglong Wu:
> And-operartion with a constant will
> always lead to fail for vlan filter.

It will work after  dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER , right?

I don't understand what this patch tries to fix. 

> 
> fix:0074d02fc(convert to new Rx offloads API)
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index f285ba278..d468bb4a1 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -2288,7 +2288,7 @@ rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t
> vlan_id, int on)
> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> -	if (!(dev->data->dev_conf.rxmode.offloads &
> +	if (!(dev->data->dev_conf.rxmode.offloads ||
>  	      DEV_RX_OFFLOAD_VLAN_FILTER)) {
>  		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering
> disabled\n", port_id);
>  		return -ENOSYS;
> --
> 2.11.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] app/testpmd:vlan filter fail
  2018-02-01  5:57 ` Shahaf Shuler
@ 2018-02-02  3:37   ` Wu, Yanglong
  0 siblings, 0 replies; 7+ messages in thread
From: Wu, Yanglong @ 2018-02-02  3:37 UTC (permalink / raw)
  To: Shahaf Shuler, dev; +Cc: Lu, Wenzhuo

Hi,
This patch is wrong, but there is bug absolutely. 
The problem can be stated as following:
in your patch(0074d02fc),
@@ -2224,7 +2221,7 @@ init_port_dcb_config(portid_t pid,
        retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
        if (retval < 0)
                return retval;
-       port_conf.rxmode.hw_vlan_filter = 1;
+       port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
You remove out port_conf.rxmode.hw_vlan_filter = 1 and assign port_conf.rxmode.offloads directly, so here port_conf.rxmode.hw_vlan_filter will equal to 0 and port_conf.rxmode.offloads will equal to DEV_RX_OFFLOAD_VLAN_FILTER, right?
 
But next in the function rte_eth_dev_configure(pid, 0, 0, &port_conf)  --> rte_eth_convert_rx_offload_bitfield , it will assign port_conf.rxmode.offloads  according to value of port_conf.rxmode.hw_vlan_filter again. As you remove out port_conf.rxmode.hw_vlan_filter = 1 and it equal to 0 now,  port_conf.rxmode.offloads is assigned as 0 again. So it will always lead to fail for vlan filter setting.

So I think port_Conf.rxmode.hw_vlan_filter should equeal to 1 and removing out  port_conf.rxmode.hw_vlan_filter = 1 will leads it assigning as a wrong number and vlan filter failing. So port_conf.rxmode.hw_vlan_filter = 1 shouldn’t be removed out, do you think so? 
I will add this line and  sent patch again

Wu yanglong
-----Original Message-----
From: Shahaf Shuler [mailto:shahafs@mellanox.com] 
Sent: Thursday, February 1, 2018 1:58 PM
To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
Subject: RE: [PATCH] app/testpmd:vlan filter fail

Thursday, February 1, 2018 3:27 AM, Yanglong Wu:
> And-operartion with a constant will
> always lead to fail for vlan filter.

It will work after  dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER , right?

I don't understand what this patch tries to fix. 

> 
> fix:0074d02fc(convert to new Rx offloads API)
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c 
> b/lib/librte_ether/rte_ethdev.c index f285ba278..d468bb4a1 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -2288,7 +2288,7 @@ rte_eth_dev_vlan_filter(uint16_t port_id, 
> uint16_t vlan_id, int on)
> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> -	if (!(dev->data->dev_conf.rxmode.offloads &
> +	if (!(dev->data->dev_conf.rxmode.offloads ||
>  	      DEV_RX_OFFLOAD_VLAN_FILTER)) {
>  		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
>  		return -ENOSYS;
> --
> 2.11.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] app/testpmd:vlan filter fail
  2018-02-04  6:27 ` Shahaf Shuler
@ 2018-02-05  1:51   ` Wu, Yanglong
  0 siblings, 0 replies; 7+ messages in thread
From: Wu, Yanglong @ 2018-02-05  1:51 UTC (permalink / raw)
  To: Shahaf Shuler, dev; +Cc: Lu, Wenzhuo

Hi,
Thanks for your review. I got it!

Yanglong Wu
-----Original Message-----
From: Shahaf Shuler [mailto:shahafs@mellanox.com] 
Sent: Sunday, February 4, 2018 2:27 PM
To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
Subject: RE: [PATCH] app/testpmd:vlan filter fail

Hi Wu,

Indeed there is an issue here, but this is not the right fix.

Friday, February 2, 2018 7:10 AM, Yanglong Wu:
> Subject: [PATCH] app/testpmd:vlan filter fail
> 
> Removing out port_conf.rxmode.hw_vlan_filter = 1 will let it equal to 
> 0 and port_conf.rxmode.offloads is assigned as 0 again if 
> hw_vlan_filter = 1. So it will always lead to fail for vlan filter 
> setting
> 
> Fix:0074d02fc(convert to new Rx offloads API)
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  app/test-pmd/testpmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 
> 5dc8ccac5..0751e573c 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2328,7 +2328,7 @@ init_port_dcb_config(portid_t pid,
>  	retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
>  	if (retval < 0)
>  		return retval;
> -	port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
> +	port_conf.rxmode.hw_vlan_filter = 1;

The VLAN filter resets because the rxmode.ignore_offload_bitfield is not set. If it was set, the ethdev rxmode convert functions would have convert the new flag to the old API (rxmode.hw_vlan_filter).

Am not much familiar with this configuration but here is a suggested fix:

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d8ac43268..caf282386 100644                           
--- a/app/test-pmd/testpmd.c                                
+++ b/app/test-pmd/testpmd.c                                
@@ -2324,6 +2324,8 @@ init_port_dcb_config(portid_t pid,    
        rte_port = &ports[pid];                             
                                                            
        memset(&port_conf, 0, sizeof(struct rte_eth_conf)); 
+       port_conf.rxmode = rte_port->dev_conf.rxmode;       
+       port_conf.txmode = rte_port->dev_conf.txmode;       
        /* Enter DCB configuration status */                
        dcb_config = 1;                                     
                                                            

The port_conf for the dcb configuration will inherit the same configuration of the port (which has the ignore_offload_bitfield set).
Otherwise, at least the rxmode.ignore_offload_bitfield must be set. 
> 
>  	/**
>  	 * Write the configuration into the device.
> --
> 2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] app/testpmd:vlan filter fail
  2018-02-02  5:09 Yanglong Wu
@ 2018-02-04  6:27 ` Shahaf Shuler
  2018-02-05  1:51   ` Wu, Yanglong
  0 siblings, 1 reply; 7+ messages in thread
From: Shahaf Shuler @ 2018-02-04  6:27 UTC (permalink / raw)
  To: Yanglong Wu, dev; +Cc: wenzhuo.lu

Hi Wu,

Indeed there is an issue here, but this is not the right fix.

Friday, February 2, 2018 7:10 AM, Yanglong Wu:
> Subject: [PATCH] app/testpmd:vlan filter fail
> 
> Removing out port_conf.rxmode.hw_vlan_filter = 1 will let it equal to 0 and
> port_conf.rxmode.offloads is assigned as 0 again if hw_vlan_filter = 1. So it
> will always lead to fail for vlan filter setting
> 
> Fix:0074d02fc(convert to new Rx offloads API)
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  app/test-pmd/testpmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 5dc8ccac5..0751e573c 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2328,7 +2328,7 @@ init_port_dcb_config(portid_t pid,
>  	retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs,
> pfc_en);
>  	if (retval < 0)
>  		return retval;
> -	port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
> +	port_conf.rxmode.hw_vlan_filter = 1;

The VLAN filter resets because the rxmode.ignore_offload_bitfield is not set. If it was set, the ethdev rxmode convert functions would have convert the new flag to the old API (rxmode.hw_vlan_filter).

Am not much familiar with this configuration but here is a suggested fix:

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d8ac43268..caf282386 100644                           
--- a/app/test-pmd/testpmd.c                                
+++ b/app/test-pmd/testpmd.c                                
@@ -2324,6 +2324,8 @@ init_port_dcb_config(portid_t pid,    
        rte_port = &ports[pid];                             
                                                            
        memset(&port_conf, 0, sizeof(struct rte_eth_conf)); 
+       port_conf.rxmode = rte_port->dev_conf.rxmode;       
+       port_conf.txmode = rte_port->dev_conf.txmode;       
        /* Enter DCB configuration status */                
        dcb_config = 1;                                     
                                                            

The port_conf for the dcb configuration will inherit the same configuration of the port (which has the ignore_offload_bitfield set).
Otherwise, at least the rxmode.ignore_offload_bitfield must be set. 
> 
>  	/**
>  	 * Write the configuration into the device.
> --
> 2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] app/testpmd:vlan filter fail
@ 2018-02-02  5:09 Yanglong Wu
  2018-02-04  6:27 ` Shahaf Shuler
  0 siblings, 1 reply; 7+ messages in thread
From: Yanglong Wu @ 2018-02-02  5:09 UTC (permalink / raw)
  To: dev; +Cc: shahafs, wenzhuo.lu, Yanglong Wu

Removing out port_conf.rxmode.hw_vlan_filter = 1
will let it equal to 0 and port_conf.rxmode.offloads
is assigned as 0 again if hw_vlan_filter = 1. So it
will always lead to fail for vlan filter setting

Fix:0074d02fc(convert to new Rx offloads API)
Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8ccac5..0751e573c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2328,7 +2328,7 @@ init_port_dcb_config(portid_t pid,
 	retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
 	if (retval < 0)
 		return retval;
-	port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+	port_conf.rxmode.hw_vlan_filter = 1;
 
 	/**
 	 * Write the configuration into the device.
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-05  1:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01  1:26 [PATCH] app/testpmd:vlan filter fail Yanglong Wu
2018-02-01  2:07 ` Thomas Monjalon
2018-02-01  5:57 ` Shahaf Shuler
2018-02-02  3:37   ` Wu, Yanglong
2018-02-02  5:09 Yanglong Wu
2018-02-04  6:27 ` Shahaf Shuler
2018-02-05  1:51   ` Wu, Yanglong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.