* [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
@ 2019-04-23 11:19 Ori Kam
2019-04-23 11:19 ` Ori Kam
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Ori Kam @ 2019-04-23 11:19 UTC (permalink / raw)
To: yskoh, shahafs, matan; +Cc: dev, orika
When creating a flow rule without the port_id pattern item, always the
PF was selected.
This commit fixes this issue, if no port_id pattern item is available
then we use the port that the flow was created on as source port.
Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
Signed-off-by: Ori Kam <orika@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c2a2fc6..d17adbe 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
union flow_dv_attr flow_attr = { .attr = 0 };
struct mlx5_flow_dv_tag_resource tag_resource;
uint32_t modify_action_position = UINT32_MAX;
+ void *match_mask = matcher.mask.buf;
+ void *match_value = dev_flow->dv.value.buf;
flow->group = attr->group;
if (attr->transfer)
@@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
}
dev_flow->dv.actions_n = actions_n;
flow->actions = action_flags;
- if (attr->ingress && !attr->transfer &&
- (priv->representor || priv->master)) {
- /* It was validated - we support unidirection flows only. */
- assert(!attr->egress);
- /*
- * Add matching on source vport index only
- * for ingress rules in E-Switch configurations.
- */
- flow_dv_translate_item_source_vport(matcher.mask.buf,
- dev_flow->dv.value.buf,
- priv->vport_id,
- 0xffff);
- }
for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
- void *match_mask = matcher.mask.buf;
- void *match_value = dev_flow->dv.value.buf;
switch (items->type) {
case RTE_FLOW_ITEM_TYPE_PORT_ID:
@@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
}
item_flags |= last_item;
}
+ if (((attr->ingress && !attr->transfer) ||
+ (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID))) &&
+ (priv->representor || priv->master)) {
+ /* It was validated - we support unidirection flows only. */
+ assert(!attr->egress);
+ /*
+ * Add matching on source vport index only
+ * for ingress rules in E-Switch configurations.
+ */
+ if (flow_dv_translate_item_port_id(dev, match_mask,
+ match_value, NULL))
+ return -rte_errno;
+ }
assert(!flow_dv_check_valid_spec(matcher.mask.buf,
dev_flow->dv.value.buf));
dev_flow->layers = item_flags;
--
1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-23 11:19 [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item Ori Kam
@ 2019-04-23 11:19 ` Ori Kam
2019-04-23 21:03 ` Yongseok Koh
2019-04-25 12:20 ` [dpdk-dev] [PATCH v2] " Ori Kam
2 siblings, 0 replies; 14+ messages in thread
From: Ori Kam @ 2019-04-23 11:19 UTC (permalink / raw)
To: yskoh, shahafs, matan; +Cc: dev, orika
When creating a flow rule without the port_id pattern item, always the
PF was selected.
This commit fixes this issue, if no port_id pattern item is available
then we use the port that the flow was created on as source port.
Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
Signed-off-by: Ori Kam <orika@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c2a2fc6..d17adbe 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
union flow_dv_attr flow_attr = { .attr = 0 };
struct mlx5_flow_dv_tag_resource tag_resource;
uint32_t modify_action_position = UINT32_MAX;
+ void *match_mask = matcher.mask.buf;
+ void *match_value = dev_flow->dv.value.buf;
flow->group = attr->group;
if (attr->transfer)
@@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
}
dev_flow->dv.actions_n = actions_n;
flow->actions = action_flags;
- if (attr->ingress && !attr->transfer &&
- (priv->representor || priv->master)) {
- /* It was validated - we support unidirection flows only. */
- assert(!attr->egress);
- /*
- * Add matching on source vport index only
- * for ingress rules in E-Switch configurations.
- */
- flow_dv_translate_item_source_vport(matcher.mask.buf,
- dev_flow->dv.value.buf,
- priv->vport_id,
- 0xffff);
- }
for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
- void *match_mask = matcher.mask.buf;
- void *match_value = dev_flow->dv.value.buf;
switch (items->type) {
case RTE_FLOW_ITEM_TYPE_PORT_ID:
@@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
}
item_flags |= last_item;
}
+ if (((attr->ingress && !attr->transfer) ||
+ (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID))) &&
+ (priv->representor || priv->master)) {
+ /* It was validated - we support unidirection flows only. */
+ assert(!attr->egress);
+ /*
+ * Add matching on source vport index only
+ * for ingress rules in E-Switch configurations.
+ */
+ if (flow_dv_translate_item_port_id(dev, match_mask,
+ match_value, NULL))
+ return -rte_errno;
+ }
assert(!flow_dv_check_valid_spec(matcher.mask.buf,
dev_flow->dv.value.buf));
dev_flow->layers = item_flags;
--
1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-23 11:19 [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item Ori Kam
2019-04-23 11:19 ` Ori Kam
@ 2019-04-23 21:03 ` Yongseok Koh
2019-04-23 21:03 ` Yongseok Koh
2019-04-25 7:02 ` Ori Kam
2019-04-25 12:20 ` [dpdk-dev] [PATCH v2] " Ori Kam
2 siblings, 2 replies; 14+ messages in thread
From: Yongseok Koh @ 2019-04-23 21:03 UTC (permalink / raw)
To: Ori Kam; +Cc: Shahaf Shuler, Matan Azrad, dev
On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote:
> When creating a flow rule without the port_id pattern item, always the
> PF was selected.
>
> This commit fixes this issue, if no port_id pattern item is available
> then we use the port that the flow was created on as source port.
>
> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index c2a2fc6..d17adbe 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
> union flow_dv_attr flow_attr = { .attr = 0 };
> struct mlx5_flow_dv_tag_resource tag_resource;
> uint32_t modify_action_position = UINT32_MAX;
> + void *match_mask = matcher.mask.buf;
> + void *match_value = dev_flow->dv.value.buf;
>
> flow->group = attr->group;
> if (attr->transfer)
> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
> }
> dev_flow->dv.actions_n = actions_n;
> flow->actions = action_flags;
> - if (attr->ingress && !attr->transfer &&
> - (priv->representor || priv->master)) {
> - /* It was validated - we support unidirection flows only. */
> - assert(!attr->egress);
> - /*
> - * Add matching on source vport index only
> - * for ingress rules in E-Switch configurations.
> - */
> - flow_dv_translate_item_source_vport(matcher.mask.buf,
> - dev_flow->dv.value.buf,
> - priv->vport_id,
> - 0xffff);
> - }
> for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
> - void *match_mask = matcher.mask.buf;
> - void *match_value = dev_flow->dv.value.buf;
>
> switch (items->type) {
> case RTE_FLOW_ITEM_TYPE_PORT_ID:
> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
> }
> item_flags |= last_item;
> }
> + if (((attr->ingress && !attr->transfer) ||
> + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID))) &&
> + (priv->representor || priv->master)) {
>From the validations, I could figure out
- Either ingress (I) or egress (E) must be specified
- Transfer (T) can't be egress
- Port ID (P) is valid only if transfer (T) is specified.
(!T and I) or (T and !P)
= (I - T) + (T - P)
= I - P
So, this condition is equivalent to
if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
(priv->representor || priv->master)) {
...
}
Right?
If agreed, please add comment properly.
> + /* It was validated - we support unidirection flows only. */
> + assert(!attr->egress);
This comment and assert are there to mention ingress and egress are exclusive.
Is it still relevant? Did you also test the patch with enabling DEBUG?
> + /*
> + * Add matching on source vport index only
> + * for ingress rules in E-Switch configurations.
> + */
Please make this comment appropriate as well.
Thanks,
Yongseok
> + if (flow_dv_translate_item_port_id(dev, match_mask,
> + match_value, NULL))
> + return -rte_errno;
> + }
> assert(!flow_dv_check_valid_spec(matcher.mask.buf,
> dev_flow->dv.value.buf));
> dev_flow->layers = item_flags;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-23 21:03 ` Yongseok Koh
@ 2019-04-23 21:03 ` Yongseok Koh
2019-04-25 7:02 ` Ori Kam
1 sibling, 0 replies; 14+ messages in thread
From: Yongseok Koh @ 2019-04-23 21:03 UTC (permalink / raw)
To: Ori Kam; +Cc: Shahaf Shuler, Matan Azrad, dev
On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote:
> When creating a flow rule without the port_id pattern item, always the
> PF was selected.
>
> This commit fixes this issue, if no port_id pattern item is available
> then we use the port that the flow was created on as source port.
>
> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index c2a2fc6..d17adbe 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
> union flow_dv_attr flow_attr = { .attr = 0 };
> struct mlx5_flow_dv_tag_resource tag_resource;
> uint32_t modify_action_position = UINT32_MAX;
> + void *match_mask = matcher.mask.buf;
> + void *match_value = dev_flow->dv.value.buf;
>
> flow->group = attr->group;
> if (attr->transfer)
> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
> }
> dev_flow->dv.actions_n = actions_n;
> flow->actions = action_flags;
> - if (attr->ingress && !attr->transfer &&
> - (priv->representor || priv->master)) {
> - /* It was validated - we support unidirection flows only. */
> - assert(!attr->egress);
> - /*
> - * Add matching on source vport index only
> - * for ingress rules in E-Switch configurations.
> - */
> - flow_dv_translate_item_source_vport(matcher.mask.buf,
> - dev_flow->dv.value.buf,
> - priv->vport_id,
> - 0xffff);
> - }
> for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
> - void *match_mask = matcher.mask.buf;
> - void *match_value = dev_flow->dv.value.buf;
>
> switch (items->type) {
> case RTE_FLOW_ITEM_TYPE_PORT_ID:
> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
> }
> item_flags |= last_item;
> }
> + if (((attr->ingress && !attr->transfer) ||
> + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID))) &&
> + (priv->representor || priv->master)) {
From the validations, I could figure out
- Either ingress (I) or egress (E) must be specified
- Transfer (T) can't be egress
- Port ID (P) is valid only if transfer (T) is specified.
(!T and I) or (T and !P)
= (I - T) + (T - P)
= I - P
So, this condition is equivalent to
if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
(priv->representor || priv->master)) {
...
}
Right?
If agreed, please add comment properly.
> + /* It was validated - we support unidirection flows only. */
> + assert(!attr->egress);
This comment and assert are there to mention ingress and egress are exclusive.
Is it still relevant? Did you also test the patch with enabling DEBUG?
> + /*
> + * Add matching on source vport index only
> + * for ingress rules in E-Switch configurations.
> + */
Please make this comment appropriate as well.
Thanks,
Yongseok
> + if (flow_dv_translate_item_port_id(dev, match_mask,
> + match_value, NULL))
> + return -rte_errno;
> + }
> assert(!flow_dv_check_valid_spec(matcher.mask.buf,
> dev_flow->dv.value.buf));
> dev_flow->layers = item_flags;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-23 21:03 ` Yongseok Koh
2019-04-23 21:03 ` Yongseok Koh
@ 2019-04-25 7:02 ` Ori Kam
2019-04-25 7:02 ` Ori Kam
2019-04-25 17:53 ` Yongseok Koh
1 sibling, 2 replies; 14+ messages in thread
From: Ori Kam @ 2019-04-25 7:02 UTC (permalink / raw)
To: Yongseok Koh; +Cc: Shahaf Shuler, Matan Azrad, dev
Hi Yongseok,
PSB,
Ori
> -----Original Message-----
> From: Yongseok Koh
> Sent: Wednesday, April 24, 2019 12:03 AM
> To: Ori Kam <orika@mellanox.com>
> Cc: Shahaf Shuler <shahafs@mellanox.com>; Matan Azrad
> <matan@mellanox.com>; dev@dpdk.org
> Subject: Re: [PATCH] net/mlx5: fix E-Switch flow without port item
>
> On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote:
> > When creating a flow rule without the port_id pattern item, always the
> > PF was selected.
> >
> > This commit fixes this issue, if no port_id pattern item is available
> > then we use the port that the flow was created on as source port.
> >
> > Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
> >
> > Signed-off-by: Ori Kam <orika@mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
> > 1 file changed, 15 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> > index c2a2fc6..d17adbe 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
> > union flow_dv_attr flow_attr = { .attr = 0 };
> > struct mlx5_flow_dv_tag_resource tag_resource;
> > uint32_t modify_action_position = UINT32_MAX;
> > + void *match_mask = matcher.mask.buf;
> > + void *match_value = dev_flow->dv.value.buf;
> >
> > flow->group = attr->group;
> > if (attr->transfer)
> > @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
> > }
> > dev_flow->dv.actions_n = actions_n;
> > flow->actions = action_flags;
> > - if (attr->ingress && !attr->transfer &&
> > - (priv->representor || priv->master)) {
> > - /* It was validated - we support unidirection flows only. */
> > - assert(!attr->egress);
> > - /*
> > - * Add matching on source vport index only
> > - * for ingress rules in E-Switch configurations.
> > - */
> > - flow_dv_translate_item_source_vport(matcher.mask.buf,
> > - dev_flow->dv.value.buf,
> > - priv->vport_id,
> > - 0xffff);
> > - }
> > for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> > int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
> > - void *match_mask = matcher.mask.buf;
> > - void *match_value = dev_flow->dv.value.buf;
> >
> > switch (items->type) {
> > case RTE_FLOW_ITEM_TYPE_PORT_ID:
> > @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
> > }
> > item_flags |= last_item;
> > }
> > + if (((attr->ingress && !attr->transfer) ||
> > + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)))
> &&
> > + (priv->representor || priv->master)) {
>
> From the validations, I could figure out
> - Either ingress (I) or egress (E) must be specified
> - Transfer (T) can't be egress
0> - Port ID (P) is valid only if transfer (T) is specified.
>
> (!T and I) or (T and !P)
> = (I - T) + (T - P)
> = I - P
>
> So, this condition is equivalent to
> if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
> (priv->representor || priv->master)) {
> ...
> }
>
> Right?
>
You are right that we correnlty only support ingress rules for E-Switch, I want to keep it open if in future we
will support also egress for E-Switch rules, but I guess we can update it when it will be relevant.
Regarding the if you wrote there should be only one ! not 2 since this code is relevant only if the user
didn't specified port_id.
Am I right?
> If agreed, please add comment properly.
>
> > + /* It was validated - we support unidirection flows only. */
> > + assert(!attr->egress);
>
> This comment and assert are there to mention ingress and egress are
> exclusive.
> Is it still relevant? Did you also test the patch with enabling DEBUG?
>
I will remove this code.
> > + /*
> > + * Add matching on source vport index only
> > + * for ingress rules in E-Switch configurations.
> > + */
>
> Please make this comment appropriate as well.
>
This comment is correct, due to the second part of the if (E-Switch mode is enabled, never mind if
it is E-Switch rule or Nic rule), but I will remove this comment and add it as part of the if updated comment.
> Thanks,
> Yongseok
>
> > + if (flow_dv_translate_item_port_id(dev, match_mask,
> > + match_value, NULL))
> > + return -rte_errno;
> > + }
> > assert(!flow_dv_check_valid_spec(matcher.mask.buf,
> > dev_flow->dv.value.buf));
> > dev_flow->layers = item_flags;
> > --
> > 1.8.3.1
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-25 7:02 ` Ori Kam
@ 2019-04-25 7:02 ` Ori Kam
2019-04-25 17:53 ` Yongseok Koh
1 sibling, 0 replies; 14+ messages in thread
From: Ori Kam @ 2019-04-25 7:02 UTC (permalink / raw)
To: Yongseok Koh; +Cc: Shahaf Shuler, Matan Azrad, dev
Hi Yongseok,
PSB,
Ori
> -----Original Message-----
> From: Yongseok Koh
> Sent: Wednesday, April 24, 2019 12:03 AM
> To: Ori Kam <orika@mellanox.com>
> Cc: Shahaf Shuler <shahafs@mellanox.com>; Matan Azrad
> <matan@mellanox.com>; dev@dpdk.org
> Subject: Re: [PATCH] net/mlx5: fix E-Switch flow without port item
>
> On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote:
> > When creating a flow rule without the port_id pattern item, always the
> > PF was selected.
> >
> > This commit fixes this issue, if no port_id pattern item is available
> > then we use the port that the flow was created on as source port.
> >
> > Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
> >
> > Signed-off-by: Ori Kam <orika@mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
> > 1 file changed, 15 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> > index c2a2fc6..d17adbe 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
> > union flow_dv_attr flow_attr = { .attr = 0 };
> > struct mlx5_flow_dv_tag_resource tag_resource;
> > uint32_t modify_action_position = UINT32_MAX;
> > + void *match_mask = matcher.mask.buf;
> > + void *match_value = dev_flow->dv.value.buf;
> >
> > flow->group = attr->group;
> > if (attr->transfer)
> > @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
> > }
> > dev_flow->dv.actions_n = actions_n;
> > flow->actions = action_flags;
> > - if (attr->ingress && !attr->transfer &&
> > - (priv->representor || priv->master)) {
> > - /* It was validated - we support unidirection flows only. */
> > - assert(!attr->egress);
> > - /*
> > - * Add matching on source vport index only
> > - * for ingress rules in E-Switch configurations.
> > - */
> > - flow_dv_translate_item_source_vport(matcher.mask.buf,
> > - dev_flow->dv.value.buf,
> > - priv->vport_id,
> > - 0xffff);
> > - }
> > for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> > int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
> > - void *match_mask = matcher.mask.buf;
> > - void *match_value = dev_flow->dv.value.buf;
> >
> > switch (items->type) {
> > case RTE_FLOW_ITEM_TYPE_PORT_ID:
> > @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
> > }
> > item_flags |= last_item;
> > }
> > + if (((attr->ingress && !attr->transfer) ||
> > + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)))
> &&
> > + (priv->representor || priv->master)) {
>
> From the validations, I could figure out
> - Either ingress (I) or egress (E) must be specified
> - Transfer (T) can't be egress
0> - Port ID (P) is valid only if transfer (T) is specified.
>
> (!T and I) or (T and !P)
> = (I - T) + (T - P)
> = I - P
>
> So, this condition is equivalent to
> if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
> (priv->representor || priv->master)) {
> ...
> }
>
> Right?
>
You are right that we correnlty only support ingress rules for E-Switch, I want to keep it open if in future we
will support also egress for E-Switch rules, but I guess we can update it when it will be relevant.
Regarding the if you wrote there should be only one ! not 2 since this code is relevant only if the user
didn't specified port_id.
Am I right?
> If agreed, please add comment properly.
>
> > + /* It was validated - we support unidirection flows only. */
> > + assert(!attr->egress);
>
> This comment and assert are there to mention ingress and egress are
> exclusive.
> Is it still relevant? Did you also test the patch with enabling DEBUG?
>
I will remove this code.
> > + /*
> > + * Add matching on source vport index only
> > + * for ingress rules in E-Switch configurations.
> > + */
>
> Please make this comment appropriate as well.
>
This comment is correct, due to the second part of the if (E-Switch mode is enabled, never mind if
it is E-Switch rule or Nic rule), but I will remove this comment and add it as part of the if updated comment.
> Thanks,
> Yongseok
>
> > + if (flow_dv_translate_item_port_id(dev, match_mask,
> > + match_value, NULL))
> > + return -rte_errno;
> > + }
> > assert(!flow_dv_check_valid_spec(matcher.mask.buf,
> > dev_flow->dv.value.buf));
> > dev_flow->layers = item_flags;
> > --
> > 1.8.3.1
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2] net/mlx5: fix E-Switch flow without port item
2019-04-23 11:19 [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item Ori Kam
2019-04-23 11:19 ` Ori Kam
2019-04-23 21:03 ` Yongseok Koh
@ 2019-04-25 12:20 ` Ori Kam
2019-04-25 12:20 ` Ori Kam
2019-04-25 17:54 ` Yongseok Koh
2 siblings, 2 replies; 14+ messages in thread
From: Ori Kam @ 2019-04-25 12:20 UTC (permalink / raw)
To: yskoh, shahafs; +Cc: dev, orika
When creating a flow rule without the port_id pattern item, always the
PF was selected.
This commit fixes this issue, if no port_id pattern item is available
then we use the port that the flow was created on as source port.
Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
Signed-off-by: Ori Kam <orika@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c2a2fc6..b3f802d 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
union flow_dv_attr flow_attr = { .attr = 0 };
struct mlx5_flow_dv_tag_resource tag_resource;
uint32_t modify_action_position = UINT32_MAX;
+ void *match_mask = matcher.mask.buf;
+ void *match_value = dev_flow->dv.value.buf;
flow->group = attr->group;
if (attr->transfer)
@@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
}
dev_flow->dv.actions_n = actions_n;
flow->actions = action_flags;
- if (attr->ingress && !attr->transfer &&
- (priv->representor || priv->master)) {
- /* It was validated - we support unidirection flows only. */
- assert(!attr->egress);
- /*
- * Add matching on source vport index only
- * for ingress rules in E-Switch configurations.
- */
- flow_dv_translate_item_source_vport(matcher.mask.buf,
- dev_flow->dv.value.buf,
- priv->vport_id,
- 0xffff);
- }
for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
- void *match_mask = matcher.mask.buf;
- void *match_value = dev_flow->dv.value.buf;
switch (items->type) {
case RTE_FLOW_ITEM_TYPE_PORT_ID:
@@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
}
item_flags |= last_item;
}
+ /*
+ * In case of ingress traffic when E-Switch mode is enabled,
+ * we have two cases where we need to set the source port manually.
+ * The first one, is in case of Nic steering rule, and the second is
+ * E-Switch rule where no port_id item was found. In both cases
+ * the source port is set according the current port in use.
+ */
+ if ((attr->ingress && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)) &&
+ (priv->representor || priv->master)) {
+ if (flow_dv_translate_item_port_id(dev, match_mask,
+ match_value, NULL))
+ return -rte_errno;
+ }
assert(!flow_dv_check_valid_spec(matcher.mask.buf,
dev_flow->dv.value.buf));
dev_flow->layers = item_flags;
--
1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dpdk-dev] [PATCH v2] net/mlx5: fix E-Switch flow without port item
2019-04-25 12:20 ` [dpdk-dev] [PATCH v2] " Ori Kam
@ 2019-04-25 12:20 ` Ori Kam
2019-04-25 17:54 ` Yongseok Koh
1 sibling, 0 replies; 14+ messages in thread
From: Ori Kam @ 2019-04-25 12:20 UTC (permalink / raw)
To: yskoh, shahafs; +Cc: dev, orika
When creating a flow rule without the port_id pattern item, always the
PF was selected.
This commit fixes this issue, if no port_id pattern item is available
then we use the port that the flow was created on as source port.
Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
Signed-off-by: Ori Kam <orika@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c2a2fc6..b3f802d 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
union flow_dv_attr flow_attr = { .attr = 0 };
struct mlx5_flow_dv_tag_resource tag_resource;
uint32_t modify_action_position = UINT32_MAX;
+ void *match_mask = matcher.mask.buf;
+ void *match_value = dev_flow->dv.value.buf;
flow->group = attr->group;
if (attr->transfer)
@@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
}
dev_flow->dv.actions_n = actions_n;
flow->actions = action_flags;
- if (attr->ingress && !attr->transfer &&
- (priv->representor || priv->master)) {
- /* It was validated - we support unidirection flows only. */
- assert(!attr->egress);
- /*
- * Add matching on source vport index only
- * for ingress rules in E-Switch configurations.
- */
- flow_dv_translate_item_source_vport(matcher.mask.buf,
- dev_flow->dv.value.buf,
- priv->vport_id,
- 0xffff);
- }
for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
- void *match_mask = matcher.mask.buf;
- void *match_value = dev_flow->dv.value.buf;
switch (items->type) {
case RTE_FLOW_ITEM_TYPE_PORT_ID:
@@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
}
item_flags |= last_item;
}
+ /*
+ * In case of ingress traffic when E-Switch mode is enabled,
+ * we have two cases where we need to set the source port manually.
+ * The first one, is in case of Nic steering rule, and the second is
+ * E-Switch rule where no port_id item was found. In both cases
+ * the source port is set according the current port in use.
+ */
+ if ((attr->ingress && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)) &&
+ (priv->representor || priv->master)) {
+ if (flow_dv_translate_item_port_id(dev, match_mask,
+ match_value, NULL))
+ return -rte_errno;
+ }
assert(!flow_dv_check_valid_spec(matcher.mask.buf,
dev_flow->dv.value.buf));
dev_flow->layers = item_flags;
--
1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-25 7:02 ` Ori Kam
2019-04-25 7:02 ` Ori Kam
@ 2019-04-25 17:53 ` Yongseok Koh
2019-04-25 17:53 ` Yongseok Koh
1 sibling, 1 reply; 14+ messages in thread
From: Yongseok Koh @ 2019-04-25 17:53 UTC (permalink / raw)
To: Ori Kam; +Cc: Shahaf Shuler, Matan Azrad, dev
> On Apr 25, 2019, at 12:02 AM, Ori Kam <orika@mellanox.com> wrote:
>
> Hi Yongseok,
> PSB,
>
> Ori
>
>> -----Original Message-----
>> From: Yongseok Koh
>> Sent: Wednesday, April 24, 2019 12:03 AM
>> To: Ori Kam <orika@mellanox.com>
>> Cc: Shahaf Shuler <shahafs@mellanox.com>; Matan Azrad
>> <matan@mellanox.com>; dev@dpdk.org
>> Subject: Re: [PATCH] net/mlx5: fix E-Switch flow without port item
>>
>> On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote:
>>> When creating a flow rule without the port_id pattern item, always the
>>> PF was selected.
>>>
>>> This commit fixes this issue, if no port_id pattern item is available
>>> then we use the port that the flow was created on as source port.
>>>
>>> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
>>>
>>> Signed-off-by: Ori Kam <orika@mellanox.com>
>>> ---
>>> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
>>> 1 file changed, 15 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
>> b/drivers/net/mlx5/mlx5_flow_dv.c
>>> index c2a2fc6..d17adbe 100644
>>> --- a/drivers/net/mlx5/mlx5_flow_dv.c
>>> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
>>> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
>>> union flow_dv_attr flow_attr = { .attr = 0 };
>>> struct mlx5_flow_dv_tag_resource tag_resource;
>>> uint32_t modify_action_position = UINT32_MAX;
>>> + void *match_mask = matcher.mask.buf;
>>> + void *match_value = dev_flow->dv.value.buf;
>>>
>>> flow->group = attr->group;
>>> if (attr->transfer)
>>> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
>>> }
>>> dev_flow->dv.actions_n = actions_n;
>>> flow->actions = action_flags;
>>> - if (attr->ingress && !attr->transfer &&
>>> - (priv->representor || priv->master)) {
>>> - /* It was validated - we support unidirection flows only. */
>>> - assert(!attr->egress);
>>> - /*
>>> - * Add matching on source vport index only
>>> - * for ingress rules in E-Switch configurations.
>>> - */
>>> - flow_dv_translate_item_source_vport(matcher.mask.buf,
>>> - dev_flow->dv.value.buf,
>>> - priv->vport_id,
>>> - 0xffff);
>>> - }
>>> for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
>>> int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
>>> - void *match_mask = matcher.mask.buf;
>>> - void *match_value = dev_flow->dv.value.buf;
>>>
>>> switch (items->type) {
>>> case RTE_FLOW_ITEM_TYPE_PORT_ID:
>>> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
>>> }
>>> item_flags |= last_item;
>>> }
>>> + if (((attr->ingress && !attr->transfer) ||
>>> + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)))
>> &&
>>> + (priv->representor || priv->master)) {
>>
>> From the validations, I could figure out
>> - Either ingress (I) or egress (E) must be specified
>> - Transfer (T) can't be egress
> 0> - Port ID (P) is valid only if transfer (T) is specified.
>>
>> (!T and I) or (T and !P)
>> = (I - T) + (T - P)
>> = I - P
>>
>> So, this condition is equivalent to
>> if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
>> (priv->representor || priv->master)) {
>> ...
>> }
>>
>> Right?
Right that was my typo.
Thanks,
Yongseok
>>
>
> You are right that we correnlty only support ingress rules for E-Switch, I want to keep it open if in future we
> will support also egress for E-Switch rules, but I guess we can update it when it will be relevant.
> Regarding the if you wrote there should be only one ! not 2 since this code is relevant only if the user
> didn't specified port_id.
>
> Am I right?
>
>> If agreed, please add comment properly.
>>
>>> + /* It was validated - we support unidirection flows only. */
>>> + assert(!attr->egress);
>>
>> This comment and assert are there to mention ingress and egress are
>> exclusive.
>> Is it still relevant? Did you also test the patch with enabling DEBUG?
>>
>
> I will remove this code.
>
>>> + /*
>>> + * Add matching on source vport index only
>>> + * for ingress rules in E-Switch configurations.
>>> + */
>>
>> Please make this comment appropriate as well.
>>
>
> This comment is correct, due to the second part of the if (E-Switch mode is enabled, never mind if
> it is E-Switch rule or Nic rule), but I will remove this comment and add it as part of the if updated comment.
>
>> Thanks,
>> Yongseok
>>
>>> + if (flow_dv_translate_item_port_id(dev, match_mask,
>>> + match_value, NULL))
>>> + return -rte_errno;
>>> + }
>>> assert(!flow_dv_check_valid_spec(matcher.mask.buf,
>>> dev_flow->dv.value.buf));
>>> dev_flow->layers = item_flags;
>>> --
>>> 1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item
2019-04-25 17:53 ` Yongseok Koh
@ 2019-04-25 17:53 ` Yongseok Koh
0 siblings, 0 replies; 14+ messages in thread
From: Yongseok Koh @ 2019-04-25 17:53 UTC (permalink / raw)
To: Ori Kam; +Cc: Shahaf Shuler, Matan Azrad, dev
> On Apr 25, 2019, at 12:02 AM, Ori Kam <orika@mellanox.com> wrote:
>
> Hi Yongseok,
> PSB,
>
> Ori
>
>> -----Original Message-----
>> From: Yongseok Koh
>> Sent: Wednesday, April 24, 2019 12:03 AM
>> To: Ori Kam <orika@mellanox.com>
>> Cc: Shahaf Shuler <shahafs@mellanox.com>; Matan Azrad
>> <matan@mellanox.com>; dev@dpdk.org
>> Subject: Re: [PATCH] net/mlx5: fix E-Switch flow without port item
>>
>> On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote:
>>> When creating a flow rule without the port_id pattern item, always the
>>> PF was selected.
>>>
>>> This commit fixes this issue, if no port_id pattern item is available
>>> then we use the port that the flow was created on as source port.
>>>
>>> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
>>>
>>> Signed-off-by: Ori Kam <orika@mellanox.com>
>>> ---
>>> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
>>> 1 file changed, 15 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
>> b/drivers/net/mlx5/mlx5_flow_dv.c
>>> index c2a2fc6..d17adbe 100644
>>> --- a/drivers/net/mlx5/mlx5_flow_dv.c
>>> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
>>> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
>>> union flow_dv_attr flow_attr = { .attr = 0 };
>>> struct mlx5_flow_dv_tag_resource tag_resource;
>>> uint32_t modify_action_position = UINT32_MAX;
>>> + void *match_mask = matcher.mask.buf;
>>> + void *match_value = dev_flow->dv.value.buf;
>>>
>>> flow->group = attr->group;
>>> if (attr->transfer)
>>> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
>>> }
>>> dev_flow->dv.actions_n = actions_n;
>>> flow->actions = action_flags;
>>> - if (attr->ingress && !attr->transfer &&
>>> - (priv->representor || priv->master)) {
>>> - /* It was validated - we support unidirection flows only. */
>>> - assert(!attr->egress);
>>> - /*
>>> - * Add matching on source vport index only
>>> - * for ingress rules in E-Switch configurations.
>>> - */
>>> - flow_dv_translate_item_source_vport(matcher.mask.buf,
>>> - dev_flow->dv.value.buf,
>>> - priv->vport_id,
>>> - 0xffff);
>>> - }
>>> for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
>>> int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
>>> - void *match_mask = matcher.mask.buf;
>>> - void *match_value = dev_flow->dv.value.buf;
>>>
>>> switch (items->type) {
>>> case RTE_FLOW_ITEM_TYPE_PORT_ID:
>>> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
>>> }
>>> item_flags |= last_item;
>>> }
>>> + if (((attr->ingress && !attr->transfer) ||
>>> + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)))
>> &&
>>> + (priv->representor || priv->master)) {
>>
>> From the validations, I could figure out
>> - Either ingress (I) or egress (E) must be specified
>> - Transfer (T) can't be egress
> 0> - Port ID (P) is valid only if transfer (T) is specified.
>>
>> (!T and I) or (T and !P)
>> = (I - T) + (T - P)
>> = I - P
>>
>> So, this condition is equivalent to
>> if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) &&
>> (priv->representor || priv->master)) {
>> ...
>> }
>>
>> Right?
Right that was my typo.
Thanks,
Yongseok
>>
>
> You are right that we correnlty only support ingress rules for E-Switch, I want to keep it open if in future we
> will support also egress for E-Switch rules, but I guess we can update it when it will be relevant.
> Regarding the if you wrote there should be only one ! not 2 since this code is relevant only if the user
> didn't specified port_id.
>
> Am I right?
>
>> If agreed, please add comment properly.
>>
>>> + /* It was validated - we support unidirection flows only. */
>>> + assert(!attr->egress);
>>
>> This comment and assert are there to mention ingress and egress are
>> exclusive.
>> Is it still relevant? Did you also test the patch with enabling DEBUG?
>>
>
> I will remove this code.
>
>>> + /*
>>> + * Add matching on source vport index only
>>> + * for ingress rules in E-Switch configurations.
>>> + */
>>
>> Please make this comment appropriate as well.
>>
>
> This comment is correct, due to the second part of the if (E-Switch mode is enabled, never mind if
> it is E-Switch rule or Nic rule), but I will remove this comment and add it as part of the if updated comment.
>
>> Thanks,
>> Yongseok
>>
>>> + if (flow_dv_translate_item_port_id(dev, match_mask,
>>> + match_value, NULL))
>>> + return -rte_errno;
>>> + }
>>> assert(!flow_dv_check_valid_spec(matcher.mask.buf,
>>> dev_flow->dv.value.buf));
>>> dev_flow->layers = item_flags;
>>> --
>>> 1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix E-Switch flow without port item
2019-04-25 12:20 ` [dpdk-dev] [PATCH v2] " Ori Kam
2019-04-25 12:20 ` Ori Kam
@ 2019-04-25 17:54 ` Yongseok Koh
2019-04-25 17:54 ` Yongseok Koh
2019-05-01 6:09 ` Shahaf Shuler
1 sibling, 2 replies; 14+ messages in thread
From: Yongseok Koh @ 2019-04-25 17:54 UTC (permalink / raw)
To: Ori Kam; +Cc: Shahaf Shuler, dev
> On Apr 25, 2019, at 5:20 AM, Ori Kam <orika@mellanox.com> wrote:
>
> When creating a flow rule without the port_id pattern item, always the
> PF was selected.
>
> This commit fixes this issue, if no port_id pattern item is available
> then we use the port that the flow was created on as source port.
>
> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index c2a2fc6..b3f802d 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
> union flow_dv_attr flow_attr = { .attr = 0 };
> struct mlx5_flow_dv_tag_resource tag_resource;
> uint32_t modify_action_position = UINT32_MAX;
> + void *match_mask = matcher.mask.buf;
> + void *match_value = dev_flow->dv.value.buf;
>
> flow->group = attr->group;
> if (attr->transfer)
> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
> }
> dev_flow->dv.actions_n = actions_n;
> flow->actions = action_flags;
> - if (attr->ingress && !attr->transfer &&
> - (priv->representor || priv->master)) {
> - /* It was validated - we support unidirection flows only. */
> - assert(!attr->egress);
> - /*
> - * Add matching on source vport index only
> - * for ingress rules in E-Switch configurations.
> - */
> - flow_dv_translate_item_source_vport(matcher.mask.buf,
> - dev_flow->dv.value.buf,
> - priv->vport_id,
> - 0xffff);
> - }
> for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
> - void *match_mask = matcher.mask.buf;
> - void *match_value = dev_flow->dv.value.buf;
>
> switch (items->type) {
> case RTE_FLOW_ITEM_TYPE_PORT_ID:
> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
> }
> item_flags |= last_item;
> }
> + /*
> + * In case of ingress traffic when E-Switch mode is enabled,
> + * we have two cases where we need to set the source port manually.
> + * The first one, is in case of Nic steering rule, and the second is
> + * E-Switch rule where no port_id item was found. In both cases
> + * the source port is set according the current port in use.
> + */
> + if ((attr->ingress && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)) &&
> + (priv->representor || priv->master)) {
> + if (flow_dv_translate_item_port_id(dev, match_mask,
> + match_value, NULL))
> + return -rte_errno;
> + }
> assert(!flow_dv_check_valid_spec(matcher.mask.buf,
> dev_flow->dv.value.buf));
> dev_flow->layers = item_flags;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix E-Switch flow without port item
2019-04-25 17:54 ` Yongseok Koh
@ 2019-04-25 17:54 ` Yongseok Koh
2019-05-01 6:09 ` Shahaf Shuler
1 sibling, 0 replies; 14+ messages in thread
From: Yongseok Koh @ 2019-04-25 17:54 UTC (permalink / raw)
To: Ori Kam; +Cc: Shahaf Shuler, dev
> On Apr 25, 2019, at 5:20 AM, Ori Kam <orika@mellanox.com> wrote:
>
> When creating a flow rule without the port_id pattern item, always the
> PF was selected.
>
> This commit fixes this issue, if no port_id pattern item is available
> then we use the port that the flow was created on as source port.
>
> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index c2a2fc6..b3f802d 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] = {
> union flow_dv_attr flow_attr = { .attr = 0 };
> struct mlx5_flow_dv_tag_resource tag_resource;
> uint32_t modify_action_position = UINT32_MAX;
> + void *match_mask = matcher.mask.buf;
> + void *match_value = dev_flow->dv.value.buf;
>
> flow->group = attr->group;
> if (attr->transfer)
> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] = {
> }
> dev_flow->dv.actions_n = actions_n;
> flow->actions = action_flags;
> - if (attr->ingress && !attr->transfer &&
> - (priv->representor || priv->master)) {
> - /* It was validated - we support unidirection flows only. */
> - assert(!attr->egress);
> - /*
> - * Add matching on source vport index only
> - * for ingress rules in E-Switch configurations.
> - */
> - flow_dv_translate_item_source_vport(matcher.mask.buf,
> - dev_flow->dv.value.buf,
> - priv->vport_id,
> - 0xffff);
> - }
> for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
> - void *match_mask = matcher.mask.buf;
> - void *match_value = dev_flow->dv.value.buf;
>
> switch (items->type) {
> case RTE_FLOW_ITEM_TYPE_PORT_ID:
> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] = {
> }
> item_flags |= last_item;
> }
> + /*
> + * In case of ingress traffic when E-Switch mode is enabled,
> + * we have two cases where we need to set the source port manually.
> + * The first one, is in case of Nic steering rule, and the second is
> + * E-Switch rule where no port_id item was found. In both cases
> + * the source port is set according the current port in use.
> + */
> + if ((attr->ingress && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)) &&
> + (priv->representor || priv->master)) {
> + if (flow_dv_translate_item_port_id(dev, match_mask,
> + match_value, NULL))
> + return -rte_errno;
> + }
> assert(!flow_dv_check_valid_spec(matcher.mask.buf,
> dev_flow->dv.value.buf));
> dev_flow->layers = item_flags;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix E-Switch flow without port item
2019-04-25 17:54 ` Yongseok Koh
2019-04-25 17:54 ` Yongseok Koh
@ 2019-05-01 6:09 ` Shahaf Shuler
2019-05-01 6:09 ` Shahaf Shuler
1 sibling, 1 reply; 14+ messages in thread
From: Shahaf Shuler @ 2019-05-01 6:09 UTC (permalink / raw)
To: Yongseok Koh, Ori Kam; +Cc: dev
Thursday, April 25, 2019 8:54 PM, Yongseok Koh:
> Subject: Re: [PATCH v2] net/mlx5: fix E-Switch flow without port item
>
>
>
> > On Apr 25, 2019, at 5:20 AM, Ori Kam <orika@mellanox.com> wrote:
> >
> > When creating a flow rule without the port_id pattern item, always the
> > PF was selected.
> >
> > This commit fixes this issue, if no port_id pattern item is available
> > then we use the port that the flow was created on as source port.
> >
> > Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
> >
> > Signed-off-by: Ori Kam <orika@mellanox.com>
> > ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix E-Switch flow without port item
2019-05-01 6:09 ` Shahaf Shuler
@ 2019-05-01 6:09 ` Shahaf Shuler
0 siblings, 0 replies; 14+ messages in thread
From: Shahaf Shuler @ 2019-05-01 6:09 UTC (permalink / raw)
To: Yongseok Koh, Ori Kam; +Cc: dev
Thursday, April 25, 2019 8:54 PM, Yongseok Koh:
> Subject: Re: [PATCH v2] net/mlx5: fix E-Switch flow without port item
>
>
>
> > On Apr 25, 2019, at 5:20 AM, Ori Kam <orika@mellanox.com> wrote:
> >
> > When creating a flow rule without the port_id pattern item, always the
> > PF was selected.
> >
> > This commit fixes this issue, if no port_id pattern item is available
> > then we use the port that the flow was created on as source port.
> >
> > Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs")
> >
> > Signed-off-by: Ori Kam <orika@mellanox.com>
> > ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-05-01 6:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 11:19 [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item Ori Kam
2019-04-23 11:19 ` Ori Kam
2019-04-23 21:03 ` Yongseok Koh
2019-04-23 21:03 ` Yongseok Koh
2019-04-25 7:02 ` Ori Kam
2019-04-25 7:02 ` Ori Kam
2019-04-25 17:53 ` Yongseok Koh
2019-04-25 17:53 ` Yongseok Koh
2019-04-25 12:20 ` [dpdk-dev] [PATCH v2] " Ori Kam
2019-04-25 12:20 ` Ori Kam
2019-04-25 17:54 ` Yongseok Koh
2019-04-25 17:54 ` Yongseok Koh
2019-05-01 6:09 ` Shahaf Shuler
2019-05-01 6:09 ` Shahaf Shuler
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).