* [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter
@ 2017-07-17 6:13 Wei Zhao
2017-07-18 10:43 ` Ferruh Yigit
2017-07-19 3:34 ` [dpdk-dev] [PATCH v2] " Wei Zhao
0 siblings, 2 replies; 11+ messages in thread
From: Wei Zhao @ 2017-07-17 6:13 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, Wei Zhao
Add queue index check when create filter rule, or
filter with invalid queue id can be created successfully.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ixgbe/ixgbe_flow.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 6885abd..6d4a0be 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -488,9 +488,7 @@ ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM ||
- filter->priority > IXGBE_5TUPLE_MAX_PRI ||
- filter->priority < IXGBE_5TUPLE_MIN_PRI)
+ if (filter->queue >= dev->data->nb_rx_queues)
return -rte_errno;
/* fixed value for ixgbe */
@@ -707,7 +705,7 @@ ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM) {
+ if (filter->queue >= dev->data->nb_rx_queues) {
memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
@@ -984,6 +982,9 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
ret = cons_parse_syn_filter(attr, pattern,
actions, filter, error);
+ if (filter->queue >= dev->data->nb_rx_queues)
+ return -rte_errno;
+
if (ret)
return ret;
@@ -1177,6 +1178,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
+ if (filter->queue >= dev->data->nb_rx_queues)
+ return -rte_errno;
+
return ret;
}
@@ -2542,6 +2546,10 @@ ixgbe_parse_fdir_filter(struct rte_eth_dev *dev,
if (fdir_mode == RTE_FDIR_MODE_NONE ||
fdir_mode != rule->mode)
return -ENOTSUP;
+
+ if (rule->queue >= dev->data->nb_rx_queues)
+ return -ENOTSUP;
+
return ret;
}
--
2.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter
2017-07-17 6:13 [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter Wei Zhao
@ 2017-07-18 10:43 ` Ferruh Yigit
2017-07-19 3:50 ` Zhao1, Wei
2017-07-19 3:34 ` [dpdk-dev] [PATCH v2] " Wei Zhao
1 sibling, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2017-07-18 10:43 UTC (permalink / raw)
To: Wei Zhao, dev; +Cc: wenzhuo.lu
On 7/17/2017 7:13 AM, Wei Zhao wrote:
> Add queue index check when create filter rule, or
> filter with invalid queue id can be created successfully.
>
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
<...>
> @@ -1177,6 +1178,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
> return -rte_errno;
> }
>
> + if (filter->queue >= dev->data->nb_rx_queues)
> + return -rte_errno;
> +
This is giving following build error [1].
[1]
.../drivers/net/ixgbe/ixgbe_flow.c:1180:6:
error: use of undeclared identifier 'filter'
if (filter->queue >= dev->data->nb_rx_queues)
^
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2] net/ixgbe: add queue index check in filter
2017-07-17 6:13 [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter Wei Zhao
2017-07-18 10:43 ` Ferruh Yigit
@ 2017-07-19 3:34 ` Wei Zhao
2017-07-19 8:56 ` Ferruh Yigit
2017-11-03 6:40 ` [dpdk-dev] [PATCH v3] net/ixgbe: fix filter parser error in L2 tunnel Wei Zhao
1 sibling, 2 replies; 11+ messages in thread
From: Wei Zhao @ 2017-07-19 3:34 UTC (permalink / raw)
To: dev; +Cc: Wei Zhao
Add queue index check when create filter rule, or
filter with invalid queue id can be created successfully.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
v2:
-fix build error.
---
drivers/net/ixgbe/ixgbe_flow.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index f70bdb0..8da8708 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -487,9 +487,7 @@ ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM ||
- filter->priority > IXGBE_5TUPLE_MAX_PRI ||
- filter->priority < IXGBE_5TUPLE_MIN_PRI)
+ if (filter->queue >= dev->data->nb_rx_queues)
return -rte_errno;
/* fixed value for ixgbe */
@@ -706,7 +704,7 @@ ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
- if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM) {
+ if (filter->queue >= dev->data->nb_rx_queues) {
memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
@@ -983,6 +981,9 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
ret = cons_parse_syn_filter(attr, pattern,
actions, filter, error);
+ if (filter->queue >= dev->data->nb_rx_queues)
+ return -rte_errno;
+
if (ret)
return ret;
@@ -1176,6 +1177,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
return -rte_errno;
}
+ if (l2_tn_filter->pool >= dev->data->nb_rx_queues)
+ return -rte_errno;
+
return ret;
}
@@ -2541,6 +2545,10 @@ ixgbe_parse_fdir_filter(struct rte_eth_dev *dev,
if (fdir_mode == RTE_FDIR_MODE_NONE ||
fdir_mode != rule->mode)
return -ENOTSUP;
+
+ if (rule->queue >= dev->data->nb_rx_queues)
+ return -ENOTSUP;
+
return ret;
}
--
2.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter
2017-07-18 10:43 ` Ferruh Yigit
@ 2017-07-19 3:50 ` Zhao1, Wei
0 siblings, 0 replies; 11+ messages in thread
From: Zhao1, Wei @ 2017-07-19 3:50 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Lu, Wenzhuo
Hi, Ferruh
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, July 18, 2017 6:44 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter
>
> On 7/17/2017 7:13 AM, Wei Zhao wrote:
> > Add queue index check when create filter rule, or filter with invalid
> > queue id can be created successfully.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
>
> <...>
>
> > @@ -1177,6 +1178,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev
> *dev,
> > return -rte_errno;
> > }
> >
> > + if (filter->queue >= dev->data->nb_rx_queues)
> > + return -rte_errno;
> > +
>
> This is giving following build error [1].
>
> [1]
> .../drivers/net/ixgbe/ixgbe_flow.c:1180:6:
> error: use of undeclared identifier 'filter'
> if (filter->queue >= dev->data->nb_rx_queues)
> ^
Thank you, a new v2 patch has been commit to DPDK.org
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/ixgbe: add queue index check in filter
2017-07-19 3:34 ` [dpdk-dev] [PATCH v2] " Wei Zhao
@ 2017-07-19 8:56 ` Ferruh Yigit
2017-11-03 6:40 ` [dpdk-dev] [PATCH v3] net/ixgbe: fix filter parser error in L2 tunnel Wei Zhao
1 sibling, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2017-07-19 8:56 UTC (permalink / raw)
To: Wei Zhao, dev
On 7/19/2017 4:34 AM, Wei Zhao wrote:
> Add queue index check when create filter rule, or
> filter with invalid queue id can be created successfully.
>
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v3] net/ixgbe: fix filter parser error in L2 tunnel
2017-07-19 3:34 ` [dpdk-dev] [PATCH v2] " Wei Zhao
2017-07-19 8:56 ` Ferruh Yigit
@ 2017-11-03 6:40 ` Wei Zhao
2017-11-03 7:38 ` [dpdk-dev] [PATCH v4] " Wei Zhao
1 sibling, 1 reply; 11+ messages in thread
From: Wei Zhao @ 2017-11-03 6:40 UTC (permalink / raw)
To: dev; +Cc: Wei Zhao
The action for L2 tunnel should be VF or PF, not QUEUE.
Fixes: 99e7003831c ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
---
v2:
-add vf id check.
v3:
-add action support for PF.
---
drivers/net/ixgbe/ixgbe_flow.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 82fc705..b839d57 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -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 or PF.
* The next not void action should be END.
* pattern example:
* ITEM Spec Mask
@@ -1106,7 +1106,8 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
* item->last should be NULL.
*/
static int
-cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,
+cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
+ const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
struct rte_eth_l2_tunnel_conf *filter,
@@ -1116,7 +1117,8 @@ 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;
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
if (!pattern) {
rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1226,10 @@ 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 or PF. */
act = next_no_void_action(actions, NULL);
- if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {
+ if (act->type != RTE_FLOW_ACTION_TYPE_VF &&
+ act->type != RTE_FLOW_ACTION_TYPE_PF) {
memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1237,12 @@ 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;
+ if (act->type != RTE_FLOW_ACTION_TYPE_VF) {
+ act_vf = (const struct rte_flow_action_vf *)act->conf;
+ filter->pool = act_vf->id;
+ } else {
+ filter->pool = pci_dev->max_vfs;
+ }
/* check if the next not void item is END */
act = next_no_void_action(actions, act);
@@ -1260,8 +1267,10 @@ 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,
+ ret = cons_parse_l2_tn_filter(dev, attr, pattern,
actions, l2_tn_filter, error);
if (hw->mac.type != ixgbe_mac_X550 &&
@@ -1274,7 +1283,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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
2017-11-03 6:40 ` [dpdk-dev] [PATCH v3] net/ixgbe: fix filter parser error in L2 tunnel Wei Zhao
@ 2017-11-03 7:38 ` Wei Zhao
2017-11-03 8:33 ` Peng, Yuan
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Wei Zhao @ 2017-11-03 7:38 UTC (permalink / raw)
To: dev; +Cc: Wei Zhao
The action for L2 tunnel should be VF or PF, not QUEUE.
Fixes: 99e7003831c ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
---
v2:
-add vf id check.
v3:
-add action support for PF.
v4:
-fix action type check error
---
drivers/net/ixgbe/ixgbe_flow.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 82fc705..8bbc8b9 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -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 or PF.
* The next not void action should be END.
* pattern example:
* ITEM Spec Mask
@@ -1106,7 +1106,8 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
* item->last should be NULL.
*/
static int
-cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,
+cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
+ const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
struct rte_eth_l2_tunnel_conf *filter,
@@ -1116,7 +1117,8 @@ 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;
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
if (!pattern) {
rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1226,10 @@ 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 or PF. */
act = next_no_void_action(actions, NULL);
- if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {
+ if (act->type != RTE_FLOW_ACTION_TYPE_VF &&
+ act->type != RTE_FLOW_ACTION_TYPE_PF) {
memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1237,12 @@ 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;
+ if (act->type == RTE_FLOW_ACTION_TYPE_VF) {
+ act_vf = (const struct rte_flow_action_vf *)act->conf;
+ filter->pool = act_vf->id;
+ } else {
+ filter->pool = pci_dev->max_vfs;
+ }
/* check if the next not void item is END */
act = next_no_void_action(actions, act);
@@ -1260,8 +1267,10 @@ 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,
+ ret = cons_parse_l2_tn_filter(dev, attr, pattern,
actions, l2_tn_filter, error);
if (hw->mac.type != ixgbe_mac_X550 &&
@@ -1274,7 +1283,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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
2017-11-03 7:38 ` [dpdk-dev] [PATCH v4] " Wei Zhao
@ 2017-11-03 8:33 ` Peng, Yuan
2017-11-03 8:38 ` Peng, Yuan
2017-11-03 18:54 ` Ferruh Yigit
2 siblings, 0 replies; 11+ messages in thread
From: Peng, Yuan @ 2017-11-03 8:33 UTC (permalink / raw)
To: Zhao1, Wei, dev; +Cc: Zhao1, Wei
Tested-by: Peng Yuan <yuan.peng@intel.com>
- Tested Branch: dpdk-master
- Tested Commit: commit 6fb00f8baefa03b9cfd1b2dfc1787258b8459601
- 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
testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1307 / end actions pf / end
Flow rule #2 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 to pf queue 0, pkt4 can't received by pf and vfs.
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
Sent: Friday, November 3, 2017 3:39 PM
To: dev@dpdk.org
Cc: Zhao1, Wei <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
The action for L2 tunnel should be VF or PF, not QUEUE.
Fixes: 99e7003831c ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
---
v2:
-add vf id check.
v3:
-add action support for PF.
v4:
-fix action type check error
---
drivers/net/ixgbe/ixgbe_flow.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 82fc705..8bbc8b9 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -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 or PF.
* The next not void action should be END.
* pattern example:
* ITEM Spec Mask
@@ -1106,7 +1106,8 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
* item->last should be NULL.
*/
static int
-cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,
+cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
+ const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
struct rte_eth_l2_tunnel_conf *filter, @@ -1116,7 +1117,8 @@ 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;
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
if (!pattern) {
rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1226,10 @@ 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 or PF. */
act = next_no_void_action(actions, NULL);
- if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {
+ if (act->type != RTE_FLOW_ACTION_TYPE_VF &&
+ act->type != RTE_FLOW_ACTION_TYPE_PF) {
memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1237,12 @@ 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;
+ if (act->type == RTE_FLOW_ACTION_TYPE_VF) {
+ act_vf = (const struct rte_flow_action_vf *)act->conf;
+ filter->pool = act_vf->id;
+ } else {
+ filter->pool = pci_dev->max_vfs;
+ }
/* check if the next not void item is END */
act = next_no_void_action(actions, act); @@ -1260,8 +1267,10 @@ 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,
+ ret = cons_parse_l2_tn_filter(dev, attr, pattern,
actions, l2_tn_filter, error);
if (hw->mac.type != ixgbe_mac_X550 &&
@@ -1274,7 +1283,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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
2017-11-03 7:38 ` [dpdk-dev] [PATCH v4] " Wei Zhao
2017-11-03 8:33 ` Peng, Yuan
@ 2017-11-03 8:38 ` Peng, Yuan
2017-11-03 19:11 ` Ferruh Yigit
2017-11-03 18:54 ` Ferruh Yigit
2 siblings, 1 reply; 11+ messages in thread
From: Peng, Yuan @ 2017-11-03 8:38 UTC (permalink / raw)
To: Zhao1, Wei, dev; +Cc: Zhao1, Wei
Tested-by: Peng Yuan <yuan.peng@intel.com>
- Tested Branch: dpdk-master
- Tested Commit: commit 6fb00f8baefa03b9cfd1b2dfc1787258b8459601
- 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
testpmd> port config 0 l2-tunnel E-tag enable
testpmd> E-tag set forwarding on port 0
./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
testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1307 / end actions pf / end
Flow rule #2 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 to pf queue 0, pkt4 can't received by pf and vfs.
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
Sent: Friday, November 3, 2017 3:39 PM
To: dev@dpdk.org
Cc: Zhao1, Wei <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
The action for L2 tunnel should be VF or PF, not QUEUE.
Fixes: 99e7003831c ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
---
v2:
-add vf id check.
v3:
-add action support for PF.
v4:
-fix action type check error
---
drivers/net/ixgbe/ixgbe_flow.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 82fc705..8bbc8b9 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -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 or PF.
* The next not void action should be END.
* pattern example:
* ITEM Spec Mask
@@ -1106,7 +1106,8 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
* item->last should be NULL.
*/
static int
-cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,
+cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
+ const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
struct rte_eth_l2_tunnel_conf *filter, @@ -1116,7 +1117,8 @@ 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;
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
if (!pattern) {
rte_flow_error_set(error, EINVAL,
@@ -1224,9 +1226,10 @@ 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 or PF. */
act = next_no_void_action(actions, NULL);
- if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {
+ if (act->type != RTE_FLOW_ACTION_TYPE_VF &&
+ act->type != RTE_FLOW_ACTION_TYPE_PF) {
memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1234,8 +1237,12 @@ 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;
+ if (act->type == RTE_FLOW_ACTION_TYPE_VF) {
+ act_vf = (const struct rte_flow_action_vf *)act->conf;
+ filter->pool = act_vf->id;
+ } else {
+ filter->pool = pci_dev->max_vfs;
+ }
/* check if the next not void item is END */
act = next_no_void_action(actions, act); @@ -1260,8 +1267,10 @@ 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,
+ ret = cons_parse_l2_tn_filter(dev, attr, pattern,
actions, l2_tn_filter, error);
if (hw->mac.type != ixgbe_mac_X550 &&
@@ -1274,7 +1283,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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
2017-11-03 7:38 ` [dpdk-dev] [PATCH v4] " Wei Zhao
2017-11-03 8:33 ` Peng, Yuan
2017-11-03 8:38 ` Peng, Yuan
@ 2017-11-03 18:54 ` Ferruh Yigit
2 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2017-11-03 18:54 UTC (permalink / raw)
To: Wei Zhao, dev; +Cc: Wei Dai
On 11/3/2017 12:38 AM, Wei Zhao wrote:
> The action for L2 tunnel should be VF or PF, not QUEUE.
>
> Fixes: 99e7003831c ("net/ixgbe: parse L2 tunnel filter")
>
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Acked-by: Wei Dai <wei.dai@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v4] net/ixgbe: fix filter parser error in L2 tunnel
2017-11-03 8:38 ` Peng, Yuan
@ 2017-11-03 19:11 ` Ferruh Yigit
0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2017-11-03 19:11 UTC (permalink / raw)
To: Peng, Yuan, Zhao1, Wei, dev
On 11/3/2017 1:38 AM, Peng, Yuan wrote:
> Tested-by: Peng Yuan <yuan.peng@intel.com>
Hi Yuan,
Thanks for the testing.
And related to the "Tested-by" tag, since it has also contains code patchwork
thinks this is a new patch [1].
This both requires someone updating patchwork and mark that patch as invalid,
and since "Tested-by" is not seen by old patch, requires to manually inserting
this tag into commit.
And we don't prefer top posting in mail list.
so to prevent above issues, would you mind changing how you send the test tag:
In the original patch _remove everything_ below tags (Signed-off-by and similar
ones) and put your tag and details _below_ those lines.
Sample:
"
xxx: fix yyyy
Some commit log.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
---
<put some c code here>
"
When you want to reply to above, it will become:
"
> xxx: fix yyyy
>
> Some commit log.
>
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Acked-by: Wei Dai <wei.dai@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
<some test details>
"
And can you please spread the word to the other members of the test team who are
sending test reports?
One minor thing, we use "Name Surname <lowercase.mail@address.com>" format, so
your tag needs to be:
Tested-by: Yuan Peng <yuan.peng@intel.com>
Although this is minor someone needs to fix it if you send the reverse.
Thanks,
ferruh
[1]
http://dpdk.org/dev/patchwork/patch/31152/
>
> - Tested Branch: dpdk-master
> - Tested Commit: commit 6fb00f8baefa03b9cfd1b2dfc1787258b8459601
> - 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
> testpmd> port config 0 l2-tunnel E-tag enable
> testpmd> E-tag set forwarding on port 0
>
> ./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
> testpmd> flow create 0 ingress pattern e_tag grp_ecid_b is 0x1307 / end actions pf / end
> Flow rule #2 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 to pf queue 0, pkt4 can't received by pf and vfs.
>
<...>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-11-03 19:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 6:13 [dpdk-dev] [PATCH] net/ixgbe: add queue index check in filter Wei Zhao
2017-07-18 10:43 ` Ferruh Yigit
2017-07-19 3:50 ` Zhao1, Wei
2017-07-19 3:34 ` [dpdk-dev] [PATCH v2] " Wei Zhao
2017-07-19 8:56 ` Ferruh Yigit
2017-11-03 6:40 ` [dpdk-dev] [PATCH v3] net/ixgbe: fix filter parser error in L2 tunnel Wei Zhao
2017-11-03 7:38 ` [dpdk-dev] [PATCH v4] " Wei Zhao
2017-11-03 8:33 ` Peng, Yuan
2017-11-03 8:38 ` Peng, Yuan
2017-11-03 19:11 ` Ferruh Yigit
2017-11-03 18:54 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).