What can I help you with?
NVIDIA DPDK Documentation MLNX_DPDK_22.11_2310.5.1 LTS

Flow Table Resize

Flow table resize for mlnx-dpdk.

The template (HWS) API created flow tables with fixed size. The application could not create flows that exceeded the table capacity. The new API allows to resize existing flow table at run-time, without interrupting active table flows. Table resize procedure has no downtime, new flows can be added while table resize is in progress. Multiple flow tables can be resized simultaneously.

RTE API

Copy
Copied!
            

RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE_TABLE 

Flow table attribute flag that specifies table resizable property. Flow tables that were created without that flag cannot be resized.

Copy
Copied!
            

bool rte_flow_table_resizable(const struct rte_flow_template_table_attr *tbl_attr);  

Returns TRUE if table is resizable.

Copy
Copied!
            

int rte_flow_template_table_resize(uint16_t port_id, struct rte_flow_template_table *table,                                                                   uint32_t nb_rules, struct rte_flow_error *error); 

Resize flow table. After successful completion, application can add flows to resized table.

Copy
Copied!
            

int rte_flow_async_update_resized(uint16_t port_id, uint32_t queue,                                                                   const struct rte_flow_op_attr *attr,                                                                  struct rte_flow *rule, void *user_data,                                                                   struct rte_flow_error *error); 

Enqueues post resize updates operation for a given flow rule.

If a flow rule was created before the table resize, the function completion is generated after updating the flow resources to match the resized table.

If a flow rule was created after the table resize, then successful completion will always be generated.

In a multi-threaded environment, the table resize API allows new flow rules insertion and flow table resize to be done simultaneously. The application has no information about the table resources used for flow creation, if the flow was created around the table resize operation.

Application maintainers are advised to update all active flows after flow table resize is completed.

Copy
Copied!
            

rte_flow_template_table_resize_complete(uint16_t port_id,                                      struct rte_flow_template_table *table,                                      struct rte_flow_error *error); 

Notifies PMD that all flows were updated.

Application can initiate new table resize after that function call.

  • Table size can be only increased.

  • Table size can be changed up to MLX5_MAXTABLE_REISZE_NUM := 64 times.

  • Ongoing table resize procedure must be completed before the subsequent resize of the same table.

  • If a flow rule is undergoing rte_flow_async_update_resized() operation, then it cannot be destroyed or updated until completion for update resized operation is received.

Create Resizable Flow Table

Copy
Copied!
            

struct rte_flow_template_table * table;  struct rte_flow_template_table_attr table_attr;  app_fill_template_table_attr(&table_attr);  table_attr. specialize |= RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE_TABLE;  table = rte_flow_template_table_create(port_id, &table_attr,                                                                           pattern_templates, nb_pattern_templates,                                                                           actions_templates, nb_actions_templates, error); 


Resize Flow Table

Copy
Copied!
            

int ret = rte_flow_template_table_resize(port_id, table, new_nb_rules, error);  if (ret == 0) {            for(int i = 0; i < app_get_table_flows_number(port_id, table); i++) {                  struct rte_flow *flow = app_fetch_table_flow_rule(port_id, table, i);                  rte_flow_async_update_resized(port_id, queue, attr, flow, user_data, error);                  app_wait_async_completion(port_id, user_data, error);          }          rte_flow_template_table_resize_complete(port_id, table, error);  }


Copy
Copied!
            

# create resizable flow table    flow template_table 0 create table_id 1 resizable \  ingress group 1 priority 0 rules_number 4 \  pattern_template 40 pattern_template 60 actions_template 50 actions_template 74 actions_template 0    ## create flows: #3 - #6     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 1 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 2 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 3 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 4 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0        # resize flow table  flow template_table 0 resize table_resize_id 1 table_resize_rules_num 16          ## create more flows: #7 - #10     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 5 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 6 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 7 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0     flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp src spec 8 / end actions raw_encap index 0 / jump group 10 / end     flow pull 0 queue 0       # update existing flows     flow queue 0 update_resized 0 rule 3     flow pull 0 queue 0     flow queue 0 update_resized 0 rule 4   flow pull 0 queue 0     flow queue 0 update_resized 0 rule 5   flow pull 0 queue 0     flow queue 0 update_resized 0 rule 6   flow pull 0 queue 0     flow queue 0 update_resized 0 rule 7   flow pull 0 queue 0     flow queue 0 update_resized 0 rule 8   flow pull 0 queue 0     flow queue 0 update_resized 0 rule 9   flow pull 0 queue 0     flow queue 0 update_resized 0 rule 10     flow pull 0 queue 0       # complete table resize     flow template_table 0 resize_complete table 1 

© Copyright 2024, NVIDIA. Last updated on Jan 9, 2025.