Skip to contentSkip to conversation

app/testpmd:vlan filter fail

PATCH In review Yanglong Wu 3 participants 4 messages Feb 1, 2018 – Feb 2, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd:vlan filter fail

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

fix:0074d02fc(convert to new Rx offloads API)

---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_ether/rte_ethdev.c +1 -1
index f285ba278..d468bb4a1 100644
@@ -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;
Signature · 1 line
2.11.0
#1 lore raw

01/02/2018 02:26, Yanglong Wu:

Quoted 5 lines

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

fix:0074d02fc(convert to new Rx offloads API)

[...]

lib/librte_ether/rte_ethdev.c rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on) · line 2294

Quoted 11 lines
lib/librte_ether/rte_ethdev.c +1 -1
@@ -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.

#2 lore raw
In reply to Yanglong Wu

Thursday, February 1, 2018 3:27 AM, Yanglong Wu:

Quoted 2 lines

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.

Quoted 24 lines

fix:0074d02fc(convert to new Rx offloads API)

---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_ether/rte_ethdev.c +1 -1
index f285ba278..d468bb4a1 100644
@@ -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

#3 lore raw

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:[email protected]]
Sent: Thursday, February 1, 2018 1:58 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: RE: [PATCH] app/testpmd:vlan filter fail

Thursday, February 1, 2018 3:27 AM, Yanglong Wu:

Quoted 2 lines

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.

Quoted 23 lines

fix:0074d02fc(convert to new Rx offloads API)

---
 lib/librte_ether/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/lib/librte_ether/rte_ethdev.c index f285ba278..d468bb4a1 100644

lib/librte_ether/rte_ethdev.c +1 -1
@@ -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