Provide flow filter API and statistics
Subsystems (2)
Re: [PATCH v4 15/86] net/ntnic: add item IPv4
In reply to Serhii IliushykQuoted 182 lines · Serhii Iliushyk
Add possibility to use
RTE_FLOW_ITEM_TYPE_IPV4Signed-off-by Serhii Iliushyk <[email protected]>--- doc/guides/nics/features/ntnic.ini | 1 + .../profile_inline/flow_api_profile_inline.c | 162 ++++++++++++++++++ 2 files changed, 163 insertions(+)doc/guides/nics/features/ntnic.ini +1
-0@@ -16,6 +16,7 @@ x86-64 = Y [rte_flow items] any = Y eth = Y +ipv4 = Y [rte_flow actions] drop = Ydrivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +153
-0@@ -664,7 +664,169 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,break ; + +case RTE_FLOW_ITEM_TYPE_IPV4 : +NT_LOG (DBG ,FILTER ,"Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_IPV4" , dev->ndev->adapter_no, dev->port); + { +const struct rte_flow_item_ipv4 *ipv4_spec = + (const struct rte_flow_item_ipv4 *)elem[eidx].spec; +const struct rte_flow_item_ipv4 *ipv4_mask = + (const struct rte_flow_item_ipv4 *)elem[eidx].mask; + +if (ipv4_spec ==NULL || ipv4_mask ==NULL ) { +if (any_count >0 || fd->l3_prot !=-1 ) + fd->tunnel_l3_prot =PROT_TUN_L3_IPV4 ; +else + fd->l3_prot =PROT_L3_IPV4 ; +break ; + } + +if (ipv4_mask->hdr.version_ihl !=0 || + ipv4_mask->hdr.type_of_service !=0 || + ipv4_mask->hdr.total_length !=0 || + ipv4_mask->hdr.packet_id !=0 || + (ipv4_mask->hdr.fragment_offset !=0 && + (ipv4_spec->hdr.fragment_offset !=0xffff || + ipv4_mask->hdr.fragment_offset !=0xffff )) || + ipv4_mask->hdr.time_to_live !=0 || + ipv4_mask->hdr.hdr_checksum !=0 ) { +NT_LOG (ERR ,FILTER , +"Requested IPv4 field not support by running SW version." ); +flow_nic_set_error (ERR_FAILED , error); +return -1 ; + } + +if (ipv4_spec->hdr.fragment_offset ==0xffff && + ipv4_mask->hdr.fragment_offset ==0xffff ) { + fd->fragmentation =0xfe ; + } + +int match_cnt = (ipv4_mask->hdr.src_addr !=0 ) + + (ipv4_mask->hdr.dst_addr !=0 ) + + (ipv4_mask->hdr.next_proto_id !=0 ); + +if (match_cnt <=0 ) { +if (any_count >0 || fd->l3_prot !=-1 ) + fd->tunnel_l3_prot =PROT_TUN_L3_IPV4 ; +else + fd->l3_prot =PROT_L3_IPV4 ; +break ; + } + +if (qw_free >0 && + (match_cnt >=2 || + (match_cnt ==1 && sw_counter >=2 ))) { +if (qw_counter >=2 ) { +NT_LOG (ERR ,FILTER , +"Key size too big. Out of QW resources." ); +flow_nic_set_error (ERR_FAILED , + error); +return -1 ; + } + +uint32_t *qw_data = &packet_data[2 +4 - qw_counter *4 ]; +uint32_t *qw_mask = &packet_mask[2 +4 - qw_counter *4 ]; + + qw_mask[0 ] =0 ; + qw_data[0 ] =0 ; + + qw_mask[1 ] = ipv4_mask->hdr.next_proto_id <<16 ; + qw_data[1 ] = ipv4_spec->hdr.next_proto_id + <<16 & qw_mask[1 ]; + + qw_mask[2 ] =ntohl (ipv4_mask->hdr.src_addr); + qw_mask[3 ] =ntohl (ipv4_mask->hdr.dst_addr); + + qw_data[2 ] =ntohl (ipv4_spec->hdr.src_addr) & qw_mask[2 ]; + qw_data[3 ] =ntohl (ipv4_spec->hdr.dst_addr) & qw_mask[3 ]; + +km_add_match_elem (&fd->km, &qw_data[0 ], &qw_mask[0 ],4 , + any_count >0 ?DYN_TUN_L3 :DYN_L3 ,4 ); +set_key_def_qw (key_def, qw_counter, any_count >0 + ?DYN_TUN_L3 :DYN_L3 ,4 ); + qw_counter +=1 ; + qw_free -=1 ; + +if (any_count >0 || fd->l3_prot !=-1 ) + fd->tunnel_l3_prot =PROT_TUN_L3_IPV4 ; +else + fd->l3_prot =PROT_L3_IPV4 ; +break ; + } + +if (ipv4_mask->hdr.src_addr) { +if (sw_counter >=2 ) { +NT_LOG (ERR ,FILTER , +"Key size too big. Out of SW resources." ); +flow_nic_set_error (ERR_FAILED , error); +return -1 ; + } + +uint32_t *sw_data = &packet_data[1 - sw_counter]; +uint32_t *sw_mask = &packet_mask[1 - sw_counter]; + + sw_mask[0 ] =ntohl (ipv4_mask->hdr.src_addr); + sw_data[0 ] =ntohl (ipv4_spec->hdr.src_addr) & sw_mask[0 ]; + +km_add_match_elem (&fd->km, &sw_data[0 ], &sw_mask[0 ],1 , + any_count >0 ?DYN_TUN_L3 :DYN_L3 ,12 ); +set_key_def_sw (key_def, sw_counter, any_count >0 + ?DYN_TUN_L3 :DYN_L3 ,12 ); + sw_counter +=1 ; + } + +if (ipv4_mask->hdr.dst_addr) { +if (sw_counter >=2 ) { +NT_LOG (ERR ,FILTER , +"Key size too big. Out of SW resources." ); +flow_nic_set_error (ERR_FAILED , error); +return -1 ; + } + +uint32_t *sw_data = &packet_data[1 - sw_counter]; +uint32_t *sw_mask = &packet_mask[1 - sw_counter]; + + sw_mask[0 ] =ntohl (ipv4_mask->hdr.dst_addr); + sw_data[0 ] =ntohl (ipv4_spec->hdr.dst_addr) & sw_mask[0 ]; + +km_add_match_elem (&fd->km, &sw_data[0 ], &sw_mask[0 ],1 , + any_count >0 ?DYN_TUN_L3 :DYN_L3 ,16 ); +set_key_def_sw (key_def, sw_counter, any_count >0 + ?DYN_TUN_L3 :DYN_L3 ,16 ); + sw_counter +=1 ; + } + +if (ipv4_mask->hdr.next_proto_id) { +if (sw_counter >=2 ) { +NT_LOG (ERR ,FILTER , +"Key size too big. Out of SW resources." ); +flow_nic_set_error (ERR_FAILED , error); +return -1 ; + } + +uint32_t *sw_data = &packet_data[1 - sw_counter]; +uint32_t *sw_mask = &packet_mask[1 - sw_counter]; + + sw_mask[0 ] = ipv4_mask->hdr.next_proto_id <<16 ; + sw_data[0 ] = ipv4_spec->hdr.next_proto_id + <<16 & sw_mask[0 ]; + +km_add_match_elem (&fd->km, &sw_data[0 ], &sw_mask[0 ],1 , + any_count >0 ?DYN_TUN_L3 :DYN_L3 ,8 ); +set_key_def_sw (key_def, sw_counter, any_count >0 + ?DYN_TUN_L3 :DYN_L3 ,8 ); + sw_counter +=1 ; + }
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c static int interpret_flow_elements(const struct flow_eth_dev *dev, · line 830
Quoted 10 lines
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +9
-0+ +if (any_count >0 || fd->l3_prot !=-1 ) + fd->tunnel_l3_prot =PROT_TUN_L3_IPV4 ; + +else + fd->l3_prot =PROT_L3_IPV4 ; + } + +break ;break ;
Redundant 'break'.
Quoted 2 lines
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +0
-0default :
PATCH v4 16/86 net/ntnic: add item ICMP
In reply to Serhii IliushykAdd possibility to use RTE_FLOW_ITEM_TYPE_ICMP
--- doc/guides/nics/features/ntnic.ini | 1 + .../profile_inline/flow_api_profile_inline.c | 101 ++++++++++++++++++ 2 files changed, 102 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -16,6 +16,7 @@ x86-64 = Y [rte_flow items] any = Y eth = Y +icmp = Y ipv4 = Y [rte_flow actions]
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +101 -0
107 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 17/86 net/ntnic: add item port ID
In reply to Serhii IliushykAdd possibility to use RTE_FLOW_ITEM_TYPE_PORT_ID
--- doc/guides/nics/features/ntnic.ini | 1 + .../flow_api/profile_inline/flow_api_profile_inline.c | 11 +++++++++++ 2 files changed, 12 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -18,6 +18,7 @@ any = Y eth = Y icmp = Y ipv4 = Y +port_id = Y [rte_flow actions] drop = Y
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +11 -0
@@ -928,6 +928,17 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, }break ; + +case RTE_FLOW_ITEM_TYPE_PORT_ID : +NT_LOG (DBG ,FILTER ,"Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_PORT_ID" , + dev->ndev->adapter_no, dev->port); + +if (elem[eidx].spec) { + *in_port_id = + ((const struct rte_flow_item_port_id *)elem[eidx].spec)->id; + } + +break ;break ;default :
Signature · 1 line
2.45.0
PATCH v4 18/86 net/ntnic: add item void
In reply to Serhii IliushykAdd possibility to use RTE_FLOW_ITEM_TYPE_VOID
--- .../nthw/flow_api/profile_inline/flow_api_profile_inline.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +4 -0
@@ -939,6 +939,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, }break ; + +case RTE_FLOW_ITEM_TYPE_VOID : +NT_LOG (DBG ,FILTER ,"Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_VOID" , + dev->ndev->adapter_no, dev->port);break ;default :
Signature · 1 line
2.45.0
PATCH v4 19/86 net/ntnic: add item UDP
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use RTE_FLOW_ITEM_TYPE_UDP
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + .../profile_inline/flow_api_profile_inline.c | 103 ++++++++++++++++++ 3 files changed, 106 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -19,6 +19,7 @@ eth = Y icmp = Y ipv4 = Y port_id = Y +udp = Y [rte_flow actions] drop = Y
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
@@ -166,6 +166,7 @@ enum { };enum { +PROT_L4_UDP =2 ,PROT_L4_ICMP =4 };
@@ -176,6 +177,7 @@ enum {enum {PROT_TUN_L4_OTHER =0 , +PROT_TUN_L4_UDP =2 ,PROT_TUN_L4_ICMP =4 };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +103 -0
121 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 20/86 net/ntnic: add action TCP
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use RTE_FLOW_ITEM_TYPE_TCP
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + .../profile_inline/flow_api_profile_inline.c | 108 ++++++++++++++++++ 3 files changed, 111 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -19,6 +19,7 @@ eth = Y icmp = Y ipv4 = Y port_id = Y +tcp = Y udp = Y [rte_flow actions]
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
@@ -166,6 +166,7 @@ enum { };enum { +PROT_L4_TCP =1 ,PROT_L4_UDP =2 ,PROT_L4_ICMP =4 };
@@ -177,6 +178,7 @@ enum {enum {PROT_TUN_L4_OTHER =0 , +PROT_TUN_L4_TCP =1 ,PROT_TUN_L4_UDP =2 ,PROT_TUN_L4_ICMP =4 };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +108 -0
126 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 21/86 net/ntnic: add action VLAN
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use RTE_FLOW_ITEM_TYPE_VLAN
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 1 + .../profile_inline/flow_api_profile_inline.c | 94 +++++++++++++++++++ 3 files changed, 96 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -21,6 +21,7 @@ ipv4 = Y port_id = Y tcp = Y udp = Y +vlan = Y [rte_flow actions] drop = Y
drivers/net/ntnic/include/hw_mod_backend.h +1 -0
@@ -134,6 +134,7 @@ static inline int is_non_zero(const void *addr, size_t n)enum frame_offs_e {DYN_L2 =1 , +DYN_FIRST_VLAN =2 ,DYN_L3 =4 ,DYN_L4 =7 ,DYN_L4_PAYLOAD =8 ,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +94 -0
106 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 22/86 net/ntnic: add item SCTP
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use RTE_FLOW_ITEM_TYPE_SCTP
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + .../profile_inline/flow_api_profile_inline.c | 102 ++++++++++++++++++ 3 files changed, 105 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -19,6 +19,7 @@ eth = Y icmp = Y ipv4 = Y port_id = Y +sctp = Y tcp = Y udp = Y vlan = Y
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
@@ -169,6 +169,7 @@ enum {enum {PROT_L4_TCP =1 ,PROT_L4_UDP =2 , +PROT_L4_SCTP =3 ,PROT_L4_ICMP =4 };
@@ -181,6 +182,7 @@ enum {PROT_TUN_L4_OTHER =0 ,PROT_TUN_L4_TCP =1 ,PROT_TUN_L4_UDP =2 , +PROT_TUN_L4_SCTP =3 , PROT_TUN_L4_ICMP = 4 };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +102 -0
120 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 23/86 net/ntnic: add items IPv6 and ICMPv6
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use
* RTE_FLOW_ITEM_TYPE_IPV6
* RTE_FLOW_ITEM_TYPE_ICMP6
--- doc/guides/nics/features/ntnic.ini | 2 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 27 ++ .../profile_inline/flow_api_profile_inline.c | 272 ++++++++++++++++++ 4 files changed, 303 insertions(+)
doc/guides/nics/features/ntnic.ini +2 -0
@@ -17,7 +17,9 @@ x86-64 = Y any = Y eth = Y icmp = Y +icmp6 = Y ipv4 = Y +ipv6 = Y port_id = Y sctp = Y tcp = Y
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
@@ -164,6 +164,7 @@ enum {enum {PROT_L3_IPV4 =1 , +PROT_L3_IPV6 =2 };enum {
@@ -176,6 +177,7 @@ enum {enum {PROT_TUN_L3_OTHER =0 ,PROT_TUN_L3_IPV4 =1 , +PROT_TUN_L3_IPV6 =2 };enum {
drivers/net/ntnic/nthw/flow_api/flow_api.c +27 -0
@@ -47,6 +47,33 @@ static const struct { } err_msg[] = { /* 00 */ { "Operation successfully completed" }, /* 01 */ { "Operation failed" }, + /* 02 */ { "Memory allocation failed" }, + /* 03 */ { "Too many output destinations" }, + /* 04 */ { "Too many output queues for RSS" }, + /* 05 */ { "The VLAN TPID specified is not supported" }, + /* 06 */ { "The VxLan Push header specified is not accepted" }, + /* 07 */ { "While interpreting VxLan Pop action, could not find a destination port" }, + /* 08 */ { "Failed in creating a HW-internal VTEP port" }, + /* 09 */ { "Too many VLAN tag matches" }, + /* 10 */ { "IPv6 invalid header specified" }, + /* 11 */ { "Too many tunnel ports. HW limit reached" }, + /* 12 */ { "Unknown or unsupported flow match element received" }, + /* 13 */ { "Match failed because of HW limitations" }, + /* 14 */ { "Match failed because of HW resource limitations" }, + /* 15 */ { "Match failed because of too complex element definitions" }, + /* 16 */ { "Action failed. To too many output destinations" }, + /* 17 */ { "Action Output failed, due to HW resource exhaustion" }, + /* 18 */ { "Push Tunnel Header action cannot output to multiple destination queues" }, + /* 19 */ { "Inline action HW resource exhaustion" }, + /* 20 */ { "Action retransmit/recirculate HW resource exhaustion" }, + /* 21 */ { "Flow counter HW resource exhaustion" }, + /* 22 */ { "Internal HW resource exhaustion to handle Actions" }, + /* 23 */ { "Internal HW QSL compare failed" }, + /* 24 */ { "Internal CAT CFN reuse failed" }, + /* 25 */ { "Match variations too complex" }, + /* 26 */ { "Match failed because of CAM/TCAM full" }, + /* 27 */ { "Internal creation of a tunnel end point port failed" }, + /* 28 */ { "Unknown or unsupported flow action received" }, /* 29 */ { "Removing flow failed" }, };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +272 -0
290 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 24/86 net/ntnic: add action modify filed
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/flow_api_engine.h | 7 + drivers/net/ntnic/include/hw_mod_backend.h | 1 + .../profile_inline/flow_api_profile_inline.c | 181 ++++++++++++++++++ 4 files changed, 190 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -30,5 +30,6 @@ vlan = Y drop = Y jump = Y mark = Y +modify_field = Y port_id = Y queue = Y
drivers/net/ntnic/include/flow_api_engine.h +7 -0
@@ -129,6 +129,10 @@ struct nic_flow_def {*/ struct {uint32_t select; +uint32_t dyn; +uint32_t ofs; +uint32_t len; +uint32_t level;union {uint8_t value8[16 ];uint16_t value16[8 ];
@@ -137,6 +141,9 @@ struct nic_flow_def { } modify_field[MAX_CPY_WRITERS_SUPPORTED ];uint32_t modify_field_count; +uint8_t ttl_sub_enable; +uint8_t ttl_sub_ipv4; +uint8_t ttl_sub_outer;/* * Key Matcher flow definitions
drivers/net/ntnic/include/hw_mod_backend.h +1 -0
@@ -140,6 +140,7 @@ enum frame_offs_e {DYN_L4_PAYLOAD =8 ,DYN_TUN_L3 =13 ,DYN_TUN_L4 =16 , + DYN_TUN_L4_PAYLOAD = 17, };/* Sideband info bit indicator */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +181 -0
193 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 25/86 net/ntnic: add items gtp and actions raw encap/decap
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add possibility to use
* RTE_FLOW_ITEM_TYPE_GTP
* RTE_FLOW_ITEM_TYPE_GTP_PSC
* RTE_FLOW_ACTION_TYPE_RAW_ENCAP
* RTE_FLOW_ACTION_TYPE_RAW_DECAP
--- doc/guides/nics/features/ntnic.ini | 4 + drivers/net/ntnic/include/create_elements.h | 4 + drivers/net/ntnic/include/flow_api_engine.h | 40 ++ drivers/net/ntnic/include/hw_mod_backend.h | 4 + .../ntnic/include/stream_binary_flow_api.h | 22 ++ .../profile_inline/flow_api_profile_inline.c | 366 +++++++++++++++++- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 291 +++++++++++++- 7 files changed, 726 insertions(+), 5 deletions(-)
doc/guides/nics/features/ntnic.ini +4 -0
@@ -16,6 +16,8 @@ x86-64 = Y [rte_flow items] any = Y eth = Y +gtp = Y +gtp_psc = Y icmp = Y icmp6 = Y ipv4 = Y
@@ -33,3 +35,5 @@ mark = Y modify_field = Y port_id = Y queue = Y +raw_decap = Y +raw_encap = Y
drivers/net/ntnic/include/create_elements.h +4 -0
@@ -27,6 +27,8 @@ struct cnv_attr_s {struct cnv_action_s {struct rte_flow_action flow_actions[MAX_ACTIONS ]; +struct flow_action_raw_encap encap; +struct flow_action_raw_decap decap;struct rte_flow_action_queue queue; };
@@ -52,6 +54,8 @@ enum nt_rte_flow_item_type { };extern rte_spinlock_t flow_lock; + +int interpret_raw_data (uint8_t *data,uint8_t *preserve,int size,struct rte_flow_item *out);int convert_error (struct rte_flow_error *error,struct rte_flow_error *rte_flow_error);int create_attr (struct cnv_attr_s *attribute,const struct rte_flow_attr *attr); int create_match_elements(struct cnv_match_s *match, const struct rte_flow_item items[],
drivers/net/ntnic/include/flow_api_engine.h +40 -0
@@ -56,6 +56,29 @@ enum res_type_e {#define MAX_MATCH_FIELDS 16 +/* +* Tunnel encapsulation header definition +*/ +#define MAX_TUN_HDR_SIZE 128 +struct tunnel_header_s { +union { +uint8_t hdr8[MAX_TUN_HDR_SIZE ]; +uint32_t hdr32[(MAX_TUN_HDR_SIZE +3 ) /4 ]; + } d; +uint32_t user_port_id; +uint8_t len; + +uint8_t nb_vlans; + +uint8_t ip_version;/* 4: v4, 6: v6 */ +uint16_t ip_csum_precalc; + +uint8_t new_outer; +uint8_t l2_len; +uint8_t l3_len; +uint8_t l4_len; +}; +struct match_elem_s {int masked_for_tcam;/* if potentially selected for TCAM */ uint32_t e_word[4 ];
@@ -124,6 +147,23 @@ struct nic_flow_def {int full_offload; +/* +* Action push tunnel +*/ +struct tunnel_header_s tun_hdr; + +/* +* If DPDK RTE tunnel helper API used +* this holds the tunnel if used in flow +*/ +struct tunnel_s *tnl; + +/* +* Header Stripper +*/ +int header_strip_end_dyn; +int header_strip_end_ofs; +/* * Modify field */
drivers/net/ntnic/include/hw_mod_backend.h +4 -0
@@ -175,6 +175,10 @@ enum {PROT_L4_ICMP =4 }; +enum { +PROT_TUN_GTPV1U =6 , +}; +enum {PROT_TUN_L3_OTHER =0 ,PROT_TUN_L3_IPV4 =1 ,
drivers/net/ntnic/include/stream_binary_flow_api.h +22 -0
@@ -18,6 +18,7 @@#define FLOW_MAX_QUEUES 128 +#define RAW_ENCAP_DECAP_ELEMS_MAX 16/* * Flow eth dev profile determines how the FPGA module resources are * managed and what features are available
@@ -31,6 +32,27 @@ struct flow_queue_id_s {int hw_id; }; +/* +* RTE_FLOW_ACTION_TYPE_RAW_ENCAP +*/ +struct flow_action_raw_encap { +uint8_t *data; +uint8_t *preserve; +size_t size; +struct rte_flow_item items[RAW_ENCAP_DECAP_ELEMS_MAX ]; +int item_count; +}; + +/* +* RTE_FLOW_ACTION_TYPE_RAW_DECAP +*/ +struct flow_action_raw_decap { +uint8_t *data; +size_t size; +struct rte_flow_item items[RAW_ENCAP_DECAP_ELEMS_MAX ]; +int item_count; +}; +struct flow_eth_dev ;/* port device */ struct flow_handle ;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +365 -1
384 lines not on this page · raw message
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +287 -4
306 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 26/86 net/ntnic: add cat module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Categorizer module’s main purpose is to is select the behavior of other modules in the FPGA pipeline depending on a protocol check.
--- drivers/net/ntnic/include/hw_mod_backend.h | 24 ++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c | 267 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.c | 165 +++++++++++ .../profile_inline/flow_api_hw_db_inline.h | 47 +++ .../profile_inline/flow_api_profile_inline.c | 83 ++++++ 5 files changed, 586 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +24 -0
@@ -315,11 +315,35 @@ int hw_mod_cat_reset(struct flow_api_backend_s *be);int hw_mod_cat_cfn_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_cat_cfn_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index,int word_off,uint32_t value); +/* KCE/KCS/FTE KM */ +int hw_mod_cat_fte_km_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num, +int start_idx,int count); +int hw_mod_cat_fte_km_set (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t value); +int hw_mod_cat_fte_km_get (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t *value); +/* KCE/KCS/FTE FLM */ +int hw_mod_cat_fte_flm_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num, +int start_idx,int count); +int hw_mod_cat_fte_flm_set (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t value); +int hw_mod_cat_fte_flm_get (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t *value);int hw_mod_cat_cte_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_cat_cte_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index, +uint32_t value); +int hw_mod_cat_cts_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_cat_cts_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index, +uint32_t value); +int hw_mod_cat_cot_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_cat_cot_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index, +uint32_t value); +int hw_mod_cat_cct_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_cat_kcc_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_cat_exo_flush (struct flow_api_backend_s *be,int start_idx,int count);
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c +267 -0
291 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +165 -0
198 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +47 -0
69 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +83 -0
107 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 27/86 net/ntnic: add SLC LR module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Slicer for Local Retransmit module can cut of the head a packet before the packet leaves the FPGA RX pipeline.
This is used when the TX pipeline is configured
to add a new head in the packet.
--- drivers/net/ntnic/include/hw_mod_backend.h | 2 + .../nthw/flow_api/hw_mod/hw_mod_slc_lr.c | 100 +++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.c | 104 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.h | 19 ++++ .../profile_inline/flow_api_profile_inline.c | 37 ++++++- 5 files changed, 257 insertions(+), 5 deletions(-)
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
@@ -697,6 +697,8 @@ int hw_mod_slc_lr_alloc(struct flow_api_backend_s *be);void hw_mod_slc_lr_free (struct flow_api_backend_s *be);int hw_mod_slc_lr_reset (struct flow_api_backend_s *be);int hw_mod_slc_lr_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_slc_lr_rcp_set (struct flow_api_backend_s *be,enum hw_slc_lr_e field,uint32_t index, +uint32_t value);struct pdb_func_s {COMMON_FUNC_INFO_S ;
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_slc_lr.c +100 -0
103 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +104 -0
135 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +19 -0
@@ -40,10 +40,15 @@ struct hw_db_cat_idx {HW_DB_IDX ; }; +struct hw_db_slc_lr_idx { +HW_DB_IDX ; +}; +enum hw_db_idx_type {HW_DB_IDX_TYPE_NONE =0 ,HW_DB_IDX_TYPE_COT ,HW_DB_IDX_TYPE_CAT , +HW_DB_IDX_TYPE_SLC_LR , };/* Functionality data types */
@@ -89,6 +94,13 @@ struct hw_db_inline_cot_data { uint32_t padding : 24; }; +struct hw_db_inline_slc_lr_data { +uint32_t head_slice_en :1 ; +uint32_t head_slice_dyn :5 ; +uint32_t head_slice_ofs :8 ; +uint32_t padding :18 ; +}; +struct hw_db_inline_hsh_data {uint32_t func;uint64_t hash_mask;
@@ -119,6 +131,13 @@ struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_havoid hw_db_inline_cot_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_cot_idx idx);void hw_db_inline_cot_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_cot_idx idx); +struct hw_db_slc_lr_idx hw_db_inline_slc_lr_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_slc_lr_data *data); +void hw_db_inline_slc_lr_ref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_slc_lr_idx idx); +void hw_db_inline_slc_lr_deref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_slc_lr_idx idx); +/**/ struct hw_db_cat_idx hw_db_inline_cat_add(struct flow_nic_dev *ndev, void *db_handle,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +32 -5
@@ -2276,18 +2276,38 @@ static int convert_fh_to_fh_flm(struct flow_handle *fh, const uint32_t *packet_dreturn 0 ; } -static int setup_flow_flm_actions(struct flow_eth_dev *dev __rte_unused, - const struct nic_flow_def *fd __rte_unused, +static int setup_flow_flm_actions (struct flow_eth_dev *dev, +const struct nic_flow_def *fd, const struct hw_db_inline_qsl_data *qsl_data __rte_unused, const struct hw_db_inline_hsh_data *hsh_data __rte_unused, uint32_t group __rte_unused, - uint32_t local_idxs[] __rte_unused, - uint32_t *local_idx_counter __rte_unused, +uint32_t local_idxs[], +uint32_t *local_idx_counter, uint16_t *flm_rpl_ext_ptr __rte_unused, uint32_t *flm_ft __rte_unused, uint32_t *flm_scrub __rte_unused, - struct rte_flow_error *error __rte_unused) +struct rte_flow_error *error) { +/* Setup SLC LR */ +struct hw_db_slc_lr_idx slc_lr_idx = { .raw =0 }; + +if (fd->header_strip_end_dyn !=0 || fd->header_strip_end_ofs !=0 ) { +struct hw_db_inline_slc_lr_data slc_lr_data = { + .head_slice_en =1 , + .head_slice_dyn = fd->header_strip_end_dyn, + .head_slice_ofs = fd->header_strip_end_ofs, + }; + slc_lr_idx = +hw_db_inline_slc_lr_add (dev->ndev, dev->ndev->hw_db_handle, &slc_lr_data); + local_idxs[(*local_idx_counter)++] = slc_lr_idx.raw; + +if (slc_lr_idx.error) { +NT_LOG (ERR ,FILTER ,"Could not reference SLC LR resource" ); +flow_nic_set_error (ERR_MATCH_RESOURCE_EXHAUSTION , error); +return -1 ; + } + } +return 0 ; }
@@ -2449,6 +2469,9 @@ int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)if (hw_mod_cat_cot_flush (&ndev->be,0 ,1 ) <0 ) goto err_exit0; +/* SLC LR index 0 is reserved */ +flow_nic_mark_resource_used (ndev,RES_SLC_LR_RCP ,0 ); +/* Setup filter using matching all packets violating traffic policing parameters */ flow_nic_mark_resource_used (ndev,RES_CAT_CFN ,NT_VIOLATING_MBR_CFN );
@@ -2497,6 +2520,10 @@ int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)hw_mod_cat_cot_flush (&ndev->be,0 ,1 );flow_nic_free_resource (ndev,RES_CAT_CFN ,0 ); +hw_mod_slc_lr_rcp_set (&ndev->be,HW_SLC_LR_RCP_PRESET_ALL ,0 ,0 ); +hw_mod_slc_lr_rcp_flush (&ndev->be,0 ,1 ); +flow_nic_free_resource (ndev,RES_SLC_LR_RCP ,0 ); +hw_mod_tpe_reset (&ndev->be);flow_nic_free_resource (ndev,RES_TPE_RCP ,0 );flow_nic_free_resource (ndev,RES_TPE_EXT ,0 );
Signature · 1 line
2.45.0
PATCH v4 28/86 net/ntnic: add PDB module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Packet Description Builder module creates packet meta-data for example virtio-net headers.
--- drivers/net/ntnic/include/hw_mod_backend.h | 3 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c | 144 ++++++++++++++++++ .../profile_inline/flow_api_profile_inline.c | 17 +++ 3 files changed, 164 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +3 -0
@@ -740,6 +740,9 @@ int hw_mod_pdb_alloc(struct flow_api_backend_s *be);void hw_mod_pdb_free (struct flow_api_backend_s *be);int hw_mod_pdb_reset (struct flow_api_backend_s *be);int hw_mod_pdb_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_pdb_rcp_set (struct flow_api_backend_s *be,enum hw_pdb_e field,uint32_t index, +uint32_t value); +int hw_mod_pdb_config_flush (struct flow_api_backend_s *be);struct tpe_func_s {
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c +144 -0
150 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +17 -0
@@ -2472,6 +2472,19 @@ int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)/* SLC LR index 0 is reserved */ flow_nic_mark_resource_used (ndev,RES_SLC_LR_RCP ,0 ); +/* PDB setup Direct Virtio Scatter-Gather descriptor of 12 bytes for its recipe 0 +*/ +if (hw_mod_pdb_rcp_set (&ndev->be,HW_PDB_RCP_DESCRIPTOR ,0 ,7 ) <0 ) + goto err_exit0; + +if (hw_mod_pdb_rcp_set (&ndev->be,HW_PDB_RCP_DESC_LEN ,0 ,6 ) <0 ) + goto err_exit0; + +if (hw_mod_pdb_rcp_flush (&ndev->be,0 ,1 ) <0 ) + goto err_exit0; + +flow_nic_mark_resource_used (ndev,RES_PDB_RCP ,0 ); +/* Setup filter using matching all packets violating traffic policing parameters */ flow_nic_mark_resource_used (ndev,RES_CAT_CFN ,NT_VIOLATING_MBR_CFN );
@@ -2529,6 +2542,10 @@ int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)flow_nic_free_resource (ndev,RES_TPE_EXT ,0 );flow_nic_free_resource (ndev,RES_TPE_RPL ,0 ); +hw_mod_pdb_rcp_set (&ndev->be,HW_PDB_RCP_PRESET_ALL ,0 ,0 ); +hw_mod_pdb_rcp_flush (&ndev->be,0 ,1 ); +flow_nic_free_resource (ndev,RES_PDB_RCP ,0 ); +hw_db_inline_destroy (ndev->hw_db_handle);#ifdef FLOW_DEBUG
Signature · 1 line
2.45.0
PATCH v4 29/86 net/ntnic: add QSL module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Queue Selector module directs packets to a given destination which includes host queues, physical ports, exceptions paths, and discard.
--- drivers/net/ntnic/include/flow_api.h | 3 + drivers/net/ntnic/include/hw_mod_backend.h | 8 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 65 ++++++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c | 218 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.c | 195 ++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.h | 11 + .../profile_inline/flow_api_profile_inline.c | 96 +++++++- 7 files changed, 595 insertions(+), 1 deletion(-)
drivers/net/ntnic/include/flow_api.h +3 -0
@@ -184,8 +184,11 @@ extern const char *dbg_res_descr[];int flow_nic_alloc_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,uint32_t alignment); +int flow_nic_alloc_resource_config (struct flow_nic_dev *ndev,enum res_type_e res_type, +unsigned int num,uint32_t alignment);void flow_nic_free_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int idx); +int flow_nic_ref_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int index);int flow_nic_deref_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int index);#endif
drivers/net/ntnic/include/hw_mod_backend.h +8 -0
@@ -666,8 +666,16 @@ int hw_mod_qsl_alloc(struct flow_api_backend_s *be);void hw_mod_qsl_free (struct flow_api_backend_s *be);int hw_mod_qsl_reset (struct flow_api_backend_s *be);int hw_mod_qsl_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_qsl_rcp_set (struct flow_api_backend_s *be,enum hw_qsl_e field,uint32_t index, +uint32_t value);int hw_mod_qsl_qst_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_qsl_qst_set (struct flow_api_backend_s *be,enum hw_qsl_e field,uint32_t index, +uint32_t value);int hw_mod_qsl_qen_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_qsl_qen_set (struct flow_api_backend_s *be,enum hw_qsl_e field,uint32_t index, +uint32_t value); +int hw_mod_qsl_qen_get (struct flow_api_backend_s *be,enum hw_qsl_e field,uint32_t index, +uint32_t *value);int hw_mod_qsl_unmq_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_qsl_unmq_set (struct flow_api_backend_s *be,enum hw_qsl_e field,uint32_t index,uint32_t value);
drivers/net/ntnic/nthw/flow_api/flow_api.c +65 -0
88 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c +218 -0
236 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +195 -0
237 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +11 -0
@@ -36,6 +36,10 @@ struct hw_db_cot_idx {HW_DB_IDX ; }; +struct hw_db_qsl_idx { +HW_DB_IDX ; +}; +struct hw_db_cat_idx {HW_DB_IDX ; };
@@ -48,6 +52,7 @@ enum hw_db_idx_type {HW_DB_IDX_TYPE_NONE =0 ,HW_DB_IDX_TYPE_COT ,HW_DB_IDX_TYPE_CAT , +HW_DB_IDX_TYPE_QSL , HW_DB_IDX_TYPE_SLC_LR, };
@@ -113,6 +118,7 @@ struct hw_db_inline_action_set_data {int jump;struct {struct hw_db_cot_idx cot; +struct hw_db_qsl_idx qsl; }; }; };
@@ -131,6 +137,11 @@ struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_havoid hw_db_inline_cot_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_cot_idx idx);void hw_db_inline_cot_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_cot_idx idx); +struct hw_db_qsl_idx hw_db_inline_qsl_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_qsl_data *data); +void hw_db_inline_qsl_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_qsl_idx idx); +void hw_db_inline_qsl_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_qsl_idx idx); +struct hw_db_slc_lr_idx hw_db_inline_slc_lr_add (struct flow_nic_dev *ndev,void *db_handle,const struct hw_db_inline_slc_lr_data *data); void hw_db_inline_slc_lr_ref(struct flow_nic_dev *ndev, void *db_handle,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +95 -1
140 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 30/86 net/ntnic: add KM module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Key Matcher module checks the values of individual fields of a packet. It supports both exact match which is implemented with a CAM, and wildcards which is implemented with a TCAM.
--- drivers/net/ntnic/include/flow_api_engine.h | 110 +- drivers/net/ntnic/include/hw_mod_backend.h | 64 +- drivers/net/ntnic/nthw/flow_api/flow_km.c | 1065 +++++++++++++++++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_km.c | 380 ++++++ .../profile_inline/flow_api_hw_db_inline.c | 234 ++++ .../profile_inline/flow_api_hw_db_inline.h | 38 + .../profile_inline/flow_api_profile_inline.c | 162 +++ 7 files changed, 2024 insertions(+), 29 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +91 -19
@@ -52,34 +52,32 @@ enum res_type_e {*/ #define MAX_OUTPUT_DEST (128) +#define MAX_WORD_NUM 24 +#define MAX_BANKS 6 + +#define MAX_TCAM_START_OFFSETS 4 +#define MAX_CPY_WRITERS_SUPPORTED 8#define MAX_MATCH_FIELDS 16/* -* Tunnel encapsulation header definition +* 128 128 32 32 32 +* Have | QW0 || QW4 || SW8 || SW9 | SWX in FPGA +* +* Each word may start at any offset, though +* they are combined in chronological order, with all enabled to +* build the extracted match data, thus that is how the match key +* must be build */ -#define MAX_TUN_HDR_SIZE 128 -struct tunnel_header_s { -union { -uint8_t hdr8[MAX_TUN_HDR_SIZE ]; -uint32_t hdr32[(MAX_TUN_HDR_SIZE +3 ) /4 ]; - } d; -uint32_t user_port_id; -uint8_t len; - -uint8_t nb_vlans; - -uint8_t ip_version;/* 4: v4, 6: v6 */ -uint16_t ip_csum_precalc; - -uint8_t new_outer; -uint8_t l2_len; -uint8_t l3_len; -uint8_t l4_len; +enum extractor_e { +KM_USE_EXTRACTOR_UNDEF , +KM_USE_EXTRACTOR_QWORD , +KM_USE_EXTRACTOR_SWORD , };struct match_elem_s { +enum extractor_e extr;int masked_for_tcam;/* if potentially selected for TCAM */ uint32_t e_word[4 ];uint32_t e_mask[4 ];
@@ -89,16 +87,76 @@ struct match_elem_s {uint32_t word_len; }; +enum cam_tech_use_e { +KM_CAM , +KM_TCAM , +KM_SYNERGY +}; +struct km_flow_def_s {struct flow_api_backend_s *be; +/* For keeping track of identical entries */ +struct km_flow_def_s *reference; +struct km_flow_def_s *root; +/* For collect flow elements and sorting */ struct match_elem_s match[MAX_MATCH_FIELDS ]; +struct match_elem_s *match_map[MAX_MATCH_FIELDS ];int num_ftype_elem; +/* Finally formatted CAM/TCAM entry */ +enum cam_tech_use_e target; +uint32_t entry_word[MAX_WORD_NUM ]; +uint32_t entry_mask[MAX_WORD_NUM ]; +int key_word_size; + +/* TCAM calculated possible bank start offsets */ +int start_offsets[MAX_TCAM_START_OFFSETS ]; +int num_start_offsets; +/* Flow information */ /* HW input port ID needed for compare. In port must be identical on flow types */ uint32_t port_id; +uint32_t info;/* used for color (actions) */ +int info_set; +int flow_type;/* 0 is illegal and used as unset */ +int flushed_to_target;/* if this km entry has been finally programmed into NIC hw */ + +/* CAM specific bank management */ +int cam_paired; +int record_indexes[MAX_BANKS ]; +int bank_used; +uint32_t *cuckoo_moves;/* for CAM statistics only */ +struct cam_distrib_s *cam_dist; + +/* TCAM specific bank management */ +struct tcam_distrib_s *tcam_dist; +int tcam_start_bank; +int tcam_record; +}; + +/* +* Tunnel encapsulation header definition +*/ +#define MAX_TUN_HDR_SIZE 128 + +struct tunnel_header_s { +union { +uint8_t hdr8[MAX_TUN_HDR_SIZE ]; +uint32_t hdr32[(MAX_TUN_HDR_SIZE +3 ) /4 ]; + } d; + +uint8_t len; + +uint8_t nb_vlans; + +uint8_t ip_version;/* 4: v4, 6: v6 */ + +uint8_t new_outer; +uint8_t l2_len; +uint8_t l3_len; +uint8_t l4_len; };enum flow_port_type_e {
@@ -247,11 +305,25 @@ struct flow_handle { }; }; +void km_attach_ndev_resource_management (struct km_flow_def_s *km,void **handle);void km_free_ndev_resource_management (void **handle);int km_add_match_elem (struct km_flow_def_s *km,uint32_t e_word[4 ],uint32_t e_mask[4 ],uint32_t word_len,enum frame_offs_e start,int8_t offset); +int km_key_create (struct km_flow_def_s *km,uint32_t port_id); +/* +* Compares 2 KM key definitions after first collect validate and optimization. +* km is compared against an existing km1. +* if identical, km1 flow_type is returned +*/ +int km_key_compare (struct km_flow_def_s *km,struct km_flow_def_s *km1); + +int km_rcp_set (struct km_flow_def_s *km,int index); + +int km_write_data_match_entry (struct km_flow_def_s *km,uint32_t color); +int km_clear_data_match_entry (struct km_flow_def_s *km); +void kcc_free_ndev_resource_management (void **handle);/*
drivers/net/ntnic/include/hw_mod_backend.h +54 -10
95 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/flow_km.c +1065 -0
1,082 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_km.c +380 -0
404 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +234 -0
268 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +38 -0
@@ -32,6 +32,10 @@ struct hw_db_idx {HW_DB_IDX ; }; +struct hw_db_action_set_idx { +HW_DB_IDX ; +}; +struct hw_db_cot_idx {HW_DB_IDX ; };
@@ -48,12 +52,22 @@ struct hw_db_slc_lr_idx {HW_DB_IDX ; }; +struct hw_db_km_idx { +HW_DB_IDX ; +}; + +struct hw_db_km_ft { +HW_DB_IDX ; +}; +enum hw_db_idx_type {HW_DB_IDX_TYPE_NONE =0 ,HW_DB_IDX_TYPE_COT ,HW_DB_IDX_TYPE_CAT ,HW_DB_IDX_TYPE_QSL ,HW_DB_IDX_TYPE_SLC_LR , +HW_DB_IDX_TYPE_KM_RCP , +HW_DB_IDX_TYPE_KM_FT , };/* Functionality data types */
@@ -123,6 +137,16 @@ struct hw_db_inline_action_set_data { }; }; +struct hw_db_inline_km_rcp_data { +uint32_t rcp; +}; + +struct hw_db_inline_km_ft_data { +struct hw_db_cat_idx cat; +struct hw_db_km_idx km; +struct hw_db_action_set_idx action_set; +}; +/**/ int hw_db_inline_create (struct flow_nic_dev *ndev,void **db_handle);
@@ -130,6 +154,8 @@ void hw_db_inline_destroy(void *db_handle);void hw_db_inline_deref_idxs (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_idx *idxs,uint32_t size); +const void *hw_db_inline_find_data (struct flow_nic_dev *ndev,void *db_handle, +enum hw_db_idx_type type,struct hw_db_idx *idxs,uint32_t size);/**/ struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_handle,
@@ -158,6 +184,18 @@ void hw_db_inline_cat_deref(struct flow_nic_dev *ndev, void *db_handle, struct h/**/ +struct hw_db_km_idx hw_db_inline_km_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_km_rcp_data *data); +void hw_db_inline_km_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_km_idx idx); +void hw_db_inline_km_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_km_idx idx); + +struct hw_db_km_ft hw_db_inline_km_ft_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_km_ft_data *data); +void hw_db_inline_km_ft_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_km_ft idx); +void hw_db_inline_km_ft_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_km_ft idx); + +/**/ +int hw_db_inline_setup_mbr_filter (struct flow_nic_dev *ndev,uint32_t cat_hw_id,uint32_t ft,uint32_t qsl_hw_id);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +162 -0
186 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 31/86 net/ntnic: add hash API
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Hasher module calculates a configurable hash value to be used internally by the FPGA.
The module support both Toeplitz and NT-hash.
--- drivers/net/ntnic/include/flow_api.h | 40 + drivers/net/ntnic/include/flow_api_engine.h | 17 + drivers/net/ntnic/include/hw_mod_backend.h | 20 + .../ntnic/include/stream_binary_flow_api.h | 25 + drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 212 +++++ drivers/net/ntnic/nthw/flow_api/flow_hasher.c | 156 ++++ drivers/net/ntnic/nthw/flow_api/flow_hasher.h | 21 + drivers/net/ntnic/nthw/flow_api/flow_km.c | 25 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c | 179 ++++ .../profile_inline/flow_api_hw_db_inline.c | 142 +++ .../profile_inline/flow_api_hw_db_inline.h | 11 + .../profile_inline/flow_api_profile_inline.c | 850 +++++++++++++++++- .../profile_inline/flow_api_profile_inline.h | 4 + drivers/net/ntnic/ntnic_mod_reg.h | 4 + 15 files changed, 1706 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.h
drivers/net/ntnic/include/flow_api.h +40 -0
@@ -29,6 +29,37 @@ struct hw_mod_resource_s {*/ int flow_delete_eth_dev (struct flow_eth_dev *eth_dev); +/** +* A structure used to configure the Receive Side Scaling (RSS) feature +* of an Ethernet port. +*/ +struct nt_eth_rss_conf { +/** +* In rte_eth_dev_rss_hash_conf_get(), the *rss_key_len* should be +* greater than or equal to the *hash_key_size* which get from +* rte_eth_dev_info_get() API. And the *rss_key* should contain at least +* *hash_key_size* bytes. If not meet these requirements, the query +* result is unreliable even if the operation returns success. +* +* In rte_eth_dev_rss_hash_update() or rte_eth_dev_configure(), if +* *rss_key* is not NULL, the *rss_key_len* indicates the length of the +* *rss_key* in bytes and it should be equal to *hash_key_size*. +* If *rss_key* is NULL, drivers are free to use a random or a default key. +*/ +uint8_t rss_key[MAX_RSS_KEY_LEN ]; +/** +* Indicates the type of packets or the specific part of packets to +* which RSS hashing is to be applied. +*/ +uint64_t rss_hf; +/** +* Hash algorithm. +*/ +enum rte_eth_hash_function algorithm; +}; + +int sprint_nt_rss_mask (char *str,uint16_t str_len,const char *prefix,uint64_t hash_mask); +struct flow_eth_dev {/* NIC that owns this port device */ struct flow_nic_dev *ndev;
@@ -49,6 +80,11 @@ struct flow_eth_dev {struct flow_eth_dev *next; }; +enum flow_nic_hash_e { +HASH_ALGO_ROUND_ROBIN =0 , +HASH_ALGO_5TUPLE , +}; +/* registered NIC backends */ struct flow_nic_dev {uint8_t adapter_no;/* physical adapter no in the host system */
@@ -191,4 +227,8 @@ void flow_nic_free_resource(struct flow_nic_dev *ndev, enum res_type_e res_type,int flow_nic_ref_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int index);int flow_nic_deref_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int index); +int flow_nic_set_hasher (struct flow_nic_dev *ndev,int hsh_idx,enum flow_nic_hash_e algorithm); +int flow_nic_set_hasher_fields (struct flow_nic_dev *ndev,int hsh_idx, +struct nt_eth_rss_conf rss_conf); +#endif
drivers/net/ntnic/include/flow_api_engine.h +17 -0
@@ -129,6 +129,7 @@ struct km_flow_def_s {int bank_used;uint32_t *cuckoo_moves;/* for CAM statistics only */ struct cam_distrib_s *cam_dist; +struct hasher_s *hsh;/* TCAM specific bank management */ struct tcam_distrib_s *tcam_dist;
@@ -136,6 +137,17 @@ struct km_flow_def_s {int tcam_record; }; +/* +* RSS configuration, see struct rte_flow_action_rss +*/ +struct hsh_def_s { +enum rte_eth_hash_function func;/* RSS hash function to apply */ +/* RSS hash types, see definition of RTE_ETH_RSS_* for hash calculation options */ +uint64_t types; +uint32_t key_len;/* Hash key length in bytes. */ +const uint8_t *key;/* Hash key. */ +}; +/* * Tunnel encapsulation header definition */
@@ -247,6 +259,11 @@ struct nic_flow_def {* Key Matcher flow definitions */ struct km_flow_def_s km; + +/* +* Hash module RSS definitions +*/ +struct hsh_def_s hsh; };enum flow_handle_type {
drivers/net/ntnic/include/hw_mod_backend.h +20 -0
@@ -149,14 +149,27 @@ enum km_flm_if_select_e { int debugenum frame_offs_e { +DYN_SOF =0 ,DYN_L2 =1 ,DYN_FIRST_VLAN =2 , +DYN_MPLS =3 ,DYN_L3 =4 , +DYN_ID_IPV4_6 =5 , +DYN_FINAL_IP_DST =6 ,DYN_L4 =7 ,DYN_L4_PAYLOAD =8 , +DYN_TUN_PAYLOAD =9 , +DYN_TUN_L2 =10 , +DYN_TUN_VLAN =11 , +DYN_TUN_MPLS =12 ,DYN_TUN_L3 =13 , +DYN_TUN_ID_IPV4_6 =14 , +DYN_TUN_FINAL_IP_DST =15 ,DYN_TUN_L4 =16 ,DYN_TUN_L4_PAYLOAD =17 , +DYN_EOF =18 , +DYN_L3_PAYLOAD_END =19 , +DYN_TUN_L3_PAYLOAD_END =20 ,SB_VNI =SWX_INFO |1 ,SB_MAC_PORT =SWX_INFO |2 ,SB_KCC_ID =SWX_INFO |3
@@ -227,6 +240,11 @@ enum { }; +enum { +HASH_HASH_NONE =0 , +HASH_5TUPLE =8 , +}; +enum {CPY_SELECT_DSCP_IPV4 =0 ,CPY_SELECT_DSCP_IPV6 =1 ,
@@ -670,6 +688,8 @@ int hw_mod_hsh_alloc(struct flow_api_backend_s *be);void hw_mod_hsh_free (struct flow_api_backend_s *be);int hw_mod_hsh_reset (struct flow_api_backend_s *be);int hw_mod_hsh_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_hsh_rcp_set (struct flow_api_backend_s *be,enum hw_hsh_e field,uint32_t index, +uint32_t word_off,uint32_t value);struct qsl_func_s {COMMON_FUNC_INFO_S ;
drivers/net/ntnic/include/stream_binary_flow_api.h +25 -0
@@ -12,6 +12,31 @@/* Max RSS hash key length in bytes */ #define MAX_RSS_KEY_LEN 40 +/* NT specific MASKs for RSS configuration */ +/* NOTE: Masks are required for correct RSS configuration, do not modify them! */ +#define NT_ETH_RSS_IPV4_MASK \ + (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \ + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP) + +#define NT_ETH_RSS_IPV6_MASK \ + (RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_IPV6_EX | \ + RTE_ETH_RSS_IPV6_TCP_EX | RTE_ETH_RSS_IPV6_UDP_EX | RTE_ETH_RSS_NONFRAG_IPV6_OTHER | \ + RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP) + +#define NT_ETH_RSS_IP_MASK \ + (NT_ETH_RSS_IPV4_MASK | NT_ETH_RSS_IPV6_MASK | RTE_ETH_RSS_L3_SRC_ONLY | \ + RTE_ETH_RSS_L3_DST_ONLY) + +/* List of all RSS flags supported for RSS calculation offload */ +#define NT_ETH_RSS_OFFLOAD_MASK \ + (RTE_ETH_RSS_ETH | RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP | \ + RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_SRC_ONLY | RTE_ETH_RSS_L2_DST_ONLY | \ + RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY | RTE_ETH_RSS_L3_SRC_ONLY | \ + RTE_ETH_RSS_L3_DST_ONLY | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_LEVEL_MASK | \ + RTE_ETH_RSS_IPV4_CHKSUM | RTE_ETH_RSS_L4_CHKSUM | RTE_ETH_RSS_PORT | RTE_ETH_RSS_GTPU) +/* * Flow frontend for binary programming interface */
drivers/net/ntnic/meson.build +1 -0
@@ -56,6 +56,7 @@ sources = files( 'nthw/flow_api/profile_inline/flow_api_hw_db_inline.c', 'nthw/flow_api/flow_backend/flow_backend.c', 'nthw/flow_api/flow_filter.c', + 'nthw/flow_api/flow_hasher.c', 'nthw/flow_api/flow_kcc.c', 'nthw/flow_api/flow_km.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c',
drivers/net/ntnic/nthw/flow_api/flow_api.c +212 -0
230 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/flow_hasher.c new file +156 -0
156 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/flow_hasher.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef _FLOW_HASHER_H_ +#define _FLOW_HASHER_H_ + +#include <stdint.h> + +struct hasher_s { +int banks; +int cam_records_bw; +uint32_t cam_records_bw_mask; +int cam_bw; +}; + +int init_hasher (struct hasher_s *hsh,int _banks,int nb_records); +uint32_t gethash (struct hasher_s *hsh,const uint32_t key[16 ],int *result); + +#endif /* _FLOW_HASHER_H_ */
drivers/net/ntnic/nthw/flow_api/flow_km.c +25 -0
@@ -9,6 +9,7 @@#include "hw_mod_backend.h" #include "flow_api_engine.h" #include "nt_util.h" +#include "flow_hasher.h" #define MAX_QWORDS 2#define MAX_SWORDS 2
@@ -75,10 +76,25 @@ static int tcam_find_mapping(struct km_flow_def_s *km);void km_attach_ndev_resource_management (struct km_flow_def_s *km,void **handle) { +/* +* KM entries occupied in CAM - to manage the cuckoo shuffling +* and manage CAM population and usage +* KM entries occupied in TCAM - to manage population and usage +*/ +if (!*handle) { + *handle =calloc (1 , + (size_t )CAM_ENTRIES +sizeof (uint32_t ) + (size_t )TCAM_ENTRIES + +sizeof (struct hasher_s )); +NT_LOG (DBG ,FILTER ,"Allocate NIC DEV CAM and TCAM record manager" ); + } + km->cam_dist = (struct cam_distrib_s *)*handle; km->cuckoo_moves = (uint32_t *)((char *)km->cam_dist +CAM_ENTRIES ); km->tcam_dist = (struct tcam_distrib_s *)((char *)km->cam_dist +CAM_ENTRIES +sizeof (uint32_t )); + + km->hsh = (struct hasher_s *)((char *)km->tcam_dist +TCAM_ENTRIES ); +init_hasher (km->hsh, km->be->km.nb_cam_banks, km->be->km.nb_cam_records); }void km_free_ndev_resource_management (void **handle)
@@ -839,9 +855,18 @@ static int move_cuckoo_index_level(struct km_flow_def_s *km_parent, int bank_idxstatic int km_write_data_to_cam (struct km_flow_def_s *km) {int res =0 ; +int val[MAX_BANKS ];assert (km->be->km.nb_cam_banks <=MAX_BANKS );assert (km->cam_dist); +/* word list without info set */ +gethash (km->hsh, km->entry_word, val); + +for (uint32_t i =0 ; i < km->be->km.nb_cam_banks; i++) { +/* if paired we start always on an even address - reset bit 0 */ + km->record_indexes[i] = (km->cam_paired) ? val[i] & ~1 : val[i]; + } +NT_LOG (DBG ,FILTER ,"KM HASH [%03X, %03X, %03X]" , km->record_indexes[0 ], km->record_indexes[1 ], km->record_indexes[2 ]);
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c +179 -0
182 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +142 -0
184 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +11 -0
@@ -60,6 +60,10 @@ struct hw_db_km_ft {HW_DB_IDX ; }; +struct hw_db_hsh_idx { +HW_DB_IDX ; +}; +enum hw_db_idx_type {HW_DB_IDX_TYPE_NONE =0 ,HW_DB_IDX_TYPE_COT ,
@@ -68,6 +72,7 @@ enum hw_db_idx_type {HW_DB_IDX_TYPE_SLC_LR ,HW_DB_IDX_TYPE_KM_RCP ,HW_DB_IDX_TYPE_KM_FT , + HW_DB_IDX_TYPE_HSH, };/* Functionality data types */
@@ -133,6 +138,7 @@ struct hw_db_inline_action_set_data {struct {struct hw_db_cot_idx cot;struct hw_db_qsl_idx qsl; +struct hw_db_hsh_idx hsh; }; }; };
@@ -175,6 +181,11 @@ void hw_db_inline_slc_lr_ref(struct flow_nic_dev *ndev, void *db_handle,void hw_db_inline_slc_lr_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_slc_lr_idx idx); +struct hw_db_hsh_idx hw_db_inline_hsh_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_hsh_data *data); +void hw_db_inline_hsh_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_hsh_idx idx); +void hw_db_inline_hsh_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_hsh_idx idx); +/**/ struct hw_db_cat_idx hw_db_inline_cat_add(struct flow_nic_dev *ndev, void *db_handle,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +849 -1
913 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +4 -0
@@ -38,4 +38,8 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev,struct flow_handle *flow, struct rte_flow_error *error); +int flow_nic_set_hasher_fields_inline (struct flow_nic_dev *ndev, +int hsh_idx, +struct nt_eth_rss_conf rss_conf); +#endif /* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/ntnic_mod_reg.h +4 -0
@@ -252,6 +252,10 @@ struct profile_inline_ops {int (*flow_destroy_profile_inline)(struct flow_eth_dev *dev,struct flow_handle *flow,struct rte_flow_error *error); + +int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev, +int hsh_idx, +struct nt_eth_rss_conf rss_conf); };void register_profile_inline_ops (const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 32/86 net/ntnic: add TPE module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The TX Packet Editor is a software abstraction module, that keeps track of the handful of FPGA modules that are used to edit packets in the TX pipeline.
--- drivers/net/ntnic/include/hw_mod_backend.h | 16 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c | 757 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.c | 373 +++++++++ .../profile_inline/flow_api_hw_db_inline.h | 70 ++ .../profile_inline/flow_api_profile_inline.c | 127 ++- 5 files changed, 1342 insertions(+), 1 deletion(-)
drivers/net/ntnic/include/hw_mod_backend.h +16 -0
@@ -889,24 +889,40 @@ void hw_mod_tpe_free(struct flow_api_backend_s *be);int hw_mod_tpe_reset (struct flow_api_backend_s *be);int hw_mod_tpe_rpp_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_rpp_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_rpp_ifr_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_tpe_ifr_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_tpe_ins_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_ins_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_rpl_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_rpl_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_rpl_ext_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_rpl_ext_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_rpl_rpl_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_rpl_rpl_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t *value);int hw_mod_tpe_cpy_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_cpy_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_hfu_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_hfu_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_csu_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_csu_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);enum debug_mode_e {FLOW_BACKEND_DEBUG_MODE_NONE =0x0000 ,
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c +757 -0
802 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +373 -0
415 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +70 -0
94 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +126 -1
158 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 33/86 net/ntnic: add FLM module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows.
--- drivers/net/ntnic/include/hw_mod_backend.h | 42 +++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c | 190 +++++++++++++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 257 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.c | 234 ++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.h | 33 +++ .../profile_inline/flow_api_profile_inline.c | 224 ++++++++++++++- .../flow_api_profile_inline_config.h | 58 ++++ drivers/net/ntnic/ntutil/nt_util.h | 8 + 8 files changed, 1042 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h
drivers/net/ntnic/include/hw_mod_backend.h +42 -0
@@ -367,6 +367,18 @@ int hw_mod_cat_cfn_flush(struct flow_api_backend_s *be, int start_idx, int countint hw_mod_cat_cfn_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index,int word_off,uint32_t value);/* KCE/KCS/FTE KM */ +int hw_mod_cat_kce_km_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num, +int start_idx,int count); +int hw_mod_cat_kce_km_set (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t value); +int hw_mod_cat_kce_km_get (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t *value); +int hw_mod_cat_kcs_km_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num, +int start_idx,int count); +int hw_mod_cat_kcs_km_set (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t value); +int hw_mod_cat_kcs_km_get (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t *value);int hw_mod_cat_fte_km_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num,int start_idx,int count); int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
@@ -374,6 +386,18 @@ int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,int hw_mod_cat_fte_km_get (struct flow_api_backend_s *be,enum hw_cat_e field,enum km_flm_if_select_e if_num,int index,uint32_t *value);/* KCE/KCS/FTE FLM */ +int hw_mod_cat_kce_flm_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num, +int start_idx,int count); +int hw_mod_cat_kce_flm_set (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t value); +int hw_mod_cat_kce_flm_get (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t *value); +int hw_mod_cat_kcs_flm_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num, +int start_idx,int count); +int hw_mod_cat_kcs_flm_set (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t value); +int hw_mod_cat_kcs_flm_get (struct flow_api_backend_s *be,enum hw_cat_e field, +enum km_flm_if_select_e if_num,int index,uint32_t *value);int hw_mod_cat_fte_flm_flush (struct flow_api_backend_s *be,enum km_flm_if_select_e if_num,int start_idx,int count); int hw_mod_cat_fte_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
@@ -384,10 +408,14 @@ int hw_mod_cat_fte_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,int hw_mod_cat_cte_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_cat_cte_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index,uint32_t value); +int hw_mod_cat_cte_get (struct flow_api_backend_s *be,enum hw_cat_e field,int index, +uint32_t *value);int hw_mod_cat_cts_flush (struct flow_api_backend_s *be,int start_idx,int count);int hw_mod_cat_cts_set (struct flow_api_backend_s *be,enum hw_cat_e field,int index,uint32_t value); +int hw_mod_cat_cts_get (struct flow_api_backend_s *be,enum hw_cat_e field,int index, +uint32_t *value);int hw_mod_cat_cot_flush (struct flow_api_backend_s *be,int start_idx,int count); int hw_mod_cat_cot_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
@@ -638,7 +666,21 @@ int hw_mod_flm_reset(struct flow_api_backend_s *be);int hw_mod_flm_control_flush (struct flow_api_backend_s *be);int hw_mod_flm_control_set (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t value); +int hw_mod_flm_status_update (struct flow_api_backend_s *be); +int hw_mod_flm_status_get (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t *value); +int hw_mod_flm_scan_flush (struct flow_api_backend_s *be); +int hw_mod_flm_scan_set (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t value); + +int hw_mod_flm_load_bin_flush (struct flow_api_backend_s *be); +int hw_mod_flm_load_bin_set (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t value); + +int hw_mod_flm_prio_flush (struct flow_api_backend_s *be); +int hw_mod_flm_prio_set (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t value); + +int hw_mod_flm_pst_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_flm_pst_set (struct flow_api_backend_s *be,enum hw_flm_e field,int index, +uint32_t value);int hw_mod_flm_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count);
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c +190 -0
214 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +257 -0
268 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +234 -0
288 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +33 -0
@@ -32,6 +32,10 @@ struct hw_db_idx {HW_DB_IDX ; }; +struct hw_db_match_set_idx { +HW_DB_IDX ; +}; +struct hw_db_action_set_idx {HW_DB_IDX ; };
@@ -106,6 +110,13 @@ struct hw_db_tpe_ext_idx {HW_DB_IDX ; }; +struct hw_db_flm_idx { +HW_DB_IDX ; +}; +struct hw_db_flm_ft { +HW_DB_IDX ; +}; +struct hw_db_km_idx {HW_DB_IDX ; };
@@ -128,6 +139,7 @@ enum hw_db_idx_type {HW_DB_IDX_TYPE_TPE_EXT ,HW_DB_IDX_TYPE_KM_RCP , +HW_DB_IDX_TYPE_FLM_FT ,HW_DB_IDX_TYPE_KM_FT , HW_DB_IDX_TYPE_HSH, };
@@ -211,6 +223,17 @@ struct hw_db_inline_km_ft_data {struct hw_db_action_set_idx action_set; }; +struct hw_db_inline_flm_ft_data { +/* Group zero flows should set jump. */ +/* Group nonzero flows should set group. */ +int is_group_zero; +union { +int jump; +int group; + }; +struct hw_db_action_set_idx action_set; +}; +/**/ int hw_db_inline_create (struct flow_nic_dev *ndev,void **db_handle);
@@ -277,6 +300,16 @@ void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct/**/ +void hw_db_inline_flm_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_flm_idx idx); + +struct hw_db_flm_ft hw_db_inline_flm_ft_default (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_flm_ft_data *data); +struct hw_db_flm_ft hw_db_inline_flm_ft_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_flm_ft_data *data); +void hw_db_inline_flm_ft_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_flm_ft idx); +void hw_db_inline_flm_ft_deref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_flm_ft idx); +int hw_db_inline_setup_mbr_filter (struct flow_nic_dev *ndev,uint32_t cat_hw_id,uint32_t ft,uint32_t qsl_hw_id);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +220 -4
274 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h new file +58 -0
58 lines not on this page · raw message
drivers/net/ntnic/ntutil/nt_util.h +8 -0
@@ -16,6 +16,14 @@#define ARRAY_SIZE (arr) RTE_DIM(arr)#endif +/* +* Windows size in seconds for measuring FLM load +* and Port load. +* The windows size must max be 3 min in order to +* prevent overflow. +*/ +#define FLM_LOAD_WINDOWS_SIZE 2ULL +#define PCIIDENT_TO_DOMAIN (pci_ident) ((uint16_t)(((unsigned int)(pci_ident) >> 16) & 0xFFFFU))#define PCIIDENT_TO_BUSNR (pci_ident) ((uint8_t)(((unsigned int)(pci_ident) >> 8) & 0xFFU))#define PCIIDENT_TO_DEVNR (pci_ident) ((uint8_t)(((unsigned int)(pci_ident) >> 3) & 0x1FU))
Signature · 1 line
2.45.0
PATCH v4 34/86 net/ntnic: add flm rcp module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows.
--- drivers/net/ntnic/include/hw_mod_backend.h | 4 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 133 ++++++++++++ .../profile_inline/flow_api_hw_db_inline.c | 195 +++++++++++++++++- .../profile_inline/flow_api_hw_db_inline.h | 20 ++ .../profile_inline/flow_api_profile_inline.c | 42 +++- 5 files changed, 390 insertions(+), 4 deletions(-)
drivers/net/ntnic/include/hw_mod_backend.h +4 -0
@@ -683,6 +683,10 @@ int hw_mod_flm_pst_set(struct flow_api_backend_s *be, enum hw_flm_e field, int i uint32_t value);int hw_mod_flm_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_flm_rcp_set_mask (struct flow_api_backend_s *be,enum hw_flm_e field,int index, +uint32_t *value); +int hw_mod_flm_rcp_set (struct flow_api_backend_s *be,enum hw_flm_e field,int index, +uint32_t value);int hw_mod_flm_scrub_flush (struct flow_api_backend_s *be,int start_idx,int count);
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +133 -0
136 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +194 -1
252 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +20 -0
@@ -138,6 +138,7 @@ enum hw_db_idx_type {HW_DB_IDX_TYPE_TPE ,HW_DB_IDX_TYPE_TPE_EXT , +HW_DB_IDX_TYPE_FLM_RCP ,HW_DB_IDX_TYPE_KM_RCP ,HW_DB_IDX_TYPE_FLM_FT , HW_DB_IDX_TYPE_KM_FT,
@@ -165,6 +166,22 @@ struct hw_db_inline_cat_data {uint8_t ip_prot_tunnel; }; +struct hw_db_inline_flm_rcp_data { +uint64_t qw0_dyn :5 ; +uint64_t qw0_ofs :8 ; +uint64_t qw4_dyn :5 ; +uint64_t qw4_ofs :8 ; +uint64_t sw8_dyn :5 ; +uint64_t sw8_ofs :8 ; +uint64_t sw9_dyn :5 ; +uint64_t sw9_ofs :8 ; +uint64_t outer_prot :1 ; +uint64_t inner_prot :1 ; +uint64_t padding :10 ; + +uint32_t mask[10 ]; +}; +struct hw_db_inline_qsl_data {uint32_t discard :1 ;uint32_t drop :1 ;
@@ -300,7 +317,10 @@ void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct/**/ +struct hw_db_flm_idx hw_db_inline_flm_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_flm_rcp_data *data,int group);void hw_db_inline_flm_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_flm_idx idx); +void hw_db_inline_flm_deref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_flm_idx idx);struct hw_db_flm_ft hw_db_inline_flm_ft_default (struct flow_nic_dev *ndev,void *db_handle,const struct hw_db_inline_flm_ft_data *data);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +39 -3
72 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 35/86 net/ntnic: add learn flow queue handling
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Implements thread for handling flow learn queue
--- drivers/net/ntnic/include/hw_mod_backend.h | 5 + drivers/net/ntnic/include/ntdrv_4ga.h | 1 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 33 +++++++ .../flow_api/profile_inline/flm_lrn_queue.c | 42 +++++++++ .../flow_api/profile_inline/flm_lrn_queue.h | 11 +++ .../profile_inline/flow_api_profile_inline.c | 48 ++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 94 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 7 ++ 8 files changed, 241 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +5 -0
@@ -688,6 +688,11 @@ int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field,int hw_mod_flm_rcp_set (struct flow_api_backend_s *be,enum hw_flm_e field,int index,uint32_t value); +int hw_mod_flm_lrn_data_set_flush (struct flow_api_backend_s *be,enum hw_flm_e field, +const uint32_t *value,uint32_t records, +uint32_t *handled_records,uint32_t *inf_word_cnt, +uint32_t *sta_word_cnt); +int hw_mod_flm_scrub_flush (struct flow_api_backend_s *be,int start_idx,int count);struct hsh_func_s {
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
@@ -14,6 +14,7 @@ typedef struct ntdrv_4ga_s {char *p_drv_name;volatile bool b_shutdown; + rte_thread_t flm_thread; } ntdrv_4ga_t;#endif /* __NTDRV_4GA_H__ */
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +33 -0
@@ -712,3 +712,36 @@ int hw_mod_flm_rcp_set(struct flow_api_backend_s *be, enum hw_flm_e field, int ireturn hw_mod_flm_rcp_mod (be, field, index, &value,0 ); } + +int hw_mod_flm_lrn_data_set_flush (struct flow_api_backend_s *be,enum hw_flm_e field, +const uint32_t *value,uint32_t records, +uint32_t *handled_records,uint32_t *inf_word_cnt, +uint32_t *sta_word_cnt) +{ +int ret =0 ; + +switch (_VER_) { +case 25 : +switch (field) { +case HW_FLM_FLOW_LRN_DATA : + ret = be->iface->flm_lrn_data_flush (be->be_dev, &be->flm, value, records, + handled_records, + (sizeof (struct flm_v25_lrn_data_s ) / +sizeof (uint32_t )), + inf_word_cnt, sta_word_cnt); +break ; + +default : +UNSUP_FIELD_LOG ; +return UNSUP_FIELD ; + } + +break ; + +default : +UNSUP_VER_LOG ; +return UNSUP_VER ; + } + +return ret; +}
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c +42 -0
53 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h +11 -0
@@ -8,7 +8,18 @@#include <stdint.h> +typedef struct read_record { +uint32_t *p; +uint32_t num; +}read_record ; + +void *flm_lrn_queue_create (void ); +void flm_lrn_queue_free (void *q); +uint32_t *flm_lrn_queue_get_write_buffer (void *q);void flm_lrn_queue_release_write_buffer (void *q); +read_record flm_lrn_queue_get_read_buffer (void *q); +void flm_lrn_queue_release_read_buffer (void *q,uint32_t num); +#endif /* _FLM_LRN_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +48 -0
60 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +94 -0
136 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +7 -0
@@ -256,6 +256,13 @@ struct profile_inline_ops {int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf); + +/* +* NT Flow FLM queue API +*/ +void (*flm_setup_queues)(void ); +void (*flm_free_queues)(void ); +uint32_t (*flm_update)(struct flow_eth_dev *dev); };void register_profile_inline_ops (const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 36/86 net/ntnic: match and action db attributes were added
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Implements match/action dereferencing
--- .../profile_inline/flow_api_hw_db_inline.c | 795 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.h | 35 + .../profile_inline/flow_api_profile_inline.c | 55 ++ 3 files changed, 885 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +795 -0
@@ -9,6 +9,9 @@#include "flow_api_hw_db_inline.h" #include "rte_common.h" +#define HW_DB_INLINE_ACTION_SET_NB 512 +#define HW_DB_INLINE_MATCH_SET_NB 512 +#define HW_DB_FT_LOOKUP_KEY_A 0#define HW_DB_FT_TYPE_KM 1
@@ -110,6 +113,20 @@ struct hw_db_inline_resource_db {int cfn_hw;int ref; } *cfn; + +uint32_t cfn_priority_counter; +uint32_t set_priority_counter; + +struct hw_db_inline_resource_db_action_set { +struct hw_db_inline_action_set_data data; +int ref; + } action_set[HW_DB_INLINE_ACTION_SET_NB ]; + +struct hw_db_inline_resource_db_match_set { +struct hw_db_inline_match_set_data data; +int ref; +uint32_t set_priority; + } match_set[HW_DB_INLINE_MATCH_SET_NB ]; };int hw_db_inline_create (struct flow_nic_dev *ndev,void **db_handle)
@@ -292,6 +309,16 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, structcase HW_DB_IDX_TYPE_NONE :break ; +case HW_DB_IDX_TYPE_MATCH_SET : +hw_db_inline_match_set_deref (ndev, db_handle, + *(struct hw_db_match_set_idx *)&idxs[i]); +break ; + +case HW_DB_IDX_TYPE_ACTION_SET : +hw_db_inline_action_set_deref (ndev, db_handle, + *(struct hw_db_action_set_idx *)&idxs[i]); +break ; +case HW_DB_IDX_TYPE_CAT :hw_db_inline_cat_deref (ndev, db_handle, *(struct hw_db_cat_idx *)&idxs[i]);break ;
@@ -360,6 +387,12 @@ const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,case HW_DB_IDX_TYPE_NONE :return NULL ; +case HW_DB_IDX_TYPE_MATCH_SET : +return &db->match_set[idxs[i].ids].data; + +case HW_DB_IDX_TYPE_ACTION_SET : +return &db->action_set[idxs[i].ids].data; +case HW_DB_IDX_TYPE_CAT :return &db->cat[idxs[i].ids].data;
@@ -552,6 +585,763 @@ static void hw_db_inline_setup_default_flm_rcp(struct flow_nic_dev *ndev, int fl } +static void hw_db_copy_ft (struct flow_nic_dev *ndev,int type,int cfn_dst,int cfn_src, +int lookup,int flow_type) +{ +const int max_lookups =4 ; +const int cat_funcs = (int )ndev->be.cat.nb_cat_funcs /8 ; + +int fte_index_dst = (8 * flow_type + cfn_dst / cat_funcs) * max_lookups + lookup; +int fte_field_dst = cfn_dst % cat_funcs; + +int fte_index_src = (8 * flow_type + cfn_src / cat_funcs) * max_lookups + lookup; +int fte_field_src = cfn_src % cat_funcs; + +uint32_t current_bm_dst =0 ; +uint32_t current_bm_src =0 ; +uint32_t fte_field_bm_dst =1 << fte_field_dst; +uint32_t fte_field_bm_src =1 << fte_field_src; + +switch (type) { +case HW_DB_FT_TYPE_FLM : +hw_mod_cat_fte_flm_get (&ndev->be,HW_CAT_FTE_ENABLE_BM ,KM_FLM_IF_FIRST , + fte_index_dst, ¤t_bm_dst); +hw_mod_cat_fte_flm_get (&ndev->be,HW_CAT_FTE_ENABLE_BM ,KM_FLM_IF_FIRST , + fte_index_src, ¤t_bm_src); +break ; + +case HW_DB_FT_TYPE_KM : +hw_mod_cat_fte_km_get (&ndev->be,HW_CAT_FTE_ENABLE_BM ,KM_FLM_IF_FIRST , + fte_index_dst, ¤t_bm_dst); +hw_mod_cat_fte_km_get (&ndev->be,HW_CAT_FTE_ENABLE_BM ,KM_FLM_IF_FIRST , + fte_index_src, ¤t_bm_src); +break ; + +default : +break ; + } + +uint32_t enable = current_bm_src & fte_field_bm_src; +uint32_t final_bm_dst = enable ? (fte_field_bm_dst | current_bm_dst) + : (~fte_field_bm_dst & current_bm_dst); + +if (current_bm_dst != final_bm_dst) { +switch (type) { +case HW_DB_FT_TYPE_FLM : +hw_mod_cat_fte_flm_set (&ndev->be,HW_CAT_FTE_ENABLE_BM ,KM_FLM_IF_FIRST , + fte_index_dst, final_bm_dst); +hw_mod_cat_fte_flm_flush (&ndev->be,KM_FLM_IF_FIRST , fte_index_dst,1 ); +break ; + +case HW_DB_FT_TYPE_KM : +hw_mod_cat_fte_km_set (&ndev->be,HW_CAT_FTE_ENABLE_BM ,KM_FLM_IF_FIRST , + fte_index_dst, final_bm_dst); +hw_mod_cat_fte_km_flush (&ndev->be,KM_FLM_IF_FIRST , fte_index_dst,1 ); +break ; + +default : +break ; + } + } +} + + +static int hw_db_inline_filter_apply (struct flow_nic_dev *ndev, +struct hw_db_inline_resource_db *db, +int cat_hw_id, +struct hw_db_match_set_idx match_set_idx, +struct hw_db_flm_ft flm_ft_idx, +struct hw_db_action_set_idx action_set_idx) +{ + (void )match_set_idx; + (void )flm_ft_idx; + +const struct hw_db_inline_match_set_data *match_set = + &db->match_set[match_set_idx.ids].data; +const struct hw_db_inline_cat_data *cat = &db->cat[match_set->cat.ids].data; + +const int km_ft = match_set->km_ft.id1; +const int km_rcp = (int )db->km[match_set->km.id1].data.rcp; + +const int flm_ft = flm_ft_idx.id1; +const int flm_rcp = flm_ft_idx.id2; + +const struct hw_db_inline_action_set_data *action_set = + &db->action_set[action_set_idx.ids].data; +const struct hw_db_inline_cot_data *cot = &db->cot[action_set->cot.ids].data; + +const int qsl_hw_id = action_set->qsl.ids; +const int slc_lr_hw_id = action_set->slc_lr.ids; +const int tpe_hw_id = action_set->tpe.ids; +const int hsh_hw_id = action_set->hsh.ids; + +/* Setup default FLM RCP if needed */ +if (flm_rcp >0 && db->flm[flm_rcp].ref <=0 ) +hw_db_inline_setup_default_flm_rcp (ndev, flm_rcp); + +/* Setup CAT.CFN */ + { +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_SET_ALL_DEFAULTS , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ENABLE , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_INV , cat_hw_id,0 ,0x0 ); + +/* Protocol checks */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_INV , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_ISL , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_CFP , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_MAC , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_L2 , cat_hw_id,0 , cat->ptc_mask_l2); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_VNTAG , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_VLAN , cat_hw_id,0 , cat->vlan_mask); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_MPLS , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_L3 , cat_hw_id,0 , cat->ptc_mask_l3); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_FRAG , cat_hw_id,0 , + cat->ptc_mask_frag); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_IP_PROT , cat_hw_id,0 , cat->ip_prot); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_L4 , cat_hw_id,0 , cat->ptc_mask_l4); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TUNNEL , cat_hw_id,0 , + cat->ptc_mask_tunnel); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_MPLS , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L3 , cat_hw_id,0 , + cat->ptc_mask_l3_tunnel); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_FRAG , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_IP_PROT , cat_hw_id,0 , + cat->ip_prot_tunnel); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L4 , cat_hw_id,0 , + cat->ptc_mask_l4_tunnel); + +/* Error checks */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_INV , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_CV , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_FCS , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_TRUNC , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_L3_CS , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_L4_CS , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_TNL_L3_CS , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_TNL_L4_CS , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_TTL_EXP , cat_hw_id,0 , + cat->err_mask_ttl); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ERR_TNL_TTL_EXP , cat_hw_id,0 , + cat->err_mask_ttl_tunnel); + +/* MAC port check */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_MAC_PORT , cat_hw_id,0 , + cat->mac_port_mask); + +/* Pattern match checks */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_CMP , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_DCT , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_EXT_INV , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_CMB , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_AND_INV , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_OR_INV , cat_hw_id,0 ,-1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PM_INV , cat_hw_id,0 ,-1 ); + +/* Length checks */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_LC , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_LC_INV , cat_hw_id,0 ,-1 ); + +/* KM and FLM */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_KM0_OR , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_KM1_OR , cat_hw_id,0 ,0x3 ); + +hw_mod_cat_cfn_flush (&ndev->be, cat_hw_id,1 ); + } + +/* Setup CAT.CTS */ + { +const int offset = ((int )ndev->be.cat.cts_num +1 ) /2 ; + +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id +0 , cat_hw_id); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id +0 ,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id +1 , hsh_hw_id); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id +1 , qsl_hw_id); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id +2 ,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id +2 , + slc_lr_hw_id); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id +3 ,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id +3 ,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id +4 ,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id +4 ,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id +5 , tpe_hw_id); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id +5 ,0 ); + +hw_mod_cat_cts_flush (&ndev->be, offset * cat_hw_id,6 ); + } + +/* Setup CAT.CTE */ + { +hw_mod_cat_cte_set (&ndev->be,HW_CAT_CTE_ENABLE_BM , cat_hw_id, +0x001 |0x004 | (qsl_hw_id ?0x008 :0 ) | + (slc_lr_hw_id ?0x020 :0 ) |0x040 | + (tpe_hw_id ?0x400 :0 )); +hw_mod_cat_cte_flush (&ndev->be, cat_hw_id,1 ); + } + +/* Setup CAT.KM */ + { +uint32_t bm =0 ; + +hw_mod_cat_kcs_km_set (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cat_hw_id, + km_rcp); +hw_mod_cat_kcs_km_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id,1 ); + +hw_mod_cat_kce_km_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , &bm); +hw_mod_cat_kce_km_set (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , bm | (1 << (cat_hw_id %8 ))); +hw_mod_cat_kce_km_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id /8 ,1 ); + +hw_db_set_ft (ndev,HW_DB_FT_TYPE_KM , cat_hw_id,HW_DB_FT_LOOKUP_KEY_A , km_ft,1 ); + } + +/* Setup CAT.FLM */ + { +uint32_t bm =0 ; + +hw_mod_cat_kcs_flm_set (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cat_hw_id, + flm_rcp); +hw_mod_cat_kcs_flm_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id,1 ); + +hw_mod_cat_kce_flm_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , &bm); +hw_mod_cat_kce_flm_set (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , bm | (1 << (cat_hw_id %8 ))); +hw_mod_cat_kce_flm_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id /8 ,1 ); + +hw_db_set_ft (ndev,HW_DB_FT_TYPE_FLM , cat_hw_id,HW_DB_FT_LOOKUP_KEY_A , km_ft,1 ); +hw_db_set_ft (ndev,HW_DB_FT_TYPE_FLM , cat_hw_id,HW_DB_FT_LOOKUP_KEY_C , flm_ft,1 ); + } + +/* Setup CAT.COT */ + { +hw_mod_cat_cot_set (&ndev->be,HW_CAT_COT_PRESET_ALL , cat_hw_id,0 ); +hw_mod_cat_cot_set (&ndev->be,HW_CAT_COT_COLOR , cat_hw_id, cot->frag_rcp <<10 ); +hw_mod_cat_cot_set (&ndev->be,HW_CAT_COT_KM , cat_hw_id, + cot->matcher_color_contrib); +hw_mod_cat_cot_flush (&ndev->be, cat_hw_id,1 ); + } + +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ENABLE , cat_hw_id,0 ,0x1 ); +hw_mod_cat_cfn_flush (&ndev->be, cat_hw_id,1 ); + +return 0 ; +} + +static void hw_db_inline_filter_clear (struct flow_nic_dev *ndev, +struct hw_db_inline_resource_db *db, +int cat_hw_id) +{ +/* Setup CAT.CFN */ +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_SET_ALL_DEFAULTS , cat_hw_id,0 ,0x0 ); +hw_mod_cat_cfn_flush (&ndev->be, cat_hw_id,1 ); + +/* Setup CAT.CTS */ + { +const int offset = ((int )ndev->be.cat.cts_num +1 ) /2 ; + +for (int i =0 ; i <6 ; ++i) { +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cat_hw_id + i,0 ); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cat_hw_id + i,0 ); + } + +hw_mod_cat_cts_flush (&ndev->be, offset * cat_hw_id,6 ); + } + +/* Setup CAT.CTE */ + { +hw_mod_cat_cte_set (&ndev->be,HW_CAT_CTE_ENABLE_BM , cat_hw_id,0 ); +hw_mod_cat_cte_flush (&ndev->be, cat_hw_id,1 ); + } + +/* Setup CAT.KM */ + { +uint32_t bm =0 ; + +hw_mod_cat_kcs_km_set (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cat_hw_id, +0 ); +hw_mod_cat_kcs_km_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id,1 ); + +hw_mod_cat_kce_km_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , &bm); +hw_mod_cat_kce_km_set (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , bm & ~(1 << (cat_hw_id %8 ))); +hw_mod_cat_kce_km_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id /8 ,1 ); + +for (int ft =0 ; ft < (int )db->nb_km_ft; ++ft) { +hw_db_set_ft (ndev,HW_DB_FT_TYPE_KM , cat_hw_id,HW_DB_FT_LOOKUP_KEY_A , ft, +0 ); + } + } + +/* Setup CAT.FLM */ + { +uint32_t bm =0 ; + +hw_mod_cat_kcs_flm_set (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cat_hw_id, +0 ); +hw_mod_cat_kcs_flm_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id,1 ); + +hw_mod_cat_kce_flm_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , &bm); +hw_mod_cat_kce_flm_set (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cat_hw_id /8 , bm & ~(1 << (cat_hw_id %8 ))); +hw_mod_cat_kce_flm_flush (&ndev->be,KM_FLM_IF_FIRST , cat_hw_id /8 ,1 ); + +for (int ft =0 ; ft < (int )db->nb_flm_ft; ++ft) { +hw_db_set_ft (ndev,HW_DB_FT_TYPE_FLM , cat_hw_id,HW_DB_FT_LOOKUP_KEY_A , ft, +0 ); +hw_db_set_ft (ndev,HW_DB_FT_TYPE_FLM , cat_hw_id,HW_DB_FT_LOOKUP_KEY_C , ft, +0 ); + } + } + +hw_mod_cat_cot_set (&ndev->be,HW_CAT_COT_PRESET_ALL , cat_hw_id,0 ); +hw_mod_cat_cot_flush (&ndev->be, cat_hw_id,1 ); +} + +static void hw_db_inline_filter_copy (struct flow_nic_dev *ndev, +struct hw_db_inline_resource_db *db,int cfn_dst,int cfn_src) +{ +uint32_t val =0 ; + +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_COPY_FROM , cfn_dst,0 , cfn_src); +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ENABLE , cfn_dst,0 ,0x0 ); +hw_mod_cat_cfn_flush (&ndev->be, cfn_dst,1 ); + +/* Setup CAT.CTS */ + { +const int offset = ((int )ndev->be.cat.cts_num +1 ) /2 ; + +for (int i =0 ; i < offset; ++i) { +hw_mod_cat_cts_get (&ndev->be,HW_CAT_CTS_CAT_A , offset * cfn_src + i, + &val); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_A , offset * cfn_dst + i, val); +hw_mod_cat_cts_get (&ndev->be,HW_CAT_CTS_CAT_B , offset * cfn_src + i, + &val); +hw_mod_cat_cts_set (&ndev->be,HW_CAT_CTS_CAT_B , offset * cfn_dst + i, val); + } + +hw_mod_cat_cts_flush (&ndev->be, offset * cfn_dst, offset); + } + +/* Setup CAT.CTE */ + { +hw_mod_cat_cte_get (&ndev->be,HW_CAT_CTE_ENABLE_BM , cfn_src, &val); +hw_mod_cat_cte_set (&ndev->be,HW_CAT_CTE_ENABLE_BM , cfn_dst, val); +hw_mod_cat_cte_flush (&ndev->be, cfn_dst,1 ); + } + +/* Setup CAT.KM */ + { +uint32_t bit_src =0 ; + +hw_mod_cat_kcs_km_get (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cfn_src, + &val); +hw_mod_cat_kcs_km_set (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cfn_dst, + val); +hw_mod_cat_kcs_km_flush (&ndev->be,KM_FLM_IF_FIRST , cfn_dst,1 ); + +hw_mod_cat_kce_km_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cfn_src /8 , &val); + bit_src = (val >> (cfn_src %8 )) &0x1 ; + +hw_mod_cat_kce_km_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cfn_dst /8 , &val); + val &= ~(1 << (cfn_dst %8 )); + +hw_mod_cat_kce_km_set (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cfn_dst /8 , val | (bit_src << (cfn_dst %8 ))); +hw_mod_cat_kce_km_flush (&ndev->be,KM_FLM_IF_FIRST , cfn_dst /8 ,1 ); + +for (int ft =0 ; ft < (int )db->nb_km_ft; ++ft) { +hw_db_copy_ft (ndev,HW_DB_FT_TYPE_KM , cfn_dst, cfn_src, +HW_DB_FT_LOOKUP_KEY_A , ft); + } + } + +/* Setup CAT.FLM */ + { +uint32_t bit_src =0 ; + +hw_mod_cat_kcs_flm_get (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cfn_src, + &val); +hw_mod_cat_kcs_flm_set (&ndev->be,HW_CAT_KCS_CATEGORY ,KM_FLM_IF_FIRST , cfn_dst, + val); +hw_mod_cat_kcs_flm_flush (&ndev->be,KM_FLM_IF_FIRST , cfn_dst,1 ); + +hw_mod_cat_kce_flm_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cfn_src /8 , &val); + bit_src = (val >> (cfn_src %8 )) &0x1 ; + +hw_mod_cat_kce_flm_get (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cfn_dst /8 , &val); + val &= ~(1 << (cfn_dst %8 )); + +hw_mod_cat_kce_flm_set (&ndev->be,HW_CAT_KCE_ENABLE_BM ,KM_FLM_IF_FIRST , + cfn_dst /8 , val | (bit_src << (cfn_dst %8 ))); +hw_mod_cat_kce_flm_flush (&ndev->be,KM_FLM_IF_FIRST , cfn_dst /8 ,1 ); + +for (int ft =0 ; ft < (int )db->nb_flm_ft; ++ft) { +hw_db_copy_ft (ndev,HW_DB_FT_TYPE_FLM , cfn_dst, cfn_src, +HW_DB_FT_LOOKUP_KEY_A , ft); +hw_db_copy_ft (ndev,HW_DB_FT_TYPE_FLM , cfn_dst, cfn_src, +HW_DB_FT_LOOKUP_KEY_C , ft); + } + } + +/* Setup CAT.COT */ + { +hw_mod_cat_cot_set (&ndev->be,HW_CAT_COT_COPY_FROM , cfn_dst, cfn_src); +hw_mod_cat_cot_flush (&ndev->be, cfn_dst,1 ); + } + +hw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_ENABLE , cfn_dst,0 ,0x1 ); +hw_mod_cat_cfn_flush (&ndev->be, cfn_dst,1 ); +} + +/* +* Algorithm for moving CFN entries to make space with respect of priority. +* The algorithm will make the fewest possible moves to fit a new CFN entry. +*/ +static int hw_db_inline_alloc_prioritized_cfn (struct flow_nic_dev *ndev, +struct hw_db_inline_resource_db *db, +struct hw_db_match_set_idx match_set_idx) +{ +const struct hw_db_inline_resource_db_match_set *match_set = + &db->match_set[match_set_idx.ids]; + +uint64_t priority = ((uint64_t )(match_set->data.priority &0xff ) <<56 ) | + ((uint64_t )(0xffffff - (match_set->set_priority &0xffffff )) <<32 ) | + (0xffffffff - ++db->cfn_priority_counter); + +int db_cfn_idx =-1 ; + +struct { +uint64_t priority; +uint32_t idx; + } sorted_priority[db->nb_cat]; + +memset (sorted_priority,0x0 ,sizeof (sorted_priority)); + +uint32_t in_use_count =0 ; + +for (uint32_t i =1 ; i < db->nb_cat; ++i) { +if (db->cfn[i].ref >0 ) { + sorted_priority[db->cfn[i].cfn_hw].priority = db->cfn[i].priority; + sorted_priority[db->cfn[i].cfn_hw].idx = i; + in_use_count +=1 ; + + }else if (db_cfn_idx ==-1 ) { + db_cfn_idx = (int )i; + } + } + +if (in_use_count >= db->nb_cat -1 ) +return -1 ; + +if (in_use_count ==0 ) { + db->cfn[db_cfn_idx].ref =1 ; + db->cfn[db_cfn_idx].cfn_hw =1 ; + db->cfn[db_cfn_idx].priority = priority; +return db_cfn_idx; + } + +int goal =1 ; +int free_before =-1000000 ; +int free_after =1000000 ; +int found_smaller =0 ; + +for (int i =1 ; i < (int )db->nb_cat; ++i) { +if (sorted_priority[i].priority > priority) {/* Bigger */ + goal = i +1 ; + + }else if (sorted_priority[i].priority ==0 ) {/* Not set */ +if (found_smaller) { +if (free_after > i) + free_after = i; + + }else { + free_before = i; + } + + }else {/* Smaller */ + found_smaller =1 ; + } + } + +int diff_before = goal - free_before -1 ; +int diff_after = free_after - goal; + +if (goal < (int )db->nb_cat && sorted_priority[goal].priority ==0 ) { + db->cfn[db_cfn_idx].ref =1 ; + db->cfn[db_cfn_idx].cfn_hw = goal; + db->cfn[db_cfn_idx].priority = priority; +return db_cfn_idx; + } + +if (diff_after <= diff_before) { +for (int i = free_after; i > goal; --i) { +int *cfn_hw = &db->cfn[sorted_priority[i -1 ].idx].cfn_hw; +hw_db_inline_filter_copy (ndev, db, i, *cfn_hw); +hw_db_inline_filter_clear (ndev, db, *cfn_hw); + *cfn_hw = i; + } + + }else { + goal -=1 ; + +for (int i = free_before; i < goal; ++i) { +int *cfn_hw = &db->cfn[sorted_priority[i +1 ].idx].cfn_hw; +hw_db_inline_filter_copy (ndev, db, i, *cfn_hw); +hw_db_inline_filter_clear (ndev, db, *cfn_hw); + *cfn_hw = i; + } + } + + db->cfn[db_cfn_idx].ref =1 ; + db->cfn[db_cfn_idx].cfn_hw = goal; + db->cfn[db_cfn_idx].priority = priority; + +return db_cfn_idx; +} + +static void hw_db_inline_free_prioritized_cfn (struct hw_db_inline_resource_db *db,int cfn_hw) +{ +for (uint32_t i =0 ; i < db->nb_cat; ++i) { +if (db->cfn[i].cfn_hw == cfn_hw) { +memset (&db->cfn[i],0x0 ,sizeof (struct hw_db_inline_resource_db_cfn )); +break ; + } + } +} + +static void hw_db_inline_update_active_filters (struct flow_nic_dev *ndev,void *db_handle, +int group) +{ +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; +struct hw_db_inline_resource_db_flm_rcp *flm_rcp = &db->flm[group]; +struct hw_db_inline_resource_db_flm_cfn_map *cell; + +for (uint32_t match_set_idx =0 ; match_set_idx < db->nb_cat; ++match_set_idx) { +for (uint32_t ft_idx =0 ; ft_idx < db->nb_flm_ft; ++ft_idx) { +int active = flm_rcp->ft[ft_idx].ref >0 && + flm_rcp->match_set[match_set_idx].ref >0 ; + cell = &flm_rcp->cfn_map[match_set_idx * db->nb_flm_ft + ft_idx]; + +if (active && cell->cfn_idx ==0 ) { +/* Setup filter */ + cell->cfn_idx =hw_db_inline_alloc_prioritized_cfn (ndev, db, + flm_rcp->match_set[match_set_idx].idx); +hw_db_inline_filter_apply (ndev, db, db->cfn[cell->cfn_idx].cfn_hw, + flm_rcp->match_set[match_set_idx].idx, + flm_rcp->ft[ft_idx].idx, + group ==0 + ? db->match_set[flm_rcp->match_set[match_set_idx] + .idx.ids] + .data.action_set + : flm_rcp->ft[ft_idx].data.action_set); + } + +if (!active && cell->cfn_idx >0 ) { +/* Teardown filter */ +hw_db_inline_filter_clear (ndev, db, db->cfn[cell->cfn_idx].cfn_hw); +hw_db_inline_free_prioritized_cfn (db, + db->cfn[cell->cfn_idx].cfn_hw); + cell->cfn_idx =0 ; + } + } + } +} + + +/******************************************************************************/ +/* Match set */ +/******************************************************************************/ + +static int hw_db_inline_match_set_compare (const struct hw_db_inline_match_set_data *data1, +const struct hw_db_inline_match_set_data *data2) +{ +return data1->cat.raw == data2->cat.raw && data1->km.raw == data2->km.raw && + data1->km_ft.raw == data2->km_ft.raw && data1->jump == data2->jump; +} + +struct hw_db_match_set_idx +hw_db_inline_match_set_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_match_set_data *data) +{ +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; +struct hw_db_inline_resource_db_flm_rcp *flm_rcp = &db->flm[data->jump]; +struct hw_db_match_set_idx idx = { .raw =0 }; +int found =0 ; + + idx.type =HW_DB_IDX_TYPE_MATCH_SET ; + +for (uint32_t i =0 ; i <HW_DB_INLINE_MATCH_SET_NB ; ++i) { +if (!found && db->match_set[i].ref <=0 ) { + found =1 ; + idx.ids = i; + } + +if (db->match_set[i].ref >0 && +hw_db_inline_match_set_compare (data, &db->match_set[i].data)) { + idx.ids = i; +hw_db_inline_match_set_ref (ndev, db, idx); +return idx; + } + } + +if (!found) { + idx.error =1 ; +return idx; + } + + found =0 ; + +for (uint32_t i =0 ; i < db->nb_cat; ++i) { +if (flm_rcp->match_set[i].ref <=0 ) { + found =1 ; + flm_rcp->match_set[i].ref =1 ; + flm_rcp->match_set[i].idx.raw = idx.raw; +break ; + } + } + +if (!found) { + idx.error =1 ; +return idx; + } + +memcpy (&db->match_set[idx.ids].data, data,sizeof (struct hw_db_inline_match_set_data )); + db->match_set[idx.ids].ref =1 ; + db->match_set[idx.ids].set_priority = ++db->set_priority_counter; + +hw_db_inline_update_active_filters (ndev, db, data->jump); + +return idx; +} + +void hw_db_inline_match_set_ref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_match_set_idx idx) +{ + (void )ndev; +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; + +if (!idx.error) + db->match_set[idx.ids].ref +=1 ; +} + +void hw_db_inline_match_set_deref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_match_set_idx idx) +{ +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; +struct hw_db_inline_resource_db_flm_rcp *flm_rcp; +int jump; + +if (idx.error) +return ; + + db->match_set[idx.ids].ref -=1 ; + +if (db->match_set[idx.ids].ref >0 ) +return ; + + jump = db->match_set[idx.ids].data.jump; + flm_rcp = &db->flm[jump]; + +for (uint32_t i =0 ; i < db->nb_cat; ++i) { +if (flm_rcp->match_set[i].idx.raw == idx.raw) { + flm_rcp->match_set[i].ref =0 ; +hw_db_inline_update_active_filters (ndev, db, jump); +memset (&flm_rcp->match_set[i],0x0 , +sizeof (struct hw_db_inline_resource_db_flm_match_set )); + } + } + +memset (&db->match_set[idx.ids].data,0x0 ,sizeof (struct hw_db_inline_match_set_data )); + db->match_set[idx.ids].ref =0 ; +} + +/******************************************************************************/ +/* Action set */ +/******************************************************************************/ + +static int hw_db_inline_action_set_compare (const struct hw_db_inline_action_set_data *data1, +const struct hw_db_inline_action_set_data *data2) +{ +if (data1->contains_jump) +return data2->contains_jump && data1->jump == data2->jump; + +return data1->cot.raw == data2->cot.raw && data1->qsl.raw == data2->qsl.raw && + data1->slc_lr.raw == data2->slc_lr.raw && data1->tpe.raw == data2->tpe.raw && + data1->hsh.raw == data2->hsh.raw; +} + +struct hw_db_action_set_idx +hw_db_inline_action_set_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_action_set_data *data) +{ +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; +struct hw_db_action_set_idx idx = { .raw =0 }; +int found =0 ; + + idx.type =HW_DB_IDX_TYPE_ACTION_SET ; + +for (uint32_t i =0 ; i <HW_DB_INLINE_ACTION_SET_NB ; ++i) { +if (!found && db->action_set[i].ref <=0 ) { + found =1 ; + idx.ids = i; + } + +if (db->action_set[i].ref >0 && +hw_db_inline_action_set_compare (data, &db->action_set[i].data)) { + idx.ids = i; +hw_db_inline_action_set_ref (ndev, db, idx); +return idx; + } + } + +if (!found) { + idx.error =1 ; +return idx; + } + +memcpy (&db->action_set[idx.ids].data, data,sizeof (struct hw_db_inline_action_set_data )); + db->action_set[idx.ids].ref =1 ; + +return idx; +} + +void hw_db_inline_action_set_ref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_action_set_idx idx) +{ + (void )ndev; +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; + +if (!idx.error) + db->action_set[idx.ids].ref +=1 ; +} + +void hw_db_inline_action_set_deref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_action_set_idx idx) +{ + (void )ndev; +struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle; + +if (idx.error) +return ; + + db->action_set[idx.ids].ref -=1 ; + +if (db->action_set[idx.ids].ref <=0 ) { +memset (&db->action_set[idx.ids].data,0x0 , +sizeof (struct hw_db_inline_action_set_data )); + db->action_set[idx.ids].ref =0 ; + } +} +/******************************************************************************/ /* COT */ /******************************************************************************/
@@ -1593,6 +2383,8 @@ struct hw_db_flm_ft hw_db_inline_flm_ft_default(struct flow_nic_dev *ndev, void flm_rcp->ft[idx.id1].idx.raw = idx.raw; flm_rcp->ft[idx.id1].ref =1 ; +hw_db_inline_update_active_filters (ndev, db, data->jump); +return idx; }
@@ -1647,6 +2439,8 @@ struct hw_db_flm_ft hw_db_inline_flm_ft_add(struct flow_nic_dev *ndev, void *db_ flm_rcp->ft[idx.id1].idx.raw = idx.raw; flm_rcp->ft[idx.id1].ref =1 ; +hw_db_inline_update_active_filters (ndev, db, data->group); +return idx; }
@@ -1677,6 +2471,7 @@ void hw_db_inline_flm_ft_deref(struct flow_nic_dev *ndev, void *db_handle, strucreturn ; flm_rcp->ft[idx.id1].ref =0 ; +hw_db_inline_update_active_filters (ndev, db, idx.id2);memset (&flm_rcp->ft[idx.id1],0x0 ,sizeof (struct hw_db_inline_resource_db_flm_ft )); }
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +35 -0
@@ -131,6 +131,10 @@ struct hw_db_hsh_idx {enum hw_db_idx_type {HW_DB_IDX_TYPE_NONE =0 , + +HW_DB_IDX_TYPE_MATCH_SET , +HW_DB_IDX_TYPE_ACTION_SET , +HW_DB_IDX_TYPE_COT ,HW_DB_IDX_TYPE_CAT ,HW_DB_IDX_TYPE_QSL ,
@@ -145,6 +149,17 @@ enum hw_db_idx_type { HW_DB_IDX_TYPE_HSH, }; +/* Container types */ +struct hw_db_inline_match_set_data { +struct hw_db_cat_idx cat; +struct hw_db_km_idx km; +struct hw_db_km_ft km_ft; +struct hw_db_action_set_idx action_set; +int jump; + +uint8_t priority; +}; +/* Functionality data types */ struct hw_db_inline_cat_data {uint32_t vlan_mask :4 ;
@@ -224,6 +239,7 @@ struct hw_db_inline_action_set_data {struct {struct hw_db_cot_idx cot;struct hw_db_qsl_idx qsl; +struct hw_db_slc_lr_idx slc_lr;struct hw_db_tpe_idx tpe;struct hw_db_hsh_idx hsh; };
@@ -262,6 +278,25 @@ const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle, enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size);/**/ + +struct hw_db_match_set_idx +hw_db_inline_match_set_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_match_set_data *data); +void hw_db_inline_match_set_ref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_match_set_idx idx); +void hw_db_inline_match_set_deref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_match_set_idx idx); + +struct hw_db_action_set_idx +hw_db_inline_action_set_add (struct flow_nic_dev *ndev,void *db_handle, +const struct hw_db_inline_action_set_data *data); +void hw_db_inline_action_set_ref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_action_set_idx idx); +void hw_db_inline_action_set_deref (struct flow_nic_dev *ndev,void *db_handle, +struct hw_db_action_set_idx idx); + +/**/ +struct hw_db_cot_idx hw_db_inline_cot_add (struct flow_nic_dev *ndev,void *db_handle,const struct hw_db_inline_cot_data *data);void hw_db_inline_cot_ref (struct flow_nic_dev *ndev,void *db_handle,struct hw_db_cot_idx idx);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +55 -0
87 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 37/86 net/ntnic: add flow dump feature
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
Add posibilyty to dump flow in human readable format
--- drivers/net/ntnic/include/flow_api_engine.h | 2 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 17 ++ .../profile_inline/flow_api_hw_db_inline.c | 264 ++++++++++++++++++ .../profile_inline/flow_api_hw_db_inline.h | 3 + .../profile_inline/flow_api_profile_inline.c | 81 ++++++ .../profile_inline/flow_api_profile_inline.h | 6 + drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 29 ++ drivers/net/ntnic/ntnic_mod_reg.h | 11 + 8 files changed, 413 insertions(+)
drivers/net/ntnic/include/flow_api_engine.h +2 -0
@@ -281,6 +281,8 @@ struct flow_handle {struct flow_handle *next;struct flow_handle *prev; +/* Flow specific pointer to application data stored during action creation. */ +void *context;void *user_data;union {
drivers/net/ntnic/nthw/flow_api/flow_api.c +17 -0
@@ -1006,6 +1006,22 @@ int flow_nic_set_hasher(struct flow_nic_dev *ndev, int hsh_idx, enum flow_nic_hareturn 0 ; } +static int flow_dev_dump (struct flow_eth_dev *dev, +struct flow_handle *flow, +uint16_t caller_id, +FILE *file, +struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG (ERR ,FILTER ,"%s: profile_inline module uninitialized" , __func__); +return -1 ; + } + +return profile_inline_ops->flow_dev_dump_profile_inline (dev, flow, caller_id, file, error); +} +int flow_nic_set_hasher_fields (struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf) {
@@ -1031,6 +1047,7 @@ static const struct flow_filter_ops ops = {*/ .flow_create = flow_create, .flow_destroy = flow_destroy, + .flow_dev_dump = flow_dev_dump, };void init_flow_filter (void )
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +264 -0
270 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +3 -0
@@ -276,6 +276,9 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct uint32_t size);const void *hw_db_inline_find_data (struct flow_nic_dev *ndev,void *db_handle,enum hw_db_idx_type type,struct hw_db_idx *idxs,uint32_t size); +void hw_db_inline_dump (struct flow_nic_dev *ndev,void *db_handle,const struct hw_db_idx *idxs, +uint32_t size,FILE *file); +void hw_db_inline_dump_cfn (struct flow_nic_dev *ndev,void *db_handle,FILE *file);/**/
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +81 -0
93 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +6 -0
@@ -38,6 +38,12 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev,struct flow_handle *flow, struct rte_flow_error *error); +int flow_dev_dump_profile_inline (struct flow_eth_dev *dev, +struct flow_handle *flow, +uint16_t caller_id, +FILE *file, +struct rte_flow_error *error); +int flow_nic_set_hasher_fields_inline (struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf);
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +29 -0
@@ -582,9 +582,38 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,return flow; } +static int eth_flow_dev_dump (struct rte_eth_dev *eth_dev, +struct rte_flow *flow, +FILE *file, +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG (ERR ,NTNIC ,"%s: flow_filter module uninitialized" , __func__); +return -1 ; + } + +struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + +static struct rte_flow_error flow_error = { + .type =RTE_FLOW_ERROR_TYPE_NONE , .message ="none" }; + +uint16_t caller_id =get_caller_id (eth_dev->data->port_id); + +int res = flow_filter_ops->flow_dev_dump (internals->flw_dev, +is_flow_handle_typecast (flow) ? (void *)flow + : flow->flw_hdl, + caller_id, file, &flow_error); + +convert_error (error, &flow_error); +return res; +} +static const struct rte_flow_ops dev_flow_ops = { .create = eth_flow_create, .destroy = eth_flow_destroy, + .dev_dump = eth_flow_dev_dump, };void dev_flow_init (void )
drivers/net/ntnic/ntnic_mod_reg.h +11 -0
@@ -253,6 +253,12 @@ struct profile_inline_ops {struct flow_handle *flow, struct rte_flow_error *error); +int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev, +struct flow_handle *flow, +uint16_t caller_id, +FILE *file, +struct rte_flow_error *error); +int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf);
@@ -284,6 +290,11 @@ struct flow_filter_ops {int *rss_target_id, enum flow_eth_dev_profile flow_profile, uint32_t exception_path); +int (*flow_dev_dump)(struct flow_eth_dev *dev, +struct flow_handle *flow, +uint16_t caller_id, +FILE *file, +struct rte_flow_error *error);/* * NT Flow API */
Signature · 1 line
2.45.0
PATCH v4 38/86 net/ntnic: add flow flush
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
Implements flow flush API
--- drivers/net/ntnic/nthw/flow_api/flow_api.c | 13 ++++++ .../profile_inline/flow_api_profile_inline.c | 43 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 4 ++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 38 ++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 7 +++ 5 files changed, 105 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +13 -0
@@ -253,6 +253,18 @@ static int flow_destroy(struct flow_eth_dev *dev __rte_unused,return profile_inline_ops->flow_destroy_profile_inline (dev, flow, error); } +static int flow_flush (struct flow_eth_dev *dev,uint16_t caller_id,struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return profile_inline_ops->flow_flush_profile_inline (dev, caller_id, error); +} +/* * Device Management API */
@@ -1047,6 +1059,7 @@ static const struct flow_filter_ops ops = {*/ .flow_create = flow_create, .flow_destroy = flow_destroy, + .flow_flush = flow_flush, .flow_dev_dump = flow_dev_dump, };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +43 -0
55 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +4 -0
@@ -38,6 +38,10 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev,struct flow_handle *flow, struct rte_flow_error *error); +int flow_flush_profile_inline (struct flow_eth_dev *dev, +uint16_t caller_id, +struct rte_flow_error *error); + int flow_dev_dump_profile_inline(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id,
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +38 -0
@@ -582,6 +582,43 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,return flow; } +static int eth_flow_flush (struct rte_eth_dev *eth_dev,struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + +static struct rte_flow_error flow_error = { + .type =RTE_FLOW_ERROR_TYPE_NONE , .message ="none" }; +int res =0 ; +/* Main application caller_id is port_id shifted above VDPA ports */ +uint16_t caller_id =get_caller_id (eth_dev->data->port_id); + +if (internals->flw_dev) { + res = flow_filter_ops->flow_flush (internals->flw_dev, caller_id, &flow_error); +rte_spinlock_lock (&flow_lock); + +for (int flow =0 ; flow <MAX_RTE_FLOWS ; flow++) { +if (nt_flows[flow].used && nt_flows[flow].caller_id == caller_id) { +/* Cleanup recorded flows */ + nt_flows[flow].used =0 ; + nt_flows[flow].caller_id =0 ; + } + } + +rte_spinlock_unlock (&flow_lock); + } + +convert_error (error, &flow_error); + +return res; +} + static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file,
@@ -613,6 +650,7 @@ static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,static const struct rte_flow_ops dev_flow_ops = { .create = eth_flow_create, .destroy = eth_flow_destroy, + .flush = eth_flow_flush, .dev_dump = eth_flow_dev_dump, };
drivers/net/ntnic/ntnic_mod_reg.h +7 -0
@@ -253,6 +253,10 @@ struct profile_inline_ops {struct flow_handle *flow, struct rte_flow_error *error); +int (*flow_flush_profile_inline)(struct flow_eth_dev *dev, +uint16_t caller_id, +struct rte_flow_error *error); + int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id,
@@ -309,6 +313,9 @@ struct flow_filter_ops {int (*flow_destroy)(struct flow_eth_dev *dev,struct flow_handle *flow,struct rte_flow_error *error); + +int (*flow_flush)(struct flow_eth_dev *dev,uint16_t caller_id, +struct rte_flow_error *error); };void register_dev_flow_ops (const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 39/86 net/ntnic: add GMF (Generic MAC Feeder) module
In reply to Serhii IliushykThe Generic MAC Feeder module provides a way to feed data to the MAC modules directly from the FPGA,
rather than from host or physical ports.
The use case for this is as a test tool and is not used by NTNIC. This module is requireqd for correct initialization
--- .../link_mgmt/link_100g/nt4ga_link_100g.c | 8 ++ drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_core.h | 1 + .../net/ntnic/nthw/core/include/nthw_gmf.h | 64 +++++++++ drivers/net/ntnic/nthw/core/nthw_gmf.c | 133 ++++++++++++++++++ 5 files changed, 207 insertions(+) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +8 -0
@@ -404,6 +404,14 @@ static int _port_init(adapter_info_t *drv, nthw_fpga_t *fpga, int port)_enable_tx (drv, mac_pcs);_reset_rx (drv, mac_pcs); +/* 2.2) Nt4gaPort::setup() */ +if (nthw_gmf_init (NULL , fpga, port) ==0 ) { +nthw_gmf_t gmf; + +if (nthw_gmf_init (&gmf, fpga, port) ==0 ) +nthw_gmf_set_enable (&gmf, true); + } +/* Phase 3. Link state machine steps */ /* 3.1) Create NIM, ::createNim() */
drivers/net/ntnic/meson.build +1 -0
@@ -38,6 +38,7 @@ sources = files( 'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nthw_fpga.c', + 'nthw/core/nthw_gmf.c', 'nthw/core/nthw_gpio_phy.c', 'nthw/core/nthw_hif.c', 'nthw/core/nthw_i2cm.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +1 -0
@@ -17,6 +17,7 @@#include "nthw_iic.h" #include "nthw_i2cm.h" +#include "nthw_gmf.h" #include "nthw_gpio_phy.h" #include "nthw_mac_pcs.h" #include "nthw_sdc.h"
drivers/net/ntnic/nthw/core/include/nthw_gmf.h new file +64 -0
64 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_gmf.c new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 40/86 net/ntnic: sort FPGA registers alphanumerically
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
Beatification commit. It is required for pretty supporting different FPGA
--- .../supported/nthw_fpga_9563_055_049_0000.c | 364 +++++++++--------- 1 file changed, 182 insertions(+), 182 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +182 -182
@@ -270,6 +270,187 @@ static nthw_fpga_register_init_s cat_registers[] = { { CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields }, }; +static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = { + {DBS_RX_AM_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_RX_AM_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_am_data_fields[] = { + {DBS_RX_AM_DATA_ENABLE ,1 ,72 ,0x0000 }, {DBS_RX_AM_DATA_GPA ,64 ,0 ,0x0000 }, + {DBS_RX_AM_DATA_HID ,8 ,64 ,0x0000 }, {DBS_RX_AM_DATA_INT ,1 ,74 ,0x0000 }, + {DBS_RX_AM_DATA_PCKED ,1 ,73 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_control_fields[] = { + {DBS_RX_CONTROL_AME ,1 ,7 ,0 }, {DBS_RX_CONTROL_AMS ,4 ,8 ,8 }, + {DBS_RX_CONTROL_LQ ,7 ,0 ,0 }, {DBS_RX_CONTROL_QE ,1 ,17 ,0 }, + {DBS_RX_CONTROL_UWE ,1 ,12 ,0 }, {DBS_RX_CONTROL_UWS ,4 ,13 ,5 }, +}; + +static nthw_fpga_field_init_s dbs_rx_dr_ctrl_fields[] = { + {DBS_RX_DR_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_RX_DR_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_dr_data_fields[] = { + {DBS_RX_DR_DATA_GPA ,64 ,0 ,0x0000 }, {DBS_RX_DR_DATA_HDR ,1 ,88 ,0x0000 }, + {DBS_RX_DR_DATA_HID ,8 ,64 ,0x0000 }, {DBS_RX_DR_DATA_PCKED ,1 ,87 ,0x0000 }, + {DBS_RX_DR_DATA_QS ,15 ,72 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_idle_fields[] = { + {DBS_RX_IDLE_BUSY ,1 ,8 ,0 }, + {DBS_RX_IDLE_IDLE ,1 ,0 ,0x0000 }, + {DBS_RX_IDLE_QUEUE ,7 ,1 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_init_fields[] = { + {DBS_RX_INIT_BUSY ,1 ,8 ,0 }, + {DBS_RX_INIT_INIT ,1 ,0 ,0x0000 }, + {DBS_RX_INIT_QUEUE ,7 ,1 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_init_val_fields[] = { + {DBS_RX_INIT_VAL_IDX ,16 ,0 ,0x0000 }, + {DBS_RX_INIT_VAL_PTR ,15 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_ptr_fields[] = { + {DBS_RX_PTR_PTR ,16 ,0 ,0x0000 }, + {DBS_RX_PTR_QUEUE ,7 ,16 ,0x0000 }, + {DBS_RX_PTR_VALID ,1 ,23 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_uw_ctrl_fields[] = { + {DBS_RX_UW_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_RX_UW_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_rx_uw_data_fields[] = { + {DBS_RX_UW_DATA_GPA ,64 ,0 ,0x0000 }, {DBS_RX_UW_DATA_HID ,8 ,64 ,0x0000 }, + {DBS_RX_UW_DATA_INT ,1 ,88 ,0x0000 }, {DBS_RX_UW_DATA_ISTK ,1 ,92 ,0x0000 }, + {DBS_RX_UW_DATA_PCKED ,1 ,87 ,0x0000 }, {DBS_RX_UW_DATA_QS ,15 ,72 ,0x0000 }, + {DBS_RX_UW_DATA_VEC ,3 ,89 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_am_ctrl_fields[] = { + {DBS_TX_AM_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_TX_AM_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_am_data_fields[] = { + {DBS_TX_AM_DATA_ENABLE ,1 ,72 ,0x0000 }, {DBS_TX_AM_DATA_GPA ,64 ,0 ,0x0000 }, + {DBS_TX_AM_DATA_HID ,8 ,64 ,0x0000 }, {DBS_TX_AM_DATA_INT ,1 ,74 ,0x0000 }, + {DBS_TX_AM_DATA_PCKED ,1 ,73 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_control_fields[] = { + {DBS_TX_CONTROL_AME ,1 ,7 ,0 }, {DBS_TX_CONTROL_AMS ,4 ,8 ,5 }, + {DBS_TX_CONTROL_LQ ,7 ,0 ,0 }, {DBS_TX_CONTROL_QE ,1 ,17 ,0 }, + {DBS_TX_CONTROL_UWE ,1 ,12 ,0 }, {DBS_TX_CONTROL_UWS ,4 ,13 ,8 }, +}; + +static nthw_fpga_field_init_s dbs_tx_dr_ctrl_fields[] = { + {DBS_TX_DR_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_TX_DR_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_dr_data_fields[] = { + {DBS_TX_DR_DATA_GPA ,64 ,0 ,0x0000 }, {DBS_TX_DR_DATA_HDR ,1 ,88 ,0x0000 }, + {DBS_TX_DR_DATA_HID ,8 ,64 ,0x0000 }, {DBS_TX_DR_DATA_PCKED ,1 ,87 ,0x0000 }, + {DBS_TX_DR_DATA_PORT ,1 ,89 ,0x0000 }, {DBS_TX_DR_DATA_QS ,15 ,72 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_idle_fields[] = { + {DBS_TX_IDLE_BUSY ,1 ,8 ,0 }, + {DBS_TX_IDLE_IDLE ,1 ,0 ,0x0000 }, + {DBS_TX_IDLE_QUEUE ,7 ,1 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_init_fields[] = { + {DBS_TX_INIT_BUSY ,1 ,8 ,0 }, + {DBS_TX_INIT_INIT ,1 ,0 ,0x0000 }, + {DBS_TX_INIT_QUEUE ,7 ,1 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_init_val_fields[] = { + {DBS_TX_INIT_VAL_IDX ,16 ,0 ,0x0000 }, + {DBS_TX_INIT_VAL_PTR ,15 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_ptr_fields[] = { + {DBS_TX_PTR_PTR ,16 ,0 ,0x0000 }, + {DBS_TX_PTR_QUEUE ,7 ,16 ,0x0000 }, + {DBS_TX_PTR_VALID ,1 ,23 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qos_ctrl_fields[] = { + {DBS_TX_QOS_CTRL_ADR ,1 ,0 ,0x0000 }, + {DBS_TX_QOS_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qos_data_fields[] = { + {DBS_TX_QOS_DATA_BS ,27 ,17 ,0x0000 }, + {DBS_TX_QOS_DATA_EN ,1 ,0 ,0x0000 }, + {DBS_TX_QOS_DATA_IR ,16 ,1 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qos_rate_fields[] = { + {DBS_TX_QOS_RATE_DIV ,19 ,16 ,2 }, + {DBS_TX_QOS_RATE_MUL ,16 ,0 ,1 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qp_ctrl_fields[] = { + {DBS_TX_QP_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_TX_QP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_qp_data_fields[] = { + {DBS_TX_QP_DATA_VPORT ,1 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_uw_ctrl_fields[] = { + {DBS_TX_UW_CTRL_ADR ,7 ,0 ,0x0000 }, + {DBS_TX_UW_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s dbs_tx_uw_data_fields[] = { + {DBS_TX_UW_DATA_GPA ,64 ,0 ,0x0000 }, {DBS_TX_UW_DATA_HID ,8 ,64 ,0x0000 }, + {DBS_TX_UW_DATA_INO ,1 ,93 ,0x0000 }, {DBS_TX_UW_DATA_INT ,1 ,88 ,0x0000 }, + {DBS_TX_UW_DATA_ISTK ,1 ,92 ,0x0000 }, {DBS_TX_UW_DATA_PCKED ,1 ,87 ,0x0000 }, + {DBS_TX_UW_DATA_QS ,15 ,72 ,0x0000 }, {DBS_TX_UW_DATA_VEC ,3 ,89 ,0x0000 }, +}; + +static nthw_fpga_register_init_s dbs_registers[] = { + {DBS_RX_AM_CTRL ,10 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_rx_am_ctrl_fields }, + {DBS_RX_AM_DATA ,11 ,75 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , dbs_rx_am_data_fields }, + {DBS_RX_CONTROL ,0 ,18 ,NTHW_FPGA_REG_TYPE_RW ,43008 ,6 , dbs_rx_control_fields }, + {DBS_RX_DR_CTRL ,18 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_rx_dr_ctrl_fields }, + {DBS_RX_DR_DATA ,19 ,89 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , dbs_rx_dr_data_fields }, + {DBS_RX_IDLE ,8 ,9 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,3 , dbs_rx_idle_fields }, + {DBS_RX_INIT ,2 ,9 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,3 , dbs_rx_init_fields }, + {DBS_RX_INIT_VAL ,3 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_rx_init_val_fields }, + {DBS_RX_PTR ,4 ,24 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,3 , dbs_rx_ptr_fields }, + {DBS_RX_UW_CTRL ,14 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_rx_uw_ctrl_fields }, + {DBS_RX_UW_DATA ,15 ,93 ,NTHW_FPGA_REG_TYPE_WO ,0 ,7 , dbs_rx_uw_data_fields }, + {DBS_TX_AM_CTRL ,12 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_tx_am_ctrl_fields }, + {DBS_TX_AM_DATA ,13 ,75 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , dbs_tx_am_data_fields }, + {DBS_TX_CONTROL ,1 ,18 ,NTHW_FPGA_REG_TYPE_RW ,66816 ,6 , dbs_tx_control_fields }, + {DBS_TX_DR_CTRL ,20 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_tx_dr_ctrl_fields }, + {DBS_TX_DR_DATA ,21 ,90 ,NTHW_FPGA_REG_TYPE_WO ,0 ,6 , dbs_tx_dr_data_fields }, + {DBS_TX_IDLE ,9 ,9 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,3 , dbs_tx_idle_fields }, + {DBS_TX_INIT ,5 ,9 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,3 , dbs_tx_init_fields }, + {DBS_TX_INIT_VAL ,6 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_tx_init_val_fields }, + {DBS_TX_PTR ,7 ,24 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,3 , dbs_tx_ptr_fields }, + {DBS_TX_QOS_CTRL ,24 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_tx_qos_ctrl_fields }, + {DBS_TX_QOS_DATA ,25 ,44 ,NTHW_FPGA_REG_TYPE_WO ,0 ,3 , dbs_tx_qos_data_fields }, + {DBS_TX_QOS_RATE ,26 ,35 ,NTHW_FPGA_REG_TYPE_RW ,131073 ,2 , dbs_tx_qos_rate_fields }, + {DBS_TX_QP_CTRL ,22 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_tx_qp_ctrl_fields }, + {DBS_TX_QP_DATA ,23 ,1 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , dbs_tx_qp_data_fields }, + {DBS_TX_UW_CTRL ,16 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , dbs_tx_uw_ctrl_fields }, + {DBS_TX_UW_DATA ,17 ,94 ,NTHW_FPGA_REG_TYPE_WO ,0 ,8 , dbs_tx_uw_data_fields }, +}; +static nthw_fpga_field_init_s gfg_burstsize0_fields[] = { {GFG_BURSTSIZE0_VAL ,24 ,0 ,0 }, };
@@ -1541,192 +1722,11 @@ static nthw_fpga_register_init_s rst9563_registers[] = { { RST9563_STICKY, 3, 6, NTHW_FPGA_REG_TYPE_RC1, 0, 6, rst9563_sticky_fields }, }; -static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = { - { DBS_RX_AM_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_am_data_fields[] = { - { DBS_RX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_RX_AM_DATA_GPA, 64, 0, 0x0000 }, - { DBS_RX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_AM_DATA_INT, 1, 74, 0x0000 }, - { DBS_RX_AM_DATA_PCKED, 1, 73, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_control_fields[] = { - { DBS_RX_CONTROL_AME, 1, 7, 0 }, { DBS_RX_CONTROL_AMS, 4, 8, 8 }, - { DBS_RX_CONTROL_LQ, 7, 0, 0 }, { DBS_RX_CONTROL_QE, 1, 17, 0 }, - { DBS_RX_CONTROL_UWE, 1, 12, 0 }, { DBS_RX_CONTROL_UWS, 4, 13, 5 }, -}; - -static nthw_fpga_field_init_s dbs_rx_dr_ctrl_fields[] = { - { DBS_RX_DR_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_RX_DR_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_dr_data_fields[] = { - { DBS_RX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_DR_DATA_HDR, 1, 88, 0x0000 }, - { DBS_RX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_DR_DATA_PCKED, 1, 87, 0x0000 }, - { DBS_RX_DR_DATA_QS, 15, 72, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_idle_fields[] = { - { DBS_RX_IDLE_BUSY, 1, 8, 0 }, - { DBS_RX_IDLE_IDLE, 1, 0, 0x0000 }, - { DBS_RX_IDLE_QUEUE, 7, 1, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_init_fields[] = { - { DBS_RX_INIT_BUSY, 1, 8, 0 }, - { DBS_RX_INIT_INIT, 1, 0, 0x0000 }, - { DBS_RX_INIT_QUEUE, 7, 1, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_init_val_fields[] = { - { DBS_RX_INIT_VAL_IDX, 16, 0, 0x0000 }, - { DBS_RX_INIT_VAL_PTR, 15, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_ptr_fields[] = { - { DBS_RX_PTR_PTR, 16, 0, 0x0000 }, - { DBS_RX_PTR_QUEUE, 7, 16, 0x0000 }, - { DBS_RX_PTR_VALID, 1, 23, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_uw_ctrl_fields[] = { - { DBS_RX_UW_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_RX_UW_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_rx_uw_data_fields[] = { - { DBS_RX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_UW_DATA_HID, 8, 64, 0x0000 }, - { DBS_RX_UW_DATA_INT, 1, 88, 0x0000 }, { DBS_RX_UW_DATA_ISTK, 1, 92, 0x0000 }, - { DBS_RX_UW_DATA_PCKED, 1, 87, 0x0000 }, { DBS_RX_UW_DATA_QS, 15, 72, 0x0000 }, - { DBS_RX_UW_DATA_VEC, 3, 89, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_am_ctrl_fields[] = { - { DBS_TX_AM_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_TX_AM_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_am_data_fields[] = { - { DBS_TX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_TX_AM_DATA_GPA, 64, 0, 0x0000 }, - { DBS_TX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_AM_DATA_INT, 1, 74, 0x0000 }, - { DBS_TX_AM_DATA_PCKED, 1, 73, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_control_fields[] = { - { DBS_TX_CONTROL_AME, 1, 7, 0 }, { DBS_TX_CONTROL_AMS, 4, 8, 5 }, - { DBS_TX_CONTROL_LQ, 7, 0, 0 }, { DBS_TX_CONTROL_QE, 1, 17, 0 }, - { DBS_TX_CONTROL_UWE, 1, 12, 0 }, { DBS_TX_CONTROL_UWS, 4, 13, 8 }, -}; - -static nthw_fpga_field_init_s dbs_tx_dr_ctrl_fields[] = { - { DBS_TX_DR_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_TX_DR_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_dr_data_fields[] = { - { DBS_TX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_DR_DATA_HDR, 1, 88, 0x0000 }, - { DBS_TX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_DR_DATA_PCKED, 1, 87, 0x0000 }, - { DBS_TX_DR_DATA_PORT, 1, 89, 0x0000 }, { DBS_TX_DR_DATA_QS, 15, 72, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_idle_fields[] = { - { DBS_TX_IDLE_BUSY, 1, 8, 0 }, - { DBS_TX_IDLE_IDLE, 1, 0, 0x0000 }, - { DBS_TX_IDLE_QUEUE, 7, 1, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_init_fields[] = { - { DBS_TX_INIT_BUSY, 1, 8, 0 }, - { DBS_TX_INIT_INIT, 1, 0, 0x0000 }, - { DBS_TX_INIT_QUEUE, 7, 1, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_init_val_fields[] = { - { DBS_TX_INIT_VAL_IDX, 16, 0, 0x0000 }, - { DBS_TX_INIT_VAL_PTR, 15, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_ptr_fields[] = { - { DBS_TX_PTR_PTR, 16, 0, 0x0000 }, - { DBS_TX_PTR_QUEUE, 7, 16, 0x0000 }, - { DBS_TX_PTR_VALID, 1, 23, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_qos_ctrl_fields[] = { - { DBS_TX_QOS_CTRL_ADR, 1, 0, 0x0000 }, - { DBS_TX_QOS_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_qos_data_fields[] = { - { DBS_TX_QOS_DATA_BS, 27, 17, 0x0000 }, - { DBS_TX_QOS_DATA_EN, 1, 0, 0x0000 }, - { DBS_TX_QOS_DATA_IR, 16, 1, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_qos_rate_fields[] = { - { DBS_TX_QOS_RATE_DIV, 19, 16, 2 }, - { DBS_TX_QOS_RATE_MUL, 16, 0, 1 }, -}; - -static nthw_fpga_field_init_s dbs_tx_qp_ctrl_fields[] = { - { DBS_TX_QP_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_TX_QP_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_qp_data_fields[] = { - { DBS_TX_QP_DATA_VPORT, 1, 0, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_uw_ctrl_fields[] = { - { DBS_TX_UW_CTRL_ADR, 7, 0, 0x0000 }, - { DBS_TX_UW_CTRL_CNT, 16, 16, 0x0000 }, -}; - -static nthw_fpga_field_init_s dbs_tx_uw_data_fields[] = { - { DBS_TX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_UW_DATA_HID, 8, 64, 0x0000 }, - { DBS_TX_UW_DATA_INO, 1, 93, 0x0000 }, { DBS_TX_UW_DATA_INT, 1, 88, 0x0000 }, - { DBS_TX_UW_DATA_ISTK, 1, 92, 0x0000 }, { DBS_TX_UW_DATA_PCKED, 1, 87, 0x0000 }, - { DBS_TX_UW_DATA_QS, 15, 72, 0x0000 }, { DBS_TX_UW_DATA_VEC, 3, 89, 0x0000 }, -}; - -static nthw_fpga_register_init_s dbs_registers[] = { - { DBS_RX_AM_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_am_ctrl_fields }, - { DBS_RX_AM_DATA, 11, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_am_data_fields }, - { DBS_RX_CONTROL, 0, 18, NTHW_FPGA_REG_TYPE_RW, 43008, 6, dbs_rx_control_fields }, - { DBS_RX_DR_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_dr_ctrl_fields }, - { DBS_RX_DR_DATA, 19, 89, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_dr_data_fields }, - { DBS_RX_IDLE, 8, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_idle_fields }, - { DBS_RX_INIT, 2, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_init_fields }, - { DBS_RX_INIT_VAL, 3, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_init_val_fields }, - { DBS_RX_PTR, 4, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_ptr_fields }, - { DBS_RX_UW_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_uw_ctrl_fields }, - { DBS_RX_UW_DATA, 15, 93, NTHW_FPGA_REG_TYPE_WO, 0, 7, dbs_rx_uw_data_fields }, - { DBS_TX_AM_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_am_ctrl_fields }, - { DBS_TX_AM_DATA, 13, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_tx_am_data_fields }, - { DBS_TX_CONTROL, 1, 18, NTHW_FPGA_REG_TYPE_RW, 66816, 6, dbs_tx_control_fields }, - { DBS_TX_DR_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_dr_ctrl_fields }, - { DBS_TX_DR_DATA, 21, 90, NTHW_FPGA_REG_TYPE_WO, 0, 6, dbs_tx_dr_data_fields }, - { DBS_TX_IDLE, 9, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_idle_fields }, - { DBS_TX_INIT, 5, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_init_fields }, - { DBS_TX_INIT_VAL, 6, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_init_val_fields }, - { DBS_TX_PTR, 7, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_ptr_fields }, - { DBS_TX_QOS_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qos_ctrl_fields }, - { DBS_TX_QOS_DATA, 25, 44, NTHW_FPGA_REG_TYPE_WO, 0, 3, dbs_tx_qos_data_fields }, - { DBS_TX_QOS_RATE, 26, 35, NTHW_FPGA_REG_TYPE_RW, 131073, 2, dbs_tx_qos_rate_fields }, - { DBS_TX_QP_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qp_ctrl_fields }, - { DBS_TX_QP_DATA, 23, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, dbs_tx_qp_data_fields }, - { DBS_TX_UW_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_uw_ctrl_fields }, - { DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields }, -}; - static nthw_fpga_module_init_s fpga_modules[] = { { MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers }, + { MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers }, { MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers }, { MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers }, - { MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers}, { MOD_GMF, 1, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9728, 12, gmf_registers }, { MOD_GPIO_PHY, 0, MOD_GPIO_PHY, 1, 0, NTHW_FPGA_BUS_TYPE_RAB0, 16386, 2,
Signature · 1 line
2.45.0
PATCH v4 41/86 net/ntnic: add CSU module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The Checksum Update module updates the checksums of packets that has been modified in any way.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +19 -1
@@ -270,6 +270,23 @@ static nthw_fpga_register_init_s cat_registers[] = { { CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields }, }; +static nthw_fpga_field_init_s csu_rcp_ctrl_fields[] = { + {CSU_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, + {CSU_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s csu_rcp_data_fields[] = { + {CSU_RCP_DATA_IL3_CMD ,2 ,5 ,0x0000 }, + {CSU_RCP_DATA_IL4_CMD ,3 ,7 ,0x0000 }, + {CSU_RCP_DATA_OL3_CMD ,2 ,0 ,0x0000 }, + {CSU_RCP_DATA_OL4_CMD ,3 ,2 ,0x0000 }, +}; + +static nthw_fpga_register_init_s csu_registers[] = { + {CSU_RCP_CTRL ,1 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , csu_rcp_ctrl_fields }, + {CSU_RCP_DATA ,2 ,10 ,NTHW_FPGA_REG_TYPE_WO ,0 ,4 , csu_rcp_data_fields }, +}; +static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = { {DBS_RX_AM_CTRL_ADR ,7 ,0 ,0x0000 }, { DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 },
@@ -1724,6 +1741,7 @@ static nthw_fpga_register_init_s rst9563_registers[] = {static nthw_fpga_module_init_s fpga_modules[] = { {MOD_CAT ,0 ,MOD_CAT ,0 ,21 ,NTHW_FPGA_BUS_TYPE_RAB1 ,768 ,34 , cat_registers }, + {MOD_CSU ,0 ,MOD_CSU ,0 ,0 ,NTHW_FPGA_BUS_TYPE_RAB1 ,9728 ,2 , csu_registers }, {MOD_DBS ,0 ,MOD_DBS ,0 ,11 ,NTHW_FPGA_BUS_TYPE_RAB2 ,12832 ,27 , dbs_registers }, {MOD_GFG ,0 ,MOD_GFG ,1 ,1 ,NTHW_FPGA_BUS_TYPE_RAB2 ,8704 ,10 , gfg_registers }, {MOD_GMF ,0 ,MOD_GMF ,2 ,5 ,NTHW_FPGA_BUS_TYPE_RAB2 ,9216 ,12 , gmf_registers },
@@ -1919,5 +1937,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,22 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,23 , fpga_modules, };
Signature · 1 line
2.45.0
PATCH v4 42/86 net/ntnic: add FLM module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 286 +++++++++++++++++- 1 file changed, 284 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +284 -2
@@ -468,6 +468,288 @@ static nthw_fpga_register_init_s dbs_registers[] = { { DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields }, }; +static nthw_fpga_field_init_s flm_buf_ctrl_fields[] = { + {FLM_BUF_CTRL_INF_AVAIL ,16 ,16 ,0x0000 }, + {FLM_BUF_CTRL_LRN_FREE ,16 ,0 ,0x0000 }, + {FLM_BUF_CTRL_STA_AVAIL ,16 ,32 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_control_fields[] = { + {FLM_CONTROL_CALIB_RECALIBRATE ,3 ,28 ,0 }, + {FLM_CONTROL_CRCRD ,1 ,12 ,0x0000 }, + {FLM_CONTROL_CRCWR ,1 ,11 ,0x0000 }, + {FLM_CONTROL_EAB ,5 ,18 ,0 }, + {FLM_CONTROL_ENABLE ,1 ,0 ,0 }, + {FLM_CONTROL_INIT ,1 ,1 ,0x0000 }, + {FLM_CONTROL_LDS ,1 ,2 ,0x0000 }, + {FLM_CONTROL_LFS ,1 ,3 ,0x0000 }, + {FLM_CONTROL_LIS ,1 ,4 ,0x0000 }, + {FLM_CONTROL_PDS ,1 ,9 ,0x0000 }, + {FLM_CONTROL_PIS ,1 ,10 ,0x0000 }, + {FLM_CONTROL_RBL ,4 ,13 ,0 }, + {FLM_CONTROL_RDS ,1 ,7 ,0x0000 }, + {FLM_CONTROL_RIS ,1 ,8 ,0x0000 }, + {FLM_CONTROL_SPLIT_SDRAM_USAGE ,5 ,23 ,16 }, + {FLM_CONTROL_UDS ,1 ,5 ,0x0000 }, + {FLM_CONTROL_UIS ,1 ,6 ,0x0000 }, + {FLM_CONTROL_WPD ,1 ,17 ,0 }, +}; + +static nthw_fpga_field_init_s flm_inf_data_fields[] = { + {FLM_INF_DATA_BYTES ,64 ,0 ,0x0000 }, {FLM_INF_DATA_CAUSE ,3 ,224 ,0x0000 }, + {FLM_INF_DATA_EOR ,1 ,287 ,0x0000 }, {FLM_INF_DATA_ID ,32 ,192 ,0x0000 }, + {FLM_INF_DATA_PACKETS ,64 ,64 ,0x0000 }, {FLM_INF_DATA_TS ,64 ,128 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_load_aps_fields[] = { + {FLM_LOAD_APS_APS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_load_bin_fields[] = { + {FLM_LOAD_BIN_BIN ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_load_lps_fields[] = { + {FLM_LOAD_LPS_LPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_lrn_data_fields[] = { + {FLM_LRN_DATA_ADJ ,32 ,480 ,0x0000 }, {FLM_LRN_DATA_COLOR ,32 ,448 ,0x0000 }, + {FLM_LRN_DATA_DSCP ,6 ,698 ,0x0000 }, {FLM_LRN_DATA_ENT ,1 ,693 ,0x0000 }, + {FLM_LRN_DATA_EOR ,1 ,767 ,0x0000 }, {FLM_LRN_DATA_FILL ,16 ,544 ,0x0000 }, + {FLM_LRN_DATA_FT ,4 ,560 ,0x0000 }, {FLM_LRN_DATA_FT_MBR ,4 ,564 ,0x0000 }, + {FLM_LRN_DATA_FT_MISS ,4 ,568 ,0x0000 }, {FLM_LRN_DATA_ID ,32 ,512 ,0x0000 }, + {FLM_LRN_DATA_KID ,8 ,328 ,0x0000 }, {FLM_LRN_DATA_MBR_ID1 ,28 ,572 ,0x0000 }, + {FLM_LRN_DATA_MBR_ID2 ,28 ,600 ,0x0000 }, {FLM_LRN_DATA_MBR_ID3 ,28 ,628 ,0x0000 }, + {FLM_LRN_DATA_MBR_ID4 ,28 ,656 ,0x0000 }, {FLM_LRN_DATA_NAT_EN ,1 ,711 ,0x0000 }, + {FLM_LRN_DATA_NAT_IP ,32 ,336 ,0x0000 }, {FLM_LRN_DATA_NAT_PORT ,16 ,400 ,0x0000 }, + {FLM_LRN_DATA_NOFI ,1 ,716 ,0x0000 }, {FLM_LRN_DATA_OP ,4 ,694 ,0x0000 }, + {FLM_LRN_DATA_PRIO ,2 ,691 ,0x0000 }, {FLM_LRN_DATA_PROT ,8 ,320 ,0x0000 }, + {FLM_LRN_DATA_QFI ,6 ,704 ,0x0000 }, {FLM_LRN_DATA_QW0 ,128 ,192 ,0x0000 }, + {FLM_LRN_DATA_QW4 ,128 ,64 ,0x0000 }, {FLM_LRN_DATA_RATE ,16 ,416 ,0x0000 }, + {FLM_LRN_DATA_RQI ,1 ,710 ,0x0000 }, + {FLM_LRN_DATA_SIZE ,16 ,432 ,0x0000 }, {FLM_LRN_DATA_STAT_PROF ,4 ,687 ,0x0000 }, + {FLM_LRN_DATA_SW8 ,32 ,32 ,0x0000 }, {FLM_LRN_DATA_SW9 ,32 ,0 ,0x0000 }, + {FLM_LRN_DATA_TEID ,32 ,368 ,0x0000 }, {FLM_LRN_DATA_VOL_IDX ,3 ,684 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_prio_fields[] = { + {FLM_PRIO_FT0 ,4 ,4 ,1 }, {FLM_PRIO_FT1 ,4 ,12 ,1 }, {FLM_PRIO_FT2 ,4 ,20 ,1 }, + {FLM_PRIO_FT3 ,4 ,28 ,1 }, {FLM_PRIO_LIMIT0 ,4 ,0 ,0 }, {FLM_PRIO_LIMIT1 ,4 ,8 ,0 }, + {FLM_PRIO_LIMIT2 ,4 ,16 ,0 }, {FLM_PRIO_LIMIT3 ,4 ,24 ,0 }, +}; + +static nthw_fpga_field_init_s flm_pst_ctrl_fields[] = { + {FLM_PST_CTRL_ADR ,4 ,0 ,0x0000 }, + {FLM_PST_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_pst_data_fields[] = { + {FLM_PST_DATA_BP ,5 ,0 ,0x0000 }, + {FLM_PST_DATA_PP ,5 ,5 ,0x0000 }, + {FLM_PST_DATA_TP ,5 ,10 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_rcp_ctrl_fields[] = { + {FLM_RCP_CTRL_ADR ,5 ,0 ,0x0000 }, + {FLM_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_rcp_data_fields[] = { + {FLM_RCP_DATA_AUTO_IPV4_MASK ,1 ,402 ,0x0000 }, + {FLM_RCP_DATA_BYT_DYN ,5 ,387 ,0x0000 }, + {FLM_RCP_DATA_BYT_OFS ,8 ,392 ,0x0000 }, + {FLM_RCP_DATA_IPN ,1 ,386 ,0x0000 }, + {FLM_RCP_DATA_KID ,8 ,377 ,0x0000 }, + {FLM_RCP_DATA_LOOKUP ,1 ,0 ,0x0000 }, + {FLM_RCP_DATA_MASK ,320 ,57 ,0x0000 }, + {FLM_RCP_DATA_OPN ,1 ,385 ,0x0000 }, + {FLM_RCP_DATA_QW0_DYN ,5 ,1 ,0x0000 }, + {FLM_RCP_DATA_QW0_OFS ,8 ,6 ,0x0000 }, + {FLM_RCP_DATA_QW0_SEL ,2 ,14 ,0x0000 }, + {FLM_RCP_DATA_QW4_DYN ,5 ,16 ,0x0000 }, + {FLM_RCP_DATA_QW4_OFS ,8 ,21 ,0x0000 }, + {FLM_RCP_DATA_SW8_DYN ,5 ,29 ,0x0000 }, + {FLM_RCP_DATA_SW8_OFS ,8 ,34 ,0x0000 }, + {FLM_RCP_DATA_SW8_SEL ,2 ,42 ,0x0000 }, + {FLM_RCP_DATA_SW9_DYN ,5 ,44 ,0x0000 }, + {FLM_RCP_DATA_SW9_OFS ,8 ,49 ,0x0000 }, + {FLM_RCP_DATA_TXPLM ,2 ,400 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_scan_fields[] = { + {FLM_SCAN_I ,16 ,0 ,0 }, +}; + +static nthw_fpga_field_init_s flm_status_fields[] = { + {FLM_STATUS_CACHE_BUFFER_CRITICAL ,1 ,12 ,0x0000 }, + {FLM_STATUS_CALIB_FAIL ,3 ,3 ,0 }, + {FLM_STATUS_CALIB_SUCCESS ,3 ,0 ,0 }, + {FLM_STATUS_CRCERR ,1 ,10 ,0x0000 }, + {FLM_STATUS_CRITICAL ,1 ,8 ,0x0000 }, + {FLM_STATUS_EFT_BP ,1 ,11 ,0x0000 }, + {FLM_STATUS_IDLE ,1 ,7 ,0x0000 }, + {FLM_STATUS_INITDONE ,1 ,6 ,0x0000 }, + {FLM_STATUS_PANIC ,1 ,9 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_aul_done_fields[] = { + {FLM_STAT_AUL_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_aul_fail_fields[] = { + {FLM_STAT_AUL_FAIL_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_aul_ignore_fields[] = { + {FLM_STAT_AUL_IGNORE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_csh_hit_fields[] = { + {FLM_STAT_CSH_HIT_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_csh_miss_fields[] = { + {FLM_STAT_CSH_MISS_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_csh_unh_fields[] = { + {FLM_STAT_CSH_UNH_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_cuc_move_fields[] = { + {FLM_STAT_CUC_MOVE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_cuc_start_fields[] = { + {FLM_STAT_CUC_START_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_flows_fields[] = { + {FLM_STAT_FLOWS_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_inf_done_fields[] = { + {FLM_STAT_INF_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_inf_skip_fields[] = { + {FLM_STAT_INF_SKIP_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_lrn_done_fields[] = { + {FLM_STAT_LRN_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_lrn_fail_fields[] = { + {FLM_STAT_LRN_FAIL_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_lrn_ignore_fields[] = { + {FLM_STAT_LRN_IGNORE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_pck_dis_fields[] = { + {FLM_STAT_PCK_DIS_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_pck_hit_fields[] = { + {FLM_STAT_PCK_HIT_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_pck_miss_fields[] = { + {FLM_STAT_PCK_MISS_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_pck_unh_fields[] = { + {FLM_STAT_PCK_UNH_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_prb_done_fields[] = { + {FLM_STAT_PRB_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_prb_ignore_fields[] = { + {FLM_STAT_PRB_IGNORE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_rel_done_fields[] = { + {FLM_STAT_REL_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_rel_ignore_fields[] = { + {FLM_STAT_REL_IGNORE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_sta_done_fields[] = { + {FLM_STAT_STA_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_tul_done_fields[] = { + {FLM_STAT_TUL_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_unl_done_fields[] = { + {FLM_STAT_UNL_DONE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_stat_unl_ignore_fields[] = { + {FLM_STAT_UNL_IGNORE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_sta_data_fields[] = { + {FLM_STA_DATA_EOR ,1 ,95 ,0x0000 }, {FLM_STA_DATA_ID ,32 ,0 ,0x0000 }, + {FLM_STA_DATA_LDS ,1 ,32 ,0x0000 }, {FLM_STA_DATA_LFS ,1 ,33 ,0x0000 }, + {FLM_STA_DATA_LIS ,1 ,34 ,0x0000 }, {FLM_STA_DATA_PDS ,1 ,39 ,0x0000 }, + {FLM_STA_DATA_PIS ,1 ,40 ,0x0000 }, {FLM_STA_DATA_RDS ,1 ,37 ,0x0000 }, + {FLM_STA_DATA_RIS ,1 ,38 ,0x0000 }, {FLM_STA_DATA_UDS ,1 ,35 ,0x0000 }, + {FLM_STA_DATA_UIS ,1 ,36 ,0x0000 }, +}; + +static nthw_fpga_register_init_s flm_registers[] = { + {FLM_BUF_CTRL ,14 ,48 ,NTHW_FPGA_REG_TYPE_RW ,0 ,3 , flm_buf_ctrl_fields }, + {FLM_CONTROL ,0 ,31 ,NTHW_FPGA_REG_TYPE_MIXED ,134217728 ,18 , flm_control_fields }, + {FLM_INF_DATA ,16 ,288 ,NTHW_FPGA_REG_TYPE_RO ,0 ,6 , flm_inf_data_fields }, + {FLM_LOAD_APS ,5 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_load_aps_fields }, + {FLM_LOAD_BIN ,3 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , flm_load_bin_fields }, + {FLM_LOAD_LPS ,4 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_load_lps_fields }, + {FLM_LRN_DATA ,15 ,768 ,NTHW_FPGA_REG_TYPE_WO ,0 ,34 , flm_lrn_data_fields }, + {FLM_PRIO ,6 ,32 ,NTHW_FPGA_REG_TYPE_WO ,269488144 ,8 , flm_prio_fields }, + {FLM_PST_CTRL ,12 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , flm_pst_ctrl_fields }, + {FLM_PST_DATA ,13 ,15 ,NTHW_FPGA_REG_TYPE_WO ,0 ,3 , flm_pst_data_fields }, + {FLM_RCP_CTRL ,8 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , flm_rcp_ctrl_fields }, + {FLM_RCP_DATA ,9 ,403 ,NTHW_FPGA_REG_TYPE_WO ,0 ,19 , flm_rcp_data_fields }, + {FLM_SCAN ,2 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , flm_scan_fields }, + {FLM_STATUS ,1 ,17 ,NTHW_FPGA_REG_TYPE_MIXED ,0 ,9 , flm_status_fields }, + {FLM_STAT_AUL_DONE ,41 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_aul_done_fields }, + {FLM_STAT_AUL_FAIL ,43 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_aul_fail_fields }, + {FLM_STAT_AUL_IGNORE ,42 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_aul_ignore_fields }, + {FLM_STAT_CSH_HIT ,52 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_csh_hit_fields }, + {FLM_STAT_CSH_MISS ,53 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_csh_miss_fields }, + {FLM_STAT_CSH_UNH ,54 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_csh_unh_fields }, + {FLM_STAT_CUC_MOVE ,56 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_cuc_move_fields }, + {FLM_STAT_CUC_START ,55 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_cuc_start_fields }, + {FLM_STAT_FLOWS ,18 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_flows_fields }, + {FLM_STAT_INF_DONE ,46 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_inf_done_fields }, + {FLM_STAT_INF_SKIP ,47 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_inf_skip_fields }, + {FLM_STAT_LRN_DONE ,32 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_lrn_done_fields }, + {FLM_STAT_LRN_FAIL ,34 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_lrn_fail_fields }, + {FLM_STAT_LRN_IGNORE ,33 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_lrn_ignore_fields }, + {FLM_STAT_PCK_DIS ,51 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_pck_dis_fields }, + {FLM_STAT_PCK_HIT ,48 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_pck_hit_fields }, + {FLM_STAT_PCK_MISS ,49 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_pck_miss_fields }, + {FLM_STAT_PCK_UNH ,50 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_pck_unh_fields }, + {FLM_STAT_PRB_DONE ,39 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_prb_done_fields }, + {FLM_STAT_PRB_IGNORE ,40 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_prb_ignore_fields }, + {FLM_STAT_REL_DONE ,37 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_rel_done_fields }, + {FLM_STAT_REL_IGNORE ,38 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_rel_ignore_fields }, + {FLM_STAT_STA_DONE ,45 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_sta_done_fields }, + {FLM_STAT_TUL_DONE ,44 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_tul_done_fields }, + {FLM_STAT_UNL_DONE ,35 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_unl_done_fields }, + {FLM_STAT_UNL_IGNORE ,36 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , flm_stat_unl_ignore_fields }, + {FLM_STA_DATA ,17 ,96 ,NTHW_FPGA_REG_TYPE_RO ,0 ,11 , flm_sta_data_fields }, +}; +static nthw_fpga_field_init_s gfg_burstsize0_fields[] = { {GFG_BURSTSIZE0_VAL ,24 ,0 ,0 }, };
@@ -1743,6 +2025,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers }, { MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers }, { MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers }, + { MOD_FLM, 0, MOD_FLM, 0, 25, NTHW_FPGA_BUS_TYPE_RAB1, 1280, 43, flm_registers }, { MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers }, { MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers }, { MOD_GMF, 1, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9728, 12, gmf_registers },
@@ -1817,7 +2100,6 @@ static nthw_fpga_prod_param_s product_parameters[] = { { NT_FLM_PRESENT, 1 }, { NT_FLM_PRIOS, 4 }, { NT_FLM_PST_PROFILES, 16 }, - { NT_FLM_SCRUB_PROFILES, 16 }, { NT_FLM_SIZE_MB, 12288 }, { NT_FLM_STATEFUL, 1 }, { NT_FLM_VARIANT, 2 },
@@ -1937,5 +2219,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,23 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,24 , fpga_modules, };
Signature · 1 line
2.45.0
PATCH v4 43/86 net/ntnic: add HFU module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The Header Field Update module updates protocol fields if the packets have been changed,
for example length fields and next protocol fields.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +37 -1
@@ -919,6 +919,41 @@ static nthw_fpga_register_init_s gpio_phy_registers[] = { { GPIO_PHY_GPIO, 1, 10, NTHW_FPGA_REG_TYPE_RW, 17, 10, gpio_phy_gpio_fields }, }; +static nthw_fpga_field_init_s hfu_rcp_ctrl_fields[] = { + {HFU_RCP_CTRL_ADR ,6 ,0 ,0x0000 }, + {HFU_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s hfu_rcp_data_fields[] = { + {HFU_RCP_DATA_LEN_A_ADD_DYN ,5 ,15 ,0x0000 }, + {HFU_RCP_DATA_LEN_A_ADD_OFS ,8 ,20 ,0x0000 }, + {HFU_RCP_DATA_LEN_A_OL4LEN ,1 ,1 ,0x0000 }, + {HFU_RCP_DATA_LEN_A_POS_DYN ,5 ,2 ,0x0000 }, + {HFU_RCP_DATA_LEN_A_POS_OFS ,8 ,7 ,0x0000 }, + {HFU_RCP_DATA_LEN_A_SUB_DYN ,5 ,28 ,0x0000 }, + {HFU_RCP_DATA_LEN_A_WR ,1 ,0 ,0x0000 }, + {HFU_RCP_DATA_LEN_B_ADD_DYN ,5 ,47 ,0x0000 }, + {HFU_RCP_DATA_LEN_B_ADD_OFS ,8 ,52 ,0x0000 }, + {HFU_RCP_DATA_LEN_B_POS_DYN ,5 ,34 ,0x0000 }, + {HFU_RCP_DATA_LEN_B_POS_OFS ,8 ,39 ,0x0000 }, + {HFU_RCP_DATA_LEN_B_SUB_DYN ,5 ,60 ,0x0000 }, + {HFU_RCP_DATA_LEN_B_WR ,1 ,33 ,0x0000 }, + {HFU_RCP_DATA_LEN_C_ADD_DYN ,5 ,79 ,0x0000 }, + {HFU_RCP_DATA_LEN_C_ADD_OFS ,8 ,84 ,0x0000 }, + {HFU_RCP_DATA_LEN_C_POS_DYN ,5 ,66 ,0x0000 }, + {HFU_RCP_DATA_LEN_C_POS_OFS ,8 ,71 ,0x0000 }, + {HFU_RCP_DATA_LEN_C_SUB_DYN ,5 ,92 ,0x0000 }, + {HFU_RCP_DATA_LEN_C_WR ,1 ,65 ,0x0000 }, + {HFU_RCP_DATA_TTL_POS_DYN ,5 ,98 ,0x0000 }, + {HFU_RCP_DATA_TTL_POS_OFS ,8 ,103 ,0x0000 }, + {HFU_RCP_DATA_TTL_WR ,1 ,97 ,0x0000 }, +}; + +static nthw_fpga_register_init_s hfu_registers[] = { + {HFU_RCP_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , hfu_rcp_ctrl_fields }, + {HFU_RCP_DATA ,1 ,111 ,NTHW_FPGA_REG_TYPE_WO ,0 ,22 , hfu_rcp_data_fields }, +}; +static nthw_fpga_field_init_s hif_build_time_fields[] = { {HIF_BUILD_TIME_TIME ,32 ,0 ,1726740521 }, };
@@ -2033,6 +2068,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {MOD_GPIO_PHY ,0 ,MOD_GPIO_PHY ,1 ,0 ,NTHW_FPGA_BUS_TYPE_RAB0 ,16386 ,2 , gpio_phy_registers }, + { MOD_HFU, 0, MOD_HFU, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 9472, 2, hfu_registers }, { MOD_HIF, 0, MOD_HIF, 0, 0, NTHW_FPGA_BUS_TYPE_PCI, 0, 18, hif_registers }, { MOD_HSH, 0, MOD_HSH, 0, 5, NTHW_FPGA_BUS_TYPE_RAB1, 1536, 2, hsh_registers }, { MOD_IIC, 0, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 768, 22, iic_registers },
@@ -2219,5 +2255,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,24 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,25 , fpga_modules, };
Signature · 1 line
2.45.0
PATCH v4 44/86 net/ntnic: add IFR module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The IP Fragmenter module can fragment outgoing packets based on a programmable MTU.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +40 -1
@@ -1095,6 +1095,44 @@ static nthw_fpga_register_init_s hsh_registers[] = { { HSH_RCP_DATA, 1, 743, NTHW_FPGA_REG_TYPE_WO, 0, 23, hsh_rcp_data_fields }, }; +static nthw_fpga_field_init_s ifr_counters_ctrl_fields[] = { + {IFR_COUNTERS_CTRL_ADR ,4 ,0 ,0x0000 }, + {IFR_COUNTERS_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s ifr_counters_data_fields[] = { + {IFR_COUNTERS_DATA_DROP ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s ifr_df_buf_ctrl_fields[] = { + {IFR_DF_BUF_CTRL_AVAILABLE ,11 ,0 ,0x0000 }, + {IFR_DF_BUF_CTRL_MTU_PROFILE ,16 ,11 ,0x0000 }, +}; + +static nthw_fpga_field_init_s ifr_df_buf_data_fields[] = { + {IFR_DF_BUF_DATA_FIFO_DAT ,128 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s ifr_rcp_ctrl_fields[] = { + {IFR_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, + {IFR_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s ifr_rcp_data_fields[] = { + {IFR_RCP_DATA_IPV4_DF_DROP ,1 ,17 ,0x0000 }, {IFR_RCP_DATA_IPV4_EN ,1 ,0 ,0x0000 }, + {IFR_RCP_DATA_IPV6_DROP ,1 ,16 ,0x0000 }, {IFR_RCP_DATA_IPV6_EN ,1 ,1 ,0x0000 }, + {IFR_RCP_DATA_MTU ,14 ,2 ,0x0000 }, +}; + +static nthw_fpga_register_init_s ifr_registers[] = { + {IFR_COUNTERS_CTRL ,4 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , ifr_counters_ctrl_fields }, + {IFR_COUNTERS_DATA ,5 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , ifr_counters_data_fields }, + {IFR_DF_BUF_CTRL ,2 ,27 ,NTHW_FPGA_REG_TYPE_RO ,0 ,2 , ifr_df_buf_ctrl_fields }, + {IFR_DF_BUF_DATA ,3 ,128 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , ifr_df_buf_data_fields }, + {IFR_RCP_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , ifr_rcp_ctrl_fields }, + {IFR_RCP_DATA ,1 ,18 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , ifr_rcp_data_fields }, +}; +static nthw_fpga_field_init_s iic_adr_fields[] = { {IIC_ADR_SLV_ADR ,7 ,1 ,0 }, };
@@ -2071,6 +2109,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_HFU, 0, MOD_HFU, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 9472, 2, hfu_registers }, { MOD_HIF, 0, MOD_HIF, 0, 0, NTHW_FPGA_BUS_TYPE_PCI, 0, 18, hif_registers }, { MOD_HSH, 0, MOD_HSH, 0, 5, NTHW_FPGA_BUS_TYPE_RAB1, 1536, 2, hsh_registers }, + { MOD_IFR, 0, MOD_IFR, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 9984, 6, ifr_registers }, { MOD_IIC, 0, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 768, 22, iic_registers }, { MOD_IIC, 1, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 896, 22, iic_registers }, { MOD_IIC, 2, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 24832, 22, iic_registers },
@@ -2255,5 +2294,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,25 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,26 , fpga_modules, };
Signature · 1 line
2.45.0
PATCH v4 45/86 net/ntnic: add MAC Rx module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The IP Fragmenter module can fragment outgoing packets based on a programmable MTU.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 61 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 3 +- .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_mac_rx.h | 29 +++++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +60 -1
@@ -1774,6 +1774,63 @@ static nthw_fpga_register_init_s mac_pcs_registers[] = { }, }; +static nthw_fpga_field_init_s mac_rx_bad_fcs_fields[] = { + {MAC_RX_BAD_FCS_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_fragment_fields[] = { + {MAC_RX_FRAGMENT_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_packet_bad_fcs_fields[] = { + {MAC_RX_PACKET_BAD_FCS_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_packet_small_fields[] = { + {MAC_RX_PACKET_SMALL_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_total_bytes_fields[] = { + {MAC_RX_TOTAL_BYTES_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_total_good_bytes_fields[] = { + {MAC_RX_TOTAL_GOOD_BYTES_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_total_good_packets_fields[] = { + {MAC_RX_TOTAL_GOOD_PACKETS_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_total_packets_fields[] = { + {MAC_RX_TOTAL_PACKETS_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_rx_undersize_fields[] = { + {MAC_RX_UNDERSIZE_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_register_init_s mac_rx_registers[] = { + {MAC_RX_BAD_FCS ,0 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_rx_bad_fcs_fields }, + {MAC_RX_FRAGMENT ,6 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_rx_fragment_fields }, + { +MAC_RX_PACKET_BAD_FCS ,7 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , + mac_rx_packet_bad_fcs_fields + }, + {MAC_RX_PACKET_SMALL ,3 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_rx_packet_small_fields }, + {MAC_RX_TOTAL_BYTES ,4 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_rx_total_bytes_fields }, + { +MAC_RX_TOTAL_GOOD_BYTES ,5 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , + mac_rx_total_good_bytes_fields + }, + { +MAC_RX_TOTAL_GOOD_PACKETS ,2 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , + mac_rx_total_good_packets_fields + }, + {MAC_RX_TOTAL_PACKETS ,1 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_rx_total_packets_fields }, + {MAC_RX_UNDERSIZE ,8 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_rx_undersize_fields }, +}; +static nthw_fpga_field_init_s pci_rd_tg_tg_ctrl_fields[] = { {PCI_RD_TG_TG_CTRL_TG_RD_RDY ,1 ,0 ,0 }, };
@@ -2123,6 +2180,8 @@ static nthw_fpga_module_init_s fpga_modules[] = {MOD_MAC_PCS ,1 ,MOD_MAC_PCS ,0 ,2 ,NTHW_FPGA_BUS_TYPE_RAB2 ,11776 ,44 , mac_pcs_registers }, + { MOD_MAC_RX, 0, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 10752, 9, mac_rx_registers }, + { MOD_MAC_RX, 1, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 12288, 9, mac_rx_registers }, {MOD_PCI_RD_TG ,0 ,MOD_PCI_RD_TG ,0 ,1 ,NTHW_FPGA_BUS_TYPE_RAB0 ,2320 ,6 , pci_rd_tg_registers
@@ -2294,5 +2353,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,26 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,28 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
@@ -29,6 +29,7 @@#define MOD_IIC (0x7629cddbUL)#define MOD_KM (0xcfbd9dbeUL)#define MOD_MAC_PCS (0x7abe24c7UL) +#define MOD_MAC_RX (0x6347b490UL)#define MOD_PCIE3 (0xfbc48c18UL)#define MOD_PCI_RD_TG (0x9ad9eed2UL)#define MOD_PCI_WR_TG (0x274b69e1UL)
@@ -43,7 +44,7 @@#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL) -#define MOD_IDX_COUNT (14) +#define MOD_IDX_COUNT (31)/* aliases - only aliases go below this point */ #endif /* _NTHW_FPGA_MOD_DEFS_H_ */
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -30,6 +30,7 @@#include "nthw_fpga_reg_defs_ins.h" #include "nthw_fpga_reg_defs_km.h" #include "nthw_fpga_reg_defs_mac_pcs.h" +#include "nthw_fpga_reg_defs_mac_rx.h" #include "nthw_fpga_reg_defs_pcie3.h" #include "nthw_fpga_reg_defs_pci_rd_tg.h" #include "nthw_fpga_reg_defs_pci_wr_tg.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2024 Napatech A/S +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_MAC_RX_ +#define _NTHW_FPGA_REG_DEFS_MAC_RX_ + +/* MAC_RX */ +#define MAC_RX_BAD_FCS (0xca07f618UL) +#define MAC_RX_BAD_FCS_COUNT (0x11d5ba0eUL) +#define MAC_RX_FRAGMENT (0x5363b736UL) +#define MAC_RX_FRAGMENT_COUNT (0xf664c9aUL) +#define MAC_RX_PACKET_BAD_FCS (0x4cb8b34cUL) +#define MAC_RX_PACKET_BAD_FCS_COUNT (0xb6701e28UL) +#define MAC_RX_PACKET_SMALL (0xed318a65UL) +#define MAC_RX_PACKET_SMALL_COUNT (0x72095ec7UL) +#define MAC_RX_TOTAL_BYTES (0x831313e2UL) +#define MAC_RX_TOTAL_BYTES_COUNT (0xe5d8be59UL) +#define MAC_RX_TOTAL_GOOD_BYTES (0x912c2d1cUL) +#define MAC_RX_TOTAL_GOOD_BYTES_COUNT (0x63bb5f3eUL) +#define MAC_RX_TOTAL_GOOD_PACKETS (0xfbb4f497UL) +#define MAC_RX_TOTAL_GOOD_PACKETS_COUNT (0xae9d21b0UL) +#define MAC_RX_TOTAL_PACKETS (0xb0ea3730UL) +#define MAC_RX_TOTAL_PACKETS_COUNT (0x532c885dUL) +#define MAC_RX_UNDERSIZE (0xb6fa4bdbUL) +#define MAC_RX_UNDERSIZE_COUNT (0x471945ffUL) + +#endif /* _NTHW_FPGA_REG_DEFS_MAC_RX_ */
Signature · 1 line
2.45.0
PATCH v4 46/86 net/ntnic: add MAC Tx module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The Media Access Control Transmit module contains counters that keep track on transmitted packets.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 38 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 3 +- .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_mac_tx.h | 21 ++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +37 -1
@@ -1831,6 +1831,40 @@ static nthw_fpga_register_init_s mac_rx_registers[] = { { MAC_RX_UNDERSIZE, 8, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_undersize_fields }, }; +static nthw_fpga_field_init_s mac_tx_packet_small_fields[] = { + {MAC_TX_PACKET_SMALL_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_tx_total_bytes_fields[] = { + {MAC_TX_TOTAL_BYTES_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_tx_total_good_bytes_fields[] = { + {MAC_TX_TOTAL_GOOD_BYTES_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_tx_total_good_packets_fields[] = { + {MAC_TX_TOTAL_GOOD_PACKETS_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s mac_tx_total_packets_fields[] = { + {MAC_TX_TOTAL_PACKETS_COUNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_register_init_s mac_tx_registers[] = { + {MAC_TX_PACKET_SMALL ,2 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_tx_packet_small_fields }, + {MAC_TX_TOTAL_BYTES ,3 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_tx_total_bytes_fields }, + { +MAC_TX_TOTAL_GOOD_BYTES ,4 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , + mac_tx_total_good_bytes_fields + }, + { +MAC_TX_TOTAL_GOOD_PACKETS ,1 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , + mac_tx_total_good_packets_fields + }, + {MAC_TX_TOTAL_PACKETS ,0 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , mac_tx_total_packets_fields }, +}; +static nthw_fpga_field_init_s pci_rd_tg_tg_ctrl_fields[] = { {PCI_RD_TG_TG_CTRL_TG_RD_RDY ,1 ,0 ,0 }, };
@@ -2182,6 +2216,8 @@ static nthw_fpga_module_init_s fpga_modules[] = { }, { MOD_MAC_RX, 0, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 10752, 9, mac_rx_registers }, { MOD_MAC_RX, 1, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 12288, 9, mac_rx_registers }, + { MOD_MAC_TX, 0, MOD_MAC_TX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 11264, 5, mac_tx_registers }, + { MOD_MAC_TX, 1, MOD_MAC_TX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 12800, 5, mac_tx_registers }, {MOD_PCI_RD_TG ,0 ,MOD_PCI_RD_TG ,0 ,1 ,NTHW_FPGA_BUS_TYPE_RAB0 ,2320 ,6 , pci_rd_tg_registers
@@ -2353,5 +2389,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,28 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,30 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
@@ -30,6 +30,7 @@#define MOD_KM (0xcfbd9dbeUL)#define MOD_MAC_PCS (0x7abe24c7UL)#define MOD_MAC_RX (0x6347b490UL) +#define MOD_MAC_TX (0x351d1316UL)#define MOD_PCIE3 (0xfbc48c18UL)#define MOD_PCI_RD_TG (0x9ad9eed2UL)#define MOD_PCI_WR_TG (0x274b69e1UL)
@@ -44,7 +45,7 @@#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL) -#define MOD_IDX_COUNT (31) +#define MOD_IDX_COUNT (32)/* aliases - only aliases go below this point */ #endif /* _NTHW_FPGA_MOD_DEFS_H_ */
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -31,6 +31,7 @@#include "nthw_fpga_reg_defs_km.h" #include "nthw_fpga_reg_defs_mac_pcs.h" #include "nthw_fpga_reg_defs_mac_rx.h" +#include "nthw_fpga_reg_defs_mac_tx.h" #include "nthw_fpga_reg_defs_pcie3.h" #include "nthw_fpga_reg_defs_pci_rd_tg.h" #include "nthw_fpga_reg_defs_pci_wr_tg.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2024 Napatech A/S +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_MAC_TX_ +#define _NTHW_FPGA_REG_DEFS_MAC_TX_ + +/* MAC_TX */ +#define MAC_TX_PACKET_SMALL (0xcfcb5e97UL) +#define MAC_TX_PACKET_SMALL_COUNT (0x84345b01UL) +#define MAC_TX_TOTAL_BYTES (0x7bd15854UL) +#define MAC_TX_TOTAL_BYTES_COUNT (0x61fb238cUL) +#define MAC_TX_TOTAL_GOOD_BYTES (0xcf0260fUL) +#define MAC_TX_TOTAL_GOOD_BYTES_COUNT (0x8603398UL) +#define MAC_TX_TOTAL_GOOD_PACKETS (0xd89f151UL) +#define MAC_TX_TOTAL_GOOD_PACKETS_COUNT (0x12c47c77UL) +#define MAC_TX_TOTAL_PACKETS (0xe37b5ed4UL) +#define MAC_TX_TOTAL_PACKETS_COUNT (0x21ddd2ddUL) + +#endif /* _NTHW_FPGA_REG_DEFS_MAC_TX_ */
Signature · 1 line
2.45.0
PATCH v4 47/86 net/ntnic: add RPP LR module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The RX Packet Process for Local Retransmit module can add bytes in the FPGA TX pipeline, which is needed when the packet increases in size. Note, this makes room for packet expansion,
but the actual expansion is done by the modules.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +31 -1
@@ -2138,6 +2138,35 @@ static nthw_fpga_register_init_s rmc_registers[] = { { RMC_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_RO, 0, 2, rmc_status_fields }, }; +static nthw_fpga_field_init_s rpp_lr_ifr_rcp_ctrl_fields[] = { + {RPP_LR_IFR_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, + {RPP_LR_IFR_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpp_lr_ifr_rcp_data_fields[] = { + {RPP_LR_IFR_RCP_DATA_IPV4_DF_DROP ,1 ,17 ,0x0000 }, + {RPP_LR_IFR_RCP_DATA_IPV4_EN ,1 ,0 ,0x0000 }, + {RPP_LR_IFR_RCP_DATA_IPV6_DROP ,1 ,16 ,0x0000 }, + {RPP_LR_IFR_RCP_DATA_IPV6_EN ,1 ,1 ,0x0000 }, + {RPP_LR_IFR_RCP_DATA_MTU ,14 ,2 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpp_lr_rcp_ctrl_fields[] = { + {RPP_LR_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, + {RPP_LR_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpp_lr_rcp_data_fields[] = { + {RPP_LR_RCP_DATA_EXP ,14 ,0 ,0x0000 }, +}; + +static nthw_fpga_register_init_s rpp_lr_registers[] = { + {RPP_LR_IFR_RCP_CTRL ,2 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , rpp_lr_ifr_rcp_ctrl_fields }, + {RPP_LR_IFR_RCP_DATA ,3 ,18 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , rpp_lr_ifr_rcp_data_fields }, + {RPP_LR_RCP_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , rpp_lr_rcp_ctrl_fields }, + {RPP_LR_RCP_DATA ,1 ,14 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , rpp_lr_rcp_data_fields }, +}; +static nthw_fpga_field_init_s rst9563_ctrl_fields[] = { {RST9563_CTRL_PTP_MMCM_CLKSEL ,1 ,2 ,1 }, { RST9563_CTRL_TS_CLKSEL, 1, 1, 1 },
@@ -2230,6 +2259,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_QSL, 0, MOD_QSL, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1792, 8, qsl_registers }, { MOD_RAC, 0, MOD_RAC, 3, 0, NTHW_FPGA_BUS_TYPE_PCI, 8192, 14, rac_registers }, { MOD_RMC, 0, MOD_RMC, 1, 3, NTHW_FPGA_BUS_TYPE_RAB0, 12288, 4, rmc_registers }, + { MOD_RPP_LR, 0, MOD_RPP_LR, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2304, 4, rpp_lr_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, };
@@ -2389,5 +2419,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,30 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,31 , fpga_modules, };
Signature · 1 line
2.45.0
PATCH v4 48/86 net/ntnic: add SLC LR module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The Slicer for Local Retransmit module can cut of the head a packet before the packet leaves the FPGA RX pipeline.
This is used when the TX pipeline is configured
to add a new head in the packet
--- .../supported/nthw_fpga_9563_055_049_0000.c | 20 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +19 -1
@@ -2214,6 +2214,23 @@ static nthw_fpga_register_init_s rst9563_registers[] = { { RST9563_STICKY, 3, 6, NTHW_FPGA_REG_TYPE_RC1, 0, 6, rst9563_sticky_fields }, }; +static nthw_fpga_field_init_s slc_rcp_ctrl_fields[] = { + {SLC_RCP_CTRL_ADR ,6 ,0 ,0x0000 }, + {SLC_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s slc_rcp_data_fields[] = { + {SLC_RCP_DATA_HEAD_DYN ,5 ,1 ,0x0000 }, {SLC_RCP_DATA_HEAD_OFS ,8 ,6 ,0x0000 }, + {SLC_RCP_DATA_HEAD_SLC_EN ,1 ,0 ,0x0000 }, {SLC_RCP_DATA_PCAP ,1 ,35 ,0x0000 }, + {SLC_RCP_DATA_TAIL_DYN ,5 ,15 ,0x0000 }, {SLC_RCP_DATA_TAIL_OFS ,15 ,20 ,0x0000 }, + {SLC_RCP_DATA_TAIL_SLC_EN ,1 ,14 ,0x0000 }, +}; + +static nthw_fpga_register_init_s slc_registers[] = { + {SLC_RCP_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , slc_rcp_ctrl_fields }, + {SLC_RCP_DATA ,1 ,36 ,NTHW_FPGA_REG_TYPE_WO ,0 ,7 , slc_rcp_data_fields }, +}; +static nthw_fpga_module_init_s fpga_modules[] = { {MOD_CAT ,0 ,MOD_CAT ,0 ,21 ,NTHW_FPGA_BUS_TYPE_RAB1 ,768 ,34 , cat_registers }, { MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers },
@@ -2261,6 +2278,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_RMC, 0, MOD_RMC, 1, 3, NTHW_FPGA_BUS_TYPE_RAB0, 12288, 4, rmc_registers }, { MOD_RPP_LR, 0, MOD_RPP_LR, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2304, 4, rpp_lr_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, + { MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers }, }; static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2419,5 +2437,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,31 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,32 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
@@ -41,11 +41,12 @@#define MOD_RPP_LR (0xba7f945cUL)#define MOD_RST9563 (0x385d6d1dUL)#define MOD_SDC (0xd2369530UL) +#define MOD_SLC (0x1aef1f38UL)#define MOD_SLC_LR (0x969fc50bUL)#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL) -#define MOD_IDX_COUNT (32) +#define MOD_IDX_COUNT (33)/* aliases - only aliases go below this point */ #endif /* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
PATCH v4 49/86 net/ntnic: add Tx CPY module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The TX Copy module writes data to packet fields based on the lookup performed by the FLM module.
This is used for NAT and can support other actions based on the RTE action MODIFY_FIELD.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 204 +++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 3 +- 2 files changed, 205 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +203 -1
@@ -270,6 +270,207 @@ static nthw_fpga_register_init_s cat_registers[] = { { CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields }, }; +static nthw_fpga_field_init_s cpy_packet_reader0_ctrl_fields[] = { + {CPY_PACKET_READER0_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_PACKET_READER0_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_packet_reader0_data_fields[] = { + {CPY_PACKET_READER0_DATA_DYN ,5 ,10 ,0x0000 }, + {CPY_PACKET_READER0_DATA_OFS ,10 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer0_ctrl_fields[] = { + {CPY_WRITER0_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER0_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer0_data_fields[] = { + {CPY_WRITER0_DATA_DYN ,5 ,17 ,0x0000 }, {CPY_WRITER0_DATA_LEN ,5 ,22 ,0x0000 }, + {CPY_WRITER0_DATA_MASK_POINTER ,4 ,27 ,0x0000 }, {CPY_WRITER0_DATA_OFS ,14 ,3 ,0x0000 }, + {CPY_WRITER0_DATA_READER_SELECT ,3 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer0_mask_ctrl_fields[] = { + {CPY_WRITER0_MASK_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER0_MASK_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer0_mask_data_fields[] = { + {CPY_WRITER0_MASK_DATA_BYTE_MASK ,16 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer1_ctrl_fields[] = { + {CPY_WRITER1_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER1_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer1_data_fields[] = { + {CPY_WRITER1_DATA_DYN ,5 ,17 ,0x0000 }, {CPY_WRITER1_DATA_LEN ,5 ,22 ,0x0000 }, + {CPY_WRITER1_DATA_MASK_POINTER ,4 ,27 ,0x0000 }, {CPY_WRITER1_DATA_OFS ,14 ,3 ,0x0000 }, + {CPY_WRITER1_DATA_READER_SELECT ,3 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer1_mask_ctrl_fields[] = { + {CPY_WRITER1_MASK_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER1_MASK_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer1_mask_data_fields[] = { + {CPY_WRITER1_MASK_DATA_BYTE_MASK ,16 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer2_ctrl_fields[] = { + {CPY_WRITER2_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER2_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer2_data_fields[] = { + {CPY_WRITER2_DATA_DYN ,5 ,17 ,0x0000 }, {CPY_WRITER2_DATA_LEN ,5 ,22 ,0x0000 }, + {CPY_WRITER2_DATA_MASK_POINTER ,4 ,27 ,0x0000 }, {CPY_WRITER2_DATA_OFS ,14 ,3 ,0x0000 }, + {CPY_WRITER2_DATA_READER_SELECT ,3 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer2_mask_ctrl_fields[] = { + {CPY_WRITER2_MASK_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER2_MASK_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer2_mask_data_fields[] = { + {CPY_WRITER2_MASK_DATA_BYTE_MASK ,16 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer3_ctrl_fields[] = { + {CPY_WRITER3_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER3_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer3_data_fields[] = { + {CPY_WRITER3_DATA_DYN ,5 ,17 ,0x0000 }, {CPY_WRITER3_DATA_LEN ,5 ,22 ,0x0000 }, + {CPY_WRITER3_DATA_MASK_POINTER ,4 ,27 ,0x0000 }, {CPY_WRITER3_DATA_OFS ,14 ,3 ,0x0000 }, + {CPY_WRITER3_DATA_READER_SELECT ,3 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer3_mask_ctrl_fields[] = { + {CPY_WRITER3_MASK_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER3_MASK_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer3_mask_data_fields[] = { + {CPY_WRITER3_MASK_DATA_BYTE_MASK ,16 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer4_ctrl_fields[] = { + {CPY_WRITER4_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER4_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer4_data_fields[] = { + {CPY_WRITER4_DATA_DYN ,5 ,17 ,0x0000 }, {CPY_WRITER4_DATA_LEN ,5 ,22 ,0x0000 }, + {CPY_WRITER4_DATA_MASK_POINTER ,4 ,27 ,0x0000 }, {CPY_WRITER4_DATA_OFS ,14 ,3 ,0x0000 }, + {CPY_WRITER4_DATA_READER_SELECT ,3 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer4_mask_ctrl_fields[] = { + {CPY_WRITER4_MASK_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER4_MASK_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer4_mask_data_fields[] = { + {CPY_WRITER4_MASK_DATA_BYTE_MASK ,16 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer5_ctrl_fields[] = { + {CPY_WRITER5_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER5_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer5_data_fields[] = { + {CPY_WRITER5_DATA_DYN ,5 ,17 ,0x0000 }, {CPY_WRITER5_DATA_LEN ,5 ,22 ,0x0000 }, + {CPY_WRITER5_DATA_MASK_POINTER ,4 ,27 ,0x0000 }, {CPY_WRITER5_DATA_OFS ,14 ,3 ,0x0000 }, + {CPY_WRITER5_DATA_READER_SELECT ,3 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer5_mask_ctrl_fields[] = { + {CPY_WRITER5_MASK_CTRL_ADR ,4 ,0 ,0x0000 }, + {CPY_WRITER5_MASK_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s cpy_writer5_mask_data_fields[] = { + {CPY_WRITER5_MASK_DATA_BYTE_MASK ,16 ,0 ,0x0000 }, +}; + +static nthw_fpga_register_init_s cpy_registers[] = { + { +CPY_PACKET_READER0_CTRL ,24 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_packet_reader0_ctrl_fields + }, + { +CPY_PACKET_READER0_DATA ,25 ,15 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_packet_reader0_data_fields + }, + {CPY_WRITER0_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , cpy_writer0_ctrl_fields }, + {CPY_WRITER0_DATA ,1 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , cpy_writer0_data_fields }, + { +CPY_WRITER0_MASK_CTRL ,2 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_writer0_mask_ctrl_fields + }, + { +CPY_WRITER0_MASK_DATA ,3 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , + cpy_writer0_mask_data_fields + }, + {CPY_WRITER1_CTRL ,4 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , cpy_writer1_ctrl_fields }, + {CPY_WRITER1_DATA ,5 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , cpy_writer1_data_fields }, + { +CPY_WRITER1_MASK_CTRL ,6 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_writer1_mask_ctrl_fields + }, + { +CPY_WRITER1_MASK_DATA ,7 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , + cpy_writer1_mask_data_fields + }, + {CPY_WRITER2_CTRL ,8 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , cpy_writer2_ctrl_fields }, + {CPY_WRITER2_DATA ,9 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , cpy_writer2_data_fields }, + { +CPY_WRITER2_MASK_CTRL ,10 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_writer2_mask_ctrl_fields + }, + { +CPY_WRITER2_MASK_DATA ,11 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , + cpy_writer2_mask_data_fields + }, + {CPY_WRITER3_CTRL ,12 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , cpy_writer3_ctrl_fields }, + {CPY_WRITER3_DATA ,13 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , cpy_writer3_data_fields }, + { +CPY_WRITER3_MASK_CTRL ,14 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_writer3_mask_ctrl_fields + }, + { +CPY_WRITER3_MASK_DATA ,15 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , + cpy_writer3_mask_data_fields + }, + {CPY_WRITER4_CTRL ,16 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , cpy_writer4_ctrl_fields }, + {CPY_WRITER4_DATA ,17 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , cpy_writer4_data_fields }, + { +CPY_WRITER4_MASK_CTRL ,18 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_writer4_mask_ctrl_fields + }, + { +CPY_WRITER4_MASK_DATA ,19 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , + cpy_writer4_mask_data_fields + }, + {CPY_WRITER5_CTRL ,20 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , cpy_writer5_ctrl_fields }, + {CPY_WRITER5_DATA ,21 ,31 ,NTHW_FPGA_REG_TYPE_WO ,0 ,5 , cpy_writer5_data_fields }, + { +CPY_WRITER5_MASK_CTRL ,22 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , + cpy_writer5_mask_ctrl_fields + }, + { +CPY_WRITER5_MASK_DATA ,23 ,16 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , + cpy_writer5_mask_data_fields + }, +}; +static nthw_fpga_field_init_s csu_rcp_ctrl_fields[] = { {CSU_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, { CSU_RCP_CTRL_CNT, 16, 16, 0x0000 },
@@ -2279,6 +2480,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_RPP_LR, 0, MOD_RPP_LR, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2304, 4, rpp_lr_registers }, { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, { MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers }, + { MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers }, }; static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2437,5 +2639,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,32 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,33 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
@@ -15,6 +15,7 @@#define MOD_UNKNOWN (0L)/* Unknown/uninitialized - keep this as the first element */ #define MOD_CAT (0x30b447c2UL) +#define MOD_CPY (0x1ddc186fUL)#define MOD_CSU (0x3f470787UL)#define MOD_DBS (0x80b29727UL)#define MOD_FLM (0xe7ba53a4UL)
@@ -46,7 +47,7 @@#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL) -#define MOD_IDX_COUNT (33) +#define MOD_IDX_COUNT (34)/* aliases - only aliases go below this point */ #endif /* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
PATCH v4 50/86 net/ntnic: add Tx INS module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The TX Inserter module injects zeros into an offset of a packet, effectively expanding the packet.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 19 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +18 -1
@@ -1457,6 +1457,22 @@ static nthw_fpga_register_init_s iic_registers[] = { { IIC_TX_FIFO_OCY, 69, 4, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_tx_fifo_ocy_fields }, }; +static nthw_fpga_field_init_s ins_rcp_ctrl_fields[] = { + {INS_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, + {INS_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s ins_rcp_data_fields[] = { + {INS_RCP_DATA_DYN ,5 ,0 ,0x0000 }, + {INS_RCP_DATA_LEN ,8 ,15 ,0x0000 }, + {INS_RCP_DATA_OFS ,10 ,5 ,0x0000 }, +}; + +static nthw_fpga_register_init_s ins_registers[] = { + {INS_RCP_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , ins_rcp_ctrl_fields }, + {INS_RCP_DATA ,1 ,23 ,NTHW_FPGA_REG_TYPE_WO ,0 ,3 , ins_rcp_data_fields }, +}; +static nthw_fpga_field_init_s km_cam_ctrl_fields[] = { {KM_CAM_CTRL_ADR ,13 ,0 ,0x0000 }, { KM_CAM_CTRL_CNT, 16, 16, 0x0000 },
@@ -2481,6 +2497,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers }, { MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers }, { MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers }, + { MOD_TX_INS, 0, MOD_INS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 8704, 2, ins_registers }, }; static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2639,5 +2656,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,33 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,34 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
@@ -28,6 +28,7 @@#define MOD_I2CM (0x93bc7780UL)#define MOD_IFR (0x9b01f1e6UL)#define MOD_IIC (0x7629cddbUL) +#define MOD_INS (0x24df4b78UL)#define MOD_KM (0xcfbd9dbeUL)#define MOD_MAC_PCS (0x7abe24c7UL)#define MOD_MAC_RX (0x6347b490UL)
@@ -47,7 +48,7 @@#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL) -#define MOD_IDX_COUNT (34) +#define MOD_IDX_COUNT (35)/* aliases - only aliases go below this point */ #endif /* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
PATCH v4 51/86 net/ntnic: add Tx RPL module registers
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
The TX Replacer module can replace a range of bytes in a packet. The replacing data is stored in a table in the module and will often contain tunnel data.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 41 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 3 +- 2 files changed, 42 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +40 -1
@@ -2355,6 +2355,44 @@ static nthw_fpga_register_init_s rmc_registers[] = { { RMC_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_RO, 0, 2, rmc_status_fields }, }; +static nthw_fpga_field_init_s rpl_ext_ctrl_fields[] = { + {RPL_EXT_CTRL_ADR ,10 ,0 ,0x0000 }, + {RPL_EXT_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpl_ext_data_fields[] = { + {RPL_EXT_DATA_RPL_PTR ,12 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpl_rcp_ctrl_fields[] = { + {RPL_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, + {RPL_RCP_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpl_rcp_data_fields[] = { + {RPL_RCP_DATA_DYN ,5 ,0 ,0x0000 }, {RPL_RCP_DATA_ETH_TYPE_WR ,1 ,36 ,0x0000 }, + {RPL_RCP_DATA_EXT_PRIO ,1 ,35 ,0x0000 }, {RPL_RCP_DATA_LEN ,8 ,15 ,0x0000 }, + {RPL_RCP_DATA_OFS ,10 ,5 ,0x0000 }, {RPL_RCP_DATA_RPL_PTR ,12 ,23 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpl_rpl_ctrl_fields[] = { + {RPL_RPL_CTRL_ADR ,12 ,0 ,0x0000 }, + {RPL_RPL_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s rpl_rpl_data_fields[] = { + {RPL_RPL_DATA_VALUE ,128 ,0 ,0x0000 }, +}; + +static nthw_fpga_register_init_s rpl_registers[] = { + {RPL_EXT_CTRL ,2 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , rpl_ext_ctrl_fields }, + {RPL_EXT_DATA ,3 ,12 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , rpl_ext_data_fields }, + {RPL_RCP_CTRL ,0 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , rpl_rcp_ctrl_fields }, + {RPL_RCP_DATA ,1 ,37 ,NTHW_FPGA_REG_TYPE_WO ,0 ,6 , rpl_rcp_data_fields }, + {RPL_RPL_CTRL ,4 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,2 , rpl_rpl_ctrl_fields }, + {RPL_RPL_DATA ,5 ,128 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , rpl_rpl_data_fields }, +}; +static nthw_fpga_field_init_s rpp_lr_ifr_rcp_ctrl_fields[] = { {RPP_LR_IFR_RCP_CTRL_ADR ,4 ,0 ,0x0000 }, { RPP_LR_IFR_RCP_CTRL_CNT, 16, 16, 0x0000 },
@@ -2498,6 +2536,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers }, { MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers }, { MOD_TX_INS, 0, MOD_INS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 8704, 2, ins_registers }, + { MOD_TX_RPL, 0, MOD_RPL, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 8960, 6, rpl_registers }, }; static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2656,5 +2695,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,34 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,35 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
@@ -40,6 +40,7 @@#define MOD_QSL (0x448ed859UL)#define MOD_RAC (0xae830b42UL)#define MOD_RMC (0x236444eUL) +#define MOD_RPL (0x6de535c3UL)#define MOD_RPP_LR (0xba7f945cUL)#define MOD_RST9563 (0x385d6d1dUL)#define MOD_SDC (0xd2369530UL)
@@ -48,7 +49,7 @@#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL) -#define MOD_IDX_COUNT (35) +#define MOD_IDX_COUNT (36)/* aliases - only aliases go below this point */ #endif /* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
PATCH v4 52/86 net/ntnic: update alignment for virt queue structs
In reply to Serhii IliushykUpdate incorrect alignment
---
v2
* Fix __rte_packed usage
Original NT PMD driver use pragma pack(1) wich is similar with combination attributes packed and aligned
In this case aligned(1) can be ignored in case of use attribute packed
--- drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +4 -3
@@ -3,6 +3,7 @@* Copyright(c) 2023 Napatech A/S */ +#include <rte_common.h> #include <unistd.h> #include "ntos_drv.h"
@@ -67,20 +68,20 @@ } \ }while (0 ) -struct __rte_aligned(8) virtq_avail { +struct __rte_packed virtq_avail {uint16_t flags;uint16_t idx;uint16_t ring[];/* Queue Size */ }; -struct __rte_aligned(8) virtq_used_elem { +struct __rte_packed virtq_used_elem {/* Index of start of used descriptor chain. */ uint32_t id;/* Total length of the descriptor chain which was used (written to) */ uint32_t len; }; -struct __rte_aligned(8) virtq_used { +struct __rte_packed virtq_used {uint16_t flags;uint16_t idx;struct virtq_used_elem ring[];/* Queue Size */
Signature · 1 line
2.45.0
PATCH v4 53/86 net/ntnic: enable RSS feature
In reply to Serhii IliushykEnable receive side scaling
---
v4
* Use RTE_MIN instead of the ternary operator.
--- doc/guides/nics/features/ntnic.ini | 3 + drivers/net/ntnic/include/create_elements.h | 1 + drivers/net/ntnic/include/flow_api.h | 2 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 6 ++ .../profile_inline/flow_api_profile_inline.c | 43 +++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 75 +++++++++++++++++++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 73 ++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 7 ++ 8 files changed, 210 insertions(+)
doc/guides/nics/features/ntnic.ini +3 -0
@@ -10,6 +10,8 @@ Link status = Y Queue start/stop = Y Unicast MAC filter = Y Multicast MAC filter = Y +RSS hash = Y +RSS key update = Y Linux = Y x86-64 = Y
@@ -37,3 +39,4 @@ port_id = Y queue = Y raw_decap = Y raw_encap = Y +rss = Y
drivers/net/ntnic/include/create_elements.h +1 -0
@@ -27,6 +27,7 @@ struct cnv_attr_s {struct cnv_action_s {struct rte_flow_action flow_actions[MAX_ACTIONS ]; +struct rte_flow_action_rss flow_rss;struct flow_action_raw_encap encap;struct flow_action_raw_decap decap;struct rte_flow_action_queue queue;
drivers/net/ntnic/include/flow_api.h +2 -0
@@ -114,6 +114,8 @@ struct flow_nic_dev {struct flow_eth_dev *eth_base;pthread_mutex_t mtx; +/* RSS hashing configuration */ +struct nt_eth_rss_conf rss_conf;/* next NIC linked list */ struct flow_nic_dev *next; };
drivers/net/ntnic/nthw/flow_api/flow_api.c +6 -0
@@ -1061,6 +1061,12 @@ static const struct flow_filter_ops ops = { .flow_destroy = flow_destroy, .flow_flush = flow_flush, .flow_dev_dump = flow_dev_dump, + +/* +* Other +*/ + .hw_mod_hsh_rcp_flush = hw_mod_hsh_rcp_flush, + .flow_nic_set_hasher_fields = flow_nic_set_hasher_fields, };void init_flow_filter (void )
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +43 -0
49 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +75 -0
93 lines not on this page · raw message
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +73 -0
79 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +7 -0
@@ -316,6 +316,13 @@ struct flow_filter_ops {int (*flow_flush)(struct flow_eth_dev *dev,uint16_t caller_id,struct rte_flow_error *error); + +/* +* Other +*/ +int (*flow_nic_set_hasher_fields)(struct flow_nic_dev *ndev,int hsh_idx, +struct nt_eth_rss_conf rss_conf); +int (*hw_mod_hsh_rcp_flush)(struct flow_api_backend_s *be,int start_idx,int count); };void register_dev_flow_ops (const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 54/86 net/ntnic: add statistics API
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Statistics init, setup, get, reset APIs and their
implementation were added.
Statistics fpga defines were added.
--- drivers/net/ntnic/adapter/nt4ga_adapter.c | 29 +- .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 192 +++++++++ .../net/ntnic/include/common_adapter_defs.h | 15 + drivers/net/ntnic/include/create_elements.h | 4 + drivers/net/ntnic/include/nt4ga_adapter.h | 2 + drivers/net/ntnic/include/ntdrv_4ga.h | 1 + drivers/net/ntnic/include/ntnic_stat.h | 149 +++++++ drivers/net/ntnic/include/ntos_drv.h | 9 + .../ntnic/include/stream_binary_flow_api.h | 5 + drivers/net/ntnic/meson.build | 3 + .../net/ntnic/nthw/core/include/nthw_rmc.h | 1 + drivers/net/ntnic/nthw/core/nthw_rmc.c | 10 + drivers/net/ntnic/nthw/stat/nthw_stat.c | 370 ++++++++++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_sta.h | 40 ++ drivers/net/ntnic/ntnic_ethdev.c | 119 +++++- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 132 +++++++ drivers/net/ntnic/ntnic_mod_reg.c | 30 ++ drivers/net/ntnic/ntnic_mod_reg.h | 17 + drivers/net/ntnic/ntutil/nt_util.h | 1 + 21 files changed, 1119 insertions(+), 12 deletions(-) create mode 100644 drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c create mode 100644 drivers/net/ntnic/include/common_adapter_defs.h create mode 100644 drivers/net/ntnic/nthw/stat/nthw_stat.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h
drivers/net/ntnic/adapter/nt4ga_adapter.c +18 -11
@@ -212,19 +212,26 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) } } -nthw_rmc_t *p_nthw_rmc =nthw_rmc_new (); -if (p_nthw_rmc ==NULL ) { -NT_LOG (ERR ,NTNIC ,"Failed to allocate memory for RMC module" ); -return -1 ; - } +const struct nt4ga_stat_ops *nt4ga_stat_ops =get_nt4ga_stat_ops (); - res =nthw_rmc_init (p_nthw_rmc, p_fpga,0 ); -if (res) { -NT_LOG (ERR ,NTNIC ,"Failed to initialize RMC module" ); -return -1 ; - } +if (nt4ga_stat_ops !=NULL ) { +/* Nt4ga Stat init/setup */ + res = nt4ga_stat_ops->nt4ga_stat_init (p_adapter_info); + +if (res !=0 ) { +NT_LOG (ERR ,NTNIC ,"%s: Cannot initialize the statistics module" , + p_adapter_id_str); +return res; + } + + res = nt4ga_stat_ops->nt4ga_stat_setup (p_adapter_info); -nthw_rmc_unblock (p_nthw_rmc, false); +if (res !=0 ) { +NT_LOG (ERR ,NTNIC ,"%s: Cannot setup the statistics module" , + p_adapter_id_str); +return res; + } + }return 0 ; }
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c new file +192 -0
192 lines not on this page · raw message
drivers/net/ntnic/include/common_adapter_defs.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef _COMMON_ADAPTER_DEFS_H_ +#define _COMMON_ADAPTER_DEFS_H_ + +/* +* Declarations shared by NT adapter types. +*/ +#define NUM_ADAPTER_MAX (8) +#define NUM_ADAPTER_PORTS_MAX (128) + +#endif /* _COMMON_ADAPTER_DEFS_H_ */
drivers/net/ntnic/include/create_elements.h +4 -0
@@ -46,6 +46,10 @@ struct rte_flow {uint32_t flow_stat_id; +uint64_t stat_pkts; +uint64_t stat_bytes; +uint8_t stat_tcp_flags; +uint16_t caller_id; };
drivers/net/ntnic/include/nt4ga_adapter.h +2 -0
@@ -6,6 +6,7 @@ #ifndef _NT4GA_ADAPTER_H_ #define _NT4GA_ADAPTER_H_ +#include "ntnic_stat.h" #include "nt4ga_link.h" typedef struct hw_info_s {
@@ -30,6 +31,7 @@ typedef struct hw_info_s {#include "ntnic_stat.h" typedef struct adapter_info_s { + struct nt4ga_stat_s nt4ga_stat; struct nt4ga_filter_s nt4ga_filter; struct nt4ga_link_s nt4ga_link;
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
@@ -15,6 +15,7 @@ typedef struct ntdrv_4ga_s {volatile bool b_shutdown;rte_thread_t flm_thread; + pthread_mutex_t stat_lck; } ntdrv_4ga_t;#endif /* __NTDRV_4GA_H__ */
drivers/net/ntnic/include/ntnic_stat.h +149 -0
155 lines not on this page · raw message
drivers/net/ntnic/include/ntos_drv.h +9 -0
@@ -57,6 +57,9 @@ struct __rte_cache_aligned ntnic_rx_queue {struct flow_queue_id_s queue;/* queue info - user id and hw queue index */ struct rte_mempool *mb_pool;/* mbuf memory pool */ uint16_t buf_size;/* Size of data area in mbuf */ +unsigned long rx_pkts;/* Rx packet statistics */ +unsigned long rx_bytes;/* Rx bytes statistics */ +unsigned long err_pkts;/* Rx error packet statistics */ int enabled;/* Enabling/disabling of this queue */ struct hwq_s hwq;
@@ -80,6 +83,9 @@ struct __rte_cache_aligned ntnic_tx_queue {int rss_target_id;uint32_t port;/* Tx port for this queue */ +unsigned long tx_pkts;/* Tx packet statistics */ +unsigned long tx_bytes;/* Tx bytes statistics */ +unsigned long err_pkts;/* Tx error packet stat */ int enabled;/* Enabling/disabling of this queue */ enum fpga_info_profile profile;/* Inline / Capture */ };
@@ -95,6 +101,7 @@ struct pmd_internals {/* Offset of the VF from the PF */ uint8_t vf_offset;uint32_t port; +uint32_t port_id;nt_meta_port_type_t type;struct flow_queue_id_s vpq[MAX_QUEUES ];unsigned int vpq_nb_vq;
@@ -107,6 +114,8 @@ struct pmd_internals {struct rte_ether_addr eth_addrs[NUM_MAC_ADDRS_PER_PORT ];/* Multicast ethernet (MAC) addresses. */ struct rte_ether_addr mc_addrs[NUM_MULTICAST_ADDRS_PER_PORT ]; +uint64_t last_stat_rtc; +uint64_t rx_missed;struct pmd_internals *next; };
drivers/net/ntnic/include/stream_binary_flow_api.h +5 -0
@@ -6,6 +6,7 @@#ifndef _STREAM_BINARY_FLOW_API_H_#define _STREAM_BINARY_FLOW_API_H_ +#include <rte_ether.h> #include "rte_flow.h" #include "rte_flow_driver.h"
@@ -44,6 +45,10 @@#define FLOW_MAX_QUEUES 128#define RAW_ENCAP_DECAP_ELEMS_MAX 16 + +extern uint64_t rte_tsc_freq; +extern rte_spinlock_t hwlock; +/* * Flow eth dev profile determines how the FPGA module resources are * managed and what features are available
drivers/net/ntnic/meson.build +3 -0
@@ -25,10 +25,12 @@ includes = [ # all sources sources = files( 'adapter/nt4ga_adapter.c', + 'adapter/nt4ga_stat/nt4ga_stat.c', 'dbsconfig/ntnic_dbsconfig.c', 'link_mgmt/link_100g/nt4ga_link_100g.c', 'link_mgmt/nt4ga_link.c', 'nim/i2c_nim.c', + 'ntnic_filter/ntnic_filter.c', 'nthw/dbs/nthw_dbs.c', 'nthw/supported/nthw_fpga_9563_055_049_0000.c', 'nthw/supported/nthw_fpga_instances.c',
@@ -48,6 +50,7 @@ sources = files( 'nthw/core/nthw_rmc.c', 'nthw/core/nthw_sdc.c', 'nthw/core/nthw_si5340.c', + 'nthw/stat/nthw_stat.c', 'nthw/flow_api/flow_api.c', 'nthw/flow_api/flow_group.c', 'nthw/flow_api/flow_id_table.c',
drivers/net/ntnic/nthw/core/include/nthw_rmc.h +1 -0
@@ -44,6 +44,7 @@ typedef struct nthw_rmc nthw_rmc;nthw_rmc_t *nthw_rmc_new (void );int nthw_rmc_init (nthw_rmc_t *p,nthw_fpga_t *p_fpga,int n_instance); +void nthw_rmc_block (nthw_rmc_t *p);void nthw_rmc_unblock (nthw_rmc_t *p,bool b_is_secondary);#endif /* NTHW_RMC_H_ */
drivers/net/ntnic/nthw/core/nthw_rmc.c +10 -0
@@ -77,6 +77,16 @@ int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance)return 0 ; } +void nthw_rmc_block (nthw_rmc_t *p) +{ +/* BLOCK_STATT(0)=1 BLOCK_KEEPA(1)=1 BLOCK_MAC_PORT(8:11)=~0 */ +if (!p->mb_administrative_block) { +nthw_field_set_flush (p->mp_fld_ctrl_block_stat_drop); +nthw_field_set_flush (p->mp_fld_ctrl_block_keep_alive); +nthw_field_set_flush (p->mp_fld_ctrl_block_mac_port); + } +} +void nthw_rmc_unblock (nthw_rmc_t *p,bool b_is_secondary) {uint32_t n_block_mask = ~0U << (b_is_secondary ? p->mn_nims : p->mn_ports);
drivers/net/ntnic/nthw/stat/nthw_stat.c new file +370 -0
370 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
@@ -46,6 +46,7 @@#define MOD_SDC (0xd2369530UL)#define MOD_SLC (0x1aef1f38UL)#define MOD_SLC_LR (0x969fc50bUL) +#define MOD_STA (0x76fae64dUL)#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -45,6 +45,7 @@#include "nthw_fpga_reg_defs_sdc.h" #include "nthw_fpga_reg_defs_slc.h" #include "nthw_fpga_reg_defs_slc_lr.h" +#include "nthw_fpga_reg_defs_sta.h" #include "nthw_fpga_reg_defs_tx_cpy.h" #include "nthw_fpga_reg_defs_tx_ins.h" #include "nthw_fpga_reg_defs_tx_rpl.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2024 Napatech A/S +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_STA_ +#define _NTHW_FPGA_REG_DEFS_STA_ + +/* STA */ +#define STA_CFG (0xcecaf9f4UL) +#define STA_CFG_CNT_CLEAR (0xc325e12eUL) +#define STA_CFG_CNT_FRZ (0x8c27a596UL) +#define STA_CFG_DMA_ENA (0x940dbacUL) +#define STA_CFG_TX_DISABLE (0x30f43250UL) +#define STA_HOST_ADR_LSB (0xde569336UL) +#define STA_HOST_ADR_LSB_LSB (0xb6f2f94bUL) +#define STA_HOST_ADR_MSB (0xdf94f901UL) +#define STA_HOST_ADR_MSB_MSB (0x114798c8UL) +#define STA_LOAD_BIN (0x2e842591UL) +#define STA_LOAD_BIN_BIN (0x1a2b942eUL) +#define STA_LOAD_BPS_RX_0 (0xbf8f4595UL) +#define STA_LOAD_BPS_RX_0_BPS (0x41647781UL) +#define STA_LOAD_BPS_RX_1 (0xc8887503UL) +#define STA_LOAD_BPS_RX_1_BPS (0x7c045e31UL) +#define STA_LOAD_BPS_TX_0 (0x9ae41a49UL) +#define STA_LOAD_BPS_TX_0_BPS (0x870b7e06UL) +#define STA_LOAD_BPS_TX_1 (0xede32adfUL) +#define STA_LOAD_BPS_TX_1_BPS (0xba6b57b6UL) +#define STA_LOAD_PPS_RX_0 (0x811173c3UL) +#define STA_LOAD_PPS_RX_0_PPS (0xbee573fcUL) +#define STA_LOAD_PPS_RX_1 (0xf6164355UL) +#define STA_LOAD_PPS_RX_1_PPS (0x83855a4cUL) +#define STA_LOAD_PPS_TX_0 (0xa47a2c1fUL) +#define STA_LOAD_PPS_TX_0_PPS (0x788a7a7bUL) +#define STA_LOAD_PPS_TX_1 (0xd37d1c89UL) +#define STA_LOAD_PPS_TX_1_PPS (0x45ea53cbUL) +#define STA_STATUS (0x91c5c51cUL) +#define STA_STATUS_STAT_TOGGLE_MISSED (0xf7242b11UL) + +#endif /* _NTHW_FPGA_REG_DEFS_STA_ */
drivers/net/ntnic/ntnic_ethdev.c +118 -1
149 lines not on this page · raw message
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +132 -0
155 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c +30 -0
@@ -19,6 +19,21 @@ const struct sg_ops_s *get_sg_ops(void)return sg_ops; } +static const struct ntnic_filter_ops *ntnic_filter_ops; + +void register_ntnic_filter_ops (const struct ntnic_filter_ops *ops) +{ + ntnic_filter_ops = ops; +} + +const struct ntnic_filter_ops *get_ntnic_filter_ops (void ) +{ +if (ntnic_filter_ops ==NULL ) +ntnic_filter_init (); + +return ntnic_filter_ops; +} +static struct link_ops_s *link_100g_ops;void register_100g_link_ops (struct link_ops_s *ops)
@@ -47,6 +62,21 @@ const struct port_ops *get_port_ops(void)return port_ops; } +static const struct nt4ga_stat_ops *nt4ga_stat_ops; + +void register_nt4ga_stat_ops (const struct nt4ga_stat_ops *ops) +{ + nt4ga_stat_ops = ops; +} + +const struct nt4ga_stat_ops *get_nt4ga_stat_ops (void ) +{ +if (nt4ga_stat_ops ==NULL ) +nt4ga_stat_ops_init (); + +return nt4ga_stat_ops; +} +static const struct adapter_ops *adapter_ops;void register_adapter_ops (const struct adapter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +17 -0
@@ -111,6 +111,14 @@ void register_sg_ops(struct sg_ops_s *ops);const struct sg_ops_s *get_sg_ops (void );void sg_init (void ); +struct ntnic_filter_ops { +int (*poll_statistics)(struct pmd_internals *internals); +}; + +void register_ntnic_filter_ops (const struct ntnic_filter_ops *ops); +const struct ntnic_filter_ops *get_ntnic_filter_ops (void ); +void ntnic_filter_init (void ); +struct link_ops_s {int (*link_init)(struct adapter_info_s *p_adapter_info,nthw_fpga_t *p_fpga); };
@@ -175,6 +183,15 @@ void register_port_ops(const struct port_ops *ops);const struct port_ops *get_port_ops (void );void port_init (void ); +struct nt4ga_stat_ops { +int (*nt4ga_stat_init)(struct adapter_info_s *p_adapter_info); +int (*nt4ga_stat_setup)(struct adapter_info_s *p_adapter_info); +}; + +void register_nt4ga_stat_ops (const struct nt4ga_stat_ops *ops); +const struct nt4ga_stat_ops *get_nt4ga_stat_ops (void ); +void nt4ga_stat_ops_init (void ); +struct adapter_ops {int (*init)(struct adapter_info_s *p_adapter_info);int (*deinit)(struct adapter_info_s *p_adapter_info);
drivers/net/ntnic/ntutil/nt_util.h +1 -0
@@ -22,6 +22,7 @@* The windows size must max be 3 min in order to * prevent overflow. */ +#define PORT_LOAD_WINDOWS_SIZE 2ULL#define FLM_LOAD_WINDOWS_SIZE 2ULL#define PCIIDENT_TO_DOMAIN (pci_ident) ((uint16_t)(((unsigned int)(pci_ident) >> 16) & 0xFFFFU))
Signature · 1 line
2.45.0
PATCH v4 55/86 net/ntnic: add rpf module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
The Receive Port FIFO module controls the small FPGA FIFO
that packets are stored in before they enter the packet processor pipeline.
--- .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 25 +++- drivers/net/ntnic/include/ntnic_stat.h | 2 + drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_rpf.h | 48 +++++++ drivers/net/ntnic/nthw/core/nthw_rpf.c | 119 ++++++++++++++++++ .../net/ntnic/nthw/model/nthw_fpga_model.c | 12 ++ .../net/ntnic/nthw/model/nthw_fpga_model.h | 1 + .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_rpf.h | 19 +++ 10 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_rpf.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_rpf.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +24 -1
@@ -11,6 +11,7 @@#include "nt4ga_adapter.h" #include "ntnic_nim.h" #include "flow_filter.h" +#include "ntnic_stat.h" #include "ntnic_mod_reg.h" #define DEFAULT_MAX_BPS_SPEED 100e9
@@ -43,7 +44,7 @@ static int nt4ga_stat_init(struct adapter_info_s *p_adapter_info)if (!p_nthw_rmc) {nthw_stat_delete (p_nthw_stat); -NT_LOG (ERR ,NTNIC ,"%s: ERROR " , p_adapter_id_str); +NT_LOG (ERR ,NTNIC ,"%s: ERROR rmc allocation" , p_adapter_id_str);return -1 ; }
@@ -54,6 +55,22 @@ static int nt4ga_stat_init(struct adapter_info_s *p_adapter_info) p_nt4ga_stat->mp_nthw_rmc =NULL ; } +if (nthw_rpf_init (NULL , p_fpga, p_adapter_info->adapter_no) ==0 ) { +nthw_rpf_t *p_nthw_rpf =nthw_rpf_new (); + +if (!p_nthw_rpf) { +nthw_stat_delete (p_nthw_stat); +NT_LOG_DBGX (ERR ,NTNIC ,"%s: ERROR" , p_adapter_id_str); +return -1 ; + } + +nthw_rpf_init (p_nthw_rpf, p_fpga, p_adapter_info->adapter_no); + p_nt4ga_stat->mp_nthw_rpf = p_nthw_rpf; + + }else { + p_nt4ga_stat->mp_nthw_rpf =NULL ; + } + p_nt4ga_stat->mp_nthw_stat = p_nthw_stat;nthw_stat_init (p_nthw_stat, p_fpga,0 );
@@ -77,6 +94,9 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)if (p_nt4ga_stat->mp_nthw_rmc)nthw_rmc_block (p_nt4ga_stat->mp_nthw_rmc); +if (p_nt4ga_stat->mp_nthw_rpf) +nthw_rpf_block (p_nt4ga_stat->mp_nthw_rpf); +/* Allocate and map memory for fpga statistics */ { uint32_t n_stat_size = (uint32_t)(p_nthw_stat->m_nb_counters * sizeof(uint32_t) +
@@ -112,6 +132,9 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)if (p_nt4ga_stat->mp_nthw_rmc)nthw_rmc_unblock (p_nt4ga_stat->mp_nthw_rmc, false); +if (p_nt4ga_stat->mp_nthw_rpf) +nthw_rpf_unblock (p_nt4ga_stat->mp_nthw_rpf); + p_nt4ga_stat->mp_stat_structs_color =calloc (p_nthw_stat->m_nb_color_counters,sizeof (struct color_counters ));
drivers/net/ntnic/include/ntnic_stat.h +2 -0
@@ -8,6 +8,7 @@#include "common_adapter_defs.h" #include "nthw_rmc.h" +#include "nthw_rpf.h" #include "nthw_fpga_model.h" #define NT_MAX_COLOR_FLOW_STATS 0x400
@@ -102,6 +103,7 @@ struct flm_counters_v1 {struct nt4ga_stat_s {nthw_stat_t *mp_nthw_stat;nthw_rmc_t *mp_nthw_rmc; +nthw_rpf_t *mp_nthw_rpf;struct nt_dma_s *p_stat_dma;uint32_t *p_stat_dma_virtual;uint32_t n_stat_size;
drivers/net/ntnic/meson.build +1 -0
@@ -47,6 +47,7 @@ sources = files( 'nthw/core/nthw_iic.c', 'nthw/core/nthw_mac_pcs.c', 'nthw/core/nthw_pcie3.c', + 'nthw/core/nthw_rpf.c', 'nthw/core/nthw_rmc.c', 'nthw/core/nthw_sdc.c', 'nthw/core/nthw_si5340.c',
drivers/net/ntnic/nthw/core/include/nthw_rpf.h new file +48 -0
48 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_rpf.c new file +119 -0
119 lines not on this page · raw message
drivers/net/ntnic/nthw/model/nthw_fpga_model.c +12 -0
@@ -1050,6 +1050,18 @@ uint32_t nthw_field_get_val32(const nthw_field_t *p)return val; } +int32_t nthw_field_get_signed (const nthw_field_t *p) +{ +uint32_t val; + +nthw_field_get_val (p, &val,1 ); + +if (val & (1U <<nthw_field_get_bit_pos_high (p)))/* check sign */ + val = val | ~nthw_field_get_mask (p);/* sign extension */ + +return (int32_t )val;/* cast to signed value */ +} +uint32_t nthw_field_get_updated (const nthw_field_t *p) {uint32_t val;
drivers/net/ntnic/nthw/model/nthw_fpga_model.h +1 -0
@@ -227,6 +227,7 @@ void nthw_field_get_val(const nthw_field_t *p, uint32_t *p_data, uint32_t len);void nthw_field_set_val (const nthw_field_t *p,const uint32_t *p_data,uint32_t len);void nthw_field_set_val_flush (const nthw_field_t *p,const uint32_t *p_data,uint32_t len);uint32_t nthw_field_get_val32 (const nthw_field_t *p); +int32_t nthw_field_get_signed (const nthw_field_t *p);uint32_t nthw_field_get_updated (const nthw_field_t *p);void nthw_field_update_register (const nthw_field_t *p);void nthw_field_flush_register (const nthw_field_t *p);
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
@@ -41,6 +41,7 @@#define MOD_RAC (0xae830b42UL)#define MOD_RMC (0x236444eUL)#define MOD_RPL (0x6de535c3UL) +#define MOD_RPF (0x8d30dcddUL)#define MOD_RPP_LR (0xba7f945cUL)#define MOD_RST9563 (0x385d6d1dUL)#define MOD_SDC (0xd2369530UL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -39,6 +39,7 @@#include "nthw_fpga_reg_defs_qsl.h" #include "nthw_fpga_reg_defs_rac.h" #include "nthw_fpga_reg_defs_rmc.h" +#include "nthw_fpga_reg_defs_rpf.h" #include "nthw_fpga_reg_defs_rpl.h" #include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2024 Napatech A/S +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_RPF_ +#define _NTHW_FPGA_REG_DEFS_RPF_ + +/* RPF */ +#define RPF_CONTROL (0x7a5bdb50UL) +#define RPF_CONTROL_KEEP_ALIVE_EN (0x80be3ffcUL) +#define RPF_CONTROL_PEN (0xb23137b8UL) +#define RPF_CONTROL_RPP_EN (0xdb51f109UL) +#define RPF_CONTROL_ST_TGL_EN (0x45a6ecfaUL) +#define RPF_TS_SORT_PRG (0xff1d137eUL) +#define RPF_TS_SORT_PRG_MATURING_DELAY (0x2a38e127UL) +#define RPF_TS_SORT_PRG_TS_AT_EOF (0x9f27d433UL) + +#endif /* _NTHW_FPGA_REG_DEFS_RPF_ */
Signature · 1 line
2.45.0
PATCH v4 56/86 net/ntnic: add statistics poll
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Mechanism which poll statistics module and update values with dma module.
--- .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 343 ++++++++++++++++++ drivers/net/ntnic/include/ntdrv_4ga.h | 1 + drivers/net/ntnic/include/ntnic_stat.h | 78 ++++ .../net/ntnic/nthw/core/include/nthw_rmc.h | 5 + drivers/net/ntnic/nthw/core/nthw_rmc.c | 20 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 1 + drivers/net/ntnic/nthw/stat/nthw_stat.c | 128 +++++++ drivers/net/ntnic/ntnic_ethdev.c | 143 ++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 2 + 9 files changed, 721 insertions(+)
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +343 -0
@@ -16,6 +16,27 @@#define DEFAULT_MAX_BPS_SPEED 100e9 +/* Inline timestamp format s pcap 32:32 bits. Convert to nsecs */ +static inline uint64_t timestamp2ns (uint64_t ts) +{ +return ((ts) >>32 ) *1000000000 + ((ts) &0xffffffff ); +} + +static int nt4ga_stat_collect_cap_v1_stats (struct adapter_info_s *p_adapter_info, +nt4ga_stat_t *p_nt4ga_stat, +uint32_t *p_stat_dma_virtual); + +static int nt4ga_stat_collect (struct adapter_info_s *p_adapter_info,nt4ga_stat_t *p_nt4ga_stat) +{ +nthw_stat_t *p_nthw_stat = p_nt4ga_stat->mp_nthw_stat; + + p_nt4ga_stat->last_timestamp =timestamp2ns (*p_nthw_stat->mp_timestamp); +nt4ga_stat_collect_cap_v1_stats (p_adapter_info, p_nt4ga_stat, + p_nt4ga_stat->p_stat_dma_virtual); + +return 0 ; +} +static int nt4ga_stat_init (struct adapter_info_s *p_adapter_info) {const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str;
@@ -203,9 +224,331 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)return 0 ; } +/* Called with stat mutex locked */ +static int nt4ga_stat_collect_cap_v1_stats (struct adapter_info_s *p_adapter_info, +nt4ga_stat_t *p_nt4ga_stat, +uint32_t *p_stat_dma_virtual) +{ + (void )p_adapter_info; +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) +return -1 ; + +nthw_stat_t *p_nthw_stat = p_nt4ga_stat->mp_nthw_stat; + +const int n_rx_ports = p_nt4ga_stat->mn_rx_ports; +const int n_tx_ports = p_nt4ga_stat->mn_tx_ports; +int c, h, p; + +if (!p_nthw_stat || !p_nt4ga_stat) +return -1 ; + +if (p_nthw_stat->mn_stat_layout_version <6 ) { +NT_LOG (ERR ,NTNIC ,"HW STA module version not supported" ); +return -1 ; + } + +/* RX ports */ +for (c =0 ; c < p_nthw_stat->m_nb_color_counters /2 ; c++) { + p_nt4ga_stat->mp_stat_structs_color[c].color_packets += p_stat_dma_virtual[c *2 ]; + p_nt4ga_stat->mp_stat_structs_color[c].color_bytes += + p_stat_dma_virtual[c *2 +1 ]; + } + +/* Move to Host buffer counters */ + p_stat_dma_virtual += p_nthw_stat->m_nb_color_counters; + +for (h =0 ; h < p_nthw_stat->m_nb_rx_host_buffers; h++) { + p_nt4ga_stat->mp_stat_structs_hb[h].flush_packets += p_stat_dma_virtual[h *8 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].drop_packets += p_stat_dma_virtual[h *8 +1 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].fwd_packets += p_stat_dma_virtual[h *8 +2 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].dbs_drop_packets += + p_stat_dma_virtual[h *8 +3 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].flush_bytes += p_stat_dma_virtual[h *8 +4 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].drop_bytes += p_stat_dma_virtual[h *8 +5 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].fwd_bytes += p_stat_dma_virtual[h *8 +6 ]; + p_nt4ga_stat->mp_stat_structs_hb[h].dbs_drop_bytes += + p_stat_dma_virtual[h *8 +7 ]; + } + +/* Move to Rx Port counters */ + p_stat_dma_virtual += p_nthw_stat->m_nb_rx_hb_counters; + +/* RX ports */ +for (p =0 ; p < n_rx_ports; p++) { + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +0 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].broadcast_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +1 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].multicast_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +2 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].unicast_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +3 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_alignment += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +4 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_code_violation += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +5 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_crc += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +6 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].undersize_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +7 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].oversize_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +8 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].fragments += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +9 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].jabbers_not_truncated += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +10 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].jabbers_truncated += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +11 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_64_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +12 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_65_to_127_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +13 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_128_to_255_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +14 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_256_to_511_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +15 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_512_to_1023_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +16 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_1024_to_1518_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +17 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_1519_to_2047_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +18 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_2048_to_4095_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +19 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_4096_to_8191_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +20 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_8192_to_max_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +21 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].mac_drop_events += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +22 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_lr += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +23 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].duplicate += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +24 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_ip_chksum_error += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +25 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_udp_chksum_error += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +26 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_tcp_chksum_error += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +27 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_giant_undersize += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +28 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_baby_giant += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +29 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_not_isl_vlan_mpls += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +30 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +31 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_vlan += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +32 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl_vlan += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +33 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_mpls += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +34 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl_mpls += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +35 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_vlan_mpls += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +36 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl_vlan_mpls += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +37 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_no_filter += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +38 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_dedup_drop += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +39 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_filter_drop += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +40 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_overflow += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +41 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_dbs_drop += + p_nthw_stat->m_dbs_present + ? p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +42 ] + :0 ; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_no_filter += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +43 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_dedup_drop += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +44 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_filter_drop += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +45 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_overflow += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +46 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_dbs_drop += + p_nthw_stat->m_dbs_present + ? p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +47 ] + :0 ; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_first_hit += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +48 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_first_not_hit += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +49 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_mid_hit += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +50 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_mid_not_hit += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +51 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_last_hit += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +52 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_last_not_hit += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +53 ]; + +/* Rx totals */ +uint64_t new_drop_events_sum = + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +22 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +38 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +39 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +40 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +41 ] + + (p_nthw_stat->m_dbs_present + ? p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +42 ] + :0 ); + +uint64_t new_packets_sum = + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +7 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +8 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +9 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +10 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +11 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +12 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +13 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +14 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +15 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +16 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +17 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +18 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +19 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +20 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +21 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].drop_events += new_drop_events_sum; + p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts += new_packets_sum; + + p_nt4ga_stat->a_port_rx_octets_total[p] += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters +0 ]; + p_nt4ga_stat->a_port_rx_packets_total[p] += new_packets_sum; + p_nt4ga_stat->a_port_rx_drops_total[p] += new_drop_events_sum; + } + +/* Move to Tx Port counters */ + p_stat_dma_virtual += n_rx_ports * p_nthw_stat->m_nb_rx_port_counters; + +for (p =0 ; p < n_tx_ports; p++) { + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +0 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].broadcast_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +1 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].multicast_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +2 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].unicast_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +3 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_alignment += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +4 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_code_violation += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +5 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_crc += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +6 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].undersize_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +7 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].oversize_pkts += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +8 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].fragments += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +9 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].jabbers_not_truncated += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +10 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].jabbers_truncated += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +11 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_64_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +12 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_65_to_127_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +13 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_128_to_255_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +14 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_256_to_511_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +15 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_512_to_1023_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +16 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_1024_to_1518_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +17 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_1519_to_2047_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +18 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_2048_to_4095_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +19 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_4096_to_8191_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +20 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_8192_to_max_octets += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +21 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].mac_drop_events += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +22 ]; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_lr += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +23 ]; + +/* Tx totals */ +uint64_t new_drop_events_sum = + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +22 ]; + +uint64_t new_packets_sum = + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +7 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +8 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +9 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +10 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +11 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +12 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +13 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +14 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +15 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +16 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +17 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +18 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +19 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +20 ] + + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +21 ]; + + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].drop_events += new_drop_events_sum; + p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts += new_packets_sum; + + p_nt4ga_stat->a_port_tx_octets_total[p] += + p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters +0 ]; + p_nt4ga_stat->a_port_tx_packets_total[p] += new_packets_sum; + p_nt4ga_stat->a_port_tx_drops_total[p] += new_drop_events_sum; + } + +/* Update and get port load counters */ +for (p =0 ; p < n_rx_ports; p++) { +uint32_t val; +nthw_stat_get_load_bps_rx (p_nthw_stat, p, &val); + p_nt4ga_stat->mp_port_load[p].rx_bps = + (uint64_t )(((__uint128_t )val *32ULL *64ULL *8ULL ) / +PORT_LOAD_WINDOWS_SIZE ); +nthw_stat_get_load_pps_rx (p_nthw_stat, p, &val); + p_nt4ga_stat->mp_port_load[p].rx_pps = + (uint64_t )(((__uint128_t )val *32ULL ) /PORT_LOAD_WINDOWS_SIZE ); + } + +for (p =0 ; p < n_tx_ports; p++) { +uint32_t val; +nthw_stat_get_load_bps_tx (p_nthw_stat, p, &val); + p_nt4ga_stat->mp_port_load[p].tx_bps = + (uint64_t )(((__uint128_t )val *32ULL *64ULL *8ULL ) / +PORT_LOAD_WINDOWS_SIZE ); +nthw_stat_get_load_pps_tx (p_nthw_stat, p, &val); + p_nt4ga_stat->mp_port_load[p].tx_pps = + (uint64_t )(((__uint128_t )val *32ULL ) /PORT_LOAD_WINDOWS_SIZE ); + } + +return 0 ; +} +static struct nt4ga_stat_ops ops = { .nt4ga_stat_init = nt4ga_stat_init, .nt4ga_stat_setup = nt4ga_stat_setup, + .nt4ga_stat_collect = nt4ga_stat_collect };void nt4ga_stat_ops_init (void )
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
@@ -16,6 +16,7 @@ typedef struct ntdrv_4ga_s {volatile bool b_shutdown;rte_thread_t flm_thread;pthread_mutex_t stat_lck; + rte_thread_t stat_thread; } ntdrv_4ga_t;#endif /* __NTDRV_4GA_H__ */
drivers/net/ntnic/include/ntnic_stat.h +78 -0
104 lines not on this page · raw message
drivers/net/ntnic/nthw/core/include/nthw_rmc.h +5 -0
@@ -47,4 +47,9 @@ int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance);void nthw_rmc_block (nthw_rmc_t *p);void nthw_rmc_unblock (nthw_rmc_t *p,bool b_is_secondary); +uint32_t nthw_rmc_get_status_sf_ram_of (nthw_rmc_t *p); +uint32_t nthw_rmc_get_status_descr_fifo_of (nthw_rmc_t *p); +uint32_t nthw_rmc_get_dbg_merge (nthw_rmc_t *p); +uint32_t nthw_rmc_get_mac_if_err (nthw_rmc_t *p); +#endif /* NTHW_RMC_H_ */
drivers/net/ntnic/nthw/core/nthw_rmc.c +20 -0
@@ -77,6 +77,26 @@ int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance)return 0 ; } +uint32_t nthw_rmc_get_status_sf_ram_of (nthw_rmc_t *p) +{ +return (p->mp_reg_status) ?nthw_field_get_updated (p->mp_fld_sf_ram_of) :0xffffffff ; +} + +uint32_t nthw_rmc_get_status_descr_fifo_of (nthw_rmc_t *p) +{ +return (p->mp_reg_status) ?nthw_field_get_updated (p->mp_fld_descr_fifo_of) :0xffffffff ; +} + +uint32_t nthw_rmc_get_dbg_merge (nthw_rmc_t *p) +{ +return (p->mp_reg_dbg) ?nthw_field_get_updated (p->mp_fld_dbg_merge) :0xffffffff ; +} + +uint32_t nthw_rmc_get_mac_if_err (nthw_rmc_t *p) +{ +return (p->mp_reg_mac_if) ?nthw_field_get_updated (p->mp_fld_mac_if_err) :0xffffffff ; +} +void nthw_rmc_block (nthw_rmc_t *p) {/* BLOCK_STATT(0)=1 BLOCK_KEEPA(1)=1 BLOCK_MAC_PORT(8:11)=~0 */
drivers/net/ntnic/nthw/flow_api/flow_api.c +1 -0
@@ -7,6 +7,7 @@#include "flow_api_engine.h" #include "flow_api_nic_setup.h" +#include "ntlog.h" #include "ntnic_mod_reg.h" #include "flow_api.h"
drivers/net/ntnic/nthw/stat/nthw_stat.c +128 -0
131 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +143 -0
191 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +2 -0
@@ -186,6 +186,8 @@ void port_init(void);struct nt4ga_stat_ops {int (*nt4ga_stat_init)(struct adapter_info_s *p_adapter_info);int (*nt4ga_stat_setup)(struct adapter_info_s *p_adapter_info); +int (*nt4ga_stat_collect)(struct adapter_info_s *p_adapter_info, +nt4ga_stat_t *p_nt4ga_stat); };void register_nt4ga_stat_ops (const struct nt4ga_stat_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 57/86 net/ntnic: added flm stat interface
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
flm stat module interface was added.
--- drivers/net/ntnic/include/flow_api.h | 2 ++ drivers/net/ntnic/include/flow_filter.h | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 11 +++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 2 ++ 4 files changed, 16 insertions(+)
drivers/net/ntnic/include/flow_api.h +2 -0
@@ -233,4 +233,6 @@ int flow_nic_set_hasher(struct flow_nic_dev *ndev, int hsh_idx, enum flow_nic_haint flow_nic_set_hasher_fields (struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf); +int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size); +#endif
drivers/net/ntnic/include/flow_filter.h +1 -0
@@ -11,5 +11,6 @@int flow_filter_init (nthw_fpga_t *p_fpga,struct flow_nic_dev **p_flow_device,int adapter_no);int flow_filter_done (struct flow_nic_dev *dev); +int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size);#endif /* __FLOW_FILTER_HPP__ */
drivers/net/ntnic/nthw/flow_api/flow_api.c +11 -0
@@ -1048,6 +1048,16 @@ int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,return profile_inline_ops->flow_nic_set_hasher_fields_inline (ndev, hsh_idx, rss_conf); } +int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size) +{ + (void )ndev; + (void )data; + (void )size; + +NT_LOG_DBGX (DBG ,FILTER ,"Not implemented yet" ); +return -1 ; +} +static const struct flow_filter_ops ops = { .flow_filter_init = flow_filter_init, .flow_filter_done = flow_filter_done,
@@ -1062,6 +1072,7 @@ static const struct flow_filter_ops ops = { .flow_destroy = flow_destroy, .flow_flush = flow_flush, .flow_dev_dump = flow_dev_dump, + .flow_get_flm_stats = flow_get_flm_stats,/* * Other
drivers/net/ntnic/ntnic_mod_reg.h +2 -0
@@ -336,6 +336,8 @@ struct flow_filter_ops {int (*flow_flush)(struct flow_eth_dev *dev,uint16_t caller_id,struct rte_flow_error *error); +int (*flow_get_flm_stats)(struct flow_nic_dev *ndev,uint64_t *data,uint64_t size); +/* * Other */
Signature · 1 line
2.45.0
PATCH v4 58/86 net/ntnic: add tsm module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
tsm module which operate with timers
in the physical nic was added.
Necessary defines and implementation were added.
The Time Stamp Module controls every aspect of packet timestamping, including time synchronization, time stamp format, PTP protocol, etc.
--- drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_tsm.h | 56 ++++++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 47 +++++ drivers/net/ntnic/nthw/core/nthw_tsm.c | 167 ++++++++++++++++++ .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../nthw/supported/nthw_fpga_reg_defs_tsm.h | 28 +++ 7 files changed, 301 insertions(+) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_tsm.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_tsm.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h
drivers/net/ntnic/meson.build +1 -0
@@ -41,6 +41,7 @@ sources = files( 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nthw_fpga.c', 'nthw/core/nthw_gmf.c', + 'nthw/core/nthw_tsm.c', 'nthw/core/nthw_gpio_phy.c', 'nthw/core/nthw_hif.c', 'nthw/core/nthw_i2cm.c',
drivers/net/ntnic/nthw/core/include/nthw_tsm.h new file +56 -0
56 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_fpga.c +47 -0
65 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_tsm.c new file +167 -0
167 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
@@ -48,6 +48,7 @@#define MOD_SLC (0x1aef1f38UL)#define MOD_SLC_LR (0x969fc50bUL)#define MOD_STA (0x76fae64dUL) +#define MOD_TSM (0x35422a24UL)#define MOD_TX_CPY (0x60acf217UL)#define MOD_TX_INS (0x59afa100UL)#define MOD_TX_RPL (0x1095dfbbUL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -44,6 +44,7 @@#include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h" #include "nthw_fpga_reg_defs_sdc.h" +#include "nthw_fpga_reg_defs_tsm.h" #include "nthw_fpga_reg_defs_slc.h" #include "nthw_fpga_reg_defs_slc_lr.h" #include "nthw_fpga_reg_defs_sta.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2024 Napatech A/S +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_TSM_ +#define _NTHW_FPGA_REG_DEFS_TSM_ + +/* TSM */ +#define TSM_CONFIG (0xef5dec83UL) +#define TSM_CONFIG_TS_FORMAT (0xe6efc2faUL) +#define TSM_TIMER_CTRL (0x648da051UL) +#define TSM_TIMER_CTRL_TIMER_EN_T0 (0x17cee154UL) +#define TSM_TIMER_CTRL_TIMER_EN_T1 (0x60c9d1c2UL) +#define TSM_TIMER_T0 (0x417217a5UL) +#define TSM_TIMER_T0_MAX_COUNT (0xaa601706UL) +#define TSM_TIMER_T1 (0x36752733UL) +#define TSM_TIMER_T1_MAX_COUNT (0x6beec8c6UL) +#define TSM_TIME_HI (0x175acea1UL) +#define TSM_TIME_HI_SEC (0xc0e9c9a1UL) +#define TSM_TIME_LO (0x9a55ae90UL) +#define TSM_TIME_LO_NS (0x879c5c4bUL) +#define TSM_TS_HI (0xccfe9e5eUL) +#define TSM_TS_HI_TIME (0xc23fed30UL) +#define TSM_TS_LO (0x41f1fe6fUL) +#define TSM_TS_LO_TIME (0xe0292a3eUL) + +#endif /* _NTHW_FPGA_REG_DEFS_TSM_ */
Signature · 1 line
2.45.0
PATCH v4 59/86 net/ntnic: add STA module
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
fpga map was extended with STA module
support which enable statistics functionality.
--- .../supported/nthw_fpga_9563_055_049_0000.c | 92 ++++++++++++++++++- .../nthw/supported/nthw_fpga_mod_str_map.c | 1 + .../nthw/supported/nthw_fpga_reg_defs_sta.h | 8 ++ 3 files changed, 100 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +91 -1
@@ -2486,6 +2486,95 @@ static nthw_fpga_register_init_s slc_registers[] = { { SLC_RCP_DATA, 1, 36, NTHW_FPGA_REG_TYPE_WO, 0, 7, slc_rcp_data_fields }, }; +static nthw_fpga_field_init_s sta_byte_fields[] = { + {STA_BYTE_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_cfg_fields[] = { + {STA_CFG_CNT_CLEAR ,1 ,1 ,0 }, + {STA_CFG_DMA_ENA ,1 ,0 ,0 }, +}; + +static nthw_fpga_field_init_s sta_cv_err_fields[] = { + {STA_CV_ERR_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_fcs_err_fields[] = { + {STA_FCS_ERR_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_host_adr_lsb_fields[] = { + {STA_HOST_ADR_LSB_LSB ,32 ,0 ,0 }, +}; + +static nthw_fpga_field_init_s sta_host_adr_msb_fields[] = { + {STA_HOST_ADR_MSB_MSB ,32 ,0 ,0 }, +}; + +static nthw_fpga_field_init_s sta_load_bin_fields[] = { + {STA_LOAD_BIN_BIN ,32 ,0 ,8388607 }, +}; + +static nthw_fpga_field_init_s sta_load_bps_rx_0_fields[] = { + {STA_LOAD_BPS_RX_0_BPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_bps_rx_1_fields[] = { + {STA_LOAD_BPS_RX_1_BPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_bps_tx_0_fields[] = { + {STA_LOAD_BPS_TX_0_BPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_bps_tx_1_fields[] = { + {STA_LOAD_BPS_TX_1_BPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_pps_rx_0_fields[] = { + {STA_LOAD_PPS_RX_0_PPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_pps_rx_1_fields[] = { + {STA_LOAD_PPS_RX_1_PPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_pps_tx_0_fields[] = { + {STA_LOAD_PPS_TX_0_PPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_load_pps_tx_1_fields[] = { + {STA_LOAD_PPS_TX_1_PPS ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_pckt_fields[] = { + {STA_PCKT_CNT ,32 ,0 ,0x0000 }, +}; + +static nthw_fpga_field_init_s sta_status_fields[] = { + {STA_STATUS_STAT_TOGGLE_MISSED ,1 ,0 ,0x0000 }, +}; + +static nthw_fpga_register_init_s sta_registers[] = { + {STA_BYTE ,4 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_byte_fields }, + {STA_CFG ,0 ,2 ,NTHW_FPGA_REG_TYPE_RW ,0 ,2 , sta_cfg_fields }, + {STA_CV_ERR ,5 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_cv_err_fields }, + {STA_FCS_ERR ,6 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_fcs_err_fields }, + {STA_HOST_ADR_LSB ,1 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , sta_host_adr_lsb_fields }, + {STA_HOST_ADR_MSB ,2 ,32 ,NTHW_FPGA_REG_TYPE_WO ,0 ,1 , sta_host_adr_msb_fields }, + {STA_LOAD_BIN ,8 ,32 ,NTHW_FPGA_REG_TYPE_WO ,8388607 ,1 , sta_load_bin_fields }, + {STA_LOAD_BPS_RX_0 ,11 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_bps_rx_0_fields }, + {STA_LOAD_BPS_RX_1 ,13 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_bps_rx_1_fields }, + {STA_LOAD_BPS_TX_0 ,15 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_bps_tx_0_fields }, + {STA_LOAD_BPS_TX_1 ,17 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_bps_tx_1_fields }, + {STA_LOAD_PPS_RX_0 ,10 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_pps_rx_0_fields }, + {STA_LOAD_PPS_RX_1 ,12 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_pps_rx_1_fields }, + {STA_LOAD_PPS_TX_0 ,14 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_pps_tx_0_fields }, + {STA_LOAD_PPS_TX_1 ,16 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_load_pps_tx_1_fields }, + {STA_PCKT ,3 ,32 ,NTHW_FPGA_REG_TYPE_RO ,0 ,1 , sta_pckt_fields }, + {STA_STATUS ,7 ,1 ,NTHW_FPGA_REG_TYPE_RC1 ,0 ,1 , sta_status_fields }, +}; +static nthw_fpga_module_init_s fpga_modules[] = { {MOD_CAT ,0 ,MOD_CAT ,0 ,21 ,NTHW_FPGA_BUS_TYPE_RAB1 ,768 ,34 , cat_registers }, { MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers },
@@ -2537,6 +2626,7 @@ static nthw_fpga_module_init_s fpga_modules[] = { { MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers }, { MOD_TX_INS, 0, MOD_INS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 8704, 2, ins_registers }, { MOD_TX_RPL, 0, MOD_RPL, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 8960, 6, rpl_registers }, + { MOD_STA, 0, MOD_STA, 0, 9, NTHW_FPGA_BUS_TYPE_RAB0, 2048, 17, sta_registers }, }; static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2695,5 +2785,5 @@ static nthw_fpga_prod_param_s product_parameters[] = { };nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = { -200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,35 , fpga_modules, +200 ,9563 ,55 ,49 ,0 ,0 ,1726740521 ,152 , product_parameters,36 , fpga_modules, };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c +1 -0
@@ -19,5 +19,6 @@ const struct nthw_fpga_mod_str_s sa_nthw_fpga_mod_str_map[] = { { MOD_RAC, "RAC" }, { MOD_RST9563, "RST9563" }, { MOD_SDC, "SDC" }, + { MOD_STA, "STA" }, { 0UL, NULL } };
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h +8 -0
@@ -7,11 +7,17 @@#define _NTHW_FPGA_REG_DEFS_STA_/* STA */ +#define STA_BYTE (0xa08364d4UL) +#define STA_BYTE_CNT (0x3119e6bcUL)#define STA_CFG (0xcecaf9f4UL)#define STA_CFG_CNT_CLEAR (0xc325e12eUL)#define STA_CFG_CNT_FRZ (0x8c27a596UL)#define STA_CFG_DMA_ENA (0x940dbacUL)#define STA_CFG_TX_DISABLE (0x30f43250UL) +#define STA_CV_ERR (0x7db7db5dUL) +#define STA_CV_ERR_CNT (0x2c02fbbeUL) +#define STA_FCS_ERR (0xa0de1647UL) +#define STA_FCS_ERR_CNT (0xc68c37d1UL)#define STA_HOST_ADR_LSB (0xde569336UL)#define STA_HOST_ADR_LSB_LSB (0xb6f2f94bUL)#define STA_HOST_ADR_MSB (0xdf94f901UL)
@@ -34,6 +40,8 @@#define STA_LOAD_PPS_TX_0_PPS (0x788a7a7bUL)#define STA_LOAD_PPS_TX_1 (0xd37d1c89UL)#define STA_LOAD_PPS_TX_1_PPS (0x45ea53cbUL) +#define STA_PCKT (0xecc8f30aUL) +#define STA_PCKT_CNT (0x63291d16UL)#define STA_STATUS (0x91c5c51cUL)#define STA_STATUS_STAT_TOGGLE_MISSED (0xf7242b11UL)
Signature · 1 line
2.45.0
PATCH v4 60/86 net/ntnic: add TSM module
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
fpga map was extended with tsm module
support which enable statistics functionality.
--- doc/guides/nics/features/ntnic.ini | 1 + .../supported/nthw_fpga_9563_055_049_0000.c | 394 +++++++++++++++++- .../nthw/supported/nthw_fpga_mod_str_map.c | 1 + .../nthw/supported/nthw_fpga_reg_defs_tsm.h | 177 ++++++++ 4 files changed, 572 insertions(+), 1 deletion(-)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -12,6 +12,7 @@ Unicast MAC filter = Y Multicast MAC filter = Y RSS hash = Y RSS key update = Y +Basic stats = Y Linux = Y x86-64 = Y
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +393 -1
410 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c +1 -0
@@ -20,5 +20,6 @@ const struct nthw_fpga_mod_str_s sa_nthw_fpga_mod_str_map[] = { { MOD_RST9563, "RST9563" }, { MOD_SDC, "SDC" }, { MOD_STA, "STA" }, + { MOD_TSM, "TSM" }, { 0UL, NULL } };
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h +177 -0
198 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 61/86 net/ntnic: add xstats
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Extended statistics implementation and
initialization were added.
eth_dev_ops api was extended with new xstats apis.
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/ntnic_stat.h | 36 + drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/ntnic_ethdev.c | 112 +++ drivers/net/ntnic/ntnic_mod_reg.c | 15 + drivers/net/ntnic/ntnic_mod_reg.h | 28 + drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c | 829 ++++++++++++++++++ 7 files changed, 1022 insertions(+) create mode 100644 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
doc/guides/nics/features/ntnic.ini +1 -0
@@ -13,6 +13,7 @@ Multicast MAC filter = Y RSS hash = Y RSS key update = Y Basic stats = Y +Extended stats = Y Linux = Y x86-64 = Y
drivers/net/ntnic/include/ntnic_stat.h +36 -0
@@ -169,6 +169,39 @@ struct port_counters_v2 { };struct flm_counters_v1 { +/* FLM 0.17 */ +uint64_t current; +uint64_t learn_done; +uint64_t learn_ignore; +uint64_t learn_fail; +uint64_t unlearn_done; +uint64_t unlearn_ignore; +uint64_t auto_unlearn_done; +uint64_t auto_unlearn_ignore; +uint64_t auto_unlearn_fail; +uint64_t timeout_unlearn_done; +uint64_t rel_done; +uint64_t rel_ignore; +/* FLM 0.20 */ +uint64_t prb_done; +uint64_t prb_ignore; +uint64_t sta_done; +uint64_t inf_done; +uint64_t inf_skip; +uint64_t pck_hit; +uint64_t pck_miss; +uint64_t pck_unh; +uint64_t pck_dis; +uint64_t csh_hit; +uint64_t csh_miss; +uint64_t csh_unh; +uint64_t cuc_start; +uint64_t cuc_move; +/* FLM 0.17 Load */ +uint64_t load_lps; +uint64_t load_aps; +uint64_t max_lps; +uint64_t max_aps; };struct nt4ga_stat_s {
@@ -200,6 +233,9 @@ struct nt4ga_stat_s {struct host_buffer_counters *mp_stat_structs_hb;struct port_load_counters *mp_port_load; +int flm_stat_ver; +struct flm_counters_v1 *mp_stat_structs_flm; +/* Rx/Tx totals: */ uint64_t n_totals_reset_timestamp;/* timestamp for last totals reset */
drivers/net/ntnic/meson.build +1 -0
@@ -31,6 +31,7 @@ sources = files( 'link_mgmt/nt4ga_link.c', 'nim/i2c_nim.c', 'ntnic_filter/ntnic_filter.c', + 'ntnic_xstats/ntnic_xstats.c', 'nthw/dbs/nthw_dbs.c', 'nthw/supported/nthw_fpga_9563_055_049_0000.c', 'nthw/supported/nthw_fpga_instances.c',
drivers/net/ntnic/ntnic_ethdev.c +112 -0
124 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c +15 -0
@@ -192,3 +192,18 @@ const struct rte_flow_ops *get_dev_flow_ops(void)return dev_flow_ops; } + +static struct ntnic_xstats_ops *ntnic_xstats_ops; + +void register_ntnic_xstats_ops (struct ntnic_xstats_ops *ops) +{ + ntnic_xstats_ops = ops; +} + +struct ntnic_xstats_ops *get_ntnic_xstats_ops (void ) +{ +if (ntnic_xstats_ops ==NULL ) +ntnic_xstats_ops_init (); + +return ntnic_xstats_ops; +}
drivers/net/ntnic/ntnic_mod_reg.h +28 -0
@@ -7,6 +7,10 @@#define __NTNIC_MOD_REG_H__#include <stdint.h> + +#include "rte_ethdev.h" +#include "rte_flow_driver.h" +#include "flow_api.h" #include "stream_binary_flow_api.h" #include "nthw_fpga_model.h"
@@ -354,4 +358,28 @@ void register_flow_filter_ops(const struct flow_filter_ops *ops);const struct flow_filter_ops *get_flow_filter_ops (void );void init_flow_filter (void ); +struct ntnic_xstats_ops { +int (*nthw_xstats_get_names)(nt4ga_stat_t *p_nt4ga_stat, +struct rte_eth_xstat_name *xstats_names, +unsigned int size); +int (*nthw_xstats_get)(nt4ga_stat_t *p_nt4ga_stat, +struct rte_eth_xstat *stats, +unsigned int n, +uint8_t port); +void (*nthw_xstats_reset)(nt4ga_stat_t *p_nt4ga_stat,uint8_t port); +int (*nthw_xstats_get_names_by_id)(nt4ga_stat_t *p_nt4ga_stat, +struct rte_eth_xstat_name *xstats_names, +const uint64_t *ids, +unsigned int size); +int (*nthw_xstats_get_by_id)(nt4ga_stat_t *p_nt4ga_stat, +const uint64_t *ids, +uint64_t *values, +unsigned int n, +uint8_t port); +}; + +void register_ntnic_xstats_ops (struct ntnic_xstats_ops *ops); +struct ntnic_xstats_ops *get_ntnic_xstats_ops (void ); +void ntnic_xstats_ops_init (void ); +#endif /* __NTNIC_MOD_REG_H__ */
drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c new file +829 -0
829 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v4 62/86 net/ntnic: added flow statistics
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
xstats was extended with flow statistics support.
Additional counters that shows learn, unlearn, lps, aps and other.
--- .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 40 ++++ drivers/net/ntnic/include/hw_mod_backend.h | 3 + drivers/net/ntnic/include/ntdrv_4ga.h | 1 + drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 11 +- .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 142 ++++++++++++++ .../flow_api/profile_inline/flm_evt_queue.c | 176 ++++++++++++++++++ .../flow_api/profile_inline/flm_evt_queue.h | 52 ++++++ .../profile_inline/flow_api_profile_inline.c | 46 +++++ .../profile_inline/flow_api_profile_inline.h | 6 + drivers/net/ntnic/nthw/rte_pmd_ntnic.h | 43 +++++ drivers/net/ntnic/ntnic_ethdev.c | 132 +++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 7 + 13 files changed, 656 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h create mode 100644 drivers/net/ntnic/nthw/rte_pmd_ntnic.h
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +40 -0
@@ -189,6 +189,24 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)return -1 ; } +if (get_flow_filter_ops () !=NULL ) { +struct flow_nic_dev *ndev = p_adapter_info->nt4ga_filter.mp_flow_device; + p_nt4ga_stat->flm_stat_ver = ndev->be.flm.ver; + p_nt4ga_stat->mp_stat_structs_flm =calloc (1 ,sizeof (struct flm_counters_v1 )); + +if (!p_nt4ga_stat->mp_stat_structs_flm) { +NT_LOG_DBGX (ERR ,GENERAL ,"Cannot allocate mem." ); +return -1 ; + } + + p_nt4ga_stat->mp_stat_structs_flm->max_aps = +nthw_fpga_get_product_param (p_adapter_info->fpga_info.mp_fpga, +NT_FLM_LOAD_APS_MAX ,0 ); + p_nt4ga_stat->mp_stat_structs_flm->max_lps = +nthw_fpga_get_product_param (p_adapter_info->fpga_info.mp_fpga, +NT_FLM_LOAD_LPS_MAX ,0 ); + } + p_nt4ga_stat->mp_port_load =calloc (NUM_ADAPTER_PORTS_MAX ,sizeof (struct port_load_counters ));
@@ -236,6 +254,7 @@ static int nt4ga_stat_collect_cap_v1_stats(struct adapter_info_s *p_adapter_inforeturn -1 ;nthw_stat_t *p_nthw_stat = p_nt4ga_stat->mp_nthw_stat; +struct flow_nic_dev *ndev = p_adapter_info->nt4ga_filter.mp_flow_device;const int n_rx_ports = p_nt4ga_stat->mn_rx_ports;const int n_tx_ports = p_nt4ga_stat->mn_tx_ports;
@@ -542,6 +561,27 @@ static int nt4ga_stat_collect_cap_v1_stats(struct adapter_info_s *p_adapter_info (uint64_t )(((__uint128_t )val *32ULL ) /PORT_LOAD_WINDOWS_SIZE ); } +/* Update and get FLM stats */ + flow_filter_ops->flow_get_flm_stats (ndev, (uint64_t *)p_nt4ga_stat->mp_stat_structs_flm, +sizeof (struct flm_counters_v1 ) /sizeof (uint64_t )); + +/* +* Calculate correct load values: +* rpp = nthw_fpga_get_product_param(p_fpga, NT_RPP_PER_PS, 0); +* bin = (uint32_t)(((FLM_LOAD_WINDOWS_SIZE * 1000000000000ULL) / (32ULL * rpp)) - 1ULL); +* load_aps = ((uint64_t)load_aps * 1000000000000ULL) / (uint64_t)((bin+1) * rpp); +* load_lps = ((uint64_t)load_lps * 1000000000000ULL) / (uint64_t)((bin+1) * rpp); +* +* Simplified it gives: +* +* load_lps = (load_lps * 32ULL) / FLM_LOAD_WINDOWS_SIZE +* load_aps = (load_aps * 32ULL) / FLM_LOAD_WINDOWS_SIZE +*/ + + p_nt4ga_stat->mp_stat_structs_flm->load_aps = + (p_nt4ga_stat->mp_stat_structs_flm->load_aps *32ULL ) /FLM_LOAD_WINDOWS_SIZE ; + p_nt4ga_stat->mp_stat_structs_flm->load_lps = + (p_nt4ga_stat->mp_stat_structs_flm->load_lps *32ULL ) /FLM_LOAD_WINDOWS_SIZE ;return 0 ; }
drivers/net/ntnic/include/hw_mod_backend.h +3 -0
@@ -688,6 +688,9 @@ int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field,int hw_mod_flm_rcp_set (struct flow_api_backend_s *be,enum hw_flm_e field,int index,uint32_t value); +int hw_mod_flm_stat_update (struct flow_api_backend_s *be); +int hw_mod_flm_stat_get (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t *value); + int hw_mod_flm_lrn_data_set_flush(struct flow_api_backend_s *be, enum hw_flm_e field, const uint32_t *value, uint32_t records, uint32_t *handled_records, uint32_t *inf_word_cnt,
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
@@ -17,6 +17,7 @@ typedef struct ntdrv_4ga_s {rte_thread_t flm_thread;pthread_mutex_t stat_lck;rte_thread_t stat_thread; + rte_thread_t port_event_thread; } ntdrv_4ga_t;#endif /* __NTDRV_4GA_H__ */
drivers/net/ntnic/meson.build +1 -0
@@ -59,6 +59,7 @@ sources = files( 'nthw/flow_api/flow_id_table.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c', 'nthw/flow_api/profile_inline/flm_lrn_queue.c', + 'nthw/flow_api/profile_inline/flm_evt_queue.c', 'nthw/flow_api/profile_inline/flow_api_profile_inline.c', 'nthw/flow_api/profile_inline/flow_api_hw_db_inline.c', 'nthw/flow_api/flow_backend/flow_backend.c',
drivers/net/ntnic/nthw/flow_api/flow_api.c +7 -4
@@ -1050,11 +1050,14 @@ int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size) { - (void )ndev; - (void )data; - (void )size; +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) +return -1 ; + +if (ndev->flow_profile ==FLOW_ETH_DEV_PROFILE_INLINE ) +return profile_inline_ops->flow_get_flm_stats_profile_inline (ndev, data, size); -NT_LOG_DBGX (DBG ,FILTER ,"Not implemented yet" );return -1 ; }
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +142 -0
148 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c new file +176 -0
176 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h new file +52 -0
52 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +46 -0
58 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +6 -0
@@ -52,4 +52,10 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,int hsh_idx, struct nt_eth_rss_conf rss_conf); +/* +* Stats +*/ + +int flow_get_flm_stats_profile_inline (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size); +#endif /* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/nthw/rte_pmd_ntnic.h new file +43 -0
43 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +132 -0
156 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +7 -0
@@ -290,6 +290,13 @@ struct profile_inline_ops {int hsh_idx, struct nt_eth_rss_conf rss_conf); +/* +* Stats +*/ +int (*flow_get_flm_stats_profile_inline)(struct flow_nic_dev *ndev, +uint64_t *data, +uint64_t size); +/* * NT Flow FLM queue API */
Signature · 1 line
2.45.0
PATCH v4 63/86 net/ntnic: add scrub registers
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Scrub fields were added to the fpga map file
Remove duplicated macro
--- .../supported/nthw_fpga_9563_055_049_0000.c | 17 ++++++++++++++++- drivers/net/ntnic/ntnic_ethdev.c | 3 --- 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +16 -1
@@ -728,7 +728,7 @@ static nthw_fpga_field_init_s flm_lrn_data_fields[] = { { FLM_LRN_DATA_PRIO, 2, 691, 0x0000 }, { FLM_LRN_DATA_PROT, 8, 320, 0x0000 }, { FLM_LRN_DATA_QFI, 6, 704, 0x0000 }, { FLM_LRN_DATA_QW0, 128, 192, 0x0000 }, { FLM_LRN_DATA_QW4, 128, 64, 0x0000 }, { FLM_LRN_DATA_RATE, 16, 416, 0x0000 }, - { FLM_LRN_DATA_RQI, 1, 710, 0x0000 }, + { FLM_LRN_DATA_RQI, 1, 710, 0x0000 }, { FLM_LRN_DATA_SCRUB_PROF, 4, 712, 0x0000 }, { FLM_LRN_DATA_SIZE, 16, 432, 0x0000 }, { FLM_LRN_DATA_STAT_PROF, 4, 687, 0x0000 }, { FLM_LRN_DATA_SW8, 32, 32, 0x0000 }, { FLM_LRN_DATA_SW9, 32, 0, 0x0000 }, { FLM_LRN_DATA_TEID, 32, 368, 0x0000 }, { FLM_LRN_DATA_VOL_IDX, 3, 684, 0x0000 },
@@ -782,6 +782,18 @@ static nthw_fpga_field_init_s flm_scan_fields[] = { { FLM_SCAN_I, 16, 0, 0 }, }; +static nthw_fpga_field_init_s flm_scrub_ctrl_fields[] = { + {FLM_SCRUB_CTRL_ADR ,4 ,0 ,0x0000 }, + {FLM_SCRUB_CTRL_CNT ,16 ,16 ,0x0000 }, +}; + +static nthw_fpga_field_init_s flm_scrub_data_fields[] = { + {FLM_SCRUB_DATA_DEL ,1 ,12 ,0 }, + {FLM_SCRUB_DATA_INF ,1 ,13 ,0 }, + {FLM_SCRUB_DATA_R ,4 ,8 ,0 }, + {FLM_SCRUB_DATA_T ,8 ,0 ,0 }, +}; +static nthw_fpga_field_init_s flm_status_fields[] = { {FLM_STATUS_CACHE_BUFFER_CRITICAL ,1 ,12 ,0x0000 }, { FLM_STATUS_CALIB_FAIL, 3, 3, 0 },
@@ -921,6 +933,8 @@ static nthw_fpga_register_init_s flm_registers[] = { { FLM_RCP_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_rcp_ctrl_fields }, { FLM_RCP_DATA, 9, 403, NTHW_FPGA_REG_TYPE_WO, 0, 19, flm_rcp_data_fields }, { FLM_SCAN, 2, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_scan_fields }, + { FLM_SCRUB_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_scrub_ctrl_fields }, + { FLM_SCRUB_DATA, 11, 14, NTHW_FPGA_REG_TYPE_WO, 0, 4, flm_scrub_data_fields }, { FLM_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_MIXED, 0, 9, flm_status_fields }, { FLM_STAT_AUL_DONE, 41, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_done_fields }, { FLM_STAT_AUL_FAIL, 43, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_fail_fields },
@@ -3058,6 +3072,7 @@ static nthw_fpga_prod_param_s product_parameters[] = { { NT_FLM_PRESENT, 1 }, { NT_FLM_PRIOS, 4 }, { NT_FLM_PST_PROFILES, 16 }, + { NT_FLM_SCRUB_PROFILES, 16 }, { NT_FLM_SIZE_MB, 12288 }, { NT_FLM_STATEFUL, 1 }, { NT_FLM_VARIANT, 2 },
drivers/net/ntnic/ntnic_ethdev.c +0 -3
@@ -47,9 +47,6 @@ const rte_thread_attr_t thread_attr = { .priority = RTE_THREAD_PRIORITY_NORMAL }#define SG_HW_RX_PKT_BUFFER_SIZE (1024 << 1)#define SG_HW_TX_PKT_BUFFER_SIZE (1024 << 1) -/* Max RSS queues */ -#define MAX_QUEUES 125 -#define NUM_VQ_SEGS (_data_size_) \ ({ \ size_t _size = (_data_size_); \
Signature · 1 line
2.45.0
PATCH v4 64/86 net/ntnic: update documentation
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
Update required documentation
--- doc/guides/nics/ntnic.rst | 30 ++++++++++++++++++++++++++ doc/guides/rel_notes/release_24_11.rst | 2 ++ 2 files changed, 32 insertions(+)
doc/guides/nics/ntnic.rst +30 -0
@@ -40,6 +40,36 @@ Features - Unicast MAC filter - Multicast MAC filter - Promiscuous mode (Enable only. The device always run promiscuous mode) +- Multiple TX and RX queues. +- Scattered and gather for TX and RX. +- RSS hash +- RSS key update +- RSS based on VLAN or 5-tuple. +- RSS using different combinations of fields: L3 only, L4 only or both, and + source only, destination only or both. +- Several RSS hash keys, one for each flow type. +- Default RSS operation with no hash key specification. +- VLAN filtering. +- RX VLAN stripping via raw decap. +- TX VLAN insertion via raw encap. +- Flow API. +- Multiple process. +- Tunnel types: GTP. +- Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum + verification. +- Support for multiple rte_flow groups. +- Encapsulation and decapsulation of GTP data. +- Packet modification: NAT, TTL decrement, DSCP tagging +- Traffic mirroring. +- Jumbo frame support. +- Port and queue statistics. +- RMON statistics in extended stats. +- Flow metering, including meter policy API. +- Link state information. +- CAM and TCAM based matching. +- Exact match of 140 million flows and policies. +- Basic stats +- Extended stats Limitations ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +2 -0
@@ -160,6 +160,8 @@ New Features * Added NT flow backend initialization. * Added initialization of FPGA modules related to flow HW offload. * Added basic handling of the virtual queues. + * Added flow handling API + * Added statistics API * **Added cryptodev queue pair reset support.**
Signature · 1 line
2.45.0
Re: [PATCH v4 64/86] net/ntnic: update documentation
Quoted 39 lines · Serhii Iliushyk
From: Oleksandr Kolomeiets <[email protected]>
Update required documentation
Signed-off-by Oleksandr Kolomeiets <[email protected]>--- doc/guides/nics/ntnic.rst | 30 ++++++++++++++++++++++++++ doc/guides/rel_notes/release_24_11.rst | 2 ++ 2 files changed, 32 insertions(+)doc/guides/nics/ntnic.rst +21
-0@@ -40,6 +40,36 @@ Features - Unicast MAC filter - Multicast MAC filter - Promiscuous mode (Enable only. The device always run promiscuous mode) +- Multiple TX and RX queues. +- Scattered and gather for TX and RX. +- RSS hash +- RSS key update +- RSS based on VLAN or 5-tuple. +- RSS using different combinations of fields: L3 only, L4 only or both, and + source only, destination only or both. +- Several RSS hash keys, one for each flow type. +- Default RSS operation with no hash key specification. +- VLAN filtering. +- RX VLAN stripping via raw decap. +- TX VLAN insertion via raw encap. +- Flow API. +- Multiple process. +- Tunnel types: GTP. +- Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum + verification. +- Support for multiple rte_flow groups. +- Encapsulation and decapsulation of GTP data. +- Packet modification: NAT, TTL decrement, DSCP tagging +- Traffic mirroring.
doc/guides/nics/ntnic.rst Features · line 73
Quoted 10 lines
doc/guides/nics/ntnic.rst +9
-0+- Jumbo frame support. +- Port and queue statistics. +- RMON statistics in extended stats. +- Flow metering, including meter policy API. +- Link state information. +- CAM and TCAM based matching. +- Exact match of 140 million flows and policies. +- Basic stats +- Extended stats
Instead of having a separate commit, can you please distribute document update to the patch that adds the documented feature?
Quoted 16 lines
doc/guides/nics/ntnic.rst +0
-0Limitations ~~~~~~~~~~~doc/guides/rel_notes/release_24_11.rst +2
-0@@ -160,6 +160,8 @@ New Features * Added NT flow backend initialization. * Added initialization of FPGA modules related to flow HW offload. * Added basic handling of the virtual queues. + * Added flow handling API + * Added statistics API * **Added cryptodev queue pair reset support.**
PATCH v4 65/86 net/ntnic: add flow aging API
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
add flow aging API to the ops structure
--- drivers/net/ntnic/nthw/flow_api/flow_api.c | 71 +++++++++++++++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 88 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 21 +++++ 3 files changed, 180 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +71 -0
@@ -1048,6 +1048,70 @@ int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,return profile_inline_ops->flow_nic_set_hasher_fields_inline (ndev, hsh_idx, rss_conf); } +static int flow_get_aged_flows (struct flow_eth_dev *dev, +uint16_t caller_id, +void **context, +uint32_t nb_contexts, +struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline_ops uninitialized" ); +return -1 ; + } + +if (nb_contexts >0 && !context) { + error->type =RTE_FLOW_ERROR_TYPE_UNSPECIFIED ; + error->message ="rte_flow_get_aged_flows - empty context" ; +return -1 ; + } + +return profile_inline_ops->flow_get_aged_flows_profile_inline (dev, caller_id, context, + nb_contexts, error); +} + +static int flow_info_get (struct flow_eth_dev *dev,uint8_t caller_id, +struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info, +struct rte_flow_error *error) +{ + (void )dev; + (void )caller_id; + (void )port_info; + (void )queue_info; + (void )error; + +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return 0 ; +} + +static int flow_configure (struct flow_eth_dev *dev,uint8_t caller_id, +const struct rte_flow_port_attr *port_attr,uint16_t nb_queue, +const struct rte_flow_queue_attr *queue_attr[],struct rte_flow_error *error) +{ + (void )dev; + (void )caller_id; + (void )port_attr; + (void )queue_attr; + (void )nb_queue; + (void )error; + +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return 0 ; +} +int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size) {const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops ();
@@ -1076,6 +1140,13 @@ static const struct flow_filter_ops ops = { .flow_flush = flow_flush, .flow_dev_dump = flow_dev_dump, .flow_get_flm_stats = flow_get_flm_stats, + .flow_get_aged_flows = flow_get_aged_flows, + +/* +* NT Flow asynchronous operations API +*/ + .flow_info_get = flow_info_get, + .flow_configure = flow_configure,/* * Other
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +88 -0
100 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +21 -0
@@ -286,6 +286,12 @@ struct profile_inline_ops {FILE *file, struct rte_flow_error *error); +int (*flow_get_aged_flows_profile_inline)(struct flow_eth_dev *dev, +uint16_t caller_id, +void **context, +uint32_t nb_contexts, +struct rte_flow_error *error); +int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf);
@@ -355,6 +361,21 @@ struct flow_filter_ops {int (*flow_nic_set_hasher_fields)(struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf);int (*hw_mod_hsh_rcp_flush)(struct flow_api_backend_s *be,int start_idx,int count); + +int (*flow_get_aged_flows)(struct flow_eth_dev *dev, +uint16_t caller_id, +void **context, +uint32_t nb_contexts, +struct rte_flow_error *error); + +int (*flow_info_get)(struct flow_eth_dev *dev,uint8_t caller_id, +struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info, +struct rte_flow_error *error); + +int (*flow_configure)(struct flow_eth_dev *dev,uint8_t caller_id, +const struct rte_flow_port_attr *port_attr,uint16_t nb_queue, +const struct rte_flow_queue_attr *queue_attr[], +struct rte_flow_error *error); };void register_dev_flow_ops (const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 66/86 net/ntnic: add aging API to the inline profile
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Added implementation for flow get aging API.
Module which operate with age queue was extended with get, count and size operations.
--- drivers/net/ntnic/meson.build | 1 + .../flow_api/profile_inline/flm_age_queue.c | 49 ++++++++++++++++++ .../flow_api/profile_inline/flm_age_queue.h | 24 +++++++++ .../profile_inline/flow_api_profile_inline.c | 51 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 6 +++ 5 files changed, 131 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h
drivers/net/ntnic/meson.build +1 -0
@@ -58,6 +58,7 @@ sources = files( 'nthw/flow_api/flow_group.c', 'nthw/flow_api/flow_id_table.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c', + 'nthw/flow_api/profile_inline/flm_age_queue.c', 'nthw/flow_api/profile_inline/flm_lrn_queue.c', 'nthw/flow_api/profile_inline/flm_evt_queue.c', 'nthw/flow_api/profile_inline/flow_api_profile_inline.c',
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c new file +49 -0
49 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2024 Napatech A/S +*/ + +#ifndef _FLM_AGE_QUEUE_H_ +#define _FLM_AGE_QUEUE_H_ + +#include "stdint.h" + +struct flm_age_event_s { +void *context; +}; + +/* Max number of event queues */ +#define MAX_EVT_AGE_QUEUES 256 + +#define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s) + +int flm_age_queue_get (uint16_t caller_id,struct flm_age_event_s *obj); +unsigned int flm_age_queue_count (uint16_t caller_id); +unsigned int flm_age_queue_get_size (uint16_t caller_id); + +#endif /* _FLM_AGE_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +51 -0
69 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +6 -0
@@ -48,6 +48,12 @@ int flow_dev_dump_profile_inline(struct flow_eth_dev *dev,FILE *file, struct rte_flow_error *error); +int flow_get_aged_flows_profile_inline (struct flow_eth_dev *dev, +uint16_t caller_id, +void **context, +uint32_t nb_contexts, +struct rte_flow_error *error); +int flow_nic_set_hasher_fields_inline (struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf);
Signature · 1 line
2.45.0
PATCH v4 67/86 net/ntnic: add flow info and flow configure APIs
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Inline profile was extended with flow info and create APIS.
Module which operate with age queue was extended with create and free operations.
--- drivers/net/ntnic/include/flow_api.h | 3 + drivers/net/ntnic/include/flow_api_engine.h | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 19 +---- .../flow_api/profile_inline/flm_age_queue.c | 77 +++++++++++++++++++ .../flow_api/profile_inline/flm_age_queue.h | 5 ++ .../profile_inline/flow_api_profile_inline.c | 62 ++++++++++++++- .../profile_inline/flow_api_profile_inline.h | 9 +++ drivers/net/ntnic/ntnic_mod_reg.h | 9 +++ 8 files changed, 169 insertions(+), 16 deletions(-)
drivers/net/ntnic/include/flow_api.h +3 -0
@@ -77,6 +77,9 @@ struct flow_eth_dev {/* QSL_HSH index if RSS needed QSL v6+ */ int rss_target_id; +/* The size of buffer for aged out flow list */ +uint32_t nb_aging_objects; +struct flow_eth_dev *next; };
drivers/net/ntnic/include/flow_api_engine.h +1 -0
@@ -320,6 +320,7 @@ struct flow_handle {uint32_t flm_teid;uint8_t flm_rqi;uint8_t flm_qfi; +uint8_t flm_scrub_prof; }; }; };
drivers/net/ntnic/nthw/flow_api/flow_api.c +4 -15
@@ -1075,12 +1075,6 @@ static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id, struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info, struct rte_flow_error *error) { - (void)dev; - (void)caller_id; - (void)port_info; - (void)queue_info; - (void)error; - const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();if (profile_inline_ops ==NULL ) {
@@ -1088,20 +1082,14 @@ static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id,return -1 ; } -return 0 ; +return profile_inline_ops->flow_info_get_profile_inline (dev, caller_id, port_info, + queue_info, error); }static int flow_configure (struct flow_eth_dev *dev,uint8_t caller_id,const struct rte_flow_port_attr *port_attr,uint16_t nb_queue,const struct rte_flow_queue_attr *queue_attr[],struct rte_flow_error *error) { - (void )dev; - (void )caller_id; - (void )port_attr; - (void )queue_attr; - (void )nb_queue; - (void )error; -const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops ();if (profile_inline_ops ==NULL ) {
@@ -1109,7 +1097,8 @@ static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id,return -1 ; } -return 0 ; +return profile_inline_ops->flow_configure_profile_inline (dev, caller_id, port_attr, + nb_queue, queue_attr, error); }int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size)
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +77 -0
89 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +5 -0
@@ -15,8 +15,13 @@ struct flm_age_event_s {/* Max number of event queues */ #define MAX_EVT_AGE_QUEUES 256 +/* Max number of event ports */ +#define MAX_EVT_AGE_PORTS 128 +#define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s) +void flm_age_queue_free (uint8_t port,uint16_t caller_id); +struct rte_ring *flm_age_queue_create (uint8_t port,uint16_t caller_id,unsigned int count);int flm_age_queue_get (uint16_t caller_id,struct flm_age_event_s *obj);unsigned int flm_age_queue_count (uint16_t caller_id);unsigned int flm_age_queue_get_size (uint16_t caller_id);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +61 -1
86 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +9 -0
@@ -64,4 +64,13 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,int flow_get_flm_stats_profile_inline (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size); +int flow_info_get_profile_inline (struct flow_eth_dev *dev,uint8_t caller_id, +struct rte_flow_port_info *port_info, +struct rte_flow_queue_info *queue_info,struct rte_flow_error *error); + +int flow_configure_profile_inline (struct flow_eth_dev *dev,uint8_t caller_id, +const struct rte_flow_port_attr *port_attr,uint16_t nb_queue, +const struct rte_flow_queue_attr *queue_attr[], +struct rte_flow_error *error); +#endif /* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/ntnic_mod_reg.h +9 -0
@@ -309,6 +309,15 @@ struct profile_inline_ops {void (*flm_setup_queues)(void );void (*flm_free_queues)(void );uint32_t (*flm_update)(struct flow_eth_dev *dev); + +int (*flow_info_get_profile_inline)(struct flow_eth_dev *dev,uint8_t caller_id, +struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info, +struct rte_flow_error *error); + +int (*flow_configure_profile_inline)(struct flow_eth_dev *dev,uint8_t caller_id, +const struct rte_flow_port_attr *port_attr,uint16_t nb_queue, +const struct rte_flow_queue_attr *queue_attr[], +struct rte_flow_error *error); };void register_profile_inline_ops (const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 68/86 net/ntnic: add flow aging event
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Port thread was extended with new age event callback handler. LRN, INF, STA registers getter setter was added.
--- drivers/net/ntnic/include/flow_api_engine.h | 13 ++ drivers/net/ntnic/include/hw_mod_backend.h | 11 ++ .../net/ntnic/nthw/flow_api/flow_id_table.c | 16 ++ .../net/ntnic/nthw/flow_api/flow_id_table.h | 3 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 158 +++++++++++++++ .../flow_api/profile_inline/flm_age_queue.c | 28 +++ .../flow_api/profile_inline/flm_age_queue.h | 12 ++ .../flow_api/profile_inline/flm_evt_queue.c | 20 ++ .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 142 +++++++++++++- .../profile_inline/flow_api_hw_db_inline.h | 84 ++++---- .../profile_inline/flow_api_profile_inline.c | 183 ++++++++++++++++++ .../flow_api_profile_inline_config.h | 21 +- drivers/net/ntnic/ntnic_ethdev.c | 16 ++ 14 files changed, 671 insertions(+), 37 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +13 -0
@@ -148,6 +148,14 @@ struct hsh_def_s {const uint8_t *key;/* Hash key. */ }; +/* +* AGE configuration, see struct rte_flow_action_age +*/ +struct age_def_s { +uint32_t timeout; +void *context; +}; +/* * Tunnel encapsulation header definition */
@@ -264,6 +272,11 @@ struct nic_flow_def {* Hash module RSS definitions */ struct hsh_def_s hsh; + +/* +* AGE action timeout +*/ +struct age_def_s age; };enum flow_handle_type {
drivers/net/ntnic/include/hw_mod_backend.h +11 -0
@@ -688,6 +688,9 @@ int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field,int hw_mod_flm_rcp_set (struct flow_api_backend_s *be,enum hw_flm_e field,int index,uint32_t value); +int hw_mod_flm_buf_ctrl_update (struct flow_api_backend_s *be); +int hw_mod_flm_buf_ctrl_get (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t *value); +int hw_mod_flm_stat_update (struct flow_api_backend_s *be);int hw_mod_flm_stat_get (struct flow_api_backend_s *be,enum hw_flm_e field,uint32_t *value);
@@ -695,8 +698,16 @@ int hw_mod_flm_lrn_data_set_flush(struct flow_api_backend_s *be, enum hw_flm_e f const uint32_t *value, uint32_t records, uint32_t *handled_records, uint32_t *inf_word_cnt, uint32_t *sta_word_cnt); +int hw_mod_flm_inf_sta_data_update_get (struct flow_api_backend_s *be,enum hw_flm_e field, +uint32_t *inf_value,uint32_t inf_size, +uint32_t *inf_word_cnt,uint32_t *sta_value, +uint32_t sta_size,uint32_t *sta_word_cnt); +uint32_t hw_mod_flm_scrub_timeout_decode (uint32_t t_enc); +uint32_t hw_mod_flm_scrub_timeout_encode (uint32_t t);int hw_mod_flm_scrub_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_flm_scrub_set (struct flow_api_backend_s *be,enum hw_flm_e field,int index, +uint32_t value);struct hsh_func_s {COMMON_FUNC_INFO_S ;
drivers/net/ntnic/nthw/flow_api/flow_id_table.c +16 -0
@@ -129,3 +129,19 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id)pthread_mutex_unlock (&handle->mtx); } + +void ntnic_id_table_find (void *id_table,uint32_t id,union flm_handles *flm_h,uint8_t *caller_id, +uint8_t *type) +{ +struct ntnic_id_table_data *handle = id_table; + +pthread_mutex_lock (&handle->mtx); + +struct ntnic_id_table_element *element =ntnic_id_table_array_find_element (handle, id); + + *caller_id = element->caller_id; + *type = element->type; +memcpy (flm_h, &element->handle,sizeof (union flm_handles )); + +pthread_mutex_unlock (&handle->mtx); +}
drivers/net/ntnic/nthw/flow_api/flow_id_table.h +3 -0
@@ -20,4 +20,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t uint8_t type);void ntnic_id_table_free_id (void *id_table,uint32_t id); +void ntnic_id_table_find (void *id_table,uint32_t id,union flm_handles *flm_h,uint8_t *caller_id, +uint8_t *type); +#endif /* FLOW_ID_TABLE_H_ */
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +158 -0
167 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +28 -0
@@ -13,6 +13,21 @@static struct rte_ring *age_queue[MAX_EVT_AGE_QUEUES ];static RTE_ATOMIC (uint16_t ) age_event[MAX_EVT_AGE_PORTS ]; +__rte_always_inline int flm_age_event_get(uint8_t port) +{ +return rte_atomic_load_explicit (&age_event[port], rte_memory_order_seq_cst); +} + +__rte_always_inline void flm_age_event_set(uint8_t port) +{ +rte_atomic_store_explicit (&age_event[port],1 , rte_memory_order_seq_cst); +} + +__rte_always_inline void flm_age_event_clear(uint8_t port) +{ +rte_atomic_store_explicit (&age_event[port],0 , rte_memory_order_seq_cst); +} +void flm_age_queue_free (uint8_t port,uint16_t caller_id) {struct rte_ring *q =NULL ;
@@ -88,6 +103,19 @@ struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsignedreturn q; } +void flm_age_queue_put (uint16_t caller_id,struct flm_age_event_s *obj) +{ +int ret; + +/* If queues is not created, then ignore and return */ +if (caller_id <MAX_EVT_AGE_QUEUES && age_queue[caller_id] !=NULL ) { + ret =rte_ring_sp_enqueue_elem (age_queue[caller_id], obj,FLM_AGE_ELEM_SIZE ); + +if (ret !=0 ) +NT_LOG (DBG ,FILTER ,"FLM aged event queue full" ); + } +} +int flm_age_queue_get (uint16_t caller_id,struct flm_age_event_s *obj) {int ret;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +12 -0
@@ -12,6 +12,14 @@ struct flm_age_event_s {void *context; }; +/* Indicates why the flow info record was generated */ +#define INF_DATA_CAUSE_SW_UNLEARN 0 +#define INF_DATA_CAUSE_TIMEOUT_FLOW_DELETED 1 +#define INF_DATA_CAUSE_NA 2 +#define INF_DATA_CAUSE_PERIODIC_FLOW_INFO 3 +#define INF_DATA_CAUSE_SW_PROBE 4 +#define INF_DATA_CAUSE_TIMEOUT_FLOW_KEPT 5 +/* Max number of event queues */ #define MAX_EVT_AGE_QUEUES 256
@@ -20,8 +28,12 @@ struct flm_age_event_s {#define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s) +int flm_age_event_get (uint8_t port); +void flm_age_event_set (uint8_t port); +void flm_age_event_clear (uint8_t port);void flm_age_queue_free (uint8_t port,uint16_t caller_id);struct rte_ring *flm_age_queue_create (uint8_t port,uint16_t caller_id,unsigned int count); +void flm_age_queue_put (uint16_t caller_id,struct flm_age_event_s *obj);int flm_age_queue_get (uint16_t caller_id,struct flm_age_event_s *obj);unsigned int flm_age_queue_count (uint16_t caller_id);unsigned int flm_age_queue_get_size (uint16_t caller_id);
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +20 -0
@@ -138,6 +138,26 @@ static struct rte_ring *flm_evt_queue_create(uint8_t port, uint8_t caller)return q; } +int flm_sta_queue_put (uint8_t port,bool remote,struct flm_status_event_s *obj) +{ +struct rte_ring **stat_q = remote ? stat_q_remote : stat_q_local; + +if (port >= (remote ?MAX_STAT_RMT_QUEUES :MAX_STAT_LCL_QUEUES )) +return -1 ; + +if (stat_q[port] ==NULL ) { +if (flm_evt_queue_create (port, remote ?FLM_STAT_REMOTE :FLM_STAT_LOCAL ) ==NULL ) +return -1 ; + } + +if (rte_ring_sp_enqueue_elem (stat_q[port], obj,FLM_STAT_ELEM_SIZE ) !=0 ) { +NT_LOG (DBG ,FILTER ,"FLM local status queue full" ); +return -1 ; + } + +return 0 ; +} +int flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj) {int ret;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
@@ -48,5 +48,6 @@ enum {#define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s)int flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj); +int flm_sta_queue_put (uint8_t port,bool remote,struct flm_status_event_s *obj);#endif /* _FLM_EVT_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +139 -3
206 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +51 -33
114 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +183 -0
257 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h +20 -1
@@ -55,4 +55,23 @@*/ #define NTNIC_SCANNER_LOAD 0.01 -#endif /* _FLOW_API_PROFILE_INLINE_CONFIG_H_ */ +/* +* This define sets the timeout resolution of aged flow scanner (scrubber). +* +* The timeout resolution feature is provided in order to reduce the number of +* write-back operations for flows without attached meter. If the resolution +* is disabled (set to 0) and flow timeout is enabled via age action, then a write-back +* occurs every the flow is evicted from the flow cache, essentially causing the +* lookup performance to drop to that of a flow with meter. By setting the timeout +* resolution (>0), write-back for flows happens only when the difference between +* the last recorded time for the flow and the current time exceeds the chosen resolution. +* +* The parameter value is a power of 2 in units of 2^28 nanoseconds. It means that value 8 sets +* the timeout resolution to: 2^8 * 2^28 / 1e9 = 68,7 seconds +* +* NOTE: This parameter has a significant impact on flow lookup performance, especially +* if full scanner timeout resolution (=0) is configured. +*/ +#define NTNIC_SCANNER_TIMEOUT_RESOLUTION 8 + +#endif /* _FLOW_API_PROFILE_INLINE_CONFIG_H_ */
drivers/net/ntnic/ntnic_ethdev.c +16 -0
@@ -26,6 +26,7 @@#include "ntnic_vfio.h" #include "ntnic_mod_reg.h" #include "nt_util.h" +#include "profile_inline/flm_age_queue.h" #include "profile_inline/flm_evt_queue.h" #include "rte_pmd_ntnic.h"
@@ -1814,6 +1815,21 @@ THREAD_FUNC port_event_thread_fn(void *context) } } +/* AGED event */ +/* Note: RTE_FLOW_PORT_FLAG_STRICT_QUEUE flag is not supported so +* event is always generated +*/ +int aged_event_count =flm_age_event_get (port_no); + +if (aged_event_count >0 && eth_dev && eth_dev->data && + eth_dev->data->dev_private) { +rte_eth_dev_callback_process (eth_dev, +RTE_ETH_EVENT_FLOW_AGED , +NULL ); +flm_age_event_clear (port_no); + do_wait = false; + } +if (do_wait)nt_os_wait_usec (10 );
Signature · 1 line
2.45.0
PATCH v4 69/86 net/ntnic: add termination thread
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Introduce clear_pdrv to unregister driver
from global tracking.
Modify drv_deinit to call clear_pdirv and ensure
safe termination.
Add flm sta and age event free.
--- .../flow_api/profile_inline/flm_age_queue.c | 10 +++ .../flow_api/profile_inline/flm_age_queue.h | 1 + .../flow_api/profile_inline/flm_evt_queue.c | 76 +++++++++++++++++++ .../flow_api/profile_inline/flm_evt_queue.h | 1 + drivers/net/ntnic/ntnic_ethdev.c | 6 ++ 5 files changed, 94 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +10 -0
@@ -44,6 +44,16 @@ void flm_age_queue_free(uint8_t port, uint16_t caller_id)rte_ring_free (q); } +void flm_age_queue_free_all (void ) +{ +int i; +int j; + +for (i =0 ; i <MAX_EVT_AGE_PORTS ; i++) +for (j =0 ; j <MAX_EVT_AGE_QUEUES ; j++) +flm_age_queue_free (i, j); +} +struct rte_ring *flm_age_queue_create (uint8_t port,uint16_t caller_id,unsigned int count) {char name[20 ];
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +1 -0
@@ -32,6 +32,7 @@ int flm_age_event_get(uint8_t port);void flm_age_event_set (uint8_t port);void flm_age_event_clear (uint8_t port);void flm_age_queue_free (uint8_t port,uint16_t caller_id); +void flm_age_queue_free_all (void );struct rte_ring *flm_age_queue_create (uint8_t port,uint16_t caller_id,unsigned int count);void flm_age_queue_put (uint16_t caller_id,struct flm_age_event_s *obj);int flm_age_queue_get (uint16_t caller_id,struct flm_age_event_s *obj);
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +76 -0
82 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
@@ -47,6 +47,7 @@ enum {#define FLM_EVT_ELEM_SIZE sizeof(struct flm_info_event_s)#define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s) +void flm_inf_sta_queue_free_all (uint8_t caller);int flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj);int flm_sta_queue_put (uint8_t port,bool remote,struct flm_status_event_s *obj);
drivers/net/ntnic/ntnic_ethdev.c +6 -0
@@ -1420,6 +1420,12 @@ drv_deinit(struct drv_s *p_drv)THREAD_JOIN (p_nt_drv->flm_thread); profile_inline_ops->flm_free_queues ();THREAD_JOIN (p_nt_drv->port_event_thread); +/* Free all local flm event queues */ +flm_inf_sta_queue_free_all (FLM_INFO_LOCAL ); +/* Free all remote flm event queues */ +flm_inf_sta_queue_free_all (FLM_INFO_REMOTE ); +/* Free all aged flow event queues */ +flm_age_queue_free_all (); }/* stop adapter */
Signature · 1 line
2.45.0
PATCH v4 70/86 net/ntnic: add aging documentation
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
ntnic.rst document was exntede with age feature specification. ntnic.ini was extended with rte_flow action age support.
--- doc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 18 ++++++++++++++++++ doc/guides/rel_notes/release_24_11.rst | 1 + 3 files changed, 20 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -33,6 +33,7 @@ udp = Y vlan = Y [rte_flow actions] +age = Y drop = Y jump = Y mark = Y
doc/guides/nics/ntnic.rst +18 -0
@@ -148,3 +148,21 @@ FILTER To enable logging on all levels use wildcard in the following way:: --log-level=pmd.net.ntnic.*,8 + +Flow Scanner +------------ + +Flow Scanner is DPDK mechanism that constantly and periodically scans the RTE flow tables to check for aged-out flows. +When flow timeout is reached, i.e. no packets were matched by the flow within timeout period, +``RTE_ETH_EVENT_FLOW_AGED`` event is reported, and flow is marked as aged-out. + +Therefore, flow scanner functionality is closely connected to the RTE flows' ``age`` action. + +There are list of characteristics that ``age timeout`` action has: + - functions only in group > 0; + - flow timeout is specified in seconds; + - flow scanner checks flows age timeout once in 1-480 seconds, therefore, flows may not age-out immediately, depedning on how big are intervals of flow scanner mechanism checks; + - aging counters can display maximum of **n - 1** aged flows when aging counters are set to **n**; + - overall 15 different timeouts can be specified for the flows at the same time (note that this limit is combined for all actions, therefore, 15 different actions can be created at the same time, maximum limit of 15 can be reached only across different groups - when 5 flows with different timeouts are created per one group, otherwise the limit within one group is 14 distinct flows); + - after flow is aged-out it's not automatically deleted; + - aged-out flow can be updated with ``flow update`` command, and its aged-out status will be reverted;
doc/guides/rel_notes/release_24_11.rst +1 -0
@@ -162,6 +162,7 @@ New Features * Added basic handling of the virtual queues. * Added flow handling API * Added statistics API + * Added age rte flow action support * **Added cryptodev queue pair reset support.**
Signature · 1 line
2.45.0
Re: [PATCH v4 70/86] net/ntnic: add aging documentation
Quoted 55 lines · Serhii Iliushyk
From: Danylo Vodopianov <[email protected]>
ntnic.rstdocument was exntede with age feature specification. ntnic.ini was extended withrte_flowaction age support.Signed-off-by Danylo Vodopianov <[email protected]>--- doc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 18 ++++++++++++++++++ doc/guides/rel_notes/release_24_11.rst | 1 + 3 files changed, 20 insertions(+)doc/guides/nics/features/ntnic.ini +1
-0@@ -33,6 +33,7 @@ udp = Y vlan = Y [rte_flow actions] +age = Y drop = Y jump = Y mark = Ydoc/guides/nics/ntnic.rst +18
-0@@ -148,3 +148,21 @@ FILTER To enable logging on all levels use wildcard in the following way:: --log-level=pmd.net.ntnic.*,8 + +Flow Scanner +------------ + +Flow Scanner is DPDK mechanism that constantly and periodically scans the RTE flow tables to check for aged-out flows. +When flow timeout is reached, i.e. no packets were matched by the flow within timeout period, +``RTE_ETH_EVENT_FLOW_AGED`` event is reported, and flow is marked as aged-out. + +Therefore, flow scanner functionality is closely connected to the RTE flows' ``age`` action. + +There are list of characteristics that ``age timeout`` action has: + - functions only in group > 0; + - flow timeout is specified in seconds; + - flow scanner checks flows age timeout once in 1-480 seconds, therefore, flows may not age-out immediately, depedning on how big are intervals of flow scanner mechanism checks; + - aging counters can display maximum of **n - 1** aged flows when aging counters are set to **n**; + - overall 15 different timeouts can be specified for the flows at the same time (note that this limit is combined for all actions, therefore, 15 different actions can be created at the same time, maximum limit of 15 can be reached only across different groups - when 5 flows with different timeouts are created per one group, otherwise the limit within one group is 14 distinct flows); + - after flow is aged-out it's not automatically deleted; + - aged-out flow can be updated with ``flow update`` command, and its aged-out status will be reverted;doc/guides/rel_notes/release_24_11.rst +0
-0
doc/guides/rel_notes/release_24_11.rst New Features · line 166
Quoted 5 lines
doc/guides/rel_notes/release_24_11.rst +1
-0@@ -162,6 +162,7 @@ New Features * Added basic handling of the virtual queues. * Added flow handling API * Added statistics API + * Added age rte flow action support
Similar comment as previous, please merge this patch with the patch that introduces the flow aging functionality.
Same for "meter documentation" patch, "documentation for flow actions update" patch, "flow API documentation" patch and "documentation for set MTU" patch.
PATCH v4 71/86 net/ntnic: add meter API
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Add meter API and implementation to the profile inline.
management functions were extended with meter flow support.
--- drivers/net/ntnic/include/flow_api.h | 1 + drivers/net/ntnic/include/flow_api_engine.h | 5 + .../flow_api/profile_inline/flm_evt_queue.c | 21 + .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_profile_inline.c | 560 +++++++++++++++++- drivers/net/ntnic/ntnic_mod_reg.h | 27 + 6 files changed, 597 insertions(+), 18 deletions(-)
drivers/net/ntnic/include/flow_api.h +1 -0
@@ -100,6 +100,7 @@ struct flow_nic_dev {void *km_res_handle;void *kcc_res_handle; +void *flm_mtr_handle;void *group_handle;void *hw_db_handle;void *id_table_handle;
drivers/net/ntnic/include/flow_api_engine.h +5 -0
@@ -57,6 +57,7 @@ enum res_type_e {#define MAX_TCAM_START_OFFSETS 4 +#define MAX_FLM_MTRS_SUPPORTED 4#define MAX_CPY_WRITERS_SUPPORTED 8#define MAX_MATCH_FIELDS 16
@@ -223,6 +224,8 @@ struct nic_flow_def {uint32_t jump_to_group; +uint32_t mtr_ids[MAX_FLM_MTRS_SUPPORTED ]; +int full_offload;/*
@@ -320,6 +323,8 @@ struct flow_handle {uint32_t flm_db_idx_counter;uint32_t flm_db_idxs[RES_COUNT ]; +uint32_t flm_mtr_ids[MAX_FLM_MTRS_SUPPORTED ]; +uint32_t flm_data[10 ];uint8_t flm_prot;uint8_t flm_kid;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +21 -0
@@ -234,6 +234,27 @@ int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj)return 0 ; } +void flm_inf_queue_put (uint8_t port,bool remote,struct flm_info_event_s *obj) +{ +int ret; + +/* If queues is not created, then ignore and return */ +if (!remote) { +if (port <MAX_INFO_LCL_QUEUES && info_q_local[port] !=NULL ) { + ret =rte_ring_sp_enqueue_elem (info_q_local[port], obj,FLM_EVT_ELEM_SIZE ); + +if (ret !=0 ) +NT_LOG (DBG ,FILTER ,"FLM local info queue full" ); + } + + }else if (port <MAX_INFO_RMT_QUEUES && info_q_remote[port] !=NULL ) { + ret =rte_ring_sp_enqueue_elem (info_q_remote[port], obj,FLM_EVT_ELEM_SIZE ); + +if (ret !=0 ) +NT_LOG (DBG ,FILTER ,"FLM remote info queue full" ); + } +} +int flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj) {int ret;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
@@ -48,6 +48,7 @@ enum {#define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s)void flm_inf_sta_queue_free_all (uint8_t caller); +void flm_inf_queue_put (uint8_t port,bool remote,struct flm_info_event_s *obj);int flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj);int flm_sta_queue_put (uint8_t port,bool remote,struct flm_status_event_s *obj);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +542 -18
662 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +27 -0
@@ -308,6 +308,33 @@ struct profile_inline_ops {*/ void (*flm_setup_queues)(void );void (*flm_free_queues)(void ); + +/* +* NT Flow FLM Meter API +*/ +int (*flow_mtr_supported)(struct flow_eth_dev *dev); +uint64_t (*flow_mtr_meter_policy_n_max)(void ); +int (*flow_mtr_set_profile)(struct flow_eth_dev *dev,uint32_t profile_id, +uint64_t bucket_rate_a,uint64_t bucket_size_a, +uint64_t bucket_rate_b,uint64_t bucket_size_b); +int (*flow_mtr_set_policy)(struct flow_eth_dev *dev,uint32_t policy_id,int drop); +int (*flow_mtr_create_meter)(struct flow_eth_dev *dev,uint8_t caller_id,uint32_t mtr_id, +uint32_t profile_id,uint32_t policy_id,uint64_t stats_mask); +int (*flow_mtr_probe_meter)(struct flow_eth_dev *dev,uint8_t caller_id,uint32_t mtr_id); +int (*flow_mtr_destroy_meter)(struct flow_eth_dev *dev,uint8_t caller_id, +uint32_t mtr_id); +int (*flm_mtr_adjust_stats)(struct flow_eth_dev *dev,uint8_t caller_id,uint32_t mtr_id, +uint32_t adjust_value); +uint32_t (*flow_mtr_meters_supported)(struct flow_eth_dev *dev,uint8_t caller_id); + +void (*flm_mtr_read_stats)(struct flow_eth_dev *dev, +uint8_t caller_id, +uint32_t id, +uint64_t *stats_mask, +uint64_t *green_pkt, +uint64_t *green_bytes, +int clear); +uint32_t (*flm_update)(struct flow_eth_dev *dev); int (*flow_info_get_profile_inline)(struct flow_eth_dev *dev, uint8_t caller_id,
Signature · 1 line
2.45.0
PATCH v4 72/86 net/ntnic: add meter module
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Meter module was added:
1. add/remove profile
2. create/destroy flow
3. add/remove meter policy
4. read/update stats
eth_dev_ops struct was extended with ops above.
--- drivers/net/ntnic/include/ntos_drv.h | 14 + drivers/net/ntnic/meson.build | 2 + .../net/ntnic/nthw/ntnic_meter/ntnic_meter.c | 483 ++++++++++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 11 +- drivers/net/ntnic/ntnic_mod_reg.c | 21 + drivers/net/ntnic/ntnic_mod_reg.h | 12 + 6 files changed, 542 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c
drivers/net/ntnic/include/ntos_drv.h +14 -0
@@ -12,6 +12,7 @@#include <inttypes.h> #include <rte_ether.h> +#include "rte_mtr.h" #include "stream_binary_flow_api.h" #include "nthw_drv.h"
@@ -90,6 +91,19 @@ struct __rte_cache_aligned ntnic_tx_queue {enum fpga_info_profile profile;/* Inline / Capture */ }; +struct nt_mtr_profile { +LIST_ENTRY (nt_mtr_profile) next; +uint32_t profile_id; +struct rte_mtr_meter_profile profile; +}; + +struct nt_mtr { +LIST_ENTRY (nt_mtr) next; +uint32_t mtr_id; +int shared; +struct nt_mtr_profile *profile; +}; +struct pmd_internals {const struct rte_pci_device *pci_dev;struct flow_eth_dev *flw_dev;
drivers/net/ntnic/meson.build +2 -0
@@ -17,6 +17,7 @@ includes = [ include_directories('nthw'), include_directories('nthw/supported'), include_directories('nthw/model'), + include_directories('nthw/ntnic_meter'), include_directories('nthw/flow_filter'), include_directories('nthw/flow_api'), include_directories('nim/'),
@@ -92,6 +93,7 @@ sources = files( 'nthw/flow_filter/flow_nthw_tx_cpy.c', 'nthw/flow_filter/flow_nthw_tx_ins.c', 'nthw/flow_filter/flow_nthw_tx_rpl.c', + 'nthw/ntnic_meter/ntnic_meter.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c',
drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c new file +483 -0
483 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +10 -1
@@ -1682,7 +1682,7 @@ static int rss_hash_conf_get(struct rte_eth_dev *eth_dev, struct rte_eth_rss_conreturn 0 ; } -static const struct eth_dev_ops nthw_eth_dev_ops = { +static struct eth_dev_ops nthw_eth_dev_ops = { .dev_configure = eth_dev_configure, .dev_start = eth_dev_start, .dev_stop = eth_dev_stop,
@@ -1705,6 +1705,7 @@ static const struct eth_dev_ops nthw_eth_dev_ops = { .mac_addr_add = eth_mac_addr_add, .mac_addr_set = eth_mac_addr_set, .set_mc_addr_list = eth_set_mc_addr_list, + .mtr_ops_get = NULL, .flow_ops_get = dev_flow_ops_get, .xstats_get = eth_xstats_get, .xstats_get_names = eth_xstats_get_names,
@@ -2168,6 +2169,14 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)return -1 ; } +const struct meter_ops_s *meter_ops =get_meter_ops (); + +if (meter_ops !=NULL ) + nthw_eth_dev_ops.mtr_ops_get = meter_ops->eth_mtr_ops_get; + +else +NT_LOG (DBG ,NTNIC ,"Meter module is not initialized" ); +/* Initialize the queue system */ if (err ==0 ) { sg_ops =get_sg_ops ();
drivers/net/ntnic/ntnic_mod_reg.c +21 -0
@@ -19,6 +19,27 @@ const struct sg_ops_s *get_sg_ops(void)return sg_ops; } +/* +* +*/ +static struct meter_ops_s *meter_ops; + +void register_meter_ops (struct meter_ops_s *ops) +{ + meter_ops = ops; +} + +const struct meter_ops_s *get_meter_ops (void ) +{ +if (meter_ops ==NULL ) +meter_init (); + +return meter_ops; +} + +/* +* +*/ static const struct ntnic_filter_ops *ntnic_filter_ops;void register_ntnic_filter_ops (const struct ntnic_filter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +12 -0
@@ -115,6 +115,18 @@ void register_sg_ops(struct sg_ops_s *ops);const struct sg_ops_s *get_sg_ops (void );void sg_init (void ); +/* Meter ops section */ +struct meter_ops_s { +int (*eth_mtr_ops_get)(struct rte_eth_dev *eth_dev,void *ops); +}; + +void register_meter_ops (struct meter_ops_s *ops); +const struct meter_ops_s *get_meter_ops (void ); +void meter_init (void ); + +/* +* +*/ struct ntnic_filter_ops {int (*poll_statistics)(struct pmd_internals *internals); };
Signature · 1 line
2.45.0
PATCH v4 73/86 net/ntnic: update meter documentation
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Update ntnic.ini ntnic.rst and release notes
--- doc/guides/nics/features/ntnic.ini | 2 ++ doc/guides/nics/ntnic.rst | 1 + doc/guides/rel_notes/release_24_11.rst | 1 + 3 files changed, 4 insertions(+)
doc/guides/nics/features/ntnic.ini +2 -0
@@ -43,3 +43,5 @@ queue = Y raw_decap = Y raw_encap = Y rss = Y +meter = Y +passthru = Y
doc/guides/nics/ntnic.rst +1 -0
@@ -70,6 +70,7 @@ Features - Exact match of 140 million flows and policies. - Basic stats - Extended stats +- Flow metering, including meter policy API. Limitations ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
@@ -163,6 +163,7 @@ New Features * Added flow handling API * Added statistics API * Added age rte flow action support + * Added meter flow metering and flow policy support * **Added cryptodev queue pair reset support.**
Signature · 1 line
2.45.0
PATCH v4 74/86 net/ntnic: add action update
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
rte_flow_ops was extended with action update feature.
--- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 66 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 10 +++ 2 files changed, 76 insertions(+)
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +66 -0
@@ -9,6 +9,7 @@#include "ntnic_mod_reg.h" #include "ntos_system.h" #include "ntos_drv.h" +#include "rte_flow.h" #define MAX_RTE_FLOWS 8192
@@ -703,6 +704,70 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *erreturn res; } +static int eth_flow_actions_update (struct rte_eth_dev *eth_dev, +struct rte_flow *flow, +const struct rte_flow_action actions[], +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG (ERR ,FILTER ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + +static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; +int res =-1 ; + +if (internals->flw_dev) { +struct pmd_internals *dev_private = + (struct pmd_internals *)eth_dev->data->dev_private; +struct fpga_info_s *fpga_info = &dev_private->p_drv->ntdrv.adapter_info.fpga_info; +struct cnv_action_s action = {0 }; + +if (fpga_info->profile ==FPGA_INFO_PROFILE_INLINE ) { +uint32_t queue_offset =0 ; + +if (dev_private->type ==PORT_TYPE_OVERRIDE && + dev_private->vpq_nb_vq >0 ) { +/* +* The queues coming from the main PMD will always start from 0 +* When the port is a the VF/vDPA port the queues must be changed +* to match the queues allocated for VF/vDPA. +*/ + queue_offset = dev_private->vpq[0 ].id; + } + +if (create_action_elements_inline (&action, actions,MAX_ACTIONS , + queue_offset) !=0 ) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL , +"Error in actions" ); +return -1 ; + } + } + +if (is_flow_handle_typecast (flow)) { + res = flow_filter_ops->flow_actions_update (internals->flw_dev, + (void *)flow, + action.flow_actions, + &flow_error); + + }else { + res = flow_filter_ops->flow_actions_update (internals->flw_dev, + flow->flw_hdl, + action.flow_actions, + &flow_error); + } + } + +convert_error (error, &flow_error); + +return res; +} + static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file,
@@ -941,6 +1006,7 @@ static const struct rte_flow_ops dev_flow_ops = { .create = eth_flow_create, .destroy = eth_flow_destroy, .flush = eth_flow_flush, + .actions_update = eth_flow_actions_update, .dev_dump = eth_flow_dev_dump, .get_aged_flows = eth_flow_get_aged_flows, .info_get = eth_flow_info_get,
drivers/net/ntnic/ntnic_mod_reg.h +10 -0
@@ -292,6 +292,11 @@ struct profile_inline_ops {uint16_t caller_id, struct rte_flow_error *error); +int (*flow_actions_update_profile_inline)(struct flow_eth_dev *dev, +struct flow_handle *flow, +const struct rte_flow_action action[], +struct rte_flow_error *error); + int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id,
@@ -401,6 +406,11 @@ struct flow_filter_ops {int (*flow_flush)(struct flow_eth_dev *dev,uint16_t caller_id,struct rte_flow_error *error); +int (*flow_actions_update)(struct flow_eth_dev *dev, +struct flow_handle *flow, +const struct rte_flow_action action[], +struct rte_flow_error *error); +int (*flow_get_flm_stats)(struct flow_nic_dev *ndev,uint64_t *data,uint64_t size);/*
Signature · 1 line
2.45.0
PATCH v4 75/86 net/ntnic: add flow action update
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
flow_filter_ops was extended with flow action update API.
--- drivers/net/ntnic/nthw/flow_api/flow_api.c | 16 ++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 5 +++++ 2 files changed, 21 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +16 -0
@@ -266,6 +266,21 @@ static int flow_flush(struct flow_eth_dev *dev, uint16_t caller_id, struct rte_freturn profile_inline_ops->flow_flush_profile_inline (dev, caller_id, error); } +static int flow_actions_update (struct flow_eth_dev *dev, +struct flow_handle *flow, +const struct rte_flow_action action[], +struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return profile_inline_ops->flow_actions_update_profile_inline (dev, flow, action, error); +} +/* * Device Management API */
@@ -1127,6 +1142,7 @@ static const struct flow_filter_ops ops = { .flow_create = flow_create, .flow_destroy = flow_destroy, .flow_flush = flow_flush, + .flow_actions_update = flow_actions_update, .flow_dev_dump = flow_dev_dump, .flow_get_flm_stats = flow_get_flm_stats, .flow_get_aged_flows = flow_get_aged_flows,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +5 -0
@@ -42,6 +42,11 @@ int flow_flush_profile_inline(struct flow_eth_dev *dev,uint16_t caller_id, struct rte_flow_error *error); +int flow_actions_update_profile_inline (struct flow_eth_dev *dev, +struct flow_handle *flow, +const struct rte_flow_action action[], +struct rte_flow_error *error); + int flow_dev_dump_profile_inline(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id,
Signature · 1 line
2.45.0
PATCH v4 76/86 net/ntnic: flow update was added
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Flow action update was implemented.
--- .../profile_inline/flow_api_profile_inline.c | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +165 -0
@@ -15,6 +15,7 @@#include "flow_api_hw_db_inline.h" #include "flow_api_profile_inline_config.h" #include "flow_id_table.h" +#include "rte_flow.h" #include "stream_binary_flow_api.h" #include "flow_api_profile_inline.h"
@@ -36,6 +37,7 @@#define NT_FLM_UNHANDLED_FLOW_TYPE 1#define NT_FLM_OP_UNLEARN 0#define NT_FLM_OP_LEARN 1 +#define NT_FLM_OP_RELEARN 2#define NT_FLM_VIOLATING_MBR_FLOW_TYPE 15#define NT_VIOLATING_MBR_CFN 0
@@ -4385,6 +4387,168 @@ int flow_flush_profile_inline(struct flow_eth_dev *dev,return err; } +int flow_actions_update_profile_inline (struct flow_eth_dev *dev, +struct flow_handle *flow, +const struct rte_flow_action action[], +struct rte_flow_error *error) +{ +assert (dev); +assert (flow); + +uint32_t num_dest_port =0 ; +uint32_t num_queues =0 ; + +int group = (int )flow->flm_kid -2 ; + +flow_nic_set_error (ERR_SUCCESS , error); + +if (flow->type !=FLOW_HANDLE_TYPE_FLM ) { +NT_LOG (ERR ,FILTER , +"Flow actions update not supported for group 0 or default flows" ); +flow_nic_set_error (ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM , error); +return -1 ; + } + +struct nic_flow_def *fd =allocate_nic_flow_def (); + +if (fd ==NULL ) { + error->type =RTE_FLOW_ERROR_TYPE_UNSPECIFIED ; + error->message ="Failed to allocate nic_flow_def" ; +return -1 ; + } + + fd->non_empty =1 ; + +int res = +interpret_flow_actions (dev, action,NULL , fd, error, &num_dest_port, &num_queues); + +if (res) { +free (fd); +return -1 ; + } + +pthread_mutex_lock (&dev->ndev->mtx); + +/* Setup new actions */ +uint32_t local_idx_counter =0 ; +uint32_t local_idxs[RES_COUNT ]; +memset (local_idxs,0x0 ,sizeof (uint32_t ) *RES_COUNT ); + +struct hw_db_inline_qsl_data qsl_data; +setup_db_qsl_data (fd, &qsl_data, num_dest_port, num_queues); + +struct hw_db_inline_hsh_data hsh_data; +setup_db_hsh_data (fd, &hsh_data); + + { +uint32_t flm_ft =0 ; +uint32_t flm_scrub =0 ; + +/* Setup FLM RCP */ +const struct hw_db_inline_flm_rcp_data *flm_data = +hw_db_inline_find_data (dev->ndev, dev->ndev->hw_db_handle, +HW_DB_IDX_TYPE_FLM_RCP , + (struct hw_db_idx *)flow->flm_db_idxs, + flow->flm_db_idx_counter); + +if (flm_data ==NULL ) { +NT_LOG (ERR ,FILTER ,"Could not retrieve FLM RPC resource" ); +flow_nic_set_error (ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM , error); + goto error_out; + } + +struct hw_db_flm_idx flm_idx = +hw_db_inline_flm_add (dev->ndev, dev->ndev->hw_db_handle, flm_data, group); + + local_idxs[local_idx_counter++] = flm_idx.raw; + +if (flm_idx.error) { +NT_LOG (ERR ,FILTER ,"Could not reference FLM RPC resource" ); +flow_nic_set_error (ERR_MATCH_RESOURCE_EXHAUSTION , error); + goto error_out; + } + +if (setup_flow_flm_actions (dev, fd, &qsl_data, &hsh_data, group, local_idxs, + &local_idx_counter, &flow->flm_rpl_ext_ptr, &flm_ft, + &flm_scrub, error)) { + goto error_out; + } + +/* Update flow_handle */ +for (int i =0 ; i <MAX_FLM_MTRS_SUPPORTED ; ++i) { +struct flm_flow_mtr_handle_s *handle = dev->ndev->flm_mtr_handle; +struct flm_mtr_stat_s *mtr_stat = + handle->port_stats[flow->caller_id]->stats; + flow->flm_mtr_ids[i] = + fd->mtr_ids[i] ==UINT32_MAX ?0 : mtr_stat[fd->mtr_ids[i]].flm_id; + } + +for (unsigned int i =0 ; i < fd->modify_field_count; ++i) { +switch (fd->modify_field[i].select) { +case CPY_SELECT_DSCP_IPV4 : + +/* fallthrough */ +case CPY_SELECT_DSCP_IPV6 : + flow->flm_dscp = fd->modify_field[i].value8[0 ]; +break ; + +case CPY_SELECT_RQI_QFI : + flow->flm_rqi = (fd->modify_field[i].value8[0 ] >>6 ) &0x1 ; + flow->flm_qfi = fd->modify_field[i].value8[0 ] &0x3f ; +break ; + +case CPY_SELECT_IPV4 : + flow->flm_nat_ipv4 =ntohl (fd->modify_field[i].value32[0 ]); +break ; + +case CPY_SELECT_PORT : + flow->flm_nat_port =ntohs (fd->modify_field[i].value16[0 ]); +break ; + +case CPY_SELECT_TEID : + flow->flm_teid =ntohl (fd->modify_field[i].value32[0 ]); +break ; + +default : +NT_LOG (DBG ,FILTER ,"Unknown modify field: %d" , + fd->modify_field[i].select); +break ; + } + } + + flow->flm_ft = (uint8_t )flm_ft; + flow->flm_scrub_prof = (uint8_t )flm_scrub; + flow->context = fd->age.context; + +/* Program flow */ +flm_flow_programming (flow,NT_FLM_OP_RELEARN ); + +hw_db_inline_deref_idxs (dev->ndev, dev->ndev->hw_db_handle, + (struct hw_db_idx *)flow->flm_db_idxs, + flow->flm_db_idx_counter); +memset (flow->flm_db_idxs,0x0 ,sizeof (struct hw_db_idx ) *RES_COUNT ); + + flow->flm_db_idx_counter = local_idx_counter; + +for (int i =0 ; i <RES_COUNT ; ++i) + flow->flm_db_idxs[i] = local_idxs[i]; + } + +pthread_mutex_unlock (&dev->ndev->mtx); + +free (fd); +return 0 ; + +error_out: +hw_db_inline_deref_idxs (dev->ndev, dev->ndev->hw_db_handle, (struct hw_db_idx *)local_idxs, + local_idx_counter); + +pthread_mutex_unlock (&dev->ndev->mtx); + +free (fd); +return -1 ; +} + static __rte_always_inline bool all_bits_enabled(uint64_t hash_mask, uint64_t hash_bits) {return (hash_mask & hash_bits) == hash_bits;
@@ -5328,6 +5492,7 @@ static const struct profile_inline_ops ops = { .flow_create_profile_inline = flow_create_profile_inline, .flow_destroy_profile_inline = flow_destroy_profile_inline, .flow_flush_profile_inline = flow_flush_profile_inline, + .flow_actions_update_profile_inline = flow_actions_update_profile_inline, .flow_nic_set_hasher_fields_inline = flow_nic_set_hasher_fields_inline, .flow_get_aged_flows_profile_inline = flow_get_aged_flows_profile_inline,/*
Signature · 1 line
2.45.0
PATCH v4 77/86 net/ntnic: update documentation for flow actions update
In reply to Serhii IliushykUpdate ntnic.rst and release notes
--- doc/guides/nics/ntnic.rst | 1 + doc/guides/rel_notes/release_24_11.rst | 1 + 2 files changed, 2 insertions(+)
doc/guides/nics/ntnic.rst +1 -0
@@ -71,6 +71,7 @@ Features - Basic stats - Extended stats - Flow metering, including meter policy API. +- Flow update. Update of the action list for specific flow Limitations ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
@@ -164,6 +164,7 @@ New Features * Added statistics API * Added age rte flow action support * Added meter flow metering and flow policy support + * Added flow actions update support * **Added cryptodev queue pair reset support.**
Signature · 1 line
2.45.0
PATCH v4 78/86 net/ntnic: migrate to the RTE spinlock
In reply to Serhii IliushykMigarte form the pthread to rte_spinlock
--- drivers/net/ntnic/include/flow_api.h | 6 +- drivers/net/ntnic/include/ntdrv_4ga.h | 3 +- .../net/ntnic/nthw/core/include/nthw_i2cm.h | 4 +- .../net/ntnic/nthw/core/include/nthw_rpf.h | 5 +- drivers/net/ntnic/nthw/core/nthw_rpf.c | 3 +- drivers/net/ntnic/nthw/flow_api/flow_api.c | 43 +++++----- .../net/ntnic/nthw/flow_api/flow_id_table.c | 20 +++-- .../profile_inline/flow_api_profile_inline.c | 80 +++++++++++-------- .../ntnic/nthw/flow_filter/flow_nthw_flm.c | 47 +++++++++-- drivers/net/ntnic/nthw/nthw_rac.c | 38 ++------- drivers/net/ntnic/nthw/nthw_rac.h | 2 +- drivers/net/ntnic/ntnic_ethdev.c | 31 +++---- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 6 +- 13 files changed, 155 insertions(+), 133 deletions(-)
drivers/net/ntnic/include/flow_api.h +3 -3
@@ -6,7 +6,7 @@#ifndef _FLOW_API_H_#define _FLOW_API_H_ -#include <pthread.h> +#include <rte_spinlock.h> #include "ntlog.h"
@@ -110,13 +110,13 @@ struct flow_nic_dev {struct flow_handle *flow_base;/* linked list of all FLM flows created on this NIC */ struct flow_handle *flow_base_flm; -pthread_mutex_t flow_mtx; +rte_spinlock_t flow_mtx;/* NIC backend API */ struct flow_api_backend_s be;/* linked list of created eth-port devices on this NIC */ struct flow_eth_dev *eth_base; -pthread_mutex_t mtx; +rte_spinlock_t mtx;/* RSS hashing configuration */ struct nt_eth_rss_conf rss_conf;
drivers/net/ntnic/include/ntdrv_4ga.h +2 -1
@@ -7,6 +7,7 @@#define __NTDRV_4GA_H__#include "nt4ga_adapter.h" +#include <rte_spinlock.h> typedef struct ntdrv_4ga_s { uint32_t pciident;
@@ -15,7 +16,7 @@ typedef struct ntdrv_4ga_s {volatile bool b_shutdown;rte_thread_t flm_thread; -pthread_mutex_t stat_lck; +rte_spinlock_t stat_lck;rte_thread_t stat_thread;rte_thread_t port_event_thread; } ntdrv_4ga_t;
drivers/net/ntnic/nthw/core/include/nthw_i2cm.h +2 -2
@@ -7,7 +7,7 @@#define __NTHW_II2CM_H__#include "nthw_fpga_model.h" -#include "pthread.h" +#include "rte_spinlock.h" struct nt_i2cm {nthw_fpga_t *mp_fpga;
@@ -39,7 +39,7 @@ struct nt_i2cm {nthw_field_t *mp_fld_io_exp_rst;nthw_field_t *mp_fld_io_exp_int_b; -pthread_mutex_t i2cmmutex; +rte_spinlock_t i2cmmutex; };typedef struct nt_i2cm nthw_i2cm_t ;
drivers/net/ntnic/nthw/core/include/nthw_rpf.h +3 -2
@@ -7,7 +7,8 @@#define NTHW_RPF_HPP_ #include "nthw_fpga_model.h" -#include "pthread.h" +#include "rte_spinlock.h" +#include <rte_spinlock.h> struct nthw_rpf {nthw_fpga_t *mp_fpga;
@@ -28,7 +29,7 @@ struct nthw_rpf {int m_default_maturing_delay;bool m_administrative_block;/* used to enforce license expiry */ -pthread_mutex_t rpf_mutex; +rte_spinlock_t rpf_mutex; };typedef struct nthw_rpf nthw_rpf_t ;
drivers/net/ntnic/nthw/core/nthw_rpf.c +2 -1
@@ -8,6 +8,7 @@#include "nthw_drv.h" #include "nthw_register.h" #include "nthw_rpf.h" +#include "rte_spinlock.h" nthw_rpf_t *nthw_rpf_new (void ) {
@@ -65,7 +66,7 @@ int nthw_rpf_init(nthw_rpf_t *p, nthw_fpga_t *p_fpga, int n_instance)nthw_fpga_get_product_param (p_fpga,NT_RPF_MATURING_DEL_DEFAULT ,0 );/* Initialize mutex */ -pthread_mutex_init (&p->rpf_mutex,NULL ); +rte_spinlock_init (&p->rpf_mutex);return 0 ; }
drivers/net/ntnic/nthw/flow_api/flow_api.c +21 -22
146 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/flow_id_table.c +9 -11
@@ -3,12 +3,12 @@* Copyright(c) 2024 Napatech A/S */ -#include <pthread.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "flow_id_table.h" +#include "rte_spinlock.h" #define NTNIC_ARRAY_BITS 14#define NTNIC_ARRAY_SIZE (1 << NTNIC_ARRAY_BITS)
@@ -25,7 +25,7 @@ struct ntnic_id_table_element {struct ntnic_id_table_data {struct ntnic_id_table_element *arrays[NTNIC_ARRAY_SIZE ]; -pthread_mutex_t mtx; +rte_spinlock_t mtx;uint32_t next_id;
@@ -68,7 +68,7 @@ void *ntnic_id_table_create(void) {struct ntnic_id_table_data *handle =calloc (1 ,sizeof (struct ntnic_id_table_data )); -pthread_mutex_init (&handle->mtx,NULL ); +rte_spinlock_init (&handle->mtx); handle->next_id =1 ;return handle;
@@ -81,8 +81,6 @@ void ntnic_id_table_destroy(void *id_table)for (uint32_t i =0 ; i <NTNIC_ARRAY_SIZE ; ++i)free (handle->arrays[i]); -pthread_mutex_destroy (&handle->mtx); -free (id_table); }
@@ -91,7 +89,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t {struct ntnic_id_table_data *handle = id_table; -pthread_mutex_lock (&handle->mtx); +rte_spinlock_lock (&handle->mtx);uint32_t new_id =ntnic_id_table_array_pop_free_id (handle);
@@ -103,7 +101,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t element->type = type;memcpy (&element->handle, &flm_h,sizeof (union flm_handles )); -pthread_mutex_unlock (&handle->mtx); +rte_spinlock_unlock (&handle->mtx);return new_id; }
@@ -112,7 +110,7 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id) {struct ntnic_id_table_data *handle = id_table; -pthread_mutex_lock (&handle->mtx); +rte_spinlock_lock (&handle->mtx);struct ntnic_id_table_element *current_element =ntnic_id_table_array_find_element (handle, id);
@@ -127,7 +125,7 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id)if (handle->free_tail ==0 ) handle->free_tail = handle->free_head; -pthread_mutex_unlock (&handle->mtx); +rte_spinlock_unlock (&handle->mtx); } void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h, uint8_t *caller_id,
@@ -135,7 +133,7 @@ void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h, {struct ntnic_id_table_data *handle = id_table; -pthread_mutex_lock (&handle->mtx); +rte_spinlock_lock (&handle->mtx);struct ntnic_id_table_element *element =ntnic_id_table_array_find_element (handle, id);
@@ -143,5 +141,5 @@ void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h, *type = element->type;memcpy (flm_h, &element->handle,sizeof (union flm_handles )); -pthread_mutex_unlock (&handle->mtx); +rte_spinlock_unlock (&handle->mtx); }
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +46 -34
272 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c +39 -8
99 lines not on this page · raw message
drivers/net/ntnic/nthw/nthw_rac.c +8 -30
@@ -3,6 +3,7 @@* Copyright(c) 2023 Napatech A/S */ +#include "rte_spinlock.h" #include "nt_util.h" #include "ntlog.h"
@@ -10,8 +11,6 @@#include "nthw_register.h" #include "nthw_rac.h" -#include <pthread.h> -#define RAB_DMA_WAIT (1000000)#define RAB_READ (0x01)
@@ -217,7 +216,7 @@ int nthw_rac_init(nthw_rac_t *p, nthw_fpga_t *p_fpga, struct fpga_info_s *p_fpga } } -pthread_mutex_init (&p->m_mutex,NULL ); +rte_spinlock_init (&p->m_mutex);return 0 ; }
@@ -389,19 +388,6 @@ void nthw_rac_bar0_write32(const struct fpga_info_s *p_fpga_info, uint32_t reg_aint nthw_rac_rab_dma_begin (nthw_rac_t *p) { -const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info; -const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; - -pthread_mutex_lock (&p->m_mutex); - -if (p->m_dma_active) { -pthread_mutex_unlock (&p->m_mutex); -NT_LOG (ERR ,NTHW , -"%s: DMA begin requested, but a DMA transaction is already active" , - p_adapter_id_str); -return -1 ; - } - p->m_dma_active = true;return 0 ;
@@ -454,19 +440,11 @@ int nthw_rac_rab_dma_commit(nthw_rac_t *p) {int ret; -if (!p->m_dma_active) { -/* Expecting mutex not to be locked! */ -assert (0 );/* alert developer that something is wrong */ -return -1 ; - } -nthw_rac_rab_dma_activate (p); ret =nthw_rac_rab_dma_wait (p); p->m_dma_active = false; -pthread_mutex_unlock (&p->m_mutex); -return ret; }
@@ -602,7 +580,7 @@ int nthw_rac_rab_write32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uintreturn -1 ; } -pthread_mutex_lock (&p->m_mutex); +rte_spinlock_lock (&p->m_mutex);if (p->m_dma_active) {NT_LOG (ERR ,NTHW ,"%s: RAB: Illegal operation: DMA enabled" , p_adapter_id_str);
@@ -748,7 +726,7 @@ int nthw_rac_rab_write32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint } exit_unlock_res: -pthread_mutex_unlock (&p->m_mutex); +rte_spinlock_unlock (&p->m_mutex);return res; }
@@ -763,7 +741,7 @@ int nthw_rac_rab_read32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint3uint32_t out_buf_free;int res =0 ; -pthread_mutex_lock (&p->m_mutex); +rte_spinlock_lock (&p->m_mutex);if (address > (1 <<RAB_ADDR_BW )) { NT_LOG(ERR, NTHW, "%s: RAB: Illegal address: value too large %d - max %d",
@@ -923,7 +901,7 @@ int nthw_rac_rab_read32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint3 } exit_unlock_res: -pthread_mutex_unlock (&p->m_mutex); +rte_spinlock_unlock (&p->m_mutex);return res; }
@@ -935,7 +913,7 @@ int nthw_rac_rab_flush(nthw_rac_t *p)uint32_t retry;int res =0 ; -pthread_mutex_lock (&p->m_mutex); +rte_spinlock_lock (&p->m_mutex);/* Set the flush bit */ nthw_rac_reg_write32(p_fpga_info, p->RAC_RAB_BUF_USED_ADDR,
@@ -960,6 +938,6 @@ int nthw_rac_rab_flush(nthw_rac_t *p)/* Clear flush bit when done */ nthw_rac_reg_write32 (p_fpga_info, p->RAC_RAB_BUF_USED_ADDR,0x0 ); -pthread_mutex_unlock (&p->m_mutex); +rte_spinlock_unlock (&p->m_mutex);return res; }
drivers/net/ntnic/nthw/nthw_rac.h +1 -1
@@ -16,7 +16,7 @@ struct nthw_rac {nthw_fpga_t *mp_fpga;nthw_module_t *mp_mod_rac; -pthread_mutex_t m_mutex; +rte_spinlock_t m_mutex;int mn_param_rac_rab_interfaces;int mn_param_rac_rab_ob_update;
drivers/net/ntnic/ntnic_ethdev.c +16 -15
@@ -18,6 +18,7 @@#include <sys/queue.h> +#include "rte_spinlock.h" #include "ntlog.h" #include "ntdrv_4ga.h" #include "ntos_drv.h"
@@ -236,7 +237,7 @@ static int dpdk_stats_reset(struct pmd_internals *internals, struct ntdrv_4ga_sif (!p_nthw_stat || !p_nt4ga_stat || n_intf_no <0 || n_intf_no >NUM_ADAPTER_PORTS_MAX )return -1 ; -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck);/* Rx */ for (i =0 ; i < internals->nb_rx_queues; i++) {
@@ -256,7 +257,7 @@ static int dpdk_stats_reset(struct pmd_internals *internals, struct ntdrv_4ga_s p_nt4ga_stat->n_totals_reset_timestamp =time (NULL ); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ; }
@@ -1519,9 +1520,9 @@ static int eth_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *stareturn -1 ; } -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck); nb_xstats = ntnic_xstats_ops->nthw_xstats_get (p_nt4ga_stat, stats, n, if_index); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);return nb_xstats; }
@@ -1544,10 +1545,10 @@ static int eth_xstats_get_by_id(struct rte_eth_dev *eth_dev,return -1 ; } -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck); nb_xstats = ntnic_xstats_ops->nthw_xstats_get_by_id (p_nt4ga_stat, ids, values, n, if_index); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);return nb_xstats; }
@@ -1566,9 +1567,9 @@ static int eth_xstats_reset(struct rte_eth_dev *eth_dev)return -1 ; } -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck); ntnic_xstats_ops->nthw_xstats_reset (p_nt4ga_stat, if_index); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);return dpdk_stats_reset (internals, p_nt_drv, if_index); }
@@ -1749,14 +1750,14 @@ THREAD_FUNC port_event_thread_fn(void *context)if (p_nt4ga_stat->flm_stat_ver >22 && p_nt4ga_stat->mp_stat_structs_flm) {if (flmdata.lookup != p_nt4ga_stat->mp_stat_structs_flm->load_lps || flmdata.access != p_nt4ga_stat->mp_stat_structs_flm->load_aps) { -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck); flmdata.lookup = p_nt4ga_stat->mp_stat_structs_flm->load_lps; flmdata.access = p_nt4ga_stat->mp_stat_structs_flm->load_aps; flmdata.lookup_maximum = p_nt4ga_stat->mp_stat_structs_flm->max_lps; flmdata.access_maximum = p_nt4ga_stat->mp_stat_structs_flm->max_aps; -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);if (eth_dev && eth_dev->data && eth_dev->data->dev_private) { rte_eth_dev_callback_process(eth_dev,
@@ -1773,7 +1774,7 @@ THREAD_FUNC port_event_thread_fn(void *context)if (p_nt4ga_stat->mp_port_load) {if (portdata.rx_bps != p_nt4ga_stat->mp_port_load[port_no].rx_bps || portdata.tx_bps != p_nt4ga_stat->mp_port_load[port_no].tx_bps) { -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck); portdata.rx_bps = p_nt4ga_stat->mp_port_load[port_no].rx_bps; portdata.tx_bps = p_nt4ga_stat->mp_port_load[port_no].tx_bps; portdata.rx_pps = p_nt4ga_stat->mp_port_load[port_no].rx_pps;
@@ -1786,7 +1787,7 @@ THREAD_FUNC port_event_thread_fn(void *context) p_nt4ga_stat->mp_port_load[port_no].rx_bps_max; portdata.tx_bps_maximum = p_nt4ga_stat->mp_port_load[port_no].tx_bps_max; -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);if (eth_dev && eth_dev->data && eth_dev->data->dev_private) { rte_eth_dev_callback_process(eth_dev,
@@ -1957,9 +1958,9 @@ THREAD_FUNC adapter_stat_thread_fn(void *context)/* Check then collect */ { -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck); nt4ga_stat_ops->nt4ga_stat_collect (&p_nt_drv->adapter_info, p_nt4ga_stat); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck); } }
@@ -2232,7 +2233,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) } } -pthread_mutex_init (&p_nt_drv->stat_lck,NULL ); +rte_spinlock_init (&p_nt_drv->stat_lck); res =THREAD_CTRL_CREATE (&p_nt_drv->stat_thread,"nt4ga_stat_thr" , adapter_stat_thread_fn, (void *)p_drv);
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +3 -3
@@ -910,7 +910,7 @@ static int poll_statistics(struct pmd_internals *internals) internals->last_stat_rtc = now_rtc; -pthread_mutex_lock (&p_nt_drv->stat_lck); +rte_spinlock_lock (&p_nt_drv->stat_lck);/* * Add the RX statistics increments since last time we polled.
@@ -951,7 +951,7 @@ static int poll_statistics(struct pmd_internals *internals)/* Globally only once a second */ if ((now_rtc - last_stat_rtc) < rte_tsc_freq) {rte_spinlock_unlock (&hwlock); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ; }
@@ -988,7 +988,7 @@ static int poll_statistics(struct pmd_internals *internals) }rte_spinlock_unlock (&hwlock); -pthread_mutex_unlock (&p_nt_drv->stat_lck); +rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ; }
Signature · 1 line
2.45.0
PATCH v4 79/86 net/ntnic: remove unnecessary type cast
In reply to Serhii IliushykThe dev_private has type void * and type casting is not necessary.
--- .../net/ntnic/nthw/ntnic_meter/ntnic_meter.c | 18 +++---- drivers/net/ntnic/ntnic_ethdev.c | 48 +++++++++---------- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 16 +++---- 3 files changed, 41 insertions(+), 41 deletions(-)
drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c +9 -9
@@ -42,7 +42,7 @@ static int eth_mtr_capabilities_get_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;uint8_t caller_id =get_caller_id (eth_dev->data->port_id);
@@ -110,7 +110,7 @@ static int eth_mtr_meter_profile_add_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;if (meter_profile_id >= profile_inline_ops->flow_mtr_meter_policy_n_max ()) return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_PROFILE_ID, NULL,
@@ -161,7 +161,7 @@ static int eth_mtr_meter_profile_delete_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;if (meter_profile_id >= profile_inline_ops->flow_mtr_meter_policy_n_max ()) return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_PROFILE_ID, NULL,
@@ -184,7 +184,7 @@ static int eth_mtr_meter_policy_add_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;if (policy_id >= profile_inline_ops->flow_mtr_meter_policy_n_max ()) return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_POLICY_ID, NULL,
@@ -250,7 +250,7 @@ static int eth_mtr_create_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;uint8_t caller_id =get_caller_id (eth_dev->data->port_id);
@@ -316,7 +316,7 @@ static int eth_mtr_destroy_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;uint8_t caller_id =get_caller_id (eth_dev->data->port_id);
@@ -348,7 +348,7 @@ static int eth_mtr_stats_adjust_inline(struct rte_eth_dev *eth_dev,const uint64_t adjust_bit =1ULL <<63 ;const uint64_t probe_bit =1ULL <<62 ; -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;uint8_t caller_id =get_caller_id (eth_dev->data->port_id); if (mtr_id >=
@@ -409,7 +409,7 @@ static int eth_mtr_stats_read_inline(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;uint8_t caller_id =get_caller_id (eth_dev->data->port_id);
@@ -445,7 +445,7 @@ static const struct rte_mtr_ops mtr_ops_inline = {static int eth_mtr_ops_get (struct rte_eth_dev *eth_dev,void *ops) { -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;ntdrv_4ga_t *p_nt_drv = &internals->p_drv->ntdrv;enum fpga_info_profile profile = p_nt_drv->adapter_info.fpga_info.profile;
drivers/net/ntnic/ntnic_ethdev.c +24 -24
192 lines not on this page · raw message
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +8 -8
@@ -491,7 +491,7 @@ static int convert_flow(struct rte_eth_dev *eth_dev,struct cnv_action_s *action, struct rte_flow_error *error) { - struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + struct pmd_internals *internals = eth_dev->data->dev_private;struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info; static struct rte_flow_error flow_error = {
@@ -554,7 +554,7 @@ eth_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *flow, struct rte_return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , .message ="none" };
@@ -595,7 +595,7 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,return NULL ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
@@ -673,7 +673,7 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *erreturn -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , .message ="none" };
@@ -716,7 +716,7 @@ static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , .message ="none" };
@@ -724,7 +724,7 @@ static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,if (internals->flw_dev) {struct pmd_internals *dev_private = - (struct pmd_internals *)eth_dev->data->dev_private; + eth_dev->data->dev_private;struct fpga_info_s *fpga_info = &dev_private->p_drv->ntdrv.adapter_info.fpga_info;struct cnv_action_s action = {0 };
@@ -780,7 +780,7 @@ static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , .message ="none" };
@@ -808,7 +808,7 @@ static int eth_flow_get_aged_flows(struct rte_eth_dev *eth_dev,return -1 ; } -struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; +struct pmd_internals *internals = eth_dev->data->dev_private;static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE ,
Signature · 1 line
2.45.0
PATCH v4 80/86 net/ntnic: add async create/destroy API declaration
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Fast path async create and destroy flow API implementation were added.
--- drivers/net/ntnic/include/flow_api_engine.h | 8 ++ drivers/net/ntnic/ntnic_ethdev.c | 1 + drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 105 ++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 15 +++ drivers/net/ntnic/ntnic_mod_reg.h | 18 +++ 5 files changed, 147 insertions(+)
drivers/net/ntnic/include/flow_api_engine.h +8 -0
@@ -343,6 +343,14 @@ struct flow_handle { }; }; +struct flow_pattern_template { +}; + +struct flow_actions_template { +}; +struct flow_template_table { +}; +void km_attach_ndev_resource_management (struct km_flow_def_s *km,void **handle);void km_free_ndev_resource_management (void **handle);
drivers/net/ntnic/ntnic_ethdev.c +1 -0
@@ -1252,6 +1252,7 @@ eth_dev_start(struct rte_eth_dev *eth_dev)return -1 ; } + eth_dev->flow_fp_ops =get_dev_fp_flow_ops ();struct pmd_internals *internals = eth_dev->data->dev_private;const int n_intf_no = internals->n_intf_no;
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +105 -0
120 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c +15 -0
@@ -199,6 +199,21 @@ const struct flow_filter_ops *get_flow_filter_ops(void)return flow_filter_ops; } +static const struct rte_flow_fp_ops *dev_fp_flow_ops; + +void register_dev_fp_flow_ops (const struct rte_flow_fp_ops *ops) +{ + dev_fp_flow_ops = ops; +} + +const struct rte_flow_fp_ops *get_dev_fp_flow_ops (void ) +{ +if (dev_fp_flow_ops ==NULL ) +dev_fp_flow_init (); + +return dev_fp_flow_ops; +} +static const struct rte_flow_ops *dev_flow_ops;void register_dev_flow_ops (const struct rte_flow_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +18 -0
@@ -7,6 +7,7 @@#define __NTNIC_MOD_REG_H__#include <stdint.h> +#include <rte_flow.h> #include "rte_ethdev.h" #include "rte_flow_driver.h"
@@ -426,6 +427,19 @@ struct flow_filter_ops {uint32_t nb_contexts, struct rte_flow_error *error); +/* +* RTE flow asynchronous operations functions +*/ +struct flow_handle *(*flow_async_create)(struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr, +struct flow_template_table *template_table,const struct rte_flow_item pattern[], +uint8_t pattern_template_index,const struct rte_flow_action actions[], +uint8_t actions_template_index,void *user_data,struct rte_flow_error *error); + +int (*flow_async_destroy)(struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr,struct flow_handle *flow, +void *user_data,struct rte_flow_error *error); +int (*flow_info_get)(struct flow_eth_dev *dev,uint8_t caller_id,struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info,struct rte_flow_error *error);
@@ -436,6 +450,10 @@ struct flow_filter_ops { struct rte_flow_error *error); }; +void register_dev_fp_flow_ops (const struct rte_flow_fp_ops *ops); +const struct rte_flow_fp_ops *get_dev_fp_flow_ops (void ); +void dev_fp_flow_init (void ); +void register_dev_flow_ops (const struct rte_flow_ops *ops);const struct rte_flow_ops *get_dev_flow_ops (void );void dev_flow_init (void );
Signature · 1 line
2.45.0
PATCH v4 81/86 net/ntnic: add async template API declaration
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
rte_flow_ops was exnteded with next features support
1. flow pattern template create
2. flow pattern template destroy
3. flow actions template create
4. flow actions template destroy
5. flow template table create
6. flow template table destroy
--- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 224 ++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 28 +++ 2 files changed, 252 insertions(+)
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +224 -0
@@ -886,6 +886,224 @@ static int eth_flow_configure(struct rte_eth_dev *dev, const struct rte_flow_porreturn res; } +static struct rte_flow_pattern_template *eth_flow_pattern_template_create (struct rte_eth_dev *dev, +const struct rte_flow_pattern_template_attr *template_attr, +const struct rte_flow_item pattern[],struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"flow_filter module uninitialized" ); +return NULL ; + } + +struct pmd_internals *internals = dev->data->dev_private; + +static struct rte_flow_error flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; + +struct cnv_match_s match = {0 }; +struct rte_flow_pattern_template_attr attr = { + .relaxed_matching = template_attr->relaxed_matching, + .ingress = template_attr->ingress, + .egress = template_attr->egress, + .transfer = template_attr->transfer, + }; + +uint16_t caller_id =get_caller_id (dev->data->port_id); + +if (create_match_elements (&match, pattern,MAX_ELEMENTS ) !=0 ) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Error in pattern" ); +return NULL ; + } + +struct flow_pattern_template *res = + flow_filter_ops->flow_pattern_template_create (internals->flw_dev, &attr, caller_id, + match.rte_flow_item, &flow_error); + +convert_error (error, &flow_error); +return (struct rte_flow_pattern_template *)res; +} + +static int eth_flow_pattern_template_destroy (struct rte_eth_dev *dev, +struct rte_flow_pattern_template *pattern_template, +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = dev->data->dev_private; + +static struct rte_flow_error rte_flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; + +int res = flow_filter_ops->flow_pattern_template_destroy (internals->flw_dev, + (struct flow_pattern_template *) + pattern_template, + &rte_flow_error); + +convert_error (error, &rte_flow_error); +return res; +} + +static struct rte_flow_actions_template *eth_flow_actions_template_create (struct rte_eth_dev *dev, +const struct rte_flow_actions_template_attr *template_attr, +const struct rte_flow_action actions[],const struct rte_flow_action masks[], +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"flow_filter module uninitialized" ); +return NULL ; + } + +struct pmd_internals *internals = dev->data->dev_private; + +struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info; +static struct rte_flow_error rte_flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; + +struct cnv_action_s action = {0 }; +struct cnv_action_s mask = {0 }; +struct rte_flow_actions_template_attr attr = { + .ingress = template_attr->ingress, + .egress = template_attr->egress, + .transfer = template_attr->transfer, + }; +uint16_t caller_id =get_caller_id (dev->data->port_id); + +if (fpga_info->profile ==FPGA_INFO_PROFILE_INLINE ) { +uint32_t queue_offset =0 ; + +if (internals->type ==PORT_TYPE_OVERRIDE && internals->vpq_nb_vq >0 ) + queue_offset = internals->vpq[0 ].id; + +if (create_action_elements_inline (&action, actions,MAX_ACTIONS , queue_offset) != +0 ) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL , +"Error in actions" ); +return NULL ; + } + +if (create_action_elements_inline (&mask, masks,MAX_ACTIONS , queue_offset) !=0 ) { +rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL , +"Error in masks" ); +return NULL ; + } + + }else { +rte_flow_error_set (error,EPERM ,RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"Unsupported adapter profile" ); +return NULL ; + } + +struct flow_actions_template *res = + flow_filter_ops->flow_actions_template_create (internals->flw_dev, &attr, caller_id, + action.flow_actions, + mask.flow_actions, &rte_flow_error); + +convert_error (error, &rte_flow_error); +return (struct rte_flow_actions_template *)res; +} + +static int eth_flow_actions_template_destroy (struct rte_eth_dev *dev, +struct rte_flow_actions_template *actions_template, +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,NTNIC ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = dev->data->dev_private; + +static struct rte_flow_error rte_flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; + +int res = flow_filter_ops->flow_actions_template_destroy (internals->flw_dev, + (struct flow_actions_template *) + actions_template, + &rte_flow_error); + +convert_error (error, &rte_flow_error); +return res; +} + +static struct rte_flow_template_table *eth_flow_template_table_create (struct rte_eth_dev *dev, +const struct rte_flow_template_table_attr *table_attr, +struct rte_flow_pattern_template *pattern_templates[],uint8_t nb_pattern_templates, +struct rte_flow_actions_template *actions_templates[],uint8_t nb_actions_templates, +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"flow_filter module uninitialized" ); +return NULL ; + } + +struct pmd_internals *internals = dev->data->dev_private; + +static struct rte_flow_error rte_flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; + +struct rte_flow_template_table_attr attr = { + .flow_attr = { + .group = table_attr->flow_attr.group, + .priority = table_attr->flow_attr.priority, + .ingress = table_attr->flow_attr.ingress, + .egress = table_attr->flow_attr.egress, + .transfer = table_attr->flow_attr.transfer, + }, + .nb_flows = table_attr->nb_flows, + }; +uint16_t forced_vlan_vid =0 ; +uint16_t caller_id =get_caller_id (dev->data->port_id); + +struct flow_template_table *res = + flow_filter_ops->flow_template_table_create (internals->flw_dev, &attr, + forced_vlan_vid, caller_id, + (struct flow_pattern_template **)pattern_templates, + nb_pattern_templates, (struct flow_actions_template **)actions_templates, + nb_actions_templates, &rte_flow_error); + +convert_error (error, &rte_flow_error); +return (struct rte_flow_template_table *)res; +} + +static int eth_flow_template_table_destroy (struct rte_eth_dev *dev, +struct rte_flow_template_table *template_table, +struct rte_flow_error *error) +{ +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = dev->data->dev_private; + +static struct rte_flow_error rte_flow_error = { .type =RTE_FLOW_ERROR_TYPE_NONE , + .message ="none" }; + +int res = flow_filter_ops->flow_template_table_destroy (internals->flw_dev, + (struct flow_template_table *) + template_table, + &rte_flow_error); + +convert_error (error, &rte_flow_error); +return res; +} + static struct rte_flow *eth_flow_async_create(struct rte_eth_dev *dev, uint32_t queue_id, const struct rte_flow_op_attr *op_attr, struct rte_flow_template_table *template_table, const struct rte_flow_item pattern[],
@@ -1106,6 +1324,12 @@ static const struct rte_flow_ops dev_flow_ops = { .get_aged_flows = eth_flow_get_aged_flows, .info_get = eth_flow_info_get, .configure = eth_flow_configure, + .pattern_template_create = eth_flow_pattern_template_create, + .pattern_template_destroy = eth_flow_pattern_template_destroy, + .actions_template_create = eth_flow_actions_template_create, + .actions_template_destroy = eth_flow_actions_template_destroy, + .template_table_create = eth_flow_template_table_create, + .template_table_destroy = eth_flow_template_table_destroy, };void dev_flow_init (void )
drivers/net/ntnic/ntnic_mod_reg.h +28 -0
@@ -430,6 +430,34 @@ struct flow_filter_ops {/* * RTE flow asynchronous operations functions */ +struct flow_pattern_template *(*flow_pattern_template_create)(struct flow_eth_dev *dev, +const struct rte_flow_pattern_template_attr *template_attr,uint16_t caller_id, +const struct rte_flow_item pattern[],struct rte_flow_error *error); + +int (*flow_pattern_template_destroy)(struct flow_eth_dev *dev, +struct flow_pattern_template *pattern_template, +struct rte_flow_error *error); + +struct flow_actions_template *(*flow_actions_template_create)(struct flow_eth_dev *dev, +const struct rte_flow_actions_template_attr *template_attr,uint16_t caller_id, +const struct rte_flow_action actions[],const struct rte_flow_action masks[], +struct rte_flow_error *error); + +int (*flow_actions_template_destroy)(struct flow_eth_dev *dev, +struct flow_actions_template *actions_template, +struct rte_flow_error *error); + +struct flow_template_table *(*flow_template_table_create)(struct flow_eth_dev *dev, +const struct rte_flow_template_table_attr *table_attr,uint16_t forced_vlan_vid, +uint16_t caller_id, +struct flow_pattern_template *pattern_templates[],uint8_t nb_pattern_templates, +struct flow_actions_template *actions_templates[],uint8_t nb_actions_templates, +struct rte_flow_error *error); + +int (*flow_template_table_destroy)(struct flow_eth_dev *dev, +struct flow_template_table *template_table, +struct rte_flow_error *error); + struct flow_handle *(*flow_async_create)(struct flow_eth_dev *dev, uint32_t queue_id, const struct rte_flow_op_attr *op_attr, struct flow_template_table *template_table, const struct rte_flow_item pattern[],
Signature · 1 line
2.45.0
PATCH v4 82/86 net/ntnic: add async flow create/delete API implementation
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
Inline profile was extended with async flow create and delete features implementation.
async & destroy API was added to the flow filter ops.
--- drivers/net/ntnic/include/flow_api_engine.h | 36 +++ drivers/net/ntnic/nthw/flow_api/flow_api.c | 39 +++ .../profile_inline/flow_api_hw_db_inline.c | 13 + .../profile_inline/flow_api_hw_db_inline.h | 2 + .../profile_inline/flow_api_profile_inline.c | 248 +++++++++++++++++- .../profile_inline/flow_api_profile_inline.h | 14 + drivers/net/ntnic/ntnic_mod_reg.h | 15 ++ 7 files changed, 366 insertions(+), 1 deletion(-)
drivers/net/ntnic/include/flow_api_engine.h +36 -0
@@ -339,6 +339,12 @@ struct flow_handle {uint8_t flm_rqi;uint8_t flm_qfi;uint8_t flm_scrub_prof; + +/* Flow specific pointer to application template table cell stored during +* flow create. +*/ +struct flow_template_table_cell *template_table_cell; +bool flm_async; }; }; };
@@ -347,8 +353,38 @@ struct flow_pattern_template { };struct flow_actions_template { +struct nic_flow_def *fd; + +uint32_t num_dest_port; +uint32_t num_queues; }; + +struct flow_template_table_cell { +atomic_int status; +atomic_int counter; + +uint32_t flm_db_idx_counter; +uint32_t flm_db_idxs[RES_COUNT ]; + +uint32_t flm_key_id; +uint32_t flm_ft; + +uint16_t flm_rpl_ext_ptr; +uint8_t flm_scrub_prof; +}; +struct flow_template_table { +struct flow_pattern_template **pattern_templates; +uint8_t nb_pattern_templates; + +struct flow_actions_template **actions_templates; +uint8_t nb_actions_templates; + +struct flow_template_table_cell *pattern_action_pairs; + +struct rte_flow_attr attr; +uint16_t forced_vlan_vid; +uint16_t caller_id; };void km_attach_ndev_resource_management (struct km_flow_def_s *km,void **handle);
drivers/net/ntnic/nthw/flow_api/flow_api.c +39 -0
@@ -1115,6 +1115,43 @@ static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id, nb_queue, queue_attr, error); } +/* +* Flow Asynchronous operation API +*/ + +static struct flow_handle * +flow_async_create (struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr,struct flow_template_table *template_table, +const struct rte_flow_item pattern[],uint8_t pattern_template_index, +const struct rte_flow_action actions[],uint8_t actions_template_index,void *user_data, +struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline module uninitialized" ); +return NULL ; + } + +return profile_inline_ops->flow_async_create_profile_inline (dev, queue_id, op_attr, + template_table, pattern, pattern_template_index, actions, + actions_template_index, user_data, error); +} + +static int flow_async_destroy (struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr,struct flow_handle *flow, +void *user_data,struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops (); + +if (profile_inline_ops ==NULL ) { +NT_LOG_DBGX (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return profile_inline_ops->flow_async_destroy_profile_inline (dev, queue_id, op_attr, flow, + user_data, error); +}int flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size) {const struct profile_inline_ops *profile_inline_ops =get_profile_inline_ops ();
@@ -1151,6 +1188,8 @@ static const struct flow_filter_ops ops = {*/ .flow_info_get = flow_info_get, .flow_configure = flow_configure, + .flow_async_create = flow_async_create, + .flow_async_destroy = flow_async_destroy,/* * Other
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +13 -0
@@ -393,6 +393,19 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct } } +struct hw_db_idx *hw_db_inline_find_idx (struct flow_nic_dev *ndev,void *db_handle, +enum hw_db_idx_type type,struct hw_db_idx *idxs,uint32_t size) +{ + (void )ndev; + (void )db_handle; +for (uint32_t i =0 ; i < size; ++i) { +if (idxs[i].type == type) +return &idxs[i]; + } + +return NULL ; +} +void hw_db_inline_dump (struct flow_nic_dev *ndev,void *db_handle,const struct hw_db_idx *idxs,uint32_t size,FILE *file) {
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +2 -0
@@ -287,6 +287,8 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct uint32_t size);const void *hw_db_inline_find_data (struct flow_nic_dev *ndev,void *db_handle,enum hw_db_idx_type type,struct hw_db_idx *idxs,uint32_t size); +struct hw_db_idx *hw_db_inline_find_idx (struct flow_nic_dev *ndev,void *db_handle, +enum hw_db_idx_type type,struct hw_db_idx *idxs,uint32_t size);void hw_db_inline_dump (struct flow_nic_dev *ndev,void *db_handle,const struct hw_db_idx *idxs,uint32_t size,FILE *file);void hw_db_inline_dump_cfn (struct flow_nic_dev *ndev,void *db_handle,FILE *file);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +247 -1
284 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +14 -0
@@ -69,6 +69,20 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,int flow_get_flm_stats_profile_inline (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size); +/* +* RTE flow asynchronous operations functions +*/ + +struct flow_handle *flow_async_create_profile_inline (struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr, +struct flow_template_table *template_table,const struct rte_flow_item pattern[], +uint8_t pattern_template_index,const struct rte_flow_action actions[], +uint8_t actions_template_index,void *user_data,struct rte_flow_error *error); + +int flow_async_destroy_profile_inline (struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr,struct flow_handle *flow, +void *user_data,struct rte_flow_error *error); +int flow_info_get_profile_inline (struct flow_eth_dev *dev,uint8_t caller_id,struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info,struct rte_flow_error *error);
drivers/net/ntnic/ntnic_mod_reg.h +15 -0
@@ -310,6 +310,21 @@ struct profile_inline_ops {uint32_t nb_contexts, struct rte_flow_error *error); +/* +* RTE flow asynchronous operations functions +*/ + +struct flow_handle *(*flow_async_create_profile_inline)(struct flow_eth_dev *dev, +uint32_t queue_id,const struct rte_flow_op_attr *op_attr, +struct flow_template_table *template_table,const struct rte_flow_item pattern[], +uint8_t rte_pattern_template_index,const struct rte_flow_action actions[], +uint8_t rte_actions_template_index,void *user_data,struct rte_flow_error *error); + +int (*flow_async_destroy_profile_inline)(struct flow_eth_dev *dev,uint32_t queue_id, +const struct rte_flow_op_attr *op_attr, +struct flow_handle *flow,void *user_data, +struct rte_flow_error *error); +int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,int hsh_idx,struct nt_eth_rss_conf rss_conf);
Signature · 1 line
2.45.0
PATCH v4 83/86 net/ntnic: add async template APIs implementation
In reply to Serhii IliushykFrom: Danylo Vodopianov <[email protected]>
flow filter ops and inline API was exnteded with next APIs:
1. flow pattern template create
2. flow pattern template destroy
3. flow actions template create
4. flow actions template destroy
5. flow template table create
6. flow template table destroy
--- drivers/net/ntnic/include/flow_api_engine.h | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 104 ++++++++ .../profile_inline/flow_api_profile_inline.c | 225 ++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 28 +++ drivers/net/ntnic/ntnic_mod_reg.h | 30 +++ 5 files changed, 388 insertions(+)
drivers/net/ntnic/include/flow_api_engine.h +1 -0
@@ -350,6 +350,7 @@ struct flow_handle { };struct flow_pattern_template { +struct nic_flow_def *fd; };struct flow_actions_template {
drivers/net/ntnic/nthw/flow_api/flow_api.c +104 -0
116 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +225 -0
237 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +28 -0
@@ -73,6 +73,34 @@ int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data,* RTE flow asynchronous operations functions */ +struct flow_pattern_template *flow_pattern_template_create_profile_inline (struct flow_eth_dev *dev, +const struct rte_flow_pattern_template_attr *template_attr,uint16_t caller_id, +const struct rte_flow_item pattern[],struct rte_flow_error *error); + +int flow_pattern_template_destroy_profile_inline (struct flow_eth_dev *dev, +struct flow_pattern_template *pattern_template, +struct rte_flow_error *error); + +struct flow_actions_template *flow_actions_template_create_profile_inline (struct flow_eth_dev *dev, +const struct rte_flow_actions_template_attr *template_attr,uint16_t caller_id, +const struct rte_flow_action actions[],const struct rte_flow_action masks[], +struct rte_flow_error *error); + +int flow_actions_template_destroy_profile_inline (struct flow_eth_dev *dev, +struct flow_actions_template *actions_template, +struct rte_flow_error *error); + +struct flow_template_table *flow_template_table_create_profile_inline (struct flow_eth_dev *dev, +const struct rte_flow_template_table_attr *table_attr,uint16_t forced_vlan_vid, +uint16_t caller_id, +struct flow_pattern_template *pattern_templates[],uint8_t nb_pattern_templates, +struct flow_actions_template *actions_templates[],uint8_t nb_actions_templates, +struct rte_flow_error *error); + +int flow_template_table_destroy_profile_inline (struct flow_eth_dev *dev, +struct flow_template_table *template_table, +struct rte_flow_error *error); + struct flow_handle *flow_async_create_profile_inline(struct flow_eth_dev *dev, uint32_t queue_id, const struct rte_flow_op_attr *op_attr, struct flow_template_table *template_table, const struct rte_flow_item pattern[],
drivers/net/ntnic/ntnic_mod_reg.h +30 -0
@@ -314,6 +314,36 @@ struct profile_inline_ops {* RTE flow asynchronous operations functions */ +struct flow_pattern_template *(*flow_pattern_template_create_profile_inline) + (struct flow_eth_dev *dev, +const struct rte_flow_pattern_template_attr *template_attr,uint16_t caller_id, +const struct rte_flow_item pattern[],struct rte_flow_error *error); + +int (*flow_pattern_template_destroy_profile_inline)(struct flow_eth_dev *dev, +struct flow_pattern_template *pattern_template, +struct rte_flow_error *error); + +struct flow_actions_template *(*flow_actions_template_create_profile_inline) + (struct flow_eth_dev *dev, +const struct rte_flow_actions_template_attr *template_attr, +uint16_t caller_id,const struct rte_flow_action actions[], +const struct rte_flow_action masks[],struct rte_flow_error *error); + +int (*flow_actions_template_destroy_profile_inline)(struct flow_eth_dev *dev, +struct flow_actions_template *actions_template, +struct rte_flow_error *error); + +struct flow_template_table *(*flow_template_table_create_profile_inline) + (struct flow_eth_dev *dev,const struct rte_flow_template_table_attr *table_attr, +uint16_t forced_vlan_vid,uint16_t caller_id, +struct flow_pattern_template *pattern_templates[],uint8_t nb_pattern_templates, +struct flow_actions_template *actions_templates[],uint8_t nb_actions_templates, +struct rte_flow_error *error); + +int (*flow_template_table_destroy_profile_inline)(struct flow_eth_dev *dev, +struct flow_template_table *template_table, +struct rte_flow_error *error); + struct flow_handle *(*flow_async_create_profile_inline)(struct flow_eth_dev *dev, uint32_t queue_id, const struct rte_flow_op_attr *op_attr, struct flow_template_table *template_table, const struct rte_flow_item pattern[],
Signature · 1 line
2.45.0
PATCH v4 84/86 net/ntnic: update async flow API documentation
In reply to Serhii IliushykUpdate ntnic.ini and release notes
--- doc/guides/nics/ntnic.rst | 1 + doc/guides/rel_notes/release_24_11.rst | 1 + 2 files changed, 2 insertions(+)
doc/guides/nics/ntnic.rst +1 -0
@@ -72,6 +72,7 @@ Features - Extended stats - Flow metering, including meter policy API. - Flow update. Update of the action list for specific flow +- Asynchronous flow API Limitations ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
@@ -165,6 +165,7 @@ New Features * Added age rte flow action support * Added meter flow metering and flow policy support * Added flow actions update support + * Added asynchronous flow API support * **Added cryptodev queue pair reset support.**
Signature · 1 line
2.45.0
PATCH v4 85/86 net/ntnic: add MTU configuration
In reply to Serhii IliushykFrom: Oleksandr Kolomeiets <[email protected]>
Add supporting API rte_eth_dev_set_mtu
--- drivers/net/ntnic/include/flow_api_engine.h | 7 ++ drivers/net/ntnic/include/hw_mod_backend.h | 4 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c | 96 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.c | 82 +++++++++++++++- .../profile_inline/flow_api_profile_inline.h | 9 ++ .../flow_api_profile_inline_config.h | 50 ++++++++++ drivers/net/ntnic/ntnic_ethdev.c | 41 ++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 5 + 8 files changed, 292 insertions(+), 2 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +7 -0
@@ -280,6 +280,11 @@ struct nic_flow_def {* AGE action timeout */ struct age_def_s age; + +/* +* TX fragmentation IFR/RPP_LR MTU recipe +*/ +uint8_t flm_mtu_fragmentation_recipe; };enum flow_handle_type {
@@ -340,6 +345,8 @@ struct flow_handle {uint8_t flm_qfi;uint8_t flm_scrub_prof; +uint8_t flm_mtu_fragmentation_recipe; +/* Flow specific pointer to application template table cell stored during * flow create. */
drivers/net/ntnic/include/hw_mod_backend.h +4 -0
@@ -958,8 +958,12 @@ int hw_mod_tpe_rpp_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, i uint32_t value);int hw_mod_tpe_rpp_ifr_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_rpp_ifr_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_ifr_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); +int hw_mod_tpe_ifr_rcp_set (struct flow_api_backend_s *be,enum hw_tpe_e field,int index, +uint32_t value);int hw_mod_tpe_ins_rcp_flush (struct flow_api_backend_s *be,int start_idx,int count); int hw_mod_tpe_ins_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c +96 -0
108 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +80 -2
130 lines not on this page · raw message
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +9 -0
@@ -11,6 +11,10 @@#include "flow_api.h" #include "stream_binary_flow_api.h" +#define DISABLE_FRAGMENTATION 0 +#define IPV4_DF_DROP 1 +#define IPV6_DROP 1 +/* * Management */
@@ -120,4 +124,9 @@ int flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id,const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error); +/* +* Config API +*/ +int flow_set_mtu_inline (struct flow_eth_dev *dev,uint32_t port,uint16_t mtu); +#endif /* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h +50 -0
56 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +41 -0
83 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +5 -0
@@ -408,6 +408,11 @@ struct profile_inline_ops { const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error); + +/* +* Config API +*/ +int (*flow_set_mtu_inline)(struct flow_eth_dev *dev,uint32_t port,uint16_t mtu); };void register_profile_inline_ops (const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
PATCH v4 86/86 net/ntnic: update documentation for set MTU
In reply to Serhii IliushykUpdate ntnic.rst and release notes
--- doc/guides/nics/ntnic.rst | 1 + doc/guides/rel_notes/release_24_11.rst | 1 + 2 files changed, 2 insertions(+)
doc/guides/nics/ntnic.rst +1 -0
@@ -73,6 +73,7 @@ Features - Flow metering, including meter policy API. - Flow update. Update of the action list for specific flow - Asynchronous flow API +- MTU update Limitations ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
@@ -166,6 +166,7 @@ New Features * Added meter flow metering and flow policy support * Added flow actions update support * Added asynchronous flow API support + * Added MTU update * **Added cryptodev queue pair reset support.**
Signature · 1 line
2.45.0
Quoted 127 lines · Serhii Iliushyk
The list of updates provided by the patchset:
- FW version
- Speed capabilities
- Link status (Link update only)
- Unicast MAC filter
- Multicast MAC filter
- Promiscuous mode (Enable only. The device always run promiscuous mode)
- Multiple TX and RX queues.
- Scattered and gather for TX and RX.
- RSS hash
- RSS key update
- RSS based on VLAN or 5-tuple.
- RSS using different combinations of fields: L3 only, L4 only or both, and source only, destination only or both.
- Several RSS hash keys, one for each flow type.
- Default RSS operation with no hash key specification.
- VLAN filtering.
- RX VLAN stripping via raw decap.
- TX VLAN insertion via raw encap.
- Flow API.
- Multiple process.
- Tunnel types: GTP.
- Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum verification.
- Support for multiplerte_flowgroups.
- Encapsulation and decapsulation of GTP data.
- Packet modification: NAT, TTL decrement, DSCP tagging
- Traffic mirroring.
- Jumbo frame support.
- Port and queue statistics.
- RMON statistics in extended stats.
- Flow metering, including meter policy API.
- Link state information.
- CAM and TCAM based matching.
- Exact match of 140 million flows and policies.
- Basic stats
- Extended stats
- Flow metering, including meter policy API.
- Flow update. Update of the action list for specific flow
- Asynchronous flow API
- MTU updateUpdate: the pthread API was replaced with RTE spinlock in the separate patch.
Danylo Vodopianov (43):
net/ntnic: add API for configuration NT flow dev net/ntnic: add item UDP
net/ntnic: add action TCP
net/ntnic: add action VLAN
net/ntnic: add item SCTP
net/ntnic: add items IPv6 and ICMPv6
net/ntnic: add action modify filed
net/ntnic: add items gtp and actions raw encap/decap net/ntnic: add cat module
net/ntnic: add SLC LR module
net/ntnic: add PDB module
net/ntnic: add QSL module
net/ntnic: add KM module
net/ntnic: add hash API
net/ntnic: add TPE module
net/ntnic: add FLM module
net/ntnic: add flm rcp module
net/ntnic: add learn flow queue handling net/ntnic: match and action db attributes were added net/ntnic: add statistics API
net/ntnic: add rpf module
net/ntnic: add statistics poll
net/ntnic: added flm stat interface
net/ntnic: add tsm module
net/ntnic: add xstats
net/ntnic: added flow statistics
net/ntnic: add scrub registers
net/ntnic: add flow aging API
net/ntnic: add aging API to the inline profile net/ntnic: add flow info and flow configure APIs net/ntnic: add flow aging event
net/ntnic: add termination thread
net/ntnic: add aging documentation
net/ntnic: add meter API
net/ntnic: add meter module
net/ntnic: update meter documentation
net/ntnic: add action update
net/ntnic: add flow action update
net/ntnic: flow update was added
net/ntnic: add async create/destroy API declaration net/ntnic: add async template API declaration net/ntnic: add async flow create/delete API implementation net/ntnic: add async template APIs implementationOleksandr Kolomeiets (18):
net/ntnic: add flow dump feature
net/ntnic: add flow flush
net/ntnic: sort FPGA registers alphanumerically
net/ntnic: add CSU module registers
net/ntnic: add FLM module registers
net/ntnic: add HFU module registers
net/ntnic: add IFR module registers
net/ntnic: add MAC Rx module registers
net/ntnic: add MAC Tx module registers
net/ntnic: add RPP LR module registers
net/ntnic: add SLC LR module registers
net/ntnic: add Tx CPY module registers
net/ntnic: add Tx INS module registers
net/ntnic: add Tx RPL module registers
net/ntnic: add STA module
net/ntnic: add TSM module
net/ntnic: update documentation
net/ntnic: add MTU configurationSerhii Iliushyk (25):
net/ntnic: add flow filter API
net/ntnic: add minimal create/destroy flow operations net/ntnic: add internal flow create/destroy API net/ntnic: add minimal NT flow inline profile net/ntnic: add management API for NT flow profile net/ntnic: add NT flow profile management implementation net/ntnic: add create/destroy implementation for NT flows net/ntnic: add infrastructure for for flow actions and items net/ntnic: add action queue
net/ntnic: add action mark
net/ntnic: add ation jump
net/ntnic: add action drop
net/ntnic: add item eth
net/ntnic: add item IPv4
net/ntnic: add item ICMP
net/ntnic: add item port ID
net/ntnic: add item void
Quoted 9 lines
net/ntnic: add GMF (Generic MAC Feeder) module net/ntnic: update alignment for virt queue structs net/ntnic: enable RSS feature
net/ntnic: update documentation for flow actions update net/ntnic: migrate to the RTE spinlock net/ntnic: remove unnecessary type cast net/ntnic: update async flow API documentation net/ntnic: update documentation for set MTU
Hi Serhii,
After each patch, driver should build fine, this is required for git bisect testing, but in this patch series build fails after some patches, can you please check?
Also a minor comment, in some patch titles 'API' is used, in DPDK scope API is functions exposed from library to application use, so almost all use of API is wrong, can you please update them?
Like "net/ntnic: add flow filter API" can become "net/ntnic: support flow filter"
v5 cover Provide flow filter and statistics support
In reply to Serhii IliushykThe list of updates provided by the patchset:
- FW version
- Speed capabilities
- Link status (Link update only)
- Unicast MAC filter
- Multicast MAC filter
- Promiscuous mode (Enable only. The device always run promiscuous mode)
- Flow API support.
- Support for multiple rte_flow groups.
- Multiple TX and RX queues.
- Scattered and gather for TX and RX.
- Jumbo frame support.
- Traffic mirroring.
- VLAN filtering.
- Packet modification: NAT, TTL decrement, DSCP tagging
- Tunnel types: GTP.
- Encapsulation and decapsulation of GTP data.
- RX VLAN stripping via raw decap.
- TX VLAN insertion via raw encap.
- CAM and TCAM based matching.
- Exact match of 140 million flows and policies.
- Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum verification.
- RSS hash
- RSS key update
- RSS based on VLAN or 5-tuple.
- RSS using different combinations of fields: L3 only, L4 only or both, and source only, destination only or both.
- Several RSS hash keys, one for each flow type.
- Default RSS operation with no hash key specification.
- Port and queue statistics.
- RMON statistics in extended stats.
- Link state information.
- Flow statistics
- Flow aging support
- Flow metering, including meter policy API.
- Flow update. Update of the action list for specific flow
- Asynchronous flow support
- MTU update
Update: the pthread API was replaced with RTE spinlock in the separate patch.
Danylo Vodopianov (41):
net/ntnic: add NT flow dev configuration net/ntnic: add item UDP
net/ntnic: add action TCP
net/ntnic: add action VLAN
net/ntnic: add item SCTP
net/ntnic: add items IPv6 and ICMPv6 net/ntnic: add action modify filed
net/ntnic: add items gtp and actions raw encap/decap net/ntnic: add cat module
net/ntnic: add SLC LR module
net/ntnic: add PDB module
net/ntnic: add QSL module
net/ntnic: add KM module
net/ntnic: add hash API
net/ntnic: add TPE module
net/ntnic: add FLM module
net/ntnic: add FLM RCP module
net/ntnic: add learn flow queue handling net/ntnic: match and action db attributes were added net/ntnic: add statistics support
net/ntnic: add rpf module
net/ntnic: add statistics poll
net/ntnic: added flm stat interface net/ntnic: add TSM module
net/ntnic: add xStats
net/ntnic: added flow statistics
net/ntnic: add scrub registers
net/ntnic: add high-level flow aging support net/ntnic: add aging to the inline profile net/ntnic: add flow info and flow configure support net/ntnic: add flow aging event
net/ntnic: add termination thread
net/ntnic: add meter support
net/ntnic: add meter module
net/ntnic: add action update support net/ntnic: add flow action update
net/ntnic: add flow actions update
net/ntnic: add async create/destroy declaration net/ntnic: add async template declaration net/ntnic: add async flow create/delete implementation net/ntnic: add async template implementation
Oleksandr Kolomeiets (17):
net/ntnic: add flow dump feature
net/ntnic: add flow flush
net/ntnic: sort FPGA registers alphanumerically
net/ntnic: add CSU module registers
net/ntnic: add FLM module registers
net/ntnic: add HFU module registers
net/ntnic: add IFR module registers
net/ntnic: add MAC Rx module registers
net/ntnic: add MAC Tx module registers
net/ntnic: add RPP LR module registers
net/ntnic: add SLC LR module registers
net/ntnic: add Tx CPY module registers
net/ntnic: add Tx INS module registers
net/ntnic: add Tx RPL module registers
net/ntnic: add STA module
net/ntnic: add TSM module
net/ntnic: add MTU configuration
Serhii Iliushyk (22):
net/ntnic: add flow filter support
net/ntnic: add minimal create/destroy flow operations net/ntnic: add internal functions for create/destroy net/ntnic: add minimal NT flow inline profile net/ntnic: add management functions for NT flow profile net/ntnic: add NT flow profile management implementation net/ntnic: add create/destroy implementation for NT flows net/ntnic: add infrastructure for for flow actions and items net/ntnic: add action queue
net/ntnic: add action mark
net/ntnic: add ation jump
net/ntnic: add action drop
net/ntnic: add item eth
net/ntnic: add item IPv4
net/ntnic: add item ICMP
net/ntnic: add item port ID
net/ntnic: add item void
net/ntnic: add GMF (Generic MAC Feeder) module net/ntnic: update alignment for virt queue structs net/ntnic: enable RSS feature
net/ntnic: migrate to the RTE spinlock
net/ntnic: remove unnecessary
doc/guides/nics/features/default.ini | 2 +- doc/guides/nics/features/ntnic.ini | 34 + doc/guides/nics/ntnic.rst | 50 + doc/guides/rel_notes/release_24_11.rst | 8 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 29 +- .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 598 ++ drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 7 +- .../net/ntnic/include/common_adapter_defs.h | 15 + drivers/net/ntnic/include/create_elements.h | 73 + drivers/net/ntnic/include/flow_api.h | 142 +- drivers/net/ntnic/include/flow_api_engine.h | 380 + drivers/net/ntnic/include/flow_filter.h | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 256 + drivers/net/ntnic/include/nt4ga_adapter.h | 2 + drivers/net/ntnic/include/ntdrv_4ga.h | 5 + drivers/net/ntnic/include/ntnic_stat.h | 265 + drivers/net/ntnic/include/ntos_drv.h | 24 + .../ntnic/include/stream_binary_flow_api.h | 67 + .../link_mgmt/link_100g/nt4ga_link_100g.c | 8 + drivers/net/ntnic/meson.build | 20 + .../net/ntnic/nthw/core/include/nthw_core.h | 1 + .../net/ntnic/nthw/core/include/nthw_gmf.h | 64 + .../net/ntnic/nthw/core/include/nthw_i2cm.h | 4 +- .../net/ntnic/nthw/core/include/nthw_rmc.h | 6 + .../net/ntnic/nthw/core/include/nthw_rpf.h | 49 + .../net/ntnic/nthw/core/include/nthw_tsm.h | 56 + drivers/net/ntnic/nthw/core/nthw_fpga.c | 47 + drivers/net/ntnic/nthw/core/nthw_gmf.c | 133 + drivers/net/ntnic/nthw/core/nthw_rmc.c | 30 + drivers/net/ntnic/nthw/core/nthw_rpf.c | 120 + drivers/net/ntnic/nthw/core/nthw_tsm.c | 167 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 923 ++- drivers/net/ntnic/nthw/flow_api/flow_group.c | 99 + drivers/net/ntnic/nthw/flow_api/flow_hasher.c | 156 + drivers/net/ntnic/nthw/flow_api/flow_hasher.h | 21 + .../net/ntnic/nthw/flow_api/flow_id_table.c | 145 + .../net/ntnic/nthw/flow_api/flow_id_table.h | 26 + drivers/net/ntnic/nthw/flow_api/flow_km.c | 1171 ++++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c | 457 ++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c | 723 ++ .../ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c | 179 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_km.c | 380 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c | 144 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c | 218 + .../nthw/flow_api/hw_mod/hw_mod_slc_lr.c | 100 + .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c | 853 +++ .../flow_api/profile_inline/flm_age_queue.c | 164 + .../flow_api/profile_inline/flm_age_queue.h | 42 + .../flow_api/profile_inline/flm_evt_queue.c | 293 + .../flow_api/profile_inline/flm_evt_queue.h | 55 + .../flow_api/profile_inline/flm_lrn_queue.c | 70 + .../flow_api/profile_inline/flm_lrn_queue.h | 25 + .../profile_inline/flow_api_hw_db_inline.c | 3000 ++++++++ .../profile_inline/flow_api_hw_db_inline.h | 394 ++ .../profile_inline/flow_api_profile_inline.c | 6082 +++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 132 + .../flow_api_profile_inline_config.h | 127 + .../ntnic/nthw/flow_filter/flow_nthw_flm.c | 47 +- .../net/ntnic/nthw/model/nthw_fpga_model.c | 12 + .../net/ntnic/nthw/model/nthw_fpga_model.h | 1 + drivers/net/ntnic/nthw/nthw_rac.c | 38 +- drivers/net/ntnic/nthw/nthw_rac.h | 2 +- .../net/ntnic/nthw/ntnic_meter/ntnic_meter.c | 483 ++ drivers/net/ntnic/nthw/rte_pmd_ntnic.h | 43 + drivers/net/ntnic/nthw/stat/nthw_stat.c | 498 ++ .../supported/nthw_fpga_9563_055_049_0000.c | 3317 ++++++--- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 11 +- .../nthw/supported/nthw_fpga_mod_str_map.c | 2 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 5 + .../supported/nthw_fpga_reg_defs_mac_rx.h | 29 + .../supported/nthw_fpga_reg_defs_mac_tx.h | 21 + .../nthw/supported/nthw_fpga_reg_defs_rpf.h | 19 + .../nthw/supported/nthw_fpga_reg_defs_sta.h | 48 + .../nthw/supported/nthw_fpga_reg_defs_tsm.h | 205 + drivers/net/ntnic/ntnic_ethdev.c | 813 ++- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 1348 ++++ drivers/net/ntnic/ntnic_mod_reg.c | 111 + drivers/net/ntnic/ntnic_mod_reg.h | 331 + drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c | 829 +++ drivers/net/ntnic/ntutil/nt_util.h | 12 + 80 files changed, 25744 insertions(+), 1123 deletions(-) create mode 100644 drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c create mode 100644 drivers/net/ntnic/include/common_adapter_defs.h create mode 100644 drivers/net/ntnic/include/create_elements.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_rpf.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_tsm.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c create mode 100644 drivers/net/ntnic/nthw/core/nthw_rpf.c create mode 100644 drivers/net/ntnic/nthw/core/nthw_tsm.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_group.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.h create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_id_table.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_id_table.h create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h create mode 100644 drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c create mode 100644 drivers/net/ntnic/nthw/rte_pmd_ntnic.h create mode 100644 drivers/net/ntnic/nthw/stat/nthw_stat.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h create mode 100644 drivers/net/ntnic/ntnic_filter/ntnic_filter.c create mode 100644 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
Signature · 1 line
2.45.0
PATCH v5 1/80 net/ntnic: add NT flow dev configuration
From: Danylo Vodopianov <[email protected]>
This API allows enabling of flow profile for NT SmartNIC.
---
v5
* remove unnecessary SCATTER_GATHER condition
--- drivers/net/ntnic/include/flow_api.h | 30 +++ drivers/net/ntnic/include/flow_api_engine.h | 5 + drivers/net/ntnic/include/ntos_drv.h | 1 + .../ntnic/include/stream_binary_flow_api.h | 9 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 209 +++++++++++++++++- drivers/net/ntnic/ntnic_ethdev.c | 22 ++ drivers/net/ntnic/ntnic_mod_reg.c | 5 + drivers/net/ntnic/ntnic_mod_reg.h | 14 ++ 8 files changed, 285 insertions(+), 10 deletions(-)
drivers/net/ntnic/include/flow_api.h +30 -0
@@ -34,6 +34,8 @@ struct flow_eth_dev {struct flow_nic_dev *ndev;/* NIC port id */ uint8_t port; +/* App assigned port_id - may be DPDK port_id */ +uint32_t port_id;/* 0th for exception */ struct flow_queue_id_s rx_queue[FLOW_MAX_QUEUES +1 ];
@@ -41,6 +43,9 @@ struct flow_eth_dev {/* VSWITCH has exceptions sent on queue 0 per design */ int num_queues; +/* QSL_HSH index if RSS needed QSL v6+ */ +int rss_target_id; +struct flow_eth_dev *next; };
@@ -48,6 +53,8 @@ struct flow_eth_dev {struct flow_nic_dev {uint8_t adapter_no;/* physical adapter no in the host system */ uint16_t ports;/* number of in-ports addressable on this NIC */ +/* flow profile this NIC is initially prepared for */ +enum flow_eth_dev_profile flow_profile;struct hw_mod_resource_s res[RES_COUNT ];/* raw NIC resource allocation table */ void *km_res_handle;
@@ -73,6 +80,14 @@ struct flow_nic_dev {extern const char *dbg_res_descr[]; +#define flow_nic_set_bit (arr, x) \ + do { \ + uint8_t *_temp_arr = (arr); \ + size_t _temp_x = (x); \ + _temp_arr[_temp_x / 8] = \ + (uint8_t)(_temp_arr[_temp_x / 8] | (uint8_t)(1 << (_temp_x % 8))); \ + } while (0) +#define flow_nic_unset_bit (arr, x) \ do { \ size_t _temp_x = (x); \
@@ -85,6 +100,18 @@ extern const char *dbg_res_descr[]; (arr[_temp_x /8 ] & (uint8_t )(1 << (_temp_x %8 ))); \ }) +#define flow_nic_mark_resource_used (_ndev, res_type, index) \ + do { \ + struct flow_nic_dev *_temp_ndev = (_ndev); \ + typeof(res_type) _temp_res_type = (res_type); \ + size_t _temp_index = (index); \ + NT_LOG(DBG, FILTER, "mark resource used: %s idx %zu", \ + dbg_res_descr[_temp_res_type], _temp_index); \ + assert(flow_nic_is_bit_set(_temp_ndev->res[_temp_res_type].alloc_bm, \ + _temp_index) == 0); \ + flow_nic_set_bit(_temp_ndev->res[_temp_res_type].alloc_bm, _temp_index); \ + } while (0) +#define flow_nic_mark_resource_unused (_ndev, res_type, index) \ do { \ typeof(res_type) _temp_res_type = (res_type); \
@@ -97,6 +124,9 @@ extern const char *dbg_res_descr[];#define flow_nic_is_resource_used (_ndev, res_type, index) \ (!!flow_nic_is_bit_set((_ndev)->res[res_type].alloc_bm, index)) +int flow_nic_alloc_resource (struct flow_nic_dev *ndev,enum res_type_e res_type, +uint32_t alignment); +void flow_nic_free_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int idx);int flow_nic_deref_resource (struct flow_nic_dev *ndev,enum res_type_e res_type,int index);
drivers/net/ntnic/include/flow_api_engine.h +5 -0
@@ -41,6 +41,11 @@ enum res_type_e { RES_INVALID }; +/* +* Flow NIC offload management +*/ +#define MAX_OUTPUT_DEST (128) +void km_free_ndev_resource_management (void **handle);void kcc_free_ndev_resource_management (void **handle);
drivers/net/ntnic/include/ntos_drv.h +1 -0
@@ -86,6 +86,7 @@ struct __rte_cache_aligned ntnic_tx_queue {struct pmd_internals {const struct rte_pci_device *pci_dev; +struct flow_eth_dev *flw_dev;char name[20 ];int n_intf_no;int lpbk_mode;
drivers/net/ntnic/include/stream_binary_flow_api.h +9 -0
@@ -12,11 +12,20 @@#define FLOW_MAX_QUEUES 128 +/* +* Flow eth dev profile determines how the FPGA module resources are +* managed and what features are available +*/ +enum flow_eth_dev_profile { +FLOW_ETH_DEV_PROFILE_INLINE =0 , +}; +struct flow_queue_id_s {int id;int hw_id; };struct flow_eth_dev ;/* port device */ +struct flow_handle ;#endif /* _STREAM_BINARY_FLOW_API_H_ */
drivers/net/ntnic/nthw/flow_api/flow_api.c +199 -10
249 lines not on this page · raw message
drivers/net/ntnic/ntnic_ethdev.c +22 -0
@@ -1355,6 +1355,13 @@ static const struct eth_dev_ops nthw_eth_dev_ops = {static int nthw_pci_dev_init (struct rte_pci_device *pci_dev) { +const struct flow_filter_ops *flow_filter_ops =get_flow_filter_ops (); + +if (flow_filter_ops ==NULL ) { +NT_LOG_DBGX (ERR ,NTNIC ,"flow_filter module uninitialized" ); +/* Return statement is not necessary here to allow traffic processing by SW */ + } +nt_vfio_init ();const struct port_ops *port_ops =get_port_ops ();
@@ -1378,10 +1385,13 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)uint32_t n_port_mask =-1 ;/* All ports enabled by default */ uint32_t nb_rx_queues =1 ;uint32_t nb_tx_queues =1 ; +uint32_t exception_path =0 ;struct flow_queue_id_s queue_ids[MAX_QUEUES ];int n_phy_ports;struct port_link_speed pls_mbps[NUM_ADAPTER_PORTS_MAX ] = {0 };int num_port_speeds =0 ; +enum flow_eth_dev_profile profile =FLOW_ETH_DEV_PROFILE_INLINE ; +NT_LOG_DBGX (DBG ,NTNIC ,"Dev %s PF #%i Init : %02x:%02x:%i" , pci_dev->name, pci_dev->addr.function, pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
@@ -1681,6 +1691,18 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)return -1 ; } +if (flow_filter_ops !=NULL ) { + internals->flw_dev = flow_filter_ops->flow_get_eth_dev (0 , n_intf_no, + eth_dev->data->port_id, nb_rx_queues, queue_ids, + &internals->txq_scg[0 ].rss_target_id, profile, exception_path); + +if (!internals->flw_dev) { +NT_LOG (ERR ,NTNIC , +"Error creating port. Resource exhaustion in HW" ); +return -1 ; + } + } +/* connect structs */ internals->p_drv = p_drv; eth_dev->data->dev_private = internals;
drivers/net/ntnic/ntnic_mod_reg.c +5 -0
@@ -118,6 +118,11 @@ const struct flow_backend_ops *get_flow_backend_ops(void)return flow_backend_ops; } +const struct profile_inline_ops *get_profile_inline_ops (void ) +{ +return NULL ; +} +static const struct flow_filter_ops *flow_filter_ops;void register_flow_filter_ops (const struct flow_filter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +14 -0
@@ -8,6 +8,7 @@#include <stdint.h> #include "flow_api.h" +#include "stream_binary_flow_api.h" #include "nthw_fpga_model.h" #include "nthw_platform_drv.h" #include "nthw_drv.h"
@@ -223,10 +224,23 @@ void register_flow_backend_ops(const struct flow_backend_ops *ops);const struct flow_backend_ops *get_flow_backend_ops (void );void flow_backend_init (void ); +const struct profile_inline_ops *get_profile_inline_ops (void ); +struct flow_filter_ops {int (*flow_filter_init)(nthw_fpga_t *p_fpga,struct flow_nic_dev **p_flow_device,int adapter_no);int (*flow_filter_done)(struct flow_nic_dev *dev); +/* +* Device Management API +*/ +struct flow_eth_dev *(*flow_get_eth_dev)(uint8_t adapter_no, +uint8_t hw_port_no, +uint32_t port_id, +int alloc_rx_queues, +struct flow_queue_id_s queue_ids[], +int *rss_target_id, +enum flow_eth_dev_profile flow_profile, +uint32_t exception_path); };void register_flow_filter_ops (const struct flow_filter_ops *ops);
Signature · 1 line
2.45.0