net/ixgbe: fix filter parser error in L2 tunnel
PATCH v2 1/1 net/ixgbe: fix filter parser error in L2 tunnel
The action for L2 tunnel should be VF, not QUEUE.
--- drivers/net/ixgbe/ixgbe_flow.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +11 -7
@@ -1095,7 +1095,7 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,* The first not void item can be E_TAG. * The next not void item must be END. * action: -* The first not void action should be QUEUE. +* The first not void action should be VF. * The next not void action should be END. * pattern example: * ITEM Spec Mask
@@ -1116,7 +1116,7 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_e_tag *e_tag_spec;const struct rte_flow_item_e_tag *e_tag_mask;const struct rte_flow_action *act; -const struct rte_flow_action_queue *act_q; +const struct rte_flow_action_vf *act_vf;if (!pattern) { rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1224,9 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* check if the first not void action is QUEUE. */ +/* check if the first not void action is VF. */ act =next_no_void_action (actions,NULL ); -if (act->type !=RTE_FLOW_ACTION_TYPE_QUEUE ) { +if (act->type !=RTE_FLOW_ACTION_TYPE_VF ) {memset (filter,0 ,sizeof (struct rte_eth_l2_tunnel_conf )); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1234,8 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,return -rte_errno; } - act_q = (const struct rte_flow_action_queue *)act->conf; - filter->pool = act_q->index; + act_vf = (const struct rte_flow_action_vf *)act->conf; + filter->pool = act_vf->id;/* check if the next not void item is END */ act =next_no_void_action (actions, act);
@@ -1260,6 +1260,8 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, {int ret =0 ;struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); +uint16_t vf_num; ret =cons_parse_l2_tn_filter (attr, pattern, actions, l2_tn_filter, error);
@@ -1274,7 +1276,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,return -rte_errno; } -if (l2_tn_filter->pool >= dev->data->nb_rx_queues) + vf_num = pci_dev->max_vfs; + +if (l2_tn_filter->pool >= vf_num)return -rte_errno;return ret;
Signature · 1 line
2.7.4
- Tested Branch: dpdk-master
- Tested Commit: 8ced1542f7a356097c0b24bd1e08db670ff31b92
- OS: 4.8.6-300.fc25.x86_64
- GCC: gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
- CPU: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
- NIC: Intel Corporation Ethernet Connection X552/X557-AT 10GBASE-T [8086:15ad]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 1 cases, 1 passed, 0 failed
Hardware:
dut: 10.240.176.192
tester: 10.240.176.191
X552/X557-AT 10g*2
Test steps:
Bind pf to igb_uio:./usertools/dpdk-devbind.py -b igb_uio 03:00.0
add two vfs on dpdk pf, then bind the vfs to vfio-pci:
echo 2 >/sys/bus/pci/devices/0000:03:00.0/max_vfs ./usertools/dpdk-devbind.py -b vfio-pci 03:10.0 03:10.2
Start testpmd:
./x86_64-native-linuxapp-gcc/app/testpmd -c 1f -n 4 -m 1024 -w 03:00.0 --file-prefix=pf - -i --rxq=4 --txq=4
testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start
./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf0 -n 4 -w 03:10.0 --file-prefix=vf0 -m 1024 - -i --rxq=4 --txq=4 --disable-rss testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start
./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf00 -n 4 -w 03:10.2 --file-prefix=vf1 -m 1024 - -i --rxq=4 --txq=4 --disable-rss testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start
1. create filter rules,
testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1309 / end actions vf id 0 / end Flow rule #0 created
testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1308 / end actions vf id 1 / end Flow rule #1 created
2. send packets:
pkt1 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x1, ECIDbase=0x309)/Raw('x' * 20) pkt2 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x1, ECIDbase=0x308)/Raw('x' * 20) pkt3 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x1, ECIDbase=0x307)/Raw('x' * 20) pkt4 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x2, ECIDbase=0x309)/Raw('x' * 20)
verify pkt1 to vf0 queue0, pkt2 to vf1 queue0, pkt3 and pkt4 can't received by pf and vfs.
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, November 1, 2017 4:25 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v2] net/ixgbe: fix filter parser error in L2 tunnel
The action for L2 tunnel should be VF, not QUEUE.
--- drivers/net/ixgbe/ixgbe_flow.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +6 -6
@@ -1095,7 +1095,7 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,* The first not void item can be E_TAG. * The next not void item must be END. * action: -* The first not void action should be QUEUE. +* The first not void action should be VF. * The next not void action should be END. * pattern example: * ITEM Spec Mask
@@ -1116,7 +1116,7 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_e_tag *e_tag_spec;const struct rte_flow_item_e_tag *e_tag_mask;const struct rte_flow_action *act; -const struct rte_flow_action_queue *act_q; +const struct rte_flow_action_vf *act_vf;if (!pattern) { rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1224,9 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* check if the first not void action is QUEUE. */ +/* check if the first not void action is VF. */ act =next_no_void_action (actions,NULL ); -if (act->type !=RTE_FLOW_ACTION_TYPE_QUEUE ) { +if (act->type !=RTE_FLOW_ACTION_TYPE_VF ) {memset (filter,0 ,sizeof (struct rte_eth_l2_tunnel_conf )); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1234,8 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,return -rte_errno; } - act_q = (const struct rte_flow_action_queue *)act->conf; - filter->pool = act_q->index; + act_vf = (const struct rte_flow_action_vf *)act->conf; + filter->pool = act_vf->id;/* check if the next not void item is END */ act = next_no_void_action(actions, act); @@ -1260,6 +1260,8 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, {
int ret = 0;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ uint16_t vf_num;
ret = cons_parse_l2_tn_filter(attr, pattern,
actions, l2_tn_filter, error);
@@ -1274,7 +1276,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- if (l2_tn_filter->pool >= dev->data->nb_rx_queues)
+ vf_num = pci_dev->max_vfs;
+
+ if (l2_tn_filter->pool >= vf_num)
return -rte_errno;
return ret;
--
2.7.4
- Tested Branch: dpdk-master
- Tested Commit: commit 8ced1542f7a356097c0b24bd1e08db670ff31b92
- OS: 4.8.6-300.fc25.x86_64
- GCC: gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
- CPU: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
- NIC: X552/X557-AT 10GBASE-T [8086:15ad]
- Default x86_64-native-linuxapp-gcc configuration
- Prerequisites:
- Total 1 cases, 1 passed, 0 failed
Hardware:
dut: 10.240.176.192
tester: 10.240.176.191
X552/X557-AT 10g*2
Test steps:
Bind pf to igb_uio:./usertools/dpdk-devbind.py -b igb_uio 03:00.0
add two vfs on dpdk pf, then bind the vfs to vfio-pci:
echo 2 >/sys/bus/pci/devices/0000:03:00.0/max_vfs ./usertools/dpdk-devbind.py -b vfio-pci 03:10.0 03:10.2
Start testpmd:
./x86_64-native-linuxapp-gcc/app/testpmd -c 1f -n 4 -m 1024 -w 03:00.0 --file-prefix=pf - -i --rxq=4 --txq=4 testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start
./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf0 -n 4 -w 03:10.0 --file-prefix=vf0 -m 1024 - -i --rxq=4 --txq=4 --disable-rss testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start
./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf00 -n 4 -w 03:10.2 --file-prefix=vf1 -m 1024 - -i --rxq=4 --txq=4 --disable-rss testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start
1. create filter rules,
testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1309 / end actions vf id 0 / end Flow rule #0 created
testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1308 / end actions vf id 1 / end Flow rule #1 created
2. send packets:
pkt1 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x1, ECIDbase=0x309)/Raw('x' * 20) pkt2 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x1, ECIDbase=0x308)/Raw('x' * 20) pkt3 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x1, ECIDbase=0x307)/Raw('x' * 20) pkt4 = Ether(dst="00:11:22:33:44:55")/Dot1BR(GRP=0x2, ECIDbase=0x309)/Raw('x' * 20)
verify pkt1 to vf0 queue0, pkt2 to vf1 queue0, pkt3 and pkt4 can't received by pf and vfs.
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, November 1, 2017 4:25 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v2] net/ixgbe: fix filter parser error in L2 tunnel
The action for L2 tunnel should be VF, not QUEUE.
--- drivers/net/ixgbe/ixgbe_flow.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +6 -6
@@ -1095,7 +1095,7 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,* The first not void item can be E_TAG. * The next not void item must be END. * action: -* The first not void action should be QUEUE. +* The first not void action should be VF. * The next not void action should be END. * pattern example: * ITEM Spec Mask
@@ -1116,7 +1116,7 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_e_tag *e_tag_spec;const struct rte_flow_item_e_tag *e_tag_mask;const struct rte_flow_action *act; -const struct rte_flow_action_queue *act_q; +const struct rte_flow_action_vf *act_vf;if (!pattern) { rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1224,9 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* check if the first not void action is QUEUE. */ +/* check if the first not void action is VF. */ act =next_no_void_action (actions,NULL ); -if (act->type !=RTE_FLOW_ACTION_TYPE_QUEUE ) { +if (act->type !=RTE_FLOW_ACTION_TYPE_VF ) {memset (filter,0 ,sizeof (struct rte_eth_l2_tunnel_conf )); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1234,8 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,return -rte_errno; } - act_q = (const struct rte_flow_action_queue *)act->conf; - filter->pool = act_q->index; + act_vf = (const struct rte_flow_action_vf *)act->conf; + filter->pool = act_vf->id;/* check if the next not void item is END */ act = next_no_void_action(actions, act); @@ -1260,6 +1260,8 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, {
int ret = 0;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ uint16_t vf_num;
ret = cons_parse_l2_tn_filter(attr, pattern,
actions, l2_tn_filter, error);
@@ -1274,7 +1276,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- if (l2_tn_filter->pool >= dev->data->nb_rx_queues)
+ vf_num = pci_dev->max_vfs;
+
+ if (l2_tn_filter->pool >= vf_num)
return -rte_errno;
return ret;
--
2.7.4