support single flow dump on MLX5 PMD
Subsystems (2)
cover support single flow dump on MLX5 PMD
Dump information for all flows are supported and it is useful to dump one flow.
Add single flow dump support on MLX5 PMD.
Modify API mlx5_flow_dev_dump to support.
Modify mlx5_socket since one extra arg flow_ptr is added.
Depends-on: series=16355 ("support single flow dump")
http://patchwork.dpdk.org/project/dpdk/list/?series=16355
Haifei Luo (2):
common/mlx5: add mlx5 APIs for single flow dump feature net/mlx5: add mlx5 APIs for single flow dump feature
drivers/common/mlx5/linux/meson.build | 6 ++++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + drivers/net/mlx5/linux/mlx5_socket.c | 30 ++++++++++++++++++++++++------ drivers/net/mlx5/mlx5_flow.c | 30 ++++++++++++++++++++++++++++-- 8 files changed, 87 insertions(+), 10 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 common/mlx5: add mlx5 APIs for single flow dump feature
add mlx5 APIs for single flow dump feature
--- drivers/common/mlx5/linux/meson.build | 6 ++++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + 6 files changed, 35 insertions(+), 2 deletions(-)
drivers/common/mlx5/linux/meson.build +4 -2
@@ -186,8 +186,10 @@ has_sym_args = [ 'mlx5dv_dr_action_create_aso' ], [ 'HAVE_INFINIBAND_VERBS_H', 'infiniband/verbs.h', 'INFINIBAND_VERBS_H' ], - [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h', - 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], + [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h', + 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_rule' ], ] config = configuration_data() foreach arg:has_sym_args
drivers/common/mlx5/linux/mlx5_glue.c +13 -0
@@ -1101,6 +1101,18 @@ }static int +mlx5_glue_dr_dump_single_rule (FILE *file,void *rule) +{ +#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE +return mlx5dv_dump_dr_rule (file, rule); +#else +RTE_SET_USED (file); +RTE_SET_USED (rule); +return -ENOTSUP ; +#endif +} + +static int mlx5_glue_dr_dump_domain (FILE *file,void *domain) {#ifdef HAVE_MLX5_DR_FLOW_DUMP
@@ -1423,6 +1435,7 @@ .devx_wq_query = mlx5_glue_devx_wq_query, .devx_port_query = mlx5_glue_devx_port_query, .dr_dump_domain = mlx5_glue_dr_dump_domain, + .dr_dump_rule = mlx5_glue_dr_dump_single_rule, .dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory, .dr_create_flow_action_sampler = mlx5_glue_dr_create_flow_action_sampler,
drivers/common/mlx5/linux/mlx5_glue.h +1 -0
@@ -313,6 +313,7 @@ struct mlx5_glue {uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port);int (*dr_dump_domain)(FILE *file,void *domain); +int (*dr_dump_rule)(FILE *file,void *rule);int (*devx_query_eqn)(struct ibv_context *context,uint32_t cpus,uint32_t *eqn);struct mlx5dv_devx_event_channel *(*devx_create_event_channel)
drivers/common/mlx5/mlx5_devx_cmds.c +14 -0
@@ -1584,6 +1584,20 @@ struct mlx5_devx_obj *return -ret; } +int +mlx5_devx_cmd_flow_single_dump(void *rule_info __rte_unused, + FILE *file __rte_unused) +{ +int ret =0 ; +#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE +if (rule_info) + ret = mlx5_glue->dr_dump_rule (file, rule_info); +#else + ret =ENOTSUP ; +#endif +return -ret; +} +/* * Create CQ using DevX API. *
drivers/common/mlx5/mlx5_devx_cmds.h +2 -0
@@ -477,6 +477,8 @@ struct mlx5_devx_obj *mlx5_devx_cmd_create_tis(void *ctx,int mlx5_devx_cmd_flow_dump (void *fdb_domain,void *rx_domain,void *tx_domain,FILE *file);__rte_internal +int mlx5_devx_cmd_flow_single_dump(void *rule, FILE *file); +__rte_internal struct mlx5_devx_obj *mlx5_devx_cmd_create_cq(void *ctx,struct mlx5_devx_cq_attr *attr); __rte_internal
drivers/common/mlx5/version.map +1 -0
@@ -30,6 +30,7 @@ INTERNAL { mlx5_devx_cmd_flow_counter_alloc; mlx5_devx_cmd_flow_counter_query; mlx5_devx_cmd_flow_dump; + mlx5_devx_cmd_flow_single_dump; mlx5_devx_cmd_mkey_create; mlx5_devx_cmd_modify_qp_state; mlx5_devx_cmd_modify_rq;
Signature · 1 line
1.8.3.1
PATCH 2/2 net/mlx5: add mlx5 APIs for single flow dump feature
In reply to Haifei LuoModify API mlx5_flow_dev_dump to support the feature. Modify mlx5_socket since one extra arg flow_ptr is added.
--- drivers/net/mlx5/linux/mlx5_socket.c | 30 ++++++++++++++++++++++++------ drivers/net/mlx5/mlx5_flow.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 8 deletions(-)
drivers/net/mlx5/linux/mlx5_socket.c +24 -6
@@ -2,6 +2,10 @@* Copyright 2019 Mellanox Technologies, Ltd */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <sys/types.h> #include <sys/socket.h> #include <sys/un.h>
@@ -29,11 +33,15 @@ {int conn_sock;int ret; +int j;struct cmsghdr *cmsg =NULL ; -int data; +#define LENGTH 9 +/* The first int for port_id and the rest for flowptr. */ +int data[LENGTH ]; +uint64_t flow_ptr =0 ;char buf[CMSG_SPACE (sizeof (int ))] = {0 };struct iovec io = { - .iov_base = &data, + .iov_base = &data[0 ], .iov_len =sizeof (data), };struct msghdr msg = {
@@ -46,7 +54,9 @@int fd;FILE *file =NULL ;struct rte_eth_dev *dev; +struct rte_flow_error err; +memset (data,0 ,sizeof (data));/* Accept the connection from the client. */ conn_sock =accept (server_socket,NULL ,NULL );if (conn_sock <0 ) {
@@ -84,15 +94,23 @@ }/* Dump flow. */ dev = &rte_eth_devices[port_id]; - ret =mlx5_flow_dev_dump (dev,NULL , file,NULL ); +/* The first in data for port_id and the following 8 for flowptr */ +for (j =1 ; j <LENGTH ; j++) + flow_ptr = (flow_ptr <<8 ) + data[j]; +if (flow_ptr ==0 ) + ret =mlx5_flow_dev_dump (dev,NULL , file,NULL ); +else + ret =mlx5_flow_dev_dump (dev, + (struct rte_flow *)((uintptr_t )flow_ptr), file, &err); +/* Set-up the ancillary data and reply. */ msg.msg_controllen =0 ; msg.msg_control =NULL ; msg.msg_iovlen =1 ; msg.msg_iov = &io; - data = -ret; - io.iov_len =sizeof (data); - io.iov_base = &data; + data[0 ] = -ret; + io.iov_len =sizeof (data[0 ]); + io.iov_base = &data[0 ];do { ret =sendmsg (conn_sock, &msg,0 ); }while (ret <0 && errno ==EINTR );
drivers/net/mlx5/mlx5_flow.c +28 -2
@@ -7160,6 +7160,10 @@ struct mlx5_meter_domains_infos * {struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_dev_ctx_shared *sh = priv->sh; +uint32_t handle_idx; +int ret; +struct mlx5_flow_handle *dh; +struct rte_flow *flow;if (!priv->config.dv_flow_en) {if (fputs ("device dv flow disabled\n" , file) <=0 )
@@ -7167,10 +7171,32 @@ struct mlx5_meter_domains_infos *return -ENOTSUP ; } +/* dump all */ if (!flow_idx)return mlx5_devx_cmd_flow_dump (sh->fdb_domain, - sh->rx_domain, sh->tx_domain, file); -return -ENOTSUP ; + sh->rx_domain, + sh->tx_domain, file); +/* dump one */ + flow =mlx5_ipool_get (priv->sh->ipool + [MLX5_IPOOL_RTE_FLOW ], (uintptr_t )(void *)flow_idx); +if (!flow) +return -ENOENT ; + + handle_idx = flow->dev_handles; +while (handle_idx) { + dh =mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW ], + handle_idx); +if (!dh) +return -ENOENT ; +if (dh->drv_flow) { + ret =mlx5_devx_cmd_flow_single_dump (dh->drv_flow, + file); +if (ret) +return -ENOENT ; + } + handle_idx = dh->next.next; + } +return 0 ; }/**
Signature · 1 line
1.8.3.1
v2 cover support single flow dump on MLX5 PMD
In reply to Haifei LuoDump information for all flows are supported and it is useful to dump one flow.
Add single flow dump support on MLX5 PMD.
Modify API mlx5_flow_dev_dump to support.
Modify mlx5_socket since one extra arg flow_ptr is added.
Depends-on: series=16362 ("support single flow dump")
http://patchwork.dpdk.org/project/dpdk/list/?series=16362
V2: rebase to fix apply patch failure.
Haifei Luo (2):
common/mlx5: add mlx5 APIs for single flow dump feature net/mlx5: add mlx5 APIs for single flow dump feature
drivers/common/mlx5/linux/meson.build | 6 ++++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + drivers/net/mlx5/linux/mlx5_socket.c | 30 ++++++++++++++++++++++++------ drivers/net/mlx5/mlx5_flow.c | 30 ++++++++++++++++++++++++++++-- 8 files changed, 87 insertions(+), 10 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/2 common/mlx5: add mlx5 APIs for single flow dump feature
add mlx5 APIs for single flow dump feature
--- drivers/common/mlx5/linux/meson.build | 6 ++++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + 6 files changed, 35 insertions(+), 2 deletions(-)
drivers/common/mlx5/linux/meson.build +4 -2
@@ -186,8 +186,10 @@ has_sym_args = [ 'mlx5dv_dr_action_create_aso' ], [ 'HAVE_INFINIBAND_VERBS_H', 'infiniband/verbs.h', 'INFINIBAND_VERBS_H' ], - [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h', - 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], + [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h', + 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_rule' ], ] config = configuration_data() foreach arg:has_sym_args
drivers/common/mlx5/linux/mlx5_glue.c +13 -0
@@ -1101,6 +1101,18 @@ }static int +mlx5_glue_dr_dump_single_rule (FILE *file,void *rule) +{ +#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE +return mlx5dv_dump_dr_rule (file, rule); +#else +RTE_SET_USED (file); +RTE_SET_USED (rule); +return -ENOTSUP ; +#endif +} + +static int mlx5_glue_dr_dump_domain (FILE *file,void *domain) {#ifdef HAVE_MLX5_DR_FLOW_DUMP
@@ -1423,6 +1435,7 @@ .devx_wq_query = mlx5_glue_devx_wq_query, .devx_port_query = mlx5_glue_devx_port_query, .dr_dump_domain = mlx5_glue_dr_dump_domain, + .dr_dump_rule = mlx5_glue_dr_dump_single_rule, .dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory, .dr_create_flow_action_sampler = mlx5_glue_dr_create_flow_action_sampler,
drivers/common/mlx5/linux/mlx5_glue.h +1 -0
@@ -313,6 +313,7 @@ struct mlx5_glue {uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port);int (*dr_dump_domain)(FILE *file,void *domain); +int (*dr_dump_rule)(FILE *file,void *rule);int (*devx_query_eqn)(struct ibv_context *context,uint32_t cpus,uint32_t *eqn);struct mlx5dv_devx_event_channel *(*devx_create_event_channel)
drivers/common/mlx5/mlx5_devx_cmds.c +14 -0
@@ -1584,6 +1584,20 @@ struct mlx5_devx_obj *return -ret; } +int +mlx5_devx_cmd_flow_single_dump(void *rule_info __rte_unused, + FILE *file __rte_unused) +{ +int ret =0 ; +#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE +if (rule_info) + ret = mlx5_glue->dr_dump_rule (file, rule_info); +#else + ret =ENOTSUP ; +#endif +return -ret; +} +/* * Create CQ using DevX API. *
drivers/common/mlx5/mlx5_devx_cmds.h +2 -0
@@ -477,6 +477,8 @@ struct mlx5_devx_obj *mlx5_devx_cmd_create_tis(void *ctx,int mlx5_devx_cmd_flow_dump (void *fdb_domain,void *rx_domain,void *tx_domain,FILE *file);__rte_internal +int mlx5_devx_cmd_flow_single_dump(void *rule, FILE *file); +__rte_internal struct mlx5_devx_obj *mlx5_devx_cmd_create_cq(void *ctx,struct mlx5_devx_cq_attr *attr); __rte_internal
drivers/common/mlx5/version.map +1 -0
@@ -30,6 +30,7 @@ INTERNAL { mlx5_devx_cmd_flow_counter_alloc; mlx5_devx_cmd_flow_counter_query; mlx5_devx_cmd_flow_dump; + mlx5_devx_cmd_flow_single_dump; mlx5_devx_cmd_mkey_create; mlx5_devx_cmd_modify_qp_state; mlx5_devx_cmd_modify_rq;
Signature · 1 line
1.8.3.1
PATCH v2 2/2 net/mlx5: add mlx5 APIs for single flow dump feature
In reply to Haifei LuoModify API mlx5_flow_dev_dump to support the feature. Modify mlx5_socket since one extra arg flow_ptr is added.
--- drivers/net/mlx5/linux/mlx5_socket.c | 30 ++++++++++++++++++++++++------ drivers/net/mlx5/mlx5_flow.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 8 deletions(-)
drivers/net/mlx5/linux/mlx5_socket.c +24 -6
@@ -2,6 +2,10 @@* Copyright 2019 Mellanox Technologies, Ltd */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <sys/types.h> #include <sys/socket.h> #include <sys/un.h>
@@ -29,11 +33,15 @@ {int conn_sock;int ret; +int j;struct cmsghdr *cmsg =NULL ; -int data; +#define LENGTH 9 +/* The first int for port_id and the rest for flowptr. */ +int data[LENGTH ]; +uint64_t flow_ptr =0 ;char buf[CMSG_SPACE (sizeof (int ))] = {0 };struct iovec io = { - .iov_base = &data, + .iov_base = &data[0 ], .iov_len =sizeof (data), };struct msghdr msg = {
@@ -46,7 +54,9 @@int fd;FILE *file =NULL ;struct rte_eth_dev *dev; +struct rte_flow_error err; +memset (data,0 ,sizeof (data));/* Accept the connection from the client. */ conn_sock =accept (server_socket,NULL ,NULL );if (conn_sock <0 ) {
@@ -84,15 +94,23 @@ }/* Dump flow. */ dev = &rte_eth_devices[port_id]; - ret =mlx5_flow_dev_dump (dev,NULL , file,NULL ); +/* The first in data for port_id and the following 8 for flowptr */ +for (j =1 ; j <LENGTH ; j++) + flow_ptr = (flow_ptr <<8 ) + data[j]; +if (flow_ptr ==0 ) + ret =mlx5_flow_dev_dump (dev,NULL , file,NULL ); +else + ret =mlx5_flow_dev_dump (dev, + (struct rte_flow *)((uintptr_t )flow_ptr), file, &err); +/* Set-up the ancillary data and reply. */ msg.msg_controllen =0 ; msg.msg_control =NULL ; msg.msg_iovlen =1 ; msg.msg_iov = &io; - data = -ret; - io.iov_len =sizeof (data); - io.iov_base = &data; + data[0 ] = -ret; + io.iov_len =sizeof (data[0 ]); + io.iov_base = &data[0 ];do { ret =sendmsg (conn_sock, &msg,0 ); }while (ret <0 && errno ==EINTR );
drivers/net/mlx5/mlx5_flow.c +28 -2
@@ -7160,6 +7160,10 @@ struct mlx5_meter_domains_infos * {struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_dev_ctx_shared *sh = priv->sh; +uint32_t handle_idx; +int ret; +struct mlx5_flow_handle *dh; +struct rte_flow *flow;if (!priv->config.dv_flow_en) {if (fputs ("device dv flow disabled\n" , file) <=0 )
@@ -7167,10 +7171,32 @@ struct mlx5_meter_domains_infos *return -ENOTSUP ; } +/* dump all */ if (!flow_idx)return mlx5_devx_cmd_flow_dump (sh->fdb_domain, - sh->rx_domain, sh->tx_domain, file); -return -ENOTSUP ; + sh->rx_domain, + sh->tx_domain, file); +/* dump one */ + flow =mlx5_ipool_get (priv->sh->ipool + [MLX5_IPOOL_RTE_FLOW ], (uintptr_t )(void *)flow_idx); +if (!flow) +return -ENOENT ; + + handle_idx = flow->dev_handles; +while (handle_idx) { + dh =mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW ], + handle_idx); +if (!dh) +return -ENOENT ; +if (dh->drv_flow) { + ret =mlx5_devx_cmd_flow_single_dump (dh->drv_flow, + file); +if (ret) +return -ENOENT ; + } + handle_idx = dh->next.next; + } +return 0 ; }/**
Signature · 1 line
1.8.3.1
v3 cover support single flow dump on MLX5 PMD
In reply to Haifei LuoDump information for all flows are supported and it is useful to dump one flow.
Add single flow dump support on MLX5 PMD.
Modify API mlx5_flow_dev_dump to support.Modify mlx5_socket since one extra arg flow_ptr is added.
The data structure sent to DPDK application from the utility triggering the flow dumps should be packed and endianness must be specified.
The native host endianness can be used, all exchange happens within the same host (we use sendmsg aux data and share the file handle, remote approach is not applicable, no inter-host communication happens).
The message structure to dump one/all flow(s):
struct mlx5_flow_dump_req {
uint32_t port_id;
uint64_t flow_ptr;
} __rte_packed;If flow_ptr is 0, all flows for the specified port will be dumped.
Depends-on: series=16367 ("single flow dump")
http://patchwork.dpdk.org/project/dpdk/list/?series=16367
V2: Rebase to fix apply patch failure.
V3: Fix commments. Modify data structures sent to DPDK application.
Haifei Luo (2):
common/mlx5: add mlx5 APIs for single flow dump feature net/mlx5: add mlx5 APIs for single flow dump feature
drivers/common/mlx5/linux/meson.build | 6 +++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 ++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 +++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + drivers/net/mlx5/linux/mlx5_os.h | 3 +++ drivers/net/mlx5/linux/mlx5_socket.c | 47 +++++++++++++++++++++++++++-------- drivers/net/mlx5/mlx5.h | 10 ++++++++ drivers/net/mlx5/mlx5_flow.c | 30 ++++++++++++++++++++-- 10 files changed, 113 insertions(+), 14 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v3 1/2 common/mlx5: add mlx5 APIs for single flow dump feature
add mlx5 APIs for single flow dump feature
--- drivers/common/mlx5/linux/meson.build | 6 ++++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + 6 files changed, 35 insertions(+), 2 deletions(-)
drivers/common/mlx5/linux/meson.build +4 -2
@@ -186,8 +186,10 @@ has_sym_args = [ 'mlx5dv_dr_action_create_aso' ], [ 'HAVE_INFINIBAND_VERBS_H', 'infiniband/verbs.h', 'INFINIBAND_VERBS_H' ], - [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h', - 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], + [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h', + 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_rule' ], ] config = configuration_data() foreach arg:has_sym_args
drivers/common/mlx5/linux/mlx5_glue.c +13 -0
@@ -1101,6 +1101,18 @@ }static int +mlx5_glue_dr_dump_single_rule (FILE *file,void *rule) +{ +#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE +return mlx5dv_dump_dr_rule (file, rule); +#else +RTE_SET_USED (file); +RTE_SET_USED (rule); +return -ENOTSUP ; +#endif +} + +static int mlx5_glue_dr_dump_domain (FILE *file,void *domain) {#ifdef HAVE_MLX5_DR_FLOW_DUMP
@@ -1423,6 +1435,7 @@ .devx_wq_query = mlx5_glue_devx_wq_query, .devx_port_query = mlx5_glue_devx_port_query, .dr_dump_domain = mlx5_glue_dr_dump_domain, + .dr_dump_rule = mlx5_glue_dr_dump_single_rule, .dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory, .dr_create_flow_action_sampler = mlx5_glue_dr_create_flow_action_sampler,
drivers/common/mlx5/linux/mlx5_glue.h +1 -0
@@ -313,6 +313,7 @@ struct mlx5_glue {uint32_t port_num, struct mlx5dv_devx_port *mlx5_devx_port);int (*dr_dump_domain)(FILE *file,void *domain); +int (*dr_dump_rule)(FILE *file,void *rule);int (*devx_query_eqn)(struct ibv_context *context,uint32_t cpus,uint32_t *eqn);struct mlx5dv_devx_event_channel *(*devx_create_event_channel)
drivers/common/mlx5/mlx5_devx_cmds.c +14 -0
@@ -1584,6 +1584,20 @@ struct mlx5_devx_obj *return -ret; } +int +mlx5_devx_cmd_flow_single_dump(void *rule_info __rte_unused, + FILE *file __rte_unused) +{ +int ret =0 ; +#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE +if (rule_info) + ret = mlx5_glue->dr_dump_rule (file, rule_info); +#else + ret =ENOTSUP ; +#endif +return -ret; +} +/* * Create CQ using DevX API. *
drivers/common/mlx5/mlx5_devx_cmds.h +2 -0
@@ -477,6 +477,8 @@ struct mlx5_devx_obj *mlx5_devx_cmd_create_tis(void *ctx,int mlx5_devx_cmd_flow_dump (void *fdb_domain,void *rx_domain,void *tx_domain,FILE *file);__rte_internal +int mlx5_devx_cmd_flow_single_dump(void *rule, FILE *file); +__rte_internal struct mlx5_devx_obj *mlx5_devx_cmd_create_cq(void *ctx,struct mlx5_devx_cq_attr *attr); __rte_internal
drivers/common/mlx5/version.map +1 -0
@@ -30,6 +30,7 @@ INTERNAL { mlx5_devx_cmd_flow_counter_alloc; mlx5_devx_cmd_flow_counter_query; mlx5_devx_cmd_flow_dump; + mlx5_devx_cmd_flow_single_dump; mlx5_devx_cmd_mkey_create; mlx5_devx_cmd_modify_qp_state; mlx5_devx_cmd_modify_rq;
Signature · 1 line
1.8.3.1
PATCH v3 2/2 net/mlx5: add mlx5 APIs for single flow dump feature
In reply to Haifei LuoModify API mlx5_flow_dev_dump to support the feature. Modify mlx5_socket since one extra arg flow_ptr is added.
The data structure sent to DPDK application from the utility triggering the flow dumps should be packed and endianness must be specified. The native host endianness can be used, all exchange happens within the same host (we use sendmsg aux data and share the file handle, remote approach is not applicable, no inter-host communication happens).
The message structure to dump one/all flow(s):
struct mlx5_flow_dump_req {
uint32_t port_id;
uint64_t flow_ptr;
} __rte_packed;If flow_ptr is 0, all flows for the specified port will be dumped.
--- drivers/net/mlx5/linux/mlx5_os.h | 3 +++ drivers/net/mlx5/linux/mlx5_socket.c | 47 ++++++++++++++++++++++++++++-------- drivers/net/mlx5/mlx5.h | 10 ++++++++ drivers/net/mlx5/mlx5_flow.c | 30 +++++++++++++++++++++-- 4 files changed, 78 insertions(+), 12 deletions(-)
drivers/net/mlx5/linux/mlx5_os.h +3 -0
@@ -14,6 +14,9 @@ enum { MLX5_FS_PATH_MAX = IBV_SYSFS_PATH_MAX + 1 }; +/* Maximal data of sendmsg message(in bytes). */ +#define MLX5_SENDMSG_MAX 64 +#define MLX5_NAMESIZE IF_NAMESIZE#define PCI_DRV_FLAGS (RTE_PCI_DRV_INTR_LSC | \
drivers/net/mlx5/linux/mlx5_socket.c +37 -10
97 lines not on this page · raw message
drivers/net/mlx5/mlx5.h +10 -0
@@ -118,6 +118,16 @@ struct mlx5_dev_spawn_data {struct mlx5_bond_info *bond_info; }; +/** Data associated with socket messages. */ +struct mlx5_flow_dump_req { +uint32_t port_id;/**< There are plans in DPDK to extend port_id. */ +uint64_t flow_id; +} __rte_packed; + +struct mlx5_flow_dump_ack { +int rc;/**< Return code. */ +}; +/** Key string for IPC. */ #define MLX5_MP_NAME "net_mlx5_mp"
drivers/net/mlx5/mlx5_flow.c +28 -2
@@ -7161,6 +7161,10 @@ struct mlx5_meter_domains_infos * {struct mlx5_priv *priv = dev->data->dev_private;struct mlx5_dev_ctx_shared *sh = priv->sh; +uint32_t handle_idx; +int ret; +struct mlx5_flow_handle *dh; +struct rte_flow *flow;if (!priv->config.dv_flow_en) {if (fputs ("device dv flow disabled\n" , file) <=0 )
@@ -7168,10 +7172,32 @@ struct mlx5_meter_domains_infos *return -ENOTSUP ; } +/* dump all */ if (!flow_idx)return mlx5_devx_cmd_flow_dump (sh->fdb_domain, - sh->rx_domain, sh->tx_domain, file); -return -ENOTSUP ; + sh->rx_domain, + sh->tx_domain, file); +/* dump one */ + flow =mlx5_ipool_get (priv->sh->ipool + [MLX5_IPOOL_RTE_FLOW ], (uintptr_t )(void *)flow_idx); +if (!flow) +return -ENOENT ; + + handle_idx = flow->dev_handles; +while (handle_idx) { + dh =mlx5_ipool_get (priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW ], + handle_idx); +if (!dh) +return -ENOENT ; +if (dh->drv_flow) { + ret =mlx5_devx_cmd_flow_single_dump (dh->drv_flow, + file); +if (ret) +return -ENOENT ; + } + handle_idx = dh->next.next; + } +return 0 ; }/**
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 2/2] net/mlx5: add mlx5 APIs for single flow dump feature
Quoted 21 lines
-----Original Message-----
From: Haifei Luo <[email protected]>
Sent: Thursday, April 15, 2021 14:19
To: [email protected]
Cc: Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Raslan Darawsheh <[email protected]>; Xueming(Steven) Li <[email protected]>; Haifei Luo <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>
Subject: [PATCH v3 2/2] net/mlx5: add mlx5 APIs for single flow dump featureModify API
mlx5_flow_dev_dumpto support the feature. Modifymlx5_socketsince one extra argflow_ptris added.The data structure sent to DPDK application from the utility triggering the flow dumps should be packed and endianness must be specified. The native host endianness can be used, all exchange happens within the same host (we use sendmsg aux data and share the file handle, remote approach is not applicable, no inter-host communication happens).
The message structure to dump one/all flow(s):
Quoted 8 lines
struct mlx5_flow_dump_req { uint32_t port_id; uint64_t flow_ptr; } __rte_packed;If
flow_ptris 0, all flows for the specified port will be dumped.Signed-off-by Haifei Luo <[email protected]>
Hi,
Quoted 36 lines
-----Original Message-----
From: Haifei Luo <[email protected]>
Sent: Wednesday, April 14, 2021 10:23 AM
To: [email protected]; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; [email protected]; NBU-Contact- Thomas Monjalon <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Xueming(Steven) Li <[email protected]>; Haifei Luo <[email protected]>
Subject: [PATCH 0/2] support single flow dump on MLX5 PMDDump information for all flows are supported and it is useful to dump one flow.
Add single flow dump support on MLX5 PMD.
Modify APImlx5_flow_dev_dumpto support.
Modifymlx5_socketsince one extra argflow_ptris added.Depends-on: series=16355 ("support single flow dump")
http://patchwork.dpdk.org/project/dpdk/list/?series=16355Haifei Luo (2):
common/mlx5: add mlx5 APIs for single flow dump feature net/mlx5: add mlx5 APIs for single flow dump featuredrivers/common/mlx5/linux/meson.build | 6 ++++-- drivers/common/mlx5/linux/mlx5_glue.c | 13 +++++++++++++ drivers/common/mlx5/linux/mlx5_glue.h | 1 + drivers/common/mlx5/mlx5_devx_cmds.c | 14 ++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/version.map | 1 + drivers/net/mlx5/linux/mlx5_socket.c | 30 ++++++++++++++++++++++++-- ---- drivers/net/mlx5/mlx5_flow.c | 30 ++++++++++++++++++++++++++++-- 8 files changed, 87 insertions(+), 10 deletions(-)
Quoted 2 lines
--
1.8.3.1
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh