[v2,0/6] net/mlx5: add support for switch flow rules

Message ID 20180713092910.26276-1-adrien.mazarguil@6wind.com (mailing list archive)
Headers
Series net/mlx5: add support for switch flow rules |

Message

Adrien Mazarguil July 13, 2018, 9:40 a.m. UTC
  This series adds support for switch flow rules, that is, rte_flow rules
applied to mlx5 devices at the switch level.

It allows applications to offload traffic redirection between DPDK ports in
hardware, while optionally modifying it (e.g. performing encap/decap).

For this to work, involved DPDK ports must be part of the same switch
domain, as is the case with port representors, and the transfer attribute
must be requested on flow rules.

Also since the mlx5 switch is controlled through Netlink instead of Verbs,
and given how tedious formatting Netlink messages is, a new dependency is
added to mlx5: libmnl. See relevant patch.

v2 changes:

- Mostly compilation fixes for missing Netlink definitions on older systems.
- Reduced stack consumption.
- Adapted series to rely on mlx5_dev_to_port_id() instead of
  mlx5_dev_to_domain_id().
- See relevant patches for more information.

Adrien Mazarguil (6):
  net/mlx5: lay groundwork for switch offloads
  net/mlx5: add framework for switch flow rules
  net/mlx5: add fate actions to switch flow rules
  net/mlx5: add L2-L4 pattern items to switch flow rules
  net/mlx5: add VLAN item and actions to switch flow rules
  net/mlx5: add port ID pattern item to switch flow rules

 drivers/net/mlx5/Makefile       |  142 ++++
 drivers/net/mlx5/mlx5.c         |   32 +
 drivers/net/mlx5/mlx5.h         |   28 +
 drivers/net/mlx5/mlx5_flow.c    |  111 +++
 drivers/net/mlx5/mlx5_nl_flow.c | 1247 ++++++++++++++++++++++++++++++++++
 mk/rte.app.mk                   |    2 +-
 6 files changed, 1561 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/mlx5/mlx5_nl_flow.c
  

Comments

Shahaf Shuler July 22, 2018, 11:21 a.m. UTC | #1
Hi Adrien,

Friday, July 13, 2018 12:41 PM, Adrien Mazarguil:
> Subject: [PATCH v2 0/6] net/mlx5: add support for switch flow rules
> 
> This series adds support for switch flow rules, that is, rte_flow rules applied
> to mlx5 devices at the switch level.
> 
> It allows applications to offload traffic redirection between DPDK ports in
> hardware, while optionally modifying it (e.g. performing encap/decap).
> 
> For this to work, involved DPDK ports must be part of the same switch
> domain, as is the case with port representors, and the transfer attribute
> must be requested on flow rules.
> 
> Also since the mlx5 switch is controlled through Netlink instead of Verbs, and
> given how tedious formatting Netlink messages is, a new dependency is
> added to mlx5: libmnl. See relevant patch.

There are some checkpatch[1] warning, but those are safe to ignore. 

Adrien, one thing which is missing is a documentation update for mlx5 doc on the new dependency of libmnl. 
Just like rdma-core: how to get it, how to install it, version required..

I won't postpone the series acceptance due to this (since I want to avoid big changes after the rc2), but we must have such doc before 18.08 release. 

Series applied to next-net-mlx, thanks!

[1]

### net/mlx5: add framework for switch flow rules

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#307: FILE: drivers/net/mlx5/mlx5_nl_flow.c:60:
+#define PATTERN_COMMON \
+       ITEM_VOID, ACTIONS

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#309: FILE: drivers/net/mlx5/mlx5_nl_flow.c:62:
+#define ACTIONS_COMMON \
+       ACTION_VOID, END

total: 2 errors, 0 warnings, 0 checks, 537 lines checked

### net/mlx5: add fate actions to switch flow rules

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#55: FILE: drivers/net/mlx5/mlx5_nl_flow.c:68:
+#define ACTIONS_FATE \
+       ACTION_PORT_ID, ACTION_DROP

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
#136: FILE: drivers/net/mlx5/mlx5_nl_flow.c:277:
+               if (!mnl_attr_put_check(buf, size, TCA_MIRRED_PARMS,

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
#159: FILE: drivers/net/mlx5/mlx5_nl_flow.c:300:
+               if (!mnl_attr_put_check(buf, size, TCA_GACT_PARMS,

total: 3 errors, 0 warnings, 0 checks, 134 lines checked

### net/mlx5: add VLAN item and actions to switch flow rules

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
#367: FILE: drivers/net/mlx5/mlx5_nl_flow.c:930:
+               if (!mnl_attr_put_check(buf, size, TCA_VLAN_PARMS,

total: 1 errors, 0 warnings, 0 checks, 358 lines checked


> 
> v2 changes:
> 
> - Mostly compilation fixes for missing Netlink definitions on older systems.
> - Reduced stack consumption.
> - Adapted series to rely on mlx5_dev_to_port_id() instead of
>   mlx5_dev_to_domain_id().
> - See relevant patches for more information.
> 
> Adrien Mazarguil (6):
>   net/mlx5: lay groundwork for switch offloads
>   net/mlx5: add framework for switch flow rules
>   net/mlx5: add fate actions to switch flow rules
>   net/mlx5: add L2-L4 pattern items to switch flow rules
>   net/mlx5: add VLAN item and actions to switch flow rules
>   net/mlx5: add port ID pattern item to switch flow rules
> 
>  drivers/net/mlx5/Makefile       |  142 ++++
>  drivers/net/mlx5/mlx5.c         |   32 +
>  drivers/net/mlx5/mlx5.h         |   28 +
>  drivers/net/mlx5/mlx5_flow.c    |  111 +++
>  drivers/net/mlx5/mlx5_nl_flow.c | 1247
> ++++++++++++++++++++++++++++++++++
>  mk/rte.app.mk                   |    2 +-
>  6 files changed, 1561 insertions(+), 1 deletion(-)  create mode 100644
> drivers/net/mlx5/mlx5_nl_flow.c
> 
> --
> 2.11.0