net/mlx5: manage header reformat actions with hashed list
PATCH 1/1 net/mlx5: manage header reformat actions with hashed list
To manage encap decap header format actions mlx5 PMD used the single linked list and lookup and insertion operations took too long times if there were millions of objects and this impacted the flow insertion/deletion rate.
In order to optimize the performance the hashed list is engaged. The list implementation is updated to support non-unique keys with few collisions.
--- drivers/net/mlx5/linux/mlx5_os.c | 16 +++++++ drivers/net/mlx5/mlx5.h | 2 +- drivers/net/mlx5/mlx5_defs.h | 3 ++ drivers/net/mlx5/mlx5_flow.h | 15 ++++++- drivers/net/mlx5/mlx5_flow_dv.c | 97 ++++++++++++++++++++++++++++++---------- 5 files changed, 107 insertions(+), 26 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +16 -0
@@ -250,6 +250,14 @@ err =ENOMEM ; goto error; } +snprintf (s,sizeof (s),"%s_encaps_decaps" , sh->ibdev_name); + sh->encaps_decaps =mlx5_hlist_create (s, +MLX5_FLOW_ENCAP_DECAP_HTABLE_SZ ); +if (!sh->encaps_decaps) { +DRV_LOG (ERR ,"encap decap hash creation failed" ); + err =ENOMEM ; + goto error; + }#ifdef HAVE_MLX5DV_DR void *domain;
@@ -323,6 +331,10 @@ mlx5_glue->destroy_flow_action (sh->pop_vlan_action); sh->pop_vlan_action =NULL ; } +if (sh->encaps_decaps) { +mlx5_hlist_destroy (sh->encaps_decaps,NULL ,NULL ); + sh->encaps_decaps =NULL ; + }if (sh->modify_cmds) {mlx5_hlist_destroy (sh->modify_cmds,NULL ,NULL ); sh->modify_cmds =NULL ;
@@ -380,6 +392,10 @@ }pthread_mutex_destroy (&sh->dv_mutex);#endif /* HAVE_MLX5DV_DR */ +if (sh->encaps_decaps) { +mlx5_hlist_destroy (sh->encaps_decaps,NULL ,NULL ); + sh->encaps_decaps =NULL ; + }if (sh->modify_cmds) {mlx5_hlist_destroy (sh->modify_cmds,NULL ,NULL ); sh->modify_cmds =NULL ;
drivers/net/mlx5/mlx5.h +1 -1
@@ -635,7 +635,7 @@ struct mlx5_dev_ctx_shared {/* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action;/* Pointer to DR E-Switch drop action. */ void *pop_vlan_action;/* Pointer to DR pop VLAN action. */ -uint32_t encaps_decaps;/* Encap/decap action indexed memory list. */ +struct mlx5_hlist *encaps_decaps;/* Encap/decap action hash list. */ struct mlx5_hlist *modify_cmds;struct mlx5_hlist *tag_table;uint32_t port_id_action_list;/* List of port ID actions. */
drivers/net/mlx5/mlx5_defs.h +3 -0
@@ -190,6 +190,9 @@/* Size of the simple hash table for header modify table. */ #define MLX5_FLOW_HDR_MODIFY_HTABLE_SZ (1 << 16) +/* Size of the simple hash table for encap decap table. */ +#define MLX5_FLOW_ENCAP_DECAP_HTABLE_SZ (1 << 16) +/* Hairpin TX/RX queue configuration parameters. */ #define MLX5_HAIRPIN_QUEUE_STRIDE 6#define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
drivers/net/mlx5/mlx5_flow.h +14 -1
@@ -388,9 +388,21 @@ struct mlx5_flow_dv_matcher {#define MLX5_ENCAP_MAX_LEN 132 +/* Encap/decap resource key of the hash organization. */ +union mlx5_flow_encap_decap_key { +struct { +uint32_t ft_type:8 ;/**< Flow table type, Rx or Tx. */ +uint32_t refmt_type:8 ;/**< Header reformat type. */ +uint32_t buf_size:8 ;/**< Encap buf size. */ +uint32_t table_level:8 ;/**< Root table or not. */ +uint32_t cksum;/**< Encap buf check sum. */ + }; +uint64_t v64;/**< full 64bits value of key */ +}; +/* Encap/decap resource structure. */ struct mlx5_flow_dv_encap_decap_resource { -ILIST_ENTRY (uint32_t )next; +struct mlx5_hlist_entry entry;/* Pointer to next element. */ rte_atomic32_t refcnt;/**< Reference counter. */ void *action;
@@ -400,6 +412,7 @@ struct mlx5_flow_dv_encap_decap_resource {uint8_t reformat_type;uint8_t ft_type;uint64_t flags;/**< Flags for RDMA API. */ +uint32_t idx;/**< Index for the index memory pool. */ };/* Tag resource structure. */
drivers/net/mlx5/mlx5_flow_dv.c +73 -24
134 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Hi,
Quoted 13 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Wednesday, September 16, 2020 1:20 PM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: manage header reformat actions with hashed listTo manage encap decap header format actions mlx5 PMD used the single linked
list and lookup and insertion operations took too long times if there were millions of objects and this impacted the flow insertion/deletion rate.
Quoted 6 lines
In order to optimize the performance the hashed list is engaged. The list implementation is updated to support non-unique keys with few collisions.
Signed-off-by Suanming Mou <[email protected]>---
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh