mlx5: LACP handling for bonded devices
Subsystems (2)
cover mlx5: LACP handling for bonded devices
When the driver has a bond configured LACP traffic should be steered to kernel to manage the bond using a new rdma-core API.
This is done by creating a new internal action and adding a new devarg that will allow the user to manage the bond and get lacp traffic if they wish.
Shiri Kuzin (3):
common/mlx5: add default miss action net/mlx5: add default miss action to flow engine net/mlx5: add new devarg dv_lacp_by_user
drivers/common/mlx5/Makefile | 5 +++ drivers/common/mlx5/meson.build | 2 + drivers/common/mlx5/mlx5_glue.c | 13 ++++++ drivers/common/mlx5/mlx5_glue.h | 1 + drivers/net/mlx5/mlx5.c | 6 +++ drivers/net/mlx5/mlx5.h | 7 ++++ drivers/net/mlx5/mlx5_flow.c | 72 ++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 10 ++++- drivers/net/mlx5/mlx5_flow_dv.c | 91 ++++++++++++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_trigger.c | 9 ++++ 10 files changed, 213 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
RFC 1/3 common/mlx5: add default miss action
Add dv_create_action_default_miss wrapper function for the action added to the rdma-core MLX5DV_FLOW_ACTION_DEFAULT_MISS.
When a packet matches MLX5DV_FLOW_ACTION_DEFAULT_MISS action it is steered to the default miss of the verbs steering domain.
--- drivers/common/mlx5/Makefile | 5 +++++ drivers/common/mlx5/meson.build | 2 ++ drivers/common/mlx5/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/mlx5_glue.h | 1 + 4 files changed, 21 insertions(+)
drivers/common/mlx5/Makefile +5 -0
@@ -153,6 +153,11 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh enum MLX5DV_FLOW_ACTION_COUNTERS_DEVX \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ + HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS \ + infiniband/mlx5dv.h \ + enum MLX5DV_FLOW_ACTION_DEFAULT_MISS \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_IBV_DEVX_ASYNC \ infiniband/mlx5dv.h \ func mlx5dv_devx_obj_query_async \
drivers/common/mlx5/meson.build +2 -0
@@ -120,6 +120,8 @@ has_sym_args = [ 'mlx5dv_devx_obj_create' ], [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], + [ 'HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS', 'infiniband/mlx5dv.h', + 'MLX5DV_FLOW_ACTION_DEFAULT_MISS' ], [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', 'mlx5dv_devx_obj_query_async' ], [ 'HAVE_IBV_DEVX_QP', 'infiniband/mlx5dv.h',
drivers/common/mlx5/mlx5_glue.c +13 -0
@@ -795,6 +795,17 @@#endif } +static void * +mlx5_glue_dr_create_flow_action_default_miss (void ) +{ +#if defined(HAVE_MLXDV_DR ) && defined(HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS ) +return mlx5dv_dr_action_create_default_miss (); +#else + errno =ENOTSUP ; +return NULL ; +#endif +} +static int mlx5_glue_dv_destroy_flow (void *flow_id) {
@@ -1264,6 +1275,8 @@ .dv_create_flow_action_tag = mlx5_glue_dv_create_flow_action_tag, .dv_create_flow_action_meter = mlx5_glue_dv_create_flow_action_meter, .dv_modify_flow_action_meter = mlx5_glue_dv_modify_flow_action_meter, + .dr_create_flow_action_default_miss = + mlx5_glue_dr_create_flow_action_default_miss, .dv_destroy_flow = mlx5_glue_dv_destroy_flow, .dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher, .dv_open_device = mlx5_glue_dv_open_device,
drivers/common/mlx5/mlx5_glue.h +1 -0
@@ -237,6 +237,7 @@ struct mlx5_glue { (struct mlx5dv_dr_flow_meter_attr *attr);int (*dv_modify_flow_action_meter)(void *action,struct mlx5dv_dr_flow_meter_attr *attr,uint64_t modify_bits); +void *(*dr_create_flow_action_default_miss)();int (*dv_destroy_flow)(void *flow);int (*dv_destroy_flow_matcher)(void *matcher);struct ibv_context *(*dv_open_device)(struct ibv_device *device);
Signature · 1 line
1.8.3.1
RFC 2/3 net/mlx5: add default miss action to flow engine
In reply to Shiri KuzinThe new action is an internal mlx5 action that will call the rdma-core function MLX5DV_FLOW_ACTION_DEFAULT_MISS.
The default miss action will be used when a bond is configured to allow traffic realted to the bond to be managed in the kernel.
--- drivers/net/mlx5/mlx5.h | 5 +++ drivers/net/mlx5/mlx5_flow.c | 72 ++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 10 ++++- drivers/net/mlx5/mlx5_flow_dv.c | 91 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 175 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5.h +5 -0
@@ -509,6 +509,9 @@ struct mlx5_ibv_shared {uint32_t port_id_action_list;/* List of port ID actions. */ uint32_t push_vlan_action_list;/* List of push VLAN actions. */ struct mlx5_flow_counter_mng cmng;/* Counters management structure. */ +void *default_miss_action;/* Pointer to the rdma-core action. */ +rte_atomic32_t default_miss_refcnt; +/* Default miss action reference counter. */ struct mlx5_indexed_pool *ipool[MLX5_IPOOL_MAX ];/* Memory Pool for mlx5 flow resources. */ /* Shared interrupt handler section. */
@@ -801,6 +804,8 @@ int mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,int mlx5_ctrl_flow (struct rte_eth_dev *dev,struct rte_flow_item_eth *eth_spec,struct rte_flow_item_eth *eth_mask); +int mlx5_flow_default_miss (struct rte_eth_dev *dev, +struct rte_flow_item_eth *eth_spec);struct rte_flow *mlx5_flow_create_esw_table_zero_flow (struct rte_eth_dev *dev);int mlx5_flow_create_drop_queue (struct rte_eth_dev *dev);void mlx5_flow_delete_drop_queue (struct rte_eth_dev *dev);
drivers/net/mlx5/mlx5_flow.c +72 -0
84 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +8 -2
@@ -43,6 +43,7 @@ enum mlx5_rte_flow_action_type {MLX5_RTE_FLOW_ACTION_TYPE_TAG ,MLX5_RTE_FLOW_ACTION_TYPE_MARK ,MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG , + MLX5_RTE_FLOW_ACTION_TYPE_DEFAULT_MISS, };/* Matches on selected register. */
@@ -200,10 +201,12 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_SET_IPV4_DSCP (1ull << 32)#define MLX5_FLOW_ACTION_SET_IPV6_DSCP (1ull << 33)#define MLX5_FLOW_ACTION_AGE (1ull << 34) +#define MLX5_FLOW_ACTION_DEFAULT_MISS (1ull << 35)#define MLX5_FLOW_FATE_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \ - MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP) + MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP | \ + MLX5_FLOW_ACTION_DEFAULT_MISS)#define MLX5_FLOW_FATE_ESWITCH_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \
@@ -365,6 +368,7 @@ enum mlx5_flow_fate_type {MLX5_FLOW_FATE_PORT_ID ,MLX5_FLOW_FATE_DROP ,MLX5_FLOW_FATE_MAX , + MLX5_FLOW_FATE_DEFAULT_MISS };/* Matcher PRM representation */
@@ -537,7 +541,7 @@ struct mlx5_flow_handle {void *ib_flow;/**< Verbs flow pointer. */ uint32_t split_flow_id:28; /**< Sub flow unique match flow id. */ uint32_t mark:1; /**< Metadate rxq mark flag. */ - uint32_t fate_action:3; /**< Fate action type. */ + uint32_t fate_action:4; /**< Fate action type. */union {uint32_t rix_hrxq;/**< Hash Rx queue object index. */ uint32_t rix_jump;/**< Index to the jump action resource. */
@@ -946,6 +950,8 @@ int mlx5_flow_validate_action_rss(const struct rte_flow_action *action,const struct rte_flow_attr *attr, uint64_t item_flags, struct rte_flow_error *error); +int mlx5_flow_validate_action_default_miss (uint64_t action_flags, +struct rte_flow_error *error);int mlx5_flow_validate_attributes (struct rte_eth_dev *dev,const struct rte_flow_attr *attributes,struct rte_flow_error *error);
drivers/net/mlx5/mlx5_flow_dv.c +90 -1
127 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RFC 3/3 net/mlx5: add new devarg dv_lacp_by_user
In reply to Shiri KuzinThe new devarg will control the steering of the lacp traffic. when setting dv_lacp_by_user = 0 the lacp traffic will be steered to kernel and managed there.
When setting dv_lacp_by_user = 1 the lacp traffic will not be steered and the user will need to manage it.
--- drivers/net/mlx5/mlx5.c | 6 ++++++ drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_trigger.c | 9 +++++++++ 3 files changed, 17 insertions(+)
drivers/net/mlx5/mlx5.c +6 -0
@@ -140,6 +140,9 @@/* Enable extensive flow metadata support. */ #define MLX5_DV_XMETA_EN "dv_xmeta_en" +/* Device parameter to let the user manage the lacp traffic of bonded device */ +#define MLX5_DV_LACP_BY_USER "dv_lacp_by_user" +/* Activate Netlink support in VF mode. */ #define MLX5_VF_NL_EN "vf_nl_en"
@@ -1852,6 +1855,8 @@ struct mlx5_flow_id_pool *return -rte_errno; } config->dv_xmeta_en = tmp; + }else if (strcmp (MLX5_DV_LACP_BY_USER , key) ==0 ) { + config->dv_lacp_by_user = !!tmp; }else if (strcmp (MLX5_MR_EXT_MEMSEG_EN , key) ==0 ) { config->mr_ext_memseg_en = !!tmp; }else if (strcmp (MLX5_MAX_DUMP_FILES_NUM , key) ==0 ) {
@@ -1910,6 +1915,7 @@ struct mlx5_flow_id_pool *MLX5_DV_ESW_EN ,MLX5_DV_FLOW_EN ,MLX5_DV_XMETA_EN , +MLX5_DV_LACP_BY_USER ,MLX5_MR_EXT_MEMSEG_EN ,MLX5_REPRESENTOR , MLX5_MAX_DUMP_FILES_NUM,
drivers/net/mlx5/mlx5.h +2 -0
@@ -157,6 +157,8 @@ struct mlx5_dev_config { unsigned int dv_esw_en:1; /* Enable E-Switch DV flow. */ unsigned int dv_flow_en:1; /* Enable DV flow. */ unsigned int dv_xmeta_en:2; /* Enable extensive flow metadata. */ + unsigned int dv_lacp_by_user:1; +/* Enable user to manage LACP traffic. */ unsigned int swp:1; /* Tx generic tunnel checksum and TSO offload. */ unsigned int devx:1; /* Whether devx interface is available or not. */ unsigned int dest_tir:1; /* Whether advanced DR API is available. */
drivers/net/mlx5/mlx5_trigger.c +9 -0
@@ -434,6 +434,10 @@const struct rte_ether_addr cmp = { .addr_bytes ="\x00\x00\x00\x00\x00\x00" , }; +struct rte_flow_item_eth lacp_spec = { + .type =0x8809 , + .dst.addr_bytes ="\x01\x80\xc2\x00\x00\x02" , + };unsigned int i;unsigned int j;int ret;
@@ -464,6 +468,11 @@" configured - only Eswitch group 0 flows are" " supported.", dev->data->port_id); } +if (!priv->config.dv_lacp_by_user && priv->pf_bond) { + ret =mlx5_flow_default_miss (dev,&lacp_spec); +if (ret) + goto error; + }if (priv->isolated)return 0 ;if (dev->data->promiscuous) {
Signature · 1 line
1.8.3.1