fix bugs
cover fix bugs
From: Jie Liu <[email protected]>
Jie Liu (13):
net/sxe2: add Rx queue buffer split fill support net/sxe2: update switchdev repr VSI ID display format net/sxe2: add ACL engine event statistics support net/sxe2: enhance device cap and res management net/sxe2: improve representor device initialization net/sxe2: refactor flow tunnel port handling net/sxe2: validate IPsec key length against maximum limit net/sxe2: enhance repr event handling and MP code net/sxe2: optimize vectorized Tx/Rx path common/sxe2: allow munmap during kernel reset net/sxe2: clean up duplicate function declarations net/sxe2: clean up structure definitions doc/sxe2: add acl-stat-type parameter documentation
doc/guides/nics/sxe2.rst | 33 +-- drivers/common/sxe2/sxe2_common.c | 5 +- drivers/common/sxe2/sxe2_ioctl_chnl.c | 8 +- drivers/net/sxe2/sxe2_cmd_chnl.c | 215 +++++++++++++++-- drivers/net/sxe2/sxe2_cmd_chnl.h | 15 +- drivers/net/sxe2/sxe2_drv_cmd.h | 47 ++-- drivers/net/sxe2/sxe2_dump.c | 10 +- drivers/net/sxe2/sxe2_ethdev.c | 203 +++++++++------- drivers/net/sxe2/sxe2_ethdev.h | 38 +-- drivers/net/sxe2/sxe2_ethdev_repr.c | 13 +- drivers/net/sxe2/sxe2_flow.c | 259 +++++++++++++++++---- drivers/net/sxe2/sxe2_flow.h | 6 +- drivers/net/sxe2/sxe2_flow_define.h | 13 +- drivers/net/sxe2/sxe2_flow_parse_action.c | 37 ++- drivers/net/sxe2/sxe2_flow_parse_pattern.c | 113 --------- drivers/net/sxe2/sxe2_flow_parse_pattern.h | 7 - drivers/net/sxe2/sxe2_ipsec.c | 5 + drivers/net/sxe2/sxe2_irq.c | 27 ++- drivers/net/sxe2/sxe2_mac.c | 10 +- drivers/net/sxe2/sxe2_mp.c | 59 +++-- drivers/net/sxe2/sxe2_queue.c | 2 + drivers/net/sxe2/sxe2_queue.h | 7 +- drivers/net/sxe2/sxe2_rx.c | 5 +- drivers/net/sxe2/sxe2_security.c | 1 + drivers/net/sxe2/sxe2_switchdev.c | 12 +- drivers/net/sxe2/sxe2_tx.c | 42 +++- drivers/net/sxe2/sxe2_tx.h | 4 + drivers/net/sxe2/sxe2_txrx.c | 19 +- drivers/net/sxe2/sxe2_txrx_poll.h | 2 - drivers/net/sxe2/sxe2_txrx_vec.c | 79 +++---- drivers/net/sxe2/sxe2_txrx_vec.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 10 +- drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 133 +---------- drivers/net/sxe2/sxe2_txrx_vec_common.h | 9 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 219 +++++++++++------ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 10 +- drivers/net/sxe2/sxe2_vsi.c | 8 +- 37 files changed, 989 insertions(+), 697 deletions(-)
Signature · 1 line
2.52.0
PATCH 1/13 net/sxe2: add Rx queue buffer split fill support
From: Jie Liu <[email protected]>
Implement sxe2_rxq_buf_split_fill function to configure Rx queue buffer split offload. The function validates and sets split parameters based on protocol header type.
Supports following split types:
- L2: Ether
- L3: IPv4, IPv6
- L4: TCP, UDP, SCTP
- Tunnel: GRE/NAT
- Inner L2/L3/L4 for tunneled packets
Sets split_type_mask and header_len (256 bytes) for hardware buffer split configuration. Returns error if protocol header is not configured or unsupported.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 142 ++++++++++++++++++++++++++++--- 1 file changed, 128 insertions(+), 14 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +128 -14
@@ -26,10 +26,9 @@ static void sxe2_drv_trace_id_alloc(uint64_t *trace_id) }static void __sxe2_drv_cmd_params_fill (struct sxe2_adapter *adapter, -struct sxe2_drv_cmd_params *cmd,uint32_t opc,const char *opc_str, +struct sxe2_drv_cmd_params *cmd,uint32_t opc,void *in_data,uint32_t in_len,void *out_data,uint32_t out_len) { -PMD_DEV_LOG_DEBUG (adapter,DRV ,"cmd opcode:%s" , opc_str); cmd->timeout =SXE2_DRV_CMD_DFLT_TIMEOUT ; cmd->opcode = opc; cmd->vsi_id = adapter->vsi_ctxt.dpdk_vsi_id;
@@ -44,7 +43,7 @@ static void __sxe2_drv_cmd_params_fill(struct sxe2_adapter *adapter, }#define sxe2_drv_cmd_params_fill (adapter, cmd, opc, in_data, in_len, out_data, out_len) \ - __sxe2_drv_cmd_params_fill(adapter, cmd, opc, #opc, in_data, in_len, out_data, out_len) + __sxe2_drv_cmd_params_fill(adapter, cmd, opc, in_data, in_len, out_data, out_len)int32_t sxe2_drv_dev_caps_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_caps_resp *dev_caps)
@@ -193,6 +192,102 @@ int32_t sxe2_drv_vsi_del(struct sxe2_adapter *adapter, struct sxe2_vsi *vsi)#define SXE2_RXQ_CTXT_CFG_BUF_LEN_ALIGN (1 << 7)#define SXE2_RX_HDR_SIZE 256 +static int32_t sxe2_rxq_buf_split_fill (struct sxe2_rx_queue *rxq, +struct sxe2_drv_rxq_ctxt *ctxt) +{ +int32_t ret =0 ; +uint32_t proto_hdr; + +if (rxq->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { + proto_hdr = rxq->rx_seg[0 ].proto_hdr; +if (proto_hdr ==RTE_PTYPE_UNKNOWN ) { +PMD_LOG_ERR (RX ,"Buffer split protocol must be configured" ); + ret =-1 ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_L4_MASK ) { +case RTE_PTYPE_L4_TCP : + ctxt->split_type_mask =SXE2_PTYPE_L4_TCP ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; +case RTE_PTYPE_L4_UDP : + ctxt->split_type_mask =SXE2_PTYPE_L4_UDP ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; +case RTE_PTYPE_L4_SCTP : + ctxt->split_type_mask =SXE2_PTYPE_L4_SCTP ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_L3_MASK ) { +case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN : + ctxt->split_type_mask =SXE2_PTYPE_L3_IPV4 ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; +case RTE_PTYPE_L3_IPV6_EXT_UNKNOWN : + ctxt->split_type_mask =SXE2_PTYPE_L3_IPV6 ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_L2_MASK ) { +case RTE_PTYPE_L2_ETHER : + ctxt->split_type_mask =SXE2_PTYPE_L2_ETHER ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_INNER_L4_MASK ) { +case RTE_PTYPE_INNER_L4_TCP : + ctxt->split_type_mask =SXE2_PTYPE_INNER_L4_TCP ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; +case RTE_PTYPE_INNER_L4_UDP : + ctxt->split_type_mask =SXE2_PTYPE_INNER_L4_UDP ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; +case RTE_PTYPE_INNER_L4_SCTP : + ctxt->split_type_mask =SXE2_PTYPE_INNER_L4_SCTP ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_INNER_L3_MASK ) { +case RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN : + ctxt->split_type_mask =SXE2_PTYPE_INNER_L3_IPV4 ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; +case RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN : + ctxt->split_type_mask =SXE2_PTYPE_INNER_L3_IPV6 ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_INNER_L2_MASK ) { +case RTE_PTYPE_INNER_L2_ETHER : + ctxt->split_type_mask =SXE2_PTYPE_INNER_L2_ETHER ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } + +switch (proto_hdr &RTE_PTYPE_TUNNEL_MASK ) { +case RTE_PTYPE_TUNNEL_GRENAT : + ctxt->split_type_mask =SXE2_PTYPE_TUNNEL_GRENAT ; + ctxt->hdr_len =SXE2_RX_HDR_SIZE ; + goto l_end; + } +PMD_LOG_ERR (RX ,"Buffer split protocol is not supported" ); + ret =-1 ; + }else { + ctxt->hdr_len =0 ; + ctxt->split_type_mask =0 ; + } +l_end: +return ret; +} +static int32_t sxe2_rxq_ctxt_cfg_fill (struct sxe2_rx_queue *rxq,struct sxe2_drv_rxq_cfg_req *req,uint16_t rxq_cnt) {
@@ -226,7 +321,17 @@ static int32_t sxe2_rxq_ctxt_cfg_fill(struct sxe2_rx_queue *rxq,else ctxt->keep_crc_en =0 ; +if (rxq->offloads &RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ) { + ret =sxe2_rxq_buf_split_fill (rxq, ctxt); +if (ret) + goto l_end; + ctxt->split_en =1 ; + }else { + ctxt->split_en =0 ; + } + ctxt->desc_size =sizeof (union sxe2_rx_desc ); +l_end:return ret; }
@@ -391,7 +496,7 @@ int32_t sxe2_drv_vsi_info_get(struct sxe2_adapter *adapter, struct sxe2_vsi *vsi &vsi_info_get_resp, sizeof(vsi_info_get_resp)); ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) { -PMD_DEV_LOG_ERR (adapter,DRV ,"switchdev cpvsi info get failed, ret=%d" , ret); +PMD_DEV_LOG_ERR (adapter,DRV ,"vsi %u info get failed, ret=%d" , vsi->vsi_id, ret); goto l_end; }
@@ -412,6 +517,7 @@ int32_t sxe2_drv_mac_link_status_get(struct sxe2_adapter *adapter) {int32_t ret =0 ;struct sxe2_common_device *cdev = adapter->cdev; +struct rte_eth_dev *dev = &rte_eth_devices[adapter->dev_info.dev_data->port_id];struct sxe2_drv_cmd_params param = {0 };struct sxe2_drv_link_info_resp resp = {0 };
@@ -425,6 +531,7 @@ int32_t sxe2_drv_mac_link_status_get(struct sxe2_adapter *adapter) } adapter->link_ctxt.speed = resp.speed; adapter->link_ctxt.link_up = resp.status; + (void )sxe2_link_update (dev,0 ); l_end:return ret;
@@ -447,7 +554,7 @@ int32_t sxe2_drv_rxq_bind_irq(struct sxe2_adapter *adapter, uint16_t rxq_idx, ui NULL, 0); ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) -PMD_DEV_LOG_ERR (adapter,DRV ,"rxq bind irq failed, ret=%d" , ret); +PMD_DEV_LOG_ERR (adapter,DRV ,"rxq %u bind irq failed, ret=%d" , rxq_idx, ret);return ret; }
@@ -467,7 +574,7 @@ int32_t sxe2_drv_rxq_unbind_irq(struct sxe2_adapter *adapter, uint16_t rxq_idx) NULL, 0); ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) -PMD_DEV_LOG_ERR (adapter,DRV ,"rxq unbind irq failed, ret=%d" , ret); +PMD_DEV_LOG_ERR (adapter,DRV ,"rxq %u unbind irq failed, ret=%d" , rxq_idx, ret);return ret; }
@@ -668,7 +775,7 @@ int32_t sxe2_drv_promisc_config(struct sxe2_adapter *adapter, bool set) ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) -PMD_DEV_LOG_WARN (adapter,DRV ,"promic config failed, ret=%d" , ret); +PMD_DEV_LOG_WARN (adapter,DRV ,"promisc config failed, ret=%d" , ret);return ret; }
@@ -1532,7 +1639,7 @@ int32_t sxe2_drv_get_udp_tunnel_port(struct sxe2_adapter *adapter, [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_GTP_U] = SXE2_UDP_TUNNEL_PROTOCOL_GTP_U, [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_NVGRE] = SXE2_UDP_TUNNEL_PROTOCOL_NVGRE, }; -struct sxe2_udp_tunnel_cfg tunnel_config = {}; +struct sxe2_udp_tunnel_cfg tunnel_config = {0 }; tunnel_config.protocol = flow_proto_to_udp_tunnel_proto[proto]; ret =sxe2_drv_udp_tunnel_get (adapter, &tunnel_config);
@@ -1560,8 +1667,10 @@ int32_t sxe2_drv_udp_tunnel_get(struct sxe2_adapter *adapter, &req,sizeof (req), &resp, sizeof(resp)); ret =sxe2_drv_cmd_exec (cdev, &cmd); -if (ret) +if (ret) {PMD_LOG_ERR (DRV ,"Failed to get udp proto %d port, ret=%d" , req.type, ret); + goto l_end; + } tunnel_config->fw_port = resp.port; tunnel_config->fw_status = resp.enable;
@@ -1569,6 +1678,7 @@ int32_t sxe2_drv_udp_tunnel_get(struct sxe2_adapter *adapter, tunnel_config->fw_src_en = resp.src; tunnel_config->fw_used = resp.fw_used; +l_end:return ret; }
@@ -1591,7 +1701,7 @@ int32_t sxe2_drv_queue_info_get_update(struct sxe2_adapter *adapter, struct eth_ &resp, sizeof(resp)); ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) { -PMD_LOG_ERR (DRV ,"get queue info map failed, ret=%d" , ret); +PMD_LOG_ERR (DRV ,"rx queue mapping failed, ret=%d" , ret); goto l_end; }
@@ -1635,7 +1745,7 @@ int32_t sxe2_drv_rxq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) -PMD_LOG_ERR (DRV ,"get dev caps failed, ret=%d" , ret); +PMD_LOG_ERR (DRV ,"rx queue mapping failed, ret=%d" , ret); l_end:return ret;
@@ -1652,7 +1762,7 @@ int32_t sxe2_drv_txq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, txq = eth_dev->data->tx_queues[queue_id];if (txq ==NULL ) { -PMD_LOG_ERR (DRV ,"Rx queue %u is not available or setup" , queue_id); +PMD_LOG_ERR (DRV ,"Tx queue %u is not available or setup" , queue_id); ret = -EINVAL ; goto l_end; }
@@ -1666,7 +1776,7 @@ int32_t sxe2_drv_txq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, ret =sxe2_drv_cmd_exec (cdev, ¶m);if (ret) -PMD_LOG_ERR (DRV ,"get dev caps failed, ret=%d" , ret); +PMD_LOG_ERR (DRV ,"tx queue mapping failed, ret=%d" , ret); l_end:return ret;
@@ -1726,10 +1836,14 @@ int32_t sxe2_drv_flow_filter_add(struct sxe2_adapter *adapter, struct sxe2_flowsxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_FLOW_FILTER_ADD , &req,sizeof (req), &resp,sizeof (resp)); ret =sxe2_drv_cmd_exec (cdev, &cmd); -if (ret) +if (ret) {PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to add flow filter, ret: %d." , ret); + flow->create_err = ret; + goto l_end; + } flow->flow_id = resp.flow_id; flow->create_err = ret; +l_end:return ret; }
Signature · 1 line
2.52.0
PATCH 2/13 net/sxe2: update switchdev repr VSI ID display format
In reply to [email protected]From: Jie Liu <[email protected]>
Update the output format for representor primary VSI ID and backup VSI ID in switchdev dump function. The fields repr_vf_primary_vsi_id and repr_vf_backup_vsi_id should be displayed correctly for better debug visibility.
--- drivers/net/sxe2/sxe2_dump.c | 8 ++++---- drivers/net/sxe2/sxe2_ethdev.h | 4 ++-- drivers/net/sxe2/sxe2_flow.c | 4 ++-- drivers/net/sxe2/sxe2_switchdev.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/sxe2/sxe2_dump.c +4 -4
@@ -211,16 +211,16 @@ sxe2_dump_switchdev_info(FILE *file, struct rte_eth_dev *dev)"\t -- repr_pf_id: %u\n" "\t -- repr_vf_id: %u\n" "\t -- repr_vf_vsi_id: %u\n" -"\t -- repr_vf_k_vsi_id: %s\n" -"\t -- repr_vf_u_vsi_id: %s\n" , +"\t -- repr_vf_primary_vsi_id: %s\n" +"\t -- repr_vf_backup_vsi_id: %s\n" , adapter->repr_priv_data->repr_id, adapter->repr_priv_data->repr_q_id, adapter->repr_priv_data->repr_pf_id, adapter->repr_priv_data->repr_vf_id, adapter->repr_priv_data->repr_vf_vsi_id, -sxe2_vsi_id_str (adapter->repr_priv_data->repr_vf_k_vsi_id, +sxe2_vsi_id_str (adapter->repr_priv_data->repr_vf_primary_vsi_id, k_vsi_buf,sizeof (k_vsi_buf)), -sxe2_vsi_id_str (adapter->repr_priv_data->repr_vf_u_vsi_id, +sxe2_vsi_id_str (adapter->repr_priv_data->repr_vf_backup_vsi_id, u_vsi_buf, sizeof(u_vsi_buf))); goto l_end; }
drivers/net/sxe2/sxe2_ethdev.h +2 -2
@@ -263,8 +263,8 @@ struct sxe2_repr_private_data {uint16_t repr_pf_id;uint16_t repr_vf_id;uint16_t repr_vf_vsi_id; -uint16_t repr_vf_k_vsi_id; -uint16_t repr_vf_u_vsi_id; +uint16_t repr_vf_primary_vsi_id; +uint16_t repr_vf_backup_vsi_id; };struct sxe2_sched_hw_cap {
drivers/net/sxe2/sxe2_flow.c +2 -2
@@ -380,9 +380,9 @@ static int32_t sxe2_flow_src_split_proc(struct rte_eth_dev *dev,if (adapter->switchdev_info.is_switchdev && adapter->is_dev_repr) { flow_bond_num =1 ; flow_src_vsi[SXE2_MAX_DRV_TYPE_DPDK ][0 ] = - adapter->repr_priv_data->repr_vf_u_vsi_id; + adapter->repr_priv_data->repr_vf_backup_vsi_id; flow_src_vsi[SXE2_MAX_DRV_TYPE_KERNEL ][0 ] = - adapter->repr_priv_data->repr_vf_k_vsi_id; + adapter->repr_priv_data->repr_vf_primary_vsi_id; }for (idx =0 ; idx < flow_bond_num; idx++) {
drivers/net/sxe2/sxe2_switchdev.c +2 -2
@@ -312,9 +312,9 @@ int32_t sxe2_switchdev_repr_private_data_init(struct rte_eth_dev *dev, repr_priv_data->repr_q_id = repr_id; repr_priv_data->repr_pf_id = parent_adapter->pf_idx; repr_priv_data->repr_vf_id = repr_id; - repr_priv_data->repr_vf_k_vsi_id = + repr_priv_data->repr_vf_primary_vsi_id = parent_adapter->repr_ctxt.repr_vf_id[repr_id].kernel_vsi_id; - repr_priv_data->repr_vf_u_vsi_id = + repr_priv_data->repr_vf_backup_vsi_id = parent_adapter->repr_ctxt.repr_vf_id[repr_id].dpdk_vsi_id; repr_priv_data->repr_vf_vsi_id =
Signature · 1 line
2.52.0
PATCH 3/13 net/sxe2: add ACL engine event statistics support
In reply to [email protected]From: Jie Liu <[email protected]>
Add statistics support for ACL flow engine to track packet hits and bytes. This enables flow aging and traffic monitoring for ACL rules.
Implementation includes:
- Add acl-stat-type devarg to configure statistics type
- Implement sxe2_drv_flow_acl_get_stat_id for stat allocation
- Implement sxe2_drv_flow_acl_free_stat for stat cleanup
- Implement sxe2_drv_flow_acl_query_stat for stat query
- Integrate stat operations into flow create/destroy/query paths
Statistics are accumulated in manager context and reported through rte_flow_query() interface with COUNT action.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 73 +++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 9 +- drivers/net/sxe2/sxe2_drv_cmd.h | 17 ++++ drivers/net/sxe2/sxe2_dump.c | 2 + drivers/net/sxe2/sxe2_ethdev.c | 25 +++-- drivers/net/sxe2/sxe2_ethdev.h | 1 + drivers/net/sxe2/sxe2_flow.c | 111 ++++++++++++++++------ drivers/net/sxe2/sxe2_flow.h | 6 +- drivers/net/sxe2/sxe2_flow_define.h | 13 +-- drivers/net/sxe2/sxe2_flow_parse_action.c | 19 +++- drivers/net/sxe2/sxe2_queue.c | 2 + 11 files changed, 225 insertions(+), 53 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +72 -1
@@ -1914,7 +1914,7 @@ int32_t sxe2_drv_flow_fnav_free_stat(struct sxe2_adapter *adapter, uint32_t stat }int32_t sxe2_drv_flow_fnav_query_stat (struct sxe2_adapter *adapter, -struct sxe2_fnav_cid_mgr *mgr) +struct sxe2_flow_cid_mgr *mgr) {struct sxe2_drv_flow_fnav_query_stat_req req = {0 };struct sxe2_drv_flow_fnav_query_stat_resp resp = {0 };
@@ -1943,6 +1943,77 @@ int32_t sxe2_drv_flow_fnav_query_stat(struct sxe2_adapter *adapter,return ret; } +int32_t sxe2_drv_flow_acl_get_stat_id (struct sxe2_adapter *adapter,uint32_t *stat_id) +{ +struct sxe2_drv_flow_fnav_get_stat_id_req req = {0 }; +struct sxe2_drv_flow_fnav_get_stat_id_resp resp = {0 }; +struct sxe2_drv_cmd_params cmd = {0 }; +struct sxe2_common_device *cdev = adapter->cdev; +int32_t ret =-1 ; + +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_FLOW_ACL_STAT_ALLOC , + &req,sizeof (req), + &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to get acl stat id, ret: %d." , ret); + goto l_end; + } + *stat_id = resp.stat_id; + +l_end: +return ret; +} + +int32_t sxe2_drv_flow_acl_free_stat (struct sxe2_adapter *adapter,uint32_t stat_id) +{ +struct sxe2_drv_flow_fnav_free_stat_id_req req = {0 }; +struct sxe2_drv_cmd_params cmd = {0 }; +struct sxe2_common_device *cdev = adapter->cdev; +int32_t ret =-1 ; + + req.stat_id = stat_id; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_FLOW_ACL_STAT_FREE , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to free acl stat id, ret: %d." , ret); + goto l_end; + } + +l_end: +return ret; +} + +int32_t sxe2_drv_flow_acl_query_stat (struct sxe2_adapter *adapter, +struct sxe2_flow_cid_mgr *mgr) +{ +struct sxe2_drv_acl_query_stat_req req = {0 }; +struct sxe2_drv_acl_query_stat_resp resp = {0 }; +struct sxe2_drv_cmd_params cmd = {0 }; +struct sxe2_common_device *cdev = adapter->cdev; +int32_t ret =-1 ; + + req.stat_id = mgr->stat_index; + req.stat_ctrl = mgr->count_type; + req.is_clear =1 ; + +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_FLOW_ACL_STAT_QUERY , + &req,sizeof (req), &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to query ACL stat, stat id: %u, ret: %d." , + req.stat_id, ret); + goto l_end; + } + mgr->hits += resp.stat_hits; + mgr->bytes += resp.stat_bytes; + +l_end: +return ret; +} +int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter,uint16_t *vsi_list,uint16_t vsi_cnt,bool set) {
drivers/net/sxe2/sxe2_cmd_chnl.h +8 -1
@@ -165,7 +165,14 @@ int32_t sxe2_drv_flow_fnav_get_stat_id(struct sxe2_adapter *adapter, uint32_t *sint32_t sxe2_drv_flow_fnav_free_stat (struct sxe2_adapter *adapter,uint32_t stat_id);int32_t sxe2_drv_flow_fnav_query_stat (struct sxe2_adapter *adapter, -struct sxe2_fnav_cid_mgr *mgr); +struct sxe2_flow_cid_mgr *mgr); + +int32_t sxe2_drv_flow_acl_get_stat_id (struct sxe2_adapter *adapter,uint32_t *stat_id); + +int32_t sxe2_drv_flow_acl_free_stat (struct sxe2_adapter *adapter,uint32_t stat_id); + +int32_t sxe2_drv_flow_acl_query_stat (struct sxe2_adapter *adapter, +struct sxe2_flow_cid_mgr *mgr);int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter,uint16_t *vsi_list,uint16_t vsi_cnt,bool set);
drivers/net/sxe2/sxe2_drv_cmd.h +17 -0
@@ -668,6 +668,18 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_fc_get_resp {uint8_t rsv[3 ]; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_acl_query_stat_req { + uint32_t stat_id; +uint32_t stat_ctrl; +uint32_t is_clear; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_acl_query_stat_resp { + uint32_t stat_index; +uint64_t stat_hits; +uint64_t stat_bytes; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
@@ -824,6 +836,11 @@ enum sxe2_drv_cmd_code {SXE2_DRV_CMD_OPT_EEP_GET =SXE2_MK_DRV_CMD (SXE2_DRV_CMD_MODULE_OPT ,1 ), +SXE2_DRV_CMD_FLOW_ACL_STAT_QUERY = +SXE2_MK_DRV_CMD (SXE2_DRV_CMD_MODULE_ACL ,1 ), +SXE2_DRV_CMD_FLOW_ACL_STAT_ALLOC , + SXE2_DRV_CMD_FLOW_ACL_STAT_FREE, + };#endif /* SXE2_DRV_CMD_H */
drivers/net/sxe2/sxe2_dump.c +2 -0
@@ -80,12 +80,14 @@ sxe2_dump_dev_args_info(FILE *file, struct rte_eth_dev *dev)"\t -- no_sched_mode: %s\n" "\t -- flow-duplicate-pattern: %u\n" "\t -- fnav-stat-type: %u\n" +"\t -- acl-stat-type: %u\n" "\t -- sched_layer_mode: %u\n" "\t -- rx_low_latency: %s\n" "\t -- function-flow-direct: %s\n" , adapter->devargs.no_sched_mode ?"On" :"Off" , adapter->devargs.flow_dup_pattern_mode, adapter->devargs.fnav_stat_type, + adapter->devargs.acl_stat_type, adapter->devargs.sched_layer_mode, adapter->devargs.rx_low_latency ?"On" :"Off" , adapter->devargs.func_flow_direct_en ? "On" : "Off");
drivers/net/sxe2/sxe2_ethdev.c +17 -8
@@ -44,7 +44,7 @@#define SXE2_PCI_VENDOR_ID_1 0x1ff2#define SXE2_PCI_DEVICE_ID_PF_1 0x10b1 -#define SXE2_PCI_DEVICE_ID_VF_1 0x10b +#define SXE2_PCI_DEVICE_ID_VF_1 0x10b2#define SXE2_PCI_VENDOR_ID_2 0x1d94#define SXE2_PCI_DEVICE_ID_PF_2 0x1260
@@ -72,6 +72,7 @@ static const struct rte_pci_id pci_id_sxe2_tbl[] = {#define SXE2_DEVARG_FLOW_DUP_PATTERN_MODE "flow-duplicate-pattern"#define SXE2_DEVARG_FUNC_FLOW_DIRCT "function-flow-direct"#define SXE2_DEVARG_FNAV_STAT_TYPE "fnav-stat-type" +#define SXE2_DEVARG_ACL_STAT_TYPE "acl-stat-type"#define SXE2_DEVARG_NO_SCHED_MODE "no-sched-mode"#define SXE2_DEVARG_SCHED_LAYER_MODE "sched-layer-mode"#define SXE2_DEVARG_RX_LOW_LATENCY "rx-low-latency"
@@ -971,11 +972,11 @@ sxe2_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev __rte_unused,return ptypes; } -static int32_t sxe2_parse_fnav_stat_type (const char *key,const char *value,void *args) +static int32_t sxe2_parse_stat_type (const char *key,const char *value,void *args) {int32_t ret = -EINVAL ;uint8_t *num = (uint8_t *)args; -unsigned long fnav_stat_type; +unsigned long stat_type;char *endptr =NULL ;if (value ==NULL || args ==NULL ) {
@@ -983,19 +984,19 @@ static int32_t sxe2_parse_fnav_stat_type(const char *key, const char *value, voi goto l_end; } errno =0 ; - fnav_stat_type =strtoul (value, &endptr,10 ); + stat_type =strtoul (value, &endptr,10 );if (errno !=0 || endptr == value || *endptr !='\0' ) {PMD_LOG_WARN (INIT ,"%s: \"%s\" is not a valid int value." , key, value); goto l_end; } -if (fnav_stat_type >SXE2_FNAV_STAT_ENA_ALL || - fnav_stat_type ==SXE2_FNAV_STAT_ENA_NONE ) { +if (stat_type >SXE2_FNAV_STAT_ENA_ALL || + stat_type ==SXE2_FNAV_STAT_ENA_NONE ) {PMD_LOG_ERR (INIT ,"%s: \"%s\" out of range [1-3]." , key, value); goto l_end; } - *num = (uint8_t )fnav_stat_type; + *num = (uint8_t )stat_type; ret =0 ; l_end:return ret;
@@ -1177,13 +1178,20 @@ static int32_t sxe2_args_parse(struct rte_eth_dev *dev, struct sxe2_dev_kvargs_iif (kvargs ==NULL ) goto l_end; ret =sxe2_kvargs_process (kvargs,SXE2_DEVARG_FNAV_STAT_TYPE , - &sxe2_parse_fnav_stat_type, + &sxe2_parse_stat_type, &adapter->devargs.fnav_stat_type);if (ret) {PMD_DEV_LOG_ERR (adapter,INIT ,"Failed to parse fnav stat type, ret:%d" , ret); goto l_end; } + ret =sxe2_kvargs_process (kvargs,SXE2_DEVARG_ACL_STAT_TYPE , + &sxe2_parse_stat_type, &adapter->devargs.acl_stat_type); +if (ret) { +PMD_DEV_LOG_ERR (adapter,INIT ,"Failed to parse acl stat type, ret:%d" , ret); + goto l_end; + } + ret =sxe2_kvargs_process (kvargs,SXE2_DEVARG_NO_SCHED_MODE , &sxe2_parse_bool, &adapter->devargs.no_sched_mode);
@@ -2350,6 +2358,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_sxe2,"flow-duplicate-pattern=<0|1|2> " "function-flow-direct=<0|1> " "fnav-stat-type=<1|2|3> " +"acl-stat-type=<1|2|3> " "no-sched-mode=<0|1> " "sched-layer-mode=<0-3> " "rx-low-latency=<0|1>");
drivers/net/sxe2/sxe2_ethdev.h +1 -0
@@ -138,6 +138,7 @@ struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;uint8_t fnav_stat_type; +uint8_t acl_stat_type;uint8_t no_sched_mode;uint8_t sched_layer_mode;uint8_t rx_low_latency;
drivers/net/sxe2/sxe2_flow.c +80 -31
211 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow.h +3 -3
@@ -14,16 +14,16 @@ int32_t sxe2_flow_init(struct rte_eth_dev *dev);int32_t sxe2_flow_uninit (struct rte_eth_dev *dev); -int32_t sxe2_fnav_get_filter_cid (struct sxe2_adapter *adapter,struct sxe2_flow *flow); +int32_t sxe2_flow_get_filter_cid (struct sxe2_adapter *adapter,struct sxe2_flow *flow);int32_t sxe2_flow_free_mgr (struct sxe2_adapter *adapter,struct sxe2_flow *flow, -struct sxe2_fnav_cid_mgr **mgr_ptr, +struct sxe2_flow_cid_mgr **mgr_ptr,struct rte_flow_error *error);int32_t sxe2_flow_query_mgr (struct sxe2_adapter *adapter,struct sxe2_flow *flow, -struct sxe2_fnav_cid_mgr **mgr_ptr, +struct sxe2_flow_cid_mgr **mgr_ptr,struct rte_flow_error *error);int32_t sxe2_flow_init_udp_tunnel_port (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow_define.h +7 -6
@@ -98,8 +98,8 @@ struct rte_flow { };TAILQ_HEAD (rte_flow_list_t, rte_flow); -struct sxe2_fnav_cid_mgr { -TAILQ_ENTRY (sxe2_fnav_cid_mgr) next; +struct sxe2_flow_cid_mgr { +TAILQ_ENTRY (sxe2_flow_cid_mgr) next;uint16_t stat_index;uint32_t user_id;uint32_t driver_id;
@@ -107,18 +107,19 @@ struct sxe2_fnav_cid_mgr {uint64_t hits;uint64_t bytes; }; -TAILQ_HEAD (sxe2_fnav_cid_mgr_list_t, sxe2_fnav_cid_mgr); +TAILQ_HEAD (sxe2_flow_cid_mgr_list_t, sxe2_flow_cid_mgr); -struct sxe2_fnav_count_resource { +struct sxe2_flow_count_resource {uint32_t count_type;uint32_t global_index; -struct sxe2_fnav_cid_mgr_list_t fnav_cid_mgr_list; +struct sxe2_flow_cid_mgr_list_t flow_cid_mgr_list; };struct sxe2_flow_context {struct rte_flow_list_t rte_flow_list;rte_spinlock_t flow_list_lock; -struct sxe2_fnav_count_resource hw_res; +struct sxe2_flow_count_resource fnav_hw_res; +struct sxe2_flow_count_resource acl_hw_res;uint16_t tunnel_port_list[SXE2_FLOW_UDP_TUNNEL_MAX ];uint32_t fnav_inited; };
drivers/net/sxe2/sxe2_flow_parse_action.c +16 -3
@@ -1037,11 +1037,24 @@ int32_t sxe2_flow_parse_action(struct rte_eth_dev *dev,if (engine_type ==SXE2_FLOW_ENGINE_FNAV ) {sxe2_set_bit (SXE2_FLOW_ACTION_COUNT , flow->action.act_types); act_count = action->conf; - flow->action.count.user_id = act_count->id; + flow->action.count.user_id = + (act_count ==NULL ) ?0 : act_count->id; flow->action.count.driver_id =0 ; -if (flow->action.count.user_id ==0 ) +if (flow->action.count.user_id ==0 ) { flow->action.count.driver_id = - ++adapter->flow_ctxt.hw_res.global_index; + ++adapter->flow_ctxt.fnav_hw_res.global_index; + } + action_num[SXE2_FLOW_ACTION_COUNT ]++; + }else if (engine_type ==SXE2_FLOW_ENGINE_ACL ) { +sxe2_set_bit (SXE2_FLOW_ACTION_COUNT , flow->action.act_types); + act_count = action->conf; + flow->action.count.user_id = + (act_count ==NULL ) ?0 : act_count->id; + flow->action.count.driver_id =0 ; +if (flow->action.count.user_id ==0 ) { + flow->action.count.driver_id = + ++adapter->flow_ctxt.acl_hw_res.global_index; + } action_num[SXE2_FLOW_ACTION_COUNT ]++; }else { rte_flow_error_set(error, ENOTSUP,
drivers/net/sxe2/sxe2_queue.c +2 -0
@@ -39,6 +39,8 @@ int32_t sxe2_queues_init(struct rte_eth_dev *dev) rxq->rx_buf_len =RTE_MIN (rxq->rx_buf_len,SXE2_RX_MAX_DATA_BUF_SIZE );if (frame_size > rxq->rx_buf_len) dev->data->scattered_rx =1 ; +if (adapter->flow_ctxt.fnav_inited) + rxq->fnav_enable = true; } adapter->ptp_ctxt.mbuf_rx_ts_offset =-1 ;
Signature · 1 line
2.52.0
PATCH 4/13 net/sxe2: enhance device cap and res management
In reply to [email protected]From: Jie Liu <[email protected]>
This patch improves the SXE2 PMD with several key enhancements:
- Enhance device info reporting:
* Add NULL check for main VSI in dev_infos_get
* Add max_mac_addrs field support
* Add RSS_HASH offload capability
* Conditionally enable QINQ_STRIP/QINQ_INSERT based on port VLAN check
* Fill nb_rx_queues and nb_tx_queues fields
* Set no_of_elements in buffer_split_supported_hdr_ptypes_get
- Unify PCI register operations:
* Move SXE2_PCI_REG_WRITE and SXE2_PCI_REG_READ to common header
* Replace write-combined write with regular write in pci_map_write_reg
* Add resource type validation in dev_pci_res_seg_map
- Improve VF representor matching logic:
* Remove kernel_repr_id encoding approach
* Match PF number and VF ID directly against representor info
* Add proper error handling for mismatched representor types
- Support multi-port probing:
* Loop through nb_ports in eth_pmd_probe
* Handle probe failure with proper cleanup
- Update resource cleanup order in dev_close:
* Adjust uninit sequence to prevent use-after-free
* Add NULL check for dev_ops before calling dev_close
- Add device type checks in UDP tunnel operations:
* Restrict tunnel operations to PF only
* Reject operations on VF representors
- Store additional device capabilities:
* Save port_idx and pf_idx from device capabilities
--- drivers/net/sxe2/sxe2_ethdev.c | 178 +++++++++++++++++++-------------- drivers/net/sxe2/sxe2_ethdev.h | 6 +- drivers/net/sxe2/sxe2_queue.h | 2 - 3 files changed, 107 insertions(+), 79 deletions(-)
drivers/net/sxe2/sxe2_ethdev.c +104 -74
@@ -95,7 +95,7 @@ static struct sxe2_pci_map_addr_info sxe2_net_map_addr_info_pf[SXE2_PCI_MAP_RES_ .reg_width = 4}, [SXE2_PCI_MAP_RES_IRQ_MSIX] = {.addr_base = SXE2_BAR4_MSIX_CTL(0), .bar_idx = 4, - .reg_width = 10}, + .reg_width = 0x10}, };static struct sxe2_pci_map_addr_info sxe2_net_map_addr_info_vf[SXE2_PCI_MAP_RES_MAX_COUNT ] = {
@@ -630,6 +630,10 @@ int32_t sxe2_udp_tunnel_port_add_common(struct sxe2_adapter *ad,struct sxe2_udp_tunnel_cfg *tunnel_config;int32_t ret =-1 ; +if (ad->dev_type !=SXE2_DEV_T_PF || ad->is_dev_repr) { + ret = -ENOTSUP ; + goto l_end; + }rte_spinlock_lock (&ad->udp_tunnel_ctx.lock); tunnel_config = &ad->udp_tunnel_ctx.tunnel_conf[tunnel_proto];
@@ -659,6 +663,7 @@ int32_t sxe2_udp_tunnel_port_add_common(struct sxe2_adapter *ad, l_unlock_end:rte_spinlock_unlock (&ad->udp_tunnel_ctx.lock); +l_end:return ret; }
@@ -782,6 +787,10 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev);struct sxe2_vsi *vsi = adapter->vsi_ctxt.main_vsi; +if (unlikely (vsi ==NULL )) { +PMD_LOG_ERR (INIT ,"main vsi is NULL" ); +return -EINVAL ; + } dev_info->max_rx_queues = vsi->rxqs.q_cnt; dev_info->max_tx_queues = vsi->txqs.q_cnt; dev_info->min_rx_bufsize =SXE2_MIN_BUF_SIZE ;
@@ -789,6 +798,7 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev, dev_info->max_lro_pkt_size =SXE2_FRAME_SIZE_MAX *SXE2_RX_LRO_DESC_MAX_NUM ; dev_info->max_mtu = dev_info->max_rx_pktlen -SXE2_ETH_OVERHEAD ; dev_info->min_mtu =RTE_ETHER_MIN_MTU ; + dev_info->max_mac_addrs =SXE2_NUM_MACADDR_MAX ; dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
@@ -800,11 +810,9 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,RTE_ETH_RX_OFFLOAD_SCTP_CKSUM |RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT | -#ifndef RTE_LIBRTE_SXE2_16BYTE_RX_DESC -RTE_ETH_RX_OFFLOAD_QINQ_STRIP | -#endifRTE_ETH_RX_OFFLOAD_VLAN_EXTEND | -RTE_ETH_RX_OFFLOAD_TCP_LRO ; +RTE_ETH_RX_OFFLOAD_TCP_LRO | +RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
@@ -850,13 +858,20 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO ; +if (sxe2_ipsec_supported (adapter)) { + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_SECURITY ; + dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_SECURITY ; + }if (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_PTP ) dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ; -if (sxe2_ipsec_supported (adapter)) { - dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_SECURITY ; - dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_SECURITY ; +if (!sxe2_dev_port_vlan_check (dev)) { + dev_info->tx_offload_capa |=RTE_ETH_TX_OFFLOAD_QINQ_INSERT ; +#ifndef RTE_LIBRTE_SXE2_16BYTE_RX_DESC + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_QINQ_STRIP ; +#endif + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_VLAN_FILTER ; }if (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_RSS ) {
@@ -909,7 +924,8 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev, dev_info->speed_capa =RTE_ETH_LINK_SPEED_10G |RTE_ETH_LINK_SPEED_25G |RTE_ETH_LINK_SPEED_50G |RTE_ETH_LINK_SPEED_100G ; - + dev_info->nb_rx_queues = dev->data->nb_rx_queues; + dev_info->nb_tx_queues = dev->data->nb_tx_queues; dev_info->default_rxportconf.burst_size =SXE2_RX_MAX_BURST ; dev_info->default_txportconf.burst_size =SXE2_TX_MAX_BURST ; dev_info->default_rxportconf.nb_queues =1 ;
@@ -918,11 +934,8 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev, dev_info->default_txportconf.ring_size =SXE2_RING_SIZE_MIN ; dev_info->rx_seg_capa.max_nseg =SXE2_RX_MAX_NSEG ; - dev_info->rx_seg_capa.multi_pools = true; - dev_info->rx_seg_capa.offset_allowed = false; - dev_info->rx_seg_capa.offset_align_log2 = false;return 0 ;
@@ -930,7 +943,7 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,static const uint32_t * sxe2_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev __rte_unused, - size_t *no_of_elements __rte_unused) +size_t *no_of_elements) {static const uint32_t ptypes[] = {RTE_PTYPE_L2_ETHER ,
@@ -968,6 +981,7 @@ sxe2_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev __rte_unused, RTE_PTYPE_UNKNOWN }; + *no_of_elements =RTE_DIM (ptypes);return ptypes; }
@@ -1352,6 +1366,8 @@ static int32_t sxe2_func_caps_get(struct sxe2_adapter *adapter) goto l_end; adapter->dev_type = dev_caps.dev_type; + adapter->port_idx = dev_caps.port_idx; + adapter->pf_idx = dev_caps.pf_idx;sxe2_drv_dev_caps_set (adapter, &dev_caps);
@@ -1437,7 +1453,7 @@ void sxe2_pci_map_write_reg(struct sxe2_adapter *adapter, goto l_ret; } -SXE2_PCI_REG_WRITE_WC (reg_addr, value); +SXE2_PCI_REG_WRITE (reg_addr, value); l_ret:return ; }
@@ -1550,6 +1566,12 @@ int32_t sxe2_dev_pci_res_seg_map(struct sxe2_adapter *adapter,struct sxe2_pci_map_addr_info *addr_info =NULL ;int32_t ret =0 ; +if (unlikely (res_type >=SXE2_PCI_MAP_RES_MAX_COUNT )) { +PMD_DEV_LOG_ERR (adapter,INIT ,"Invalid resource type %u" , res_type); + ret = -EINVAL ; + goto l_end; + } + addr_info = &adapter->map_ctxt.addr_info[res_type];if (!addr_info || addr_info->bar_idx ==SXE2_PCI_MAP_BAR_INVALID ) {PMD_DEV_LOG_ERR (adapter,INIT ,"Invalid bar index with resource type %d" , res_type);
@@ -1765,14 +1787,13 @@ void sxe2_dev_pci_map_uinit(struct rte_eth_dev *dev)uint8_t i =0 ;PMD_INIT_FUNC_TRACE (); +if (map_ctxt->bar_info !=NULL ) { + (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_DOORBELL_RX_TAIL ); + (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_DOORBELL_TX ); + (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_IRQ_DYN ); + (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_IRQ_ITR ); + (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_IRQ_MSIX ); - (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_DOORBELL_RX_TAIL ); - (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_DOORBELL_TX ); - (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_IRQ_DYN ); - (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_IRQ_ITR ); - (void )sxe2_dev_pci_seg_unmap (adapter,SXE2_PCI_MAP_RES_IRQ_MSIX ); - -if (map_ctxt !=NULL && map_ctxt->bar_info !=NULL ) {for (i =0 ; i < map_ctxt->bar_cnt; i++) { bar_info = &map_ctxt->bar_info[i];if (bar_info !=NULL && bar_info->seg_info !=NULL ) {
@@ -1783,7 +1804,6 @@ void sxe2_dev_pci_map_uinit(struct rte_eth_dev *dev)rte_free (map_ctxt->bar_info); map_ctxt->bar_info =NULL ; } - adapter->dev_info.dev_data =NULL ; }
@@ -1936,6 +1956,12 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_switchdev_err; } + ret =sxe2_eth_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to initialize eth parameters, ret=%d" , ret); + goto init_eth_err; + } + ret =sxe2_sw_init (dev);if (ret) {PMD_LOG_ERR (INIT ,"Failed to initialize sw parameters, ret=[%d]" , ret);
@@ -1948,12 +1974,6 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_irq_err; } - ret =sxe2_eth_init (dev); -if (ret) { -PMD_LOG_ERR (INIT ,"Failed to initialize eth parameters, ret=%d" , ret); - goto init_eth_err; - } - ret =sxe2_security_init (dev);if (ret) {PMD_LOG_ERR (INIT ,"Failed to initialize security, ret=%d" , ret);
@@ -2005,15 +2025,15 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, init_fc_state_err: (void )sxe2_flow_uninit (dev); init_flow_err: -init_rss_err:sxe2_security_uinit (dev); +init_rss_err: init_security_err: -sxe2_eth_uinit (dev); -init_eth_err:sxe2_intr_uninit (dev); init_irq_err:sxe2_sw_uninit (dev); init_sw_err: +sxe2_eth_uinit (dev); +init_eth_err: (void )sxe2_switchdev_uninit (dev); init_switchdev_err: init_dev_info_err:
@@ -2035,17 +2055,15 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev) (void )sxe2_queues_release (dev);sxe2_mp_uninit (dev); (void )sxe2_sched_uinit (dev); - (void )sxe2_rss_disable (dev); (void )sxe2_flow_uninit (dev); + (void )sxe2_rss_disable (dev); (void )sxe2_udp_tunnel_port_clear (dev); -sxe2_vsi_uninit (dev);sxe2_security_uinit (dev);sxe2_intr_uninit (dev); (void )sxe2_switchdev_uninit (dev);sxe2_sw_uninit (dev); - (void )sxe2_switchdev_uninit (dev); -sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev); +sxe2_vsi_uninit (dev);sxe2_dev_pci_map_uinit (dev);sxe2_free_repr_info (dev);sxe2_fc_state_uinit (dev);
@@ -2068,9 +2086,11 @@ static int32_t sxe2_dev_uninit(struct rte_eth_dev *dev)for (i =0 ; i < adapter->repr_ctxt.nb_repr_vf; i++) { rep_dev = adapter->repr_ctxt.vf_rep_eth_dev[i];if (rep_dev) { - ret = rep_dev->dev_ops->dev_close (rep_dev); -if (ret) - goto l_end; +if (rep_dev->dev_ops && rep_dev->dev_ops->dev_close) { + ret = rep_dev->dev_ops->dev_close (rep_dev); +if (ret) + goto l_end; + }if (rep_dev->intr_handle)rte_intr_instance_free (rep_dev->intr_handle); ret =rte_eth_dev_release_port (rep_dev);
@@ -2143,42 +2163,25 @@ static int32_t sxe2_fw_version_string_get(struct rte_eth_dev *dev, char *fw_versreturn ret; } -static uint16_t sxe2_switchdev_repr_id_encode_get (struct sxe2_switchdev_info *switchdev_info) -{ -enum rte_eth_representor_type type; -uint16_t repr = switchdev_info->vf_num; -uint32_t pf = switchdev_info->pf_num; - -switch (switchdev_info->port_name_type) { -case SXE2_PHYS_PORT_NAME_TYPE_UPLINK : -if (!switchdev_info->representor) -return UINT16_MAX ; - type =RTE_ETH_REPRESENTOR_PF ; - pf = switchdev_info->mpesw_owner; -break ; -case SXE2_PHYS_PORT_NAME_TYPE_PFVF : -default : - type =RTE_ETH_REPRESENTOR_VF ; -break ; - } - -return SXE2_REPRESENTOR_ID (pf, type, repr); -} -static bool sxe2_switchdev_repr_match (struct sxe2_adapter *adapter,struct rte_eth_devargs *req_eth_da) { -uint32_t port_idx =0 ; -uint32_t repr_idx; -uint16_t kernel_repr_id =sxe2_switchdev_repr_id_encode_get (&adapter->switchdev_info); -uint16_t repr_id; +uint16_t port_idx =UINT16_MAX ; +uint16_t repr_idx; +uint16_t vf_id; +uint16_t i;switch (req_eth_da->type) {case RTE_ETH_REPRESENTOR_PF : +if (adapter->switchdev_info.port_name_type != +SXE2_PHYS_PORT_NAME_TYPE_UPLINK ) { + rte_errno =EBUSY ; +return false; + }break ;case RTE_ETH_REPRESENTOR_VF :if (adapter->switchdev_info.port_name_type != -SXE2_PHYS_PORT_NAME_TYPE_PFVF ) { +SXE2_PHYS_PORT_NAME_TYPE_PFVF ) { rte_errno =EBUSY ;return false; }
@@ -2191,15 +2194,30 @@ static bool sxe2_switchdev_repr_match(struct sxe2_adapter *adapter,return false; } +for (port_idx =0 ; port_idx < req_eth_da->nb_ports; ++port_idx) { +if (adapter->switchdev_info.pf_num != req_eth_da->ports[port_idx]) { +PMD_DEV_LOG_DEBUG (adapter,DRV ,"switchdev pf %u not match req pf %u" , + adapter->switchdev_info.pf_num, req_eth_da->ports[port_idx]); + rte_errno =EBUSY ; +return false; + } + } +for (repr_idx =0 ; repr_idx < req_eth_da->nb_representor_ports; ++repr_idx) { - repr_id =SXE2_REPRESENTOR_ID (req_eth_da->ports[port_idx], - req_eth_da->type, - req_eth_da->representor_ports[repr_idx]); -if (repr_id == kernel_repr_id) -return true; - } - rte_errno =EBUSY ; -return false; +for (i =0 ; i < adapter->repr_ctxt.nb_vf; ++i) { + vf_id =rte_le_to_cpu_16 (adapter->repr_ctxt.repr_vf_id[i].func_id); +if (vf_id == req_eth_da->representor_ports[repr_idx]) +break ; + } +if (i == adapter->repr_ctxt.nb_vf) { +PMD_DEV_LOG_DEBUG (adapter,DRV ,"switchdev vf %u not match req vf(cnt:%u)" , + req_eth_da->representor_ports[repr_idx], adapter->repr_ctxt.nb_vf); + rte_errno =EBUSY ; +return false; + } + } + +return true; } static int32_t sxe2_eth_pmd_probe_pf(struct sxe2_common_device *cdev,
@@ -2317,6 +2335,7 @@ static int32_t sxe2_eth_pmd_probe(struct sxe2_common_device *cdev, {struct rte_eth_devargs eth_da = { .nb_ports =0 };int32_t ret =0 ; +uint16_t port; ret =sxe2_parse_eth_devargs (cdev->dev, ð_da);if (ret !=0 ) {
@@ -2324,7 +2343,18 @@ static int32_t sxe2_eth_pmd_probe(struct sxe2_common_device *cdev, goto l_end; } - ret =sxe2_eth_pmd_probe_pf (cdev, ð_da,0 , kvargs); +if (eth_da.nb_ports >0 ) { +for (port =0 ; port < eth_da.nb_ports; port++) { + ret =sxe2_eth_pmd_probe_pf (cdev, ð_da, port, kvargs); +if (ret !=0 ) { +PMD_LOG_ERR (INIT ,"sxe2 eth pmd probe failed, ret=%d" , ret); + (void )sxe2_eth_pmd_remove (cdev); + goto l_end; + } + } + }else { + ret =sxe2_eth_pmd_probe_pf (cdev, ð_da,0 , kvargs); + } l_end:return ret;
drivers/net/sxe2/sxe2_ethdev.h +3 -3
@@ -65,9 +65,6 @@ enum sxe2_fnav_tunnel_flag_type {#define upper_32_bits (n) ((uint32_t)(((n) >> 16) >> 16))#define lower_32_bits (n) ((uint32_t)((n) & 0xffffffff)) -#define SXE2_REPRESENTOR_ID (pf, type, repr) \ - (((pf) << 14) + ((type) << 12) + ((repr) & 0xfff)) -#define SXE2_I2C_EEPROM_DEV_ADDR 0xA0#define SXE2_I2C_EEPROM_DEV_ADDR2 0xA2#define SXE2_MODULE_TYPE_SFP 0x03
@@ -356,6 +353,9 @@ struct sxe2_adapter {#define SXE2_DEV_PRIVATE_TO_ADAPTER (dev) \ ((struct sxe2_adapter *)(dev)->data->dev_private) +#define SXE2_PCI_REG_WRITE (reg, value) rte_write32((rte_cpu_to_le_32(value)), (reg)) +#define SXE2_PCI_REG_READ (reg) rte_read32(reg) +void *sxe2_pci_map_addr_get (struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type,uint16_t idx_in_func);
drivers/net/sxe2/sxe2_queue.h +0 -2
@@ -12,8 +12,6 @@#include "sxe2_drv_cmd.h" #include "sxe2_txrx_common.h" -#define SXE2_PCI_REG_READ (reg) \ - rte_read32(reg)#define SXE2_PCI_REG_WRITE_WC (reg, value) \ rte_write32_wc((rte_cpu_to_le_32(value)), reg)#define SXE2_PCI_REG_WRITE_WC_RELAXED (reg, value) \
Signature · 1 line
2.52.0
PATCH 5/13 net/sxe2: improve representor device initialization
In reply to [email protected]From: Jie Liu <[email protected]>
This patch enhances the representor device initialization with:
- Add statistics initialization in sxe2_repr_dev_init
* Call sxe2_stats_init to setup statistics infrastructure
* Add proper error handling path for stats init failure
- Add representor device naming and NUMA node assignment:
* Update device name format to use base device name prefix
* Set numa_node from parent device data for proper NUMA locality
* Ensures representor devices are allocated on the same NUMA node
- Code style improvements:
* Align struct member fields in sxe2_adapter for consistency
--- drivers/net/sxe2/sxe2_ethdev.h | 24 ++++++++++++------------ drivers/net/sxe2/sxe2_ethdev_repr.c | 13 +++++++++++-- 2 files changed, 23 insertions(+), 14 deletions(-)
drivers/net/sxe2/sxe2_ethdev.h +12 -12
@@ -314,10 +314,10 @@ struct sxe2_fc_state_ctxt { };struct sxe2_adapter { -struct sxe2_common_device *cdev; -struct sxe2_dev_info dev_info; -struct rte_pci_device *pci_dev; -struct sxe2_repr_private_data *repr_priv_data; +struct sxe2_common_device *cdev; +struct sxe2_dev_info dev_info; +struct rte_pci_device *pci_dev; +struct sxe2_repr_private_data *repr_priv_data;struct sxe2_pci_map_context map_ctxt;struct sxe2_irq_context irq_ctxt;struct sxe2_queue_context q_ctxt;
@@ -338,16 +338,16 @@ struct sxe2_adapter {bool rule_started;bool flow_isolated;bool flow_isolate_cfg; -uint16_t dev_port_id; +uint16_t dev_port_id;bool is_dev_repr; -uint64_t cap_flags; +uint64_t cap_flags;enum sxe2_dev_type dev_type; -struct rte_ether_addr mac_addr; -uint8_t port_idx; -uint8_t pf_idx; -uint32_t tx_mode_flags; -uint32_t rx_mode_flags; -uint8_t started; +struct rte_ether_addr mac_addr; +uint8_t port_idx; +uint8_t pf_idx; +uint32_t tx_mode_flags; +uint32_t rx_mode_flags; +uint8_t started; };#define SXE2_DEV_PRIVATE_TO_ADAPTER (dev) \
drivers/net/sxe2/sxe2_ethdev_repr.c +11 -2
@@ -483,8 +483,16 @@ int32_t sxe2_repr_dev_init(struct rte_eth_dev *dev, goto l_init_sw_err; } + ret =sxe2_stats_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to initialize stats, ret=[%d]" , ret); + goto l_init_irq_ctxt_err; + } + goto l_end; +l_init_irq_ctxt_err: +sxe2_sw_irq_ctxt_uninit (dev); l_init_sw_err:sxe2_eth_uinit (dev); l_init_eth_err:
@@ -544,8 +552,8 @@ int32_t sxe2_switchdev_repr_devs_init(struct sxe2_adapter *adapter, }for (repr_idx =0 ; repr_idx < req_eth_da->nb_representor_ports; ++repr_idx) { -snprintf (name,sizeof (name),"sxe2_representor_c%dpf%d%s%u" , - adapter->pf_idx, adapter->pf_idx, +snprintf (name,sizeof (name),"%s_representor_%s%u" , + adapter->cdev->dev->name,"vf" , req_eth_da->representor_ports[repr_idx]);
@@ -554,6 +562,7 @@ int32_t sxe2_switchdev_repr_devs_init(struct sxe2_adapter *adapter, ret = -ENOMEM ; goto l_release_port; } + eth_dev->data->numa_node = adapter->dev_info.dev_data->numa_node; eth_dev->data->dev_private = rte_zmalloc_socket(name, sizeof(struct sxe2_adapter), RTE_CACHE_LINE_SIZE,
Signature · 1 line
2.52.0
PATCH 6/13 net/sxe2: refactor flow tunnel port handling
In reply to [email protected]From: Jie Liu <[email protected]>
This patch refactors flow tunnel port handling and adds support for PF bond devices:
- Refactor tunnel port functions from pattern module to flow module:
* Move sxe2_flow_parse_pattern_ipip from sxe2_flow_parse_pattern.c
* Move sxe2_flow_add_udp_tunnel_port from sxe2_flow_parse_pattern.c
* Move sxe2_flow_add_tunnel_port from public API to static function
* Remove public function declaration from header file
* Keep functions internal to flow module for better encapsulation
- Add PF bond device support in flow source split processing:
* Add bond_member_cnt field to sxe2_adapter structure
* Handle SXE2_DEV_T_PF_BOND device type in sxe2_flow_src_split_proc
* Populate flow_src_vsi for all bond members
- Enhance ACL engine support in flow actions:
* Add ACL engine support in flow action checks
* Allow PASSTHRU action for ACL engine
--- drivers/net/sxe2/sxe2_ethdev.h | 1 + drivers/net/sxe2/sxe2_flow.c | 144 ++++++++++++++++++++- drivers/net/sxe2/sxe2_flow_parse_action.c | 18 ++- drivers/net/sxe2/sxe2_flow_parse_pattern.c | 113 ---------------- drivers/net/sxe2/sxe2_flow_parse_pattern.h | 7 - 5 files changed, 151 insertions(+), 132 deletions(-)
drivers/net/sxe2/sxe2_ethdev.h +1 -0
@@ -340,6 +340,7 @@ struct sxe2_adapter {bool flow_isolate_cfg;uint16_t dev_port_id;bool is_dev_repr; +uint16_t bond_member_cnt;uint64_t cap_flags;enum sxe2_dev_type dev_type;struct rte_ether_addr mac_addr;
drivers/net/sxe2/sxe2_flow.c +137 -7
163 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.c +13 -5
@@ -25,15 +25,21 @@ static int32_t sxe2_flow_check_rss_action_attr(const struct rte_flow_action_rss goto l_end; } -if (rss->level >2 ) +if (rss->level >2 ) {rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"RSS level is could not be greater than 2" ); -if (rss->key_len) + goto l_end; + } +if (rss->key_len) {rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"a nonzero RSS key_len is not supported" ); -if (rss->queue_num) + goto l_end; + } +if (rss->queue_num) {rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION ,NULL ,"a non-NULL RSS queue is not supported" ); + goto l_end; + } ret =0 ; l_end:return ret;
@@ -953,7 +959,8 @@ static int32_t sxe2_flow_check_actions(struct rte_eth_dev *dev __rte_unused, str } } -if (engine_type ==SXE2_FLOW_ENGINE_FNAV ) { +if (engine_type ==SXE2_FLOW_ENGINE_FNAV || + engine_type ==SXE2_FLOW_ENGINE_ACL ) {if (vsi_num) { flow->action.q_region.q_index =0 ; flow->action.q_region.region =7 ;
@@ -988,7 +995,8 @@ int32_t sxe2_flow_parse_action(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_VOID :break ;case RTE_FLOW_ACTION_TYPE_PASSTHRU : -if (engine_type ==SXE2_FLOW_ENGINE_FNAV ) { +if (engine_type ==SXE2_FLOW_ENGINE_FNAV || + engine_type ==SXE2_FLOW_ENGINE_ACL ) {sxe2_set_bit (SXE2_FLOW_ACTION_PASSTHRU , flow->action.act_types); action_num[SXE2_FLOW_ACTION_PASSTHRU ]++; }else {
drivers/net/sxe2/sxe2_flow_parse_pattern.c +0 -113
119 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h +0 -7
@@ -36,11 +36,4 @@ int32_t sxe2_flow_parse_pattern(struct rte_eth_dev *dev,const struct rte_flow_item patterns[], struct rte_flow_error *error, struct sxe2_flow *flow); - -int32_t sxe2_flow_add_tunnel_port (struct rte_eth_dev *dev, -struct rte_flow_error *error, -struct sxe2_flow *flow, -BITMAP_TYPE *flow_type, -enum sxe2_flow_tunnel_type tunnel_type); -#endif /* SXE2_FLOW_PARSE_PATTERN_H_ */
Signature · 1 line
2.52.0
PATCH 7/13 net/sxe2: validate IPsec key length against maximum limit
In reply to [email protected]From: Jie Liu <[email protected]>
Add validation check in sxe2_security_valid_key to ensure source key length does not exceed SXE2_IPSEC_MAX_KEY_LEN. This prevents potential buffer overflows when processing security keys that are longer than the supported maximum length.
--- drivers/net/sxe2/sxe2_ipsec.c | 5 +++++ drivers/net/sxe2/sxe2_security.c | 1 + 2 files changed, 6 insertions(+)
drivers/net/sxe2/sxe2_ipsec.c +5 -0
@@ -254,6 +254,11 @@ static bool sxe2_security_valid_key(uint16_t src_key, uint16_t max_key, goto l_end; } +if (src_key >SXE2_IPSEC_MAX_KEY_LEN ) { + is_valid = false; + goto l_end; + } + is_valid = true; l_end:
drivers/net/sxe2/sxe2_security.c +1 -0
@@ -326,6 +326,7 @@ void sxe2_security_uinit(struct rte_eth_dev *dev)if (sctx !=NULL ) {rte_free (sctx); sctx =NULL ; + dev->security_ctx =NULL ; }sxe2_ipsec_uinit (adapter);
Signature · 1 line
2.52.0
PATCH 8/13 net/sxe2: enhance repr event handling and MP code
In reply to [email protected]From: Jie Liu <[email protected]>
This patch improves representor link state event handling and refactors multi-process message processing:
- Add representor link state event propagation:
* Propagate LSC events to all VF representors when PF link changes
* Get link status and trigger callbacks for each representor
* Only process in primary process for representor callbacks
* Change OICR log format to hexadecimal for better readability
- Refactor primary process message handling:
* Extract work logic to sxe2_mp_do_primary_work helper function
* Use parameter copy to avoid side effects on original message
* Simplify reply construction in primary handler
- Simplify statistics interface:
* Remove qstats parameter from sxe2_mp_req_get_stats
* Remove qstats copy from shared memory
* Update function signature in header and implementation
- Improve error handling and cleanup:
* Change error return from EINVAL to ENODATA when no response
* Simplify sxe2_link_update_init error path
* Remove unnecessary goto statements and cleanup labels
* Remove extra whitespace
--- drivers/net/sxe2/sxe2_irq.c | 27 +++++++++++++---- drivers/net/sxe2/sxe2_mac.c | 10 ++----- drivers/net/sxe2/sxe2_mp.c | 59 +++++++++++++++++++++---------------- 3 files changed, 58 insertions(+), 38 deletions(-)
drivers/net/sxe2/sxe2_irq.c +22 -5
@@ -77,14 +77,32 @@ static int32_t sxe2_fc_state_callback(struct rte_eth_dev *dev)static void sxe2_event_irq_common_handler (struct sxe2_adapter *adapter,uint64_t oicr) {struct rte_eth_dev *dev = &rte_eth_devices[adapter->dev_info.dev_data->port_id]; +struct rte_eth_dev *repr_eth_dev; +struct sxe2_adapter *repr_adapter; +uint8_t vf_id;if (oicr &RTE_BIT32 (SXE2_COM_EC_LINK_CHG )) { -PMD_DEV_LOG_INFO (adapter,DRV ,"OICR=%" PRIu64, oicr); +PMD_DEV_LOG_INFO (adapter,DRV ,"OICR=0x%" PRIx64, oicr); (void )sxe2_drv_mac_link_status_get (adapter); -if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_INTR_LSC ,NULL ); + } +if (adapter->switchdev_info.is_switchdev) { +for (vf_id =0 ; vf_id < adapter->repr_ctxt.nb_repr_vf; vf_id++) { + repr_eth_dev = adapter->repr_ctxt.vf_rep_eth_dev[vf_id]; +if (!repr_eth_dev) +continue ; + repr_adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (repr_eth_dev); + (void )sxe2_drv_mac_link_status_get (repr_adapter); +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { +rte_eth_dev_callback_process (repr_eth_dev, +RTE_ETH_EVENT_INTR_LSC , +NULL ); + } + } + } }if (oicr &RTE_BIT32 (SXE2_COM_SW_MODE_SWITCHDEV )) {PMD_DEV_LOG_INFO (adapter,DRV ,"event notify switchdev" );
@@ -863,12 +881,11 @@ static void sxe2_rxq_intr_unregister(struct rte_eth_dev *dev) (void )sxe2_drv_dev_rxq_irq_set (adapter->cdev, i, &efd,1 );sxe2_rxq_intr_efd_free (irq_ctxt->rxq_event_fd[i]); } +rte_free (irq_ctxt->rxq_event_fd); + irq_ctxt->rxq_event_fd =NULL ; } -rte_free (irq_ctxt->rxq_event_fd); - irq_ctxt->rxq_event_fd =NULL ;rte_intr_vec_list_free (intr_handle); -rte_intr_nb_efd_set (intr_handle,0 );rte_intr_max_intr_set (intr_handle,0 ); }
drivers/net/sxe2/sxe2_mac.c +2 -8
@@ -448,20 +448,14 @@ int32_t sxe2_link_update_init(struct rte_eth_dev *dev)int32_t ret;PMD_INIT_FUNC_TRACE (); -rte_spinlock_init (&adapter->link_ctxt.link_lock); - ret =sxe2_drv_mac_link_status_get (adapter); -if (ret) { +if (ret)PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to get link status, ret=%d" , ret); - goto l_end; - } - - (void )sxe2_link_update (dev,0 ); -l_end:return ret; } + int32_t sxe2_link_update(struct rte_eth_dev *dev, __rte_unused int32_t wait_to_complete) {struct rte_eth_link new_link;
drivers/net/sxe2/sxe2_mp.c +34 -25
96 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH 9/13 net/sxe2: optimize vectorized Tx/Rx path
In reply to [email protected]From: Jie Liu <[email protected]>
This patch optimizes vectorized packet processing with improved buffer management and unified buffer structure:
- Introduce unified Tx buffer structure:
* Add union in sxe2_tx_queue for buffer_ring/buffer_ring_vec
* Use sxe2_tx_buffer_vec for vectorized Tx path
* Eliminate runtime type checking and branching
- Refactor Tx queue reset operations:
* Extract desc ring reset to sxe2_tx_queue_desc_ring_reset
* Add sxe2_tx_queue_reset_vec for vectorized queues
* Simplify buffer initialization in vector mode
- Optimize Tx vector path mbuf release:
* Remove conditional AVX512 branching
* Use direct buffer_vec access without casting
* Simplify loop logic with consistent pattern
* Remove NULL checks after initialization validation
- Refactor Tx queue operations:
* Export sxe2_tx_buffer_ring_free as public API
* Add sxe2_tx_vec_ops_get() for vector operations
* Use operation table instead of direct function calls
- Improve VSI management:
* Initialize other_vsi_list before main VSI creation
* Ignore -EPERM errors when destroying VSI in uninit
* Set main_vsi to NULL after successful destroy
* Prevent dangling pointer references
- Enhance Tx mode function selection:
* Use rte_eth_tx_pkt_prepare_dummy for vectorized paths
* Split NEON simple/offload mode selection logic
* Clean up conditional compilation structure
--- drivers/net/sxe2/sxe2_queue.h | 5 +- drivers/net/sxe2/sxe2_rx.c | 5 +- drivers/net/sxe2/sxe2_switchdev.c | 8 +- drivers/net/sxe2/sxe2_tx.c | 42 +++-- drivers/net/sxe2/sxe2_tx.h | 4 + drivers/net/sxe2/sxe2_txrx.c | 19 +- drivers/net/sxe2/sxe2_txrx_poll.h | 2 - drivers/net/sxe2/sxe2_txrx_vec.c | 79 +++------ drivers/net/sxe2/sxe2_txrx_vec.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 10 +- drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 133 +------------- drivers/net/sxe2/sxe2_txrx_vec_common.h | 9 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 219 ++++++++++++++++-------- drivers/net/sxe2/sxe2_txrx_vec_sse.c | 10 +- drivers/net/sxe2/sxe2_vsi.c | 8 +- 15 files changed, 252 insertions(+), 302 deletions(-)
drivers/net/sxe2/sxe2_queue.h +4 -1
@@ -62,7 +62,10 @@ struct sxe2_txq_ops { };struct sxe2_tx_queue {volatile union sxe2_tx_data_desc *desc_ring; -struct sxe2_tx_buffer *buffer_ring; +union { +struct sxe2_tx_buffer *buffer_ring; +struct sxe2_tx_buffer_vec *buffer_ring_vec; + };volatile uint32_t *tdt_reg_addr;uint64_t offloads;
drivers/net/sxe2/sxe2_rx.c +3 -2
@@ -319,7 +319,8 @@ int32_t __rte_cold sxe2_rx_queue_setup(struct rte_eth_dev *dev, rxq->mb_pool = mp; } - rxq->rx_free_thresh = rx_conf->rx_free_thresh; + rxq->rx_free_thresh = (rx_conf->rx_free_thresh ==0 ) ? +SXE2_DEFAULT_RX_FREE_THRESH : rx_conf->rx_free_thresh; rxq->port_id = dev->data->port_id; rxq->offloads = offloads;if (offloads &RTE_ETH_RX_OFFLOAD_KEEP_CRC )
@@ -550,7 +551,7 @@ void __rte_cold sxe2_rxqs_all_stop(struct rte_eth_dev *dev)static int32_t sxe2_monitor_callback (const uint64_t value, const uint64_t arg[RTE_POWER_MONITOR_OPAQUE_SZ] __rte_unused) { -const uint64_t dd_state =rte_cpu_to_le_64 (SXE2_RX_DESC_STATUS_DD_MASK ); +const uint64_t dd_state =rte_cpu_to_le_64 (SXE2_RX_DESC_STATUS_DD_SHIFT );return (value & dd_state) == dd_state ?-1 :0 ; }
drivers/net/sxe2/sxe2_switchdev.c +1 -7
@@ -316,13 +316,7 @@ int32_t sxe2_switchdev_repr_private_data_init(struct rte_eth_dev *dev, parent_adapter->repr_ctxt.repr_vf_id[repr_id].kernel_vsi_id; repr_priv_data->repr_vf_backup_vsi_id = parent_adapter->repr_ctxt.repr_vf_id[repr_id].dpdk_vsi_id; - - repr_priv_data->repr_vf_vsi_id = - parent_adapter->repr_ctxt.repr_vf_id[repr_id].kernel_vsi_id != -SXE2_INVALID_VSI_ID ? - parent_adapter->repr_ctxt.repr_vf_id[repr_id].kernel_vsi_id : - parent_adapter->repr_ctxt.repr_vf_id[repr_id].dpdk_vsi_id; - + repr_priv_data->repr_vf_vsi_id = repr_priv_data->repr_vf_primary_vsi_id; adapter->repr_priv_data = repr_priv_data; goto l_end; l_free:
drivers/net/sxe2/sxe2_tx.c +31 -11
73 lines not on this page · raw message
drivers/net/sxe2/sxe2_tx.h +4 -0
@@ -9,6 +9,10 @@ void __rte_cold sxe2_tx_queue_reset(struct sxe2_tx_queue *txq); +void __rte_cold sxe2_tx_queue_reset_vec(struct sxe2_tx_queue *txq); + +void __rte_cold sxe2_tx_buffer_ring_free(struct sxe2_tx_queue *txq); + int32_t __rte_cold sxe2_tx_queue_start(struct rte_eth_dev *dev, uint16_t queue_id);void sxe2_tx_queue_mbufs_release (struct sxe2_tx_queue *txq);
drivers/net/sxe2/sxe2_txrx.c +13 -6
@@ -358,7 +358,7 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) }if (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) { - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;#ifdef RTE_ARCH_X86 if (tx_mode_flags &SXE2_TX_MODE_VEC_AVX512 ) {#ifdef CC_AVX512_SUPPORT
@@ -386,21 +386,25 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) }#elif defined(RTE_ARCH_ARM64 )if (tx_mode_flags &SXE2_TX_MODE_VEC_NEON ) { - dev->tx_pkt_prepare = sxe2_tx_pkts_prepare; - dev->tx_pkt_burst = sxe2_tx_pkts_vec_neon; - }else { - dev->tx_pkt_burst = sxe2_tx_pkts_vec_neon_simple; +if (tx_mode_flags &SXE2_TX_MODE_VEC_OFFLOAD ) { + dev->tx_pkt_prepare = sxe2_tx_pkts_prepare; + dev->tx_pkt_burst = sxe2_tx_pkts_vec_neon; + }else { + dev->tx_pkt_burst = sxe2_tx_pkts_vec_neon_simple; + } }#endif }else {if (tx_mode_flags &SXE2_TX_MODE_SIMPLE_BATCH ) { - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy; dev->tx_pkt_burst = sxe2_tx_pkts_simple; }else { dev->tx_pkt_prepare = sxe2_tx_pkts_prepare; dev->tx_pkt_burst = sxe2_tx_pkts; } } +PMD_LOG_DEBUG (TX ,"Tx mode flags:0x%016x port_id:%u." , + tx_mode_flags, dev->data->port_id); } static const struct {
@@ -582,6 +586,9 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev) dev->rx_pkt_burst = sxe2_rx_pkts_scattered_split; else dev->rx_pkt_burst = sxe2_rx_pkts_scattered; + +PMD_LOG_DEBUG (RX ,"Rx mode flags:0x%016x port_id:%u." , + rx_mode_flags, dev->data->port_id); } static const struct {
drivers/net/sxe2/sxe2_txrx_poll.h +0 -2
@@ -13,8 +13,6 @@ uint16_t sxe2_tx_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_tuint16_t sxe2_rx_pkts_scattered (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); -uint16_t sxe2_rx_pkts_scattered (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); -uint16_t sxe2_rx_pkts_scattered_split (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts);#endif /* SXE2_TXRX_POLL_H */
drivers/net/sxe2/sxe2_txrx_vec.c +27 -52
107 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec.h +1 -0
@@ -89,6 +89,7 @@ uint16_t sxe2_rx_pkts_scattered_vec_neon_offload(void *rx_queue, struct rte_mbufuint16_t sxe2_tx_pkts_vec_neon_simple (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);uint16_t sxe2_tx_pkts_vec_neon (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);#endif +struct sxe2_txq_ops sxe2_tx_vec_ops_get (void ); int32_t __rte_cold sxe2_tx_vec_support_check(struct rte_eth_dev *dev, uint32_t *vec_flags); int32_t __rte_cold sxe2_tx_queues_vec_prepare(struct rte_eth_dev *dev); int32_t __rte_cold sxe2_rx_vec_support_check(struct rte_eth_dev *dev, uint32_t *vec_flags);
drivers/net/sxe2/sxe2_txrx_vec_avx2.c +5 -5
@@ -115,7 +115,7 @@ sxe2_tx_pkts_vec_avx2_batch(struct sxe2_tx_queue *txq, struct rte_mbuf **tx_pkts uint16_t nb_pkts, bool with_offloads) {volatile union sxe2_tx_data_desc *desc; -struct sxe2_tx_buffer *buffer; +struct sxe2_tx_buffer_vec *buffer;uint16_t next_use;uint16_t res_num;uint16_t tx_num;
@@ -134,14 +134,14 @@ sxe2_tx_pkts_vec_avx2_batch(struct sxe2_tx_queue *txq, struct rte_mbuf **tx_pkts next_use = txq->next_use; desc = &txq->desc_ring[next_use]; - buffer = &txq->buffer_ring[next_use]; + buffer = &txq->buffer_ring_vec[next_use]; txq->desc_free_num -= nb_pkts; res_num = txq->ring_depth - txq->next_use;if (tx_num >= res_num) { -sxe2_tx_pkts_mbuf_fill (buffer, tx_pkts, res_num); +sxe2_tx_pkts_mbuf_fill_vec (buffer, tx_pkts, res_num);sxe2_tx_desc_fill_avx2 (desc, tx_pkts, res_num,SXE2_TX_DATA_DESC_CMD_EOP , with_offloads);
@@ -157,10 +157,10 @@ sxe2_tx_pkts_vec_avx2_batch(struct sxe2_tx_queue *txq, struct rte_mbuf **tx_pkts next_use =0 ; txq->next_rs = txq->rs_thresh -1 ; desc = &txq->desc_ring[next_use]; - buffer = &txq->buffer_ring[next_use]; + buffer = &txq->buffer_ring_vec[next_use]; } -sxe2_tx_pkts_mbuf_fill (buffer, tx_pkts, tx_num); +sxe2_tx_pkts_mbuf_fill_vec (buffer, tx_pkts, tx_num);sxe2_tx_desc_fill_avx2 (desc, tx_pkts, tx_num,SXE2_TX_DATA_DESC_CMD_EOP , with_offloads);
drivers/net/sxe2/sxe2_txrx_vec_avx512.c +5 -128
180 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec_common.h +5 -4
@@ -25,10 +25,11 @@#define SXE2_TX_FREE_BUFFER_SIZE_MAX_VEC 64 static __rte_always_inline void -sxe2_tx_pkts_mbuf_fill (struct sxe2_tx_buffer *buffer, -struct rte_mbuf **tx_pkts,uint16_t nb_pkts) +sxe2_tx_pkts_mbuf_fill_vec (struct sxe2_tx_buffer_vec *buffer, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {uint16_t i; +for (i =0 ; i < nb_pkts; ++i) buffer[i].mbuf = tx_pkts[i]; }
@@ -36,7 +37,7 @@ sxe2_tx_pkts_mbuf_fill(struct sxe2_tx_buffer *buffer, static __rte_always_inline int32_tsxe2_tx_bufs_free_vec (struct sxe2_tx_queue *txq) { -struct sxe2_tx_buffer *buffer; +struct sxe2_tx_buffer_vec *buffer;struct rte_mbuf *mbuf;struct rte_mbuf *mbuf_free_arr[SXE2_TX_FREE_BUFFER_SIZE_MAX_VEC ];int32_t ret;
@@ -50,7 +51,7 @@ sxe2_tx_bufs_free_vec(struct sxe2_tx_queue *txq) goto l_end; } rs_thresh = txq->rs_thresh; - buffer = &txq->buffer_ring[txq->next_dd - (rs_thresh -1 )]; + buffer = &txq->buffer_ring_vec[txq->next_dd - (rs_thresh -1 )]; mbuf =rte_pktmbuf_prefree_seg (buffer[0 ].mbuf);if (likely (mbuf)) { mbuf_free_arr[0 ] = mbuf;
drivers/net/sxe2/sxe2_txrx_vec_neon.c +143 -76
346 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec_sse.c +5 -5
@@ -40,7 +40,7 @@ sxe2_tx_pkts_vec_sse_batch(struct sxe2_tx_queue *txq, uint16_t nb_pkts, bool with_offloads) {volatile union sxe2_tx_data_desc *desc; -struct sxe2_tx_buffer *buffer; +struct sxe2_tx_buffer_vec *buffer;uint16_t next_use;uint16_t res_num;uint16_t tx_num;
@@ -57,11 +57,11 @@ sxe2_tx_pkts_vec_sse_batch(struct sxe2_tx_queue *txq, tx_num = nb_pkts; next_use = txq->next_use; desc = &txq->desc_ring[next_use]; - buffer = &txq->buffer_ring[next_use]; + buffer = &txq->buffer_ring_vec[next_use]; txq->desc_free_num -= nb_pkts; res_num = txq->ring_depth - txq->next_use;if (tx_num >= res_num) { -sxe2_tx_pkts_mbuf_fill (buffer, tx_pkts, res_num); +sxe2_tx_pkts_mbuf_fill_vec (buffer, tx_pkts, res_num);for (i =0 ; i < res_num -1 ; ++i, ++tx_pkts, ++desc) { sxe2_tx_desc_fill_one_sse(desc, *tx_pkts, SXE2_TX_DATA_DESC_CMD_EOP,
@@ -74,9 +74,9 @@ sxe2_tx_pkts_vec_sse_batch(struct sxe2_tx_queue *txq, next_use =0 ; txq->next_rs = txq->rs_thresh -1 ; desc = &txq->desc_ring[next_use]; - buffer = &txq->buffer_ring[next_use]; + buffer = &txq->buffer_ring_vec[next_use]; } -sxe2_tx_pkts_mbuf_fill (buffer, tx_pkts, tx_num); +sxe2_tx_pkts_mbuf_fill_vec (buffer, tx_pkts, tx_num);for (i =0 ; i < tx_num; ++i, ++tx_pkts, ++desc) { sxe2_tx_desc_fill_one_sse(desc, *tx_pkts, SXE2_TX_DATA_DESC_CMD_EOP,
drivers/net/sxe2/sxe2_vsi.c +5 -3
@@ -230,7 +230,7 @@ int32_t sxe2_vsi_init(struct rte_eth_dev *dev)uint16_t srcvsi_cnt;PMD_INIT_FUNC_TRACE (); - +TAILQ_INIT (&adapter->vsi_ctxt.other_vsi_list); ret =sxe2_main_vsi_create (adapter);if (ret) {PMD_LOG_ERR (DRV ,"Failed to create main VSI, ret=%d" , ret);
@@ -283,13 +283,14 @@ void sxe2_vsi_uninit(struct rte_eth_dev *dev) l_free: ret =sxe2_vsi_destroy (adapter, adapter->vsi_ctxt.main_vsi); -if (ret) { +if (ret && ret != -EPERM ) {PMD_LOG_ERR (DRV ,"Failed to del vsi from fw, ret=%d" , ret); goto l_end; } + adapter->vsi_ctxt.main_vsi =NULL ; RTE_TAILQ_FOREACH_SAFE(var, &adapter->vsi_ctxt.other_vsi_list, next, tvar) { ret =sxe2_vsi_destroy (adapter, var); -if (ret) { +if (ret && ret != -EPERM ) {PMD_LOG_ERR (DRV ,"Failed to del vsi from fw, ret=%d" , ret);break ; }
@@ -357,4 +358,5 @@ void sxe2_vsi_repr_main_vsi_destroy(struct rte_eth_dev *dev)struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev);sxe2_vsi_node_free (adapter->vsi_ctxt.main_vsi); + adapter->vsi_ctxt.main_vsi =NULL ; }
Signature · 1 line
2.52.0
PATCH 10/13 common/sxe2: allow munmap during kernel reset
In reply to [email protected]From: Jie Liu <[email protected]>
This patch improves error handling and resource management:
- Add NULL pointer protection in driver remove path:
* Check cdrv and cdrv->remove before calling remove function
* Prevent NULL pointer dereference in sxe2_classes_driver_remove
* Return SXE2_SUCCESS if no driver or remove handler exists
- Allow memory unmap during kernel reset:
* Remove kernel_reset restriction in sxe2_drv_dev_munmap
* Enable cleanup operations even when kernel has been reset
--- drivers/common/sxe2/sxe2_common.c | 5 ++++- drivers/common/sxe2/sxe2_ioctl_chnl.c | 8 +------- 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/common/sxe2/sxe2_common.c +4 -1
@@ -465,8 +465,11 @@ static int32_t sxe2_classes_driver_probe(struct sxe2_common_device *cdev,static int32_t sxe2_classes_driver_remove (struct sxe2_common_device *cdev) {struct sxe2_class_driver *cdrv = cdev->cdrv; +int32_t ret =0 ; -return cdrv->remove (cdev); +if (cdrv !=NULL && cdrv->remove !=NULL ) + ret = cdrv->remove (cdev); +return ret; }static int32_t sxe2_kvargs_validate (struct sxe2_dev_kvargs_info *kv_info)
drivers/common/sxe2/sxe2_ioctl_chnl.c +1 -7
@@ -367,16 +367,10 @@ voidRTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_munmap) int32_t -sxe2_drv_dev_munmap (struct sxe2_common_device *cdev,void *virt,uint64_t len) +sxe2_drv_dev_munmap(struct sxe2_common_device *cdev __rte_unused, void *virt, uint64_t len) {int32_t ret =0 ; -if (cdev->config.kernel_reset) { - ret = -EPERM ; -PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); - goto l_end; - } -PMD_LOG_DEBUG (COM ,"Munmap virt=%p, len=0x%" PRIx64"" , virt, len);
Signature · 1 line
2.52.0
PATCH 11/13 net/sxe2: clean up duplicate function declarations
In reply to [email protected]From: Jie Liu <[email protected]>
This commit removes duplicate function declarations in the sxe2 driver header files.
- Remove duplicate sxe2_drv_promisc_config declaration in sxe2_cmd_chnl.h
- Remove duplicate sxe2_drv_vsi_info_get declaration in sxe2_cmd_chnl.h
- Remove duplicate sxe2_drv_mac_link_status_get declaration in sxe2_cmd_chnl.h
- Remove duplicate sxe2_drv_rxq_mapping_set declaration in sxe2_cmd_chnl.h
- Remove duplicate sxe2_dev_pci_seg_unmap declaration in sxe2_ethdev.h
--- drivers/net/sxe2/sxe2_cmd_chnl.h | 6 ------ drivers/net/sxe2/sxe2_ethdev.h | 2 -- 2 files changed, 8 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.h +0 -6
@@ -65,8 +65,6 @@ int32_t sxe2_drv_ipsec_rxsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_ipsec_txsa_delete (struct sxe2_adapter *adapter,uint16_t sa_id); -int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); -int32_t sxe2_drv_udp_tunnel_add (struct sxe2_adapter *adapter,enum sxe2_udp_tunnel_protocol tunnel_proto,uint16_t udp_port);
@@ -84,8 +82,6 @@ int32_t sxe2_drv_get_udp_tunnel_port(struct sxe2_adapter *adapter,int32_t sxe2_drv_vsi_info_get (struct sxe2_adapter *adapter,struct sxe2_vsi *vsi); -int32_t sxe2_drv_vsi_info_get (struct sxe2_adapter *adapter,struct sxe2_vsi *vsi); -int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter);int32_t sxe2_drv_get_mac_stats (struct sxe2_adapter *adapter);
@@ -110,8 +106,6 @@ int32_t sxe2_drv_mapping_reset(struct rte_eth_dev *eth_dev);int32_t sxe2_drv_mapping_stats_info_clear (struct rte_eth_dev *eth_dev); -int32_t sxe2_drv_rxq_mapping_set (struct rte_eth_dev *eth_dev,uint16_t queue_id,uint8_t pool_idx); -int32_t sxe2_drv_allmulti_config (struct sxe2_adapter *adapter,bool set);int32_t sxe2_drv_uc_config (struct sxe2_adapter *adapter,struct rte_ether_addr *addr,bool add);
drivers/net/sxe2/sxe2_ethdev.h +0 -2
@@ -387,8 +387,6 @@ void sxe2_dev_pci_seg_unmap(struct sxe2_adapter *adapter, uint32_t res_type);int32_t sxe2_dev_pci_map_init (struct rte_eth_dev *dev); -void sxe2_dev_pci_seg_unmap (struct sxe2_adapter *adapter,uint32_t res_type); -int32_t sxe2_udp_tunnel_port_del_common (struct sxe2_adapter *ad,enum sxe2_udp_tunnel_protocol tunnel_proto,uint16_t udp_port);
Signature · 1 line
2.52.0
PATCH 12/13 net/sxe2: clean up structure definitions
In reply to [email protected]From: Jie Liu <[email protected]>
This commit removes packed attributes and unused reserved fields from structure definitions in the sxe2 driver header file.
- Remove packed attributes and rsv[2] field from sxe2_tm_res structure
- Remove packed attributes from sxe2_tm_info structure
- Remove packed attributes from sxe2_txq_map_info structure
- Remove packed attributes from sxe2_rxq_map_info structure
- Remove packed attributes from sxe2_queue_map_info structure
- Remove packed attributes from sxe2_drv_sfp_req structure
- Remove packed attributes from sxe2_drv_sfp_resp structure
- Remove unused rsv[3] field from sxe2_drv_link_info_resp structure
--- drivers/net/sxe2/sxe2_drv_cmd.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/net/sxe2/sxe2_drv_cmd.h +14 -16
@@ -230,7 +230,6 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_info_get_resp { struct __rte_aligned(4) __rte_packed_begin sxe2_drv_link_info_resp { uint32_t speed;uint8_t status; -uint8_t rsv[3 ]; } __rte_packed_end; struct __rte_aligned(4) __rte_packed_begin sxe2_switchdev_info {
@@ -348,18 +347,17 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_rss_hf_req {uint8_t rsv1[3 ]; } __rte_packed_end; -struct __rte_aligned(4) __rte_packed_begin sxe2_tm_res { +struct sxe2_tm_res {uint16_t teid; -uint8_t rsv[2 ]; -} __rte_packed_end; +}; -struct __rte_aligned(4) __rte_packed_begin sxe2_tm_info { +struct sxe2_tm_info {uint32_t committed;uint32_t peak;uint8_t priority;uint8_t reserve;uint16_t weight; -} __rte_packed_end; +}; struct __rte_aligned(4) __rte_packed_begin sxe2_tm_add_mid_msg { uint16_t parent_teid;
@@ -526,24 +524,24 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_mac_stats_resp {uint64_t prio_xon_2_xoff[SXE2_MAX_USER_PRIORITY ]; } __rte_packed_end; -struct __rte_aligned(4) __rte_packed_begin sxe2_txq_map_info { +struct sxe2_txq_map_info {uint32_t txq_lan_pkt_cnt;uint32_t txq_lan_byte_cnt; -} __rte_packed_end; +}; -struct __rte_aligned(4) __rte_packed_begin sxe2_rxq_map_info { +struct sxe2_rxq_map_info {uint64_t rxq_lan_in_pkt_cnt;uint64_t rxq_lan_in_byte_cnt;uint64_t rxq_fd_in_pkt_cnt;uint64_t rxq_mng_in_pkt_cnt;uint64_t rxq_mng_in_byte_cnt;uint64_t rxq_mng_out_pkt_cnt; -} __rte_packed_end; +}; -struct __rte_aligned(4) __rte_packed_begin sxe2_queue_map_info { +struct sxe2_queue_map_info {struct sxe2_rxq_map_info rxq_stats_map_info[SXE2_RXQ_STATS_MAP_MAX_NUM ];struct sxe2_txq_map_info txq_stats_map_info[SXE2_TXQ_STATS_MAP_MAX_NUM ]; -} __rte_packed_end; +}; struct __rte_aligned(4) __rte_packed_begin sxe2_drv_rx_map_req { uint16_t queue_id;
@@ -633,7 +631,7 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_resp {uint8_t rsv; } __rte_packed_end; -struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_req { +struct sxe2_drv_sfp_req {uint8_t is_wr;uint8_t is_qsfp;uint16_t bus_addr;
@@ -642,14 +640,14 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_req {uint16_t data_len;uint16_t rvd;uint8_t data[]; -} __rte_packed_end; +}; -struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_resp { +struct sxe2_drv_sfp_resp {uint8_t is_wr;uint8_t is_qsfp;uint16_t data_len;uint8_t data[]; -} __rte_packed_end; +};enum sxe2_fc_type {SXE2_FC_T_DIS =0 ,
Signature · 1 line
2.52.0
PATCH 13/13 doc/sxe2: add acl-stat-type parameter documentation
In reply to [email protected]From: Jie Liu <[email protected]>
This commit adds documentation for the acl-stat-type parameter which controls ACL statistics type used for ACL rule hit counting.
- 1: Only count the number of packets
- 2: Only count the number of bytes
- 3: Count both packets and bytes (default)
--- doc/guides/nics/sxe2.rst | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)
doc/guides/nics/sxe2.rst +10 -23
@@ -98,29 +98,16 @@ Runtime Configuration Default value is 3 (count both packets and bytes). -- ``drv-sw-stats`` parameter [int] - - This parameter controls whether per-packet software statistics (SW stats) - are collected in the Rx data path. - - Hardware packet statistic counters may be inaccurate for certain packet types - due to hardware design limitations. - When accuracy of Rx packet classification statistics is critical, - enabling this parameter allows the driver to accumulate statistics in software - as packets are received, providing an alternative statistical path - that bypasses hardware counter inaccuracies. - - - 0: Disable software statistics collection (default). - The basic port statistics (``ipackets``, ``ibytes``) are reported - from the hardware counters. - - 1: Enable software statistics collection. - Per-packet software statistics are accumulated for unicast, - multicast, broadcast, and dropped packets in the Rx data path. - - When enabled, the following extended statistics (xstats) are available: - ``rx_sw_unicast_packets``, ``rx_sw_multicast_packets``, - ``rx_sw_broadcast_packets``, ``rx_sw_drop_packets``, - and ``rx_sw_drop_bytes``. +- ``acl-stat-type`` parameter [int] + + This parameter controls the ACL statistics type + used for ACL rule hit counting (via ``rte_flow_query``). + + - 1: Only count the number of packets. + - 2: Only count the number of bytes. + - 3: Count both packets and bytes (default). + + Default value is 3 (count both packets and bytes). - ``no-sched-mode`` parameter [int]
Signature · 1 line
2.52.0
Quoted 47 lines · On Mon, 17 Aug 2026 10:53:26 +0800 [email protected] wrote:
From: Jie Liu <[email protected]>
Jie Liu (13):
net/sxe2: add Rx queue buffer split fill support net/sxe2: update switchdev repr VSI ID display format net/sxe2: add ACL engine event statistics support net/sxe2: enhance device cap and res management net/sxe2: improve representor device initialization net/sxe2: refactor flow tunnel port handling net/sxe2: validate IPsec key length against maximum limit net/sxe2: enhance repr event handling and MP code net/sxe2: optimize vectorized Tx/Rx path common/sxe2: allow munmap during kernel reset net/sxe2: clean up duplicate function declarations net/sxe2: clean up structure definitions doc/sxe2: add acl-stat-type parameter documentationdoc/guides/nics/sxe2.rst | 33 +-- drivers/common/sxe2/sxe2_common.c | 5 +- drivers/common/sxe2/sxe2_ioctl_chnl.c | 8 +- drivers/net/sxe2/sxe2_cmd_chnl.c | 215 +++++++++++++++-- drivers/net/sxe2/sxe2_cmd_chnl.h | 15 +- drivers/net/sxe2/sxe2_drv_cmd.h | 47 ++-- drivers/net/sxe2/sxe2_dump.c | 10 +- drivers/net/sxe2/sxe2_ethdev.c | 203 +++++++++------- drivers/net/sxe2/sxe2_ethdev.h | 38 +-- drivers/net/sxe2/sxe2_ethdev_repr.c | 13 +- drivers/net/sxe2/sxe2_flow.c | 259 +++++++++++++++++---- drivers/net/sxe2/sxe2_flow.h | 6 +- drivers/net/sxe2/sxe2_flow_define.h | 13 +- drivers/net/sxe2/sxe2_flow_parse_action.c | 37 ++- drivers/net/sxe2/sxe2_flow_parse_pattern.c | 113 --------- drivers/net/sxe2/sxe2_flow_parse_pattern.h | 7 - drivers/net/sxe2/sxe2_ipsec.c | 5 + drivers/net/sxe2/sxe2_irq.c | 27 ++- drivers/net/sxe2/sxe2_mac.c | 10 +- drivers/net/sxe2/sxe2_mp.c | 59 +++-- drivers/net/sxe2/sxe2_queue.c | 2 + drivers/net/sxe2/sxe2_queue.h | 7 +- drivers/net/sxe2/sxe2_rx.c | 5 +- drivers/net/sxe2/sxe2_security.c | 1 + drivers/net/sxe2/sxe2_switchdev.c | 12 +- drivers/net/sxe2/sxe2_tx.c | 42 +++- drivers/net/sxe2/sxe2_tx.h | 4 + drivers/net/sxe2/sxe2_txrx.c | 19 +- drivers/net/sxe2/sxe2_txrx_poll.h | 2 - drivers/net/sxe2/sxe2_txrx_vec.c | 79 +++----
Quoted 9 lines
drivers/net/sxe2/sxe2_txrx_vec.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 10 +- drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 133 +---------- drivers/net/sxe2/sxe2_txrx_vec_common.h | 9 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 219 +++++++++++------ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 10 +- drivers/net/sxe2/sxe2_vsi.c | 8 +- 37 files changed, 989 insertions(+), 697 deletions(-)
Multiple build failures.
FAILED: drivers/libtmp_rte_net_sxe2.a.p/net_sxe2_sxe2_txrx_vec_neon.c.o
cc -Idrivers/libtmp_rte_net_sxe2.a.p -Idrivers -I../drivers -Idrivers/net/sxe2 -I../drivers/net/sxe2 -Idrivers/common/sxe2 -I../drivers/common/sxe2 -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/arm/include -I../lib/eal/arm/include -I../kernel/linux -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/argparse -I../lib/argparse -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -Ilib/cryptodev -I../lib/cryptodev -Ilib/security -I../lib/security -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -fPIC -mcpu=neoverse-n1 -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -g -DRTE_COMPONENT_CLASS=pmd_net -DRTE_COMPONENT_NAME=sxe2 -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe2 -MD -MQ drivers/libtmp_rte_net_sxe2.a.p/net_sxe2_sxe2_txrx_vec_neon.c.o -MF drivers/libtmp_rte_net_sxe2.a.p/net_sxe2_sxe2_txrx_vec_neon.c.o.d -o drivers/libtmp_rte_net_sxe2.a.p/net_sxe2_sxe2_txrx_vec_neon.c.o -c ../drivers/net/sxe2/sxe2_txrx_vec_neon.c ../drivers/net/sxe2/sxe2_txrx_vec_neon.c: In function ‘sxe2_tx_desc_fill_4_neon_simple’:../drivers/net/sxe2/sxe2_txrx_vec_neon.c:79:22: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
79 | vst1q_u64_x4((uint64_t *)desc, v);
| ^../drivers/net/sxe2/sxe2_txrx_vec_neon.c: In function ‘sxe2_rx_pkts_common_vec_neon’:../drivers/net/sxe2/sxe2_txrx_vec_neon.c:458:54: error: ‘struct sxe2_adapter’ has no member named ‘ptype_tbl’
458 | const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
| ^~