net/sxe2: added Linkdata sxe ethernet driver
Subsystems (2)
PATCH v6 11/23 drivers: interrupt handling
In reply to [email protected]From: Jie Liu <[email protected]>
This patch includes:
- MSI-X vector allocation and mapping logic.
- Support for rx_queue_intr_enable and rx_queue_intr_disable ops.
- Interrupt handler to process admin and queue events.
- Integration with EAL interrupt framework.
RX queue interrupts allow applications to use rte_eth_dev_rx_intr_wait() for power-efficient packet processing.
--- drivers/common/sxe2/sxe2_ioctl_chnl.c | 176 +++- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 42 + drivers/net/sxe2/sxe2_cmd_chnl.h | 4 + drivers/net/sxe2/sxe2_drv_cmd.h | 8 + drivers/net/sxe2/sxe2_ethdev.c | 93 +- drivers/net/sxe2/sxe2_ethdev.h | 6 + drivers/net/sxe2/sxe2_irq.c | 942 +++++++++++++++++++++ drivers/net/sxe2/sxe2_irq.h | 21 + drivers/net/sxe2/sxe2vf_regs.h | 85 ++ 11 files changed, 1393 insertions(+), 3 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
drivers/common/sxe2/sxe2_ioctl_chnl.c +174 -2
@@ -67,6 +67,7 @@ sxe2_drv_cmd_exec(struct sxe2_common_device *cdev,return ret; } +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_open) int32_tsxe2_drv_dev_open (struct sxe2_common_device *cdev,struct rte_pci_device *pci_dev)
@@ -87,7 +88,7 @@ sxe2_drv_dev_open(struct sxe2_common_device *cdev, struct rte_pci_device *pci_deif (fd <0 ) { ret = -EBADF ;PMD_LOG_ERR (COM ,"Fail to open device:%s, ret=%d, err:%s" , - drv_name, ret,strerror (errno)); + drv_name, ret,strerror (errno)); goto l_end; }
@@ -159,6 +160,177 @@ sxe2_drv_dev_handshake(struct sxe2_common_device *cdev)return ret; } +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_rxq_irq_set) +int32_t +sxe2_drv_dev_rxq_irq_set (struct sxe2_common_device *cdev, +uint16_t base_irq,int32_t *efd,uint16_t nb_irq) +{ +struct sxe2_ioctl_irq_set cmd_params; +int32_t ret =0 ; +int32_t cmd_fd =0 ; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set rxq irq, base_queue=%d, efds=%p, nb_irq=%d" , + cmd_fd, base_irq, efd, nb_irq); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_irq_set )); + cmd_params.base_irq_in_com = base_irq; + cmd_params.cnt = nb_irq; + cmd_params.event_fd = efd; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_IO_IRQS_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set io irqs, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_other_irq_set) +int32_t +sxe2_drv_dev_other_irq_set (struct sxe2_common_device *cdev, +int32_t efd,uint64_t event) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_other_evt_set cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set other irq, efd=%d, event=%" PRIu64"" , + cmd_fd, efd, event); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_other_evt_set )); + cmd_params.eventfd = efd; + cmd_params.filter_table = event; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_EVT_IRQ_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set others evt, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_other_irq_get) +int32_t +sxe2_drv_dev_other_irq_get (struct sxe2_common_device *cdev,uint64_t *event) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_other_evt_get cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to get other irq" , cmd_fd); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_other_evt_get )); + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_EVT_CAUSE_GET , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set others evt, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + *event = cmd_params.evt_cause; + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_reset_irq_set) +int32_t +sxe2_drv_dev_reset_irq_set (struct sxe2_common_device *cdev,int32_t efd) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_reset_sub_set cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set reset irq, efd=%d" , + cmd_fd, efd); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_reset_sub_set )); + cmd_params.eventfd = efd; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_RST_IRQ_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set reset irqs, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_mmap) void *sxe2_drv_dev_mmap (struct sxe2_common_device *cdev,uint8_t bar_idx,uint64_t len,uint64_t offset)
@@ -223,7 +395,7 @@ sxe2_drv_dev_munmap(struct sxe2_common_device *cdev, void *virt, uint64_t len)RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_dma_map) int32_tsxe2_drv_dev_dma_map (struct sxe2_common_device *cdev,uint64_t vaddr, -uint64_t iova,uint64_t size) +uint64_t iova,uint64_t size) {struct sxe2_ioctl_iommu_dma_map cmd_params;enum rte_iova_mode iova_mode;
drivers/common/sxe2/sxe2_ioctl_chnl_func.h +18 -0
@@ -29,6 +29,7 @@ int32_t sxe2_drv_dev_open(struct sxe2_common_device *cdev, struct rte_pci_device *pci_dev); +__rte_internal voidsxe2_drv_dev_close (struct sxe2_common_device *cdev);
@@ -37,6 +38,23 @@ __rte_internalint32_t sxe2_drv_dev_handshake (struct sxe2_common_device *cdev); +__rte_internal +int32_t +sxe2_drv_dev_rxq_irq_set (struct sxe2_common_device *cdev,uint16_t base_irq, +int32_t *efd,uint16_t nb_irq); + +__rte_internal +int32_t +sxe2_drv_dev_other_irq_set (struct sxe2_common_device *cdev,int32_t efd,uint64_t event); + +__rte_internal +int32_t +sxe2_drv_dev_other_irq_get (struct sxe2_common_device *cdev,uint64_t *event); + +__rte_internal +int32_t +sxe2_drv_dev_reset_irq_set (struct sxe2_common_device *cdev,int32_t fd); +__rte_internal void *sxe2_drv_dev_mmap(struct sxe2_common_device *cdev, uint8_t bar_idx,
drivers/net/sxe2/meson.build +1 -0
@@ -68,4 +68,5 @@ sources += files( 'sxe2_security.c', 'sxe2_mp.c', 'sxe2_stats.c', + 'sxe2_irq.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +42 -0
48 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +4 -0
@@ -118,4 +118,8 @@ int32_t sxe2_drv_rss_hf_clear(struct sxe2_adapter *adapter);int32_t sxe2_drv_ptp_gettime (struct sxe2_adapter *adapter,struct sxe2_rx_queue *rxq); +int32_t sxe2_drv_rxq_bind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx,uint16_t msix_idx); + +int32_t sxe2_drv_rxq_unbind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +8 -0
@@ -556,6 +556,14 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_tx_map_req {uint8_t pool_idx; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_queue_irq_bind_req { + uint16_t q_idx; +uint16_t msix_idx; +uint8_t itr_idx; +uint8_t bind; +uint8_t rsv[2 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +92 -1
161 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +6 -0
@@ -350,6 +350,12 @@ int32_t sxe2_dev_pci_res_seg_map(struct sxe2_adapter *adapter,uint32_t item_cnt, uint32_t item_base); +void sxe2_pci_map_write_reg (struct sxe2_adapter *adapter, +enum sxe2_pci_map_resource res_type,uint16_t idx_in_func,uint32_t value); + +uint32_t sxe2_pci_map_read_reg (struct sxe2_adapter *adapter, +enum sxe2_pci_map_resource res_type,uint16_t idx_in_func); +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);
drivers/net/sxe2/sxe2_irq.c new file +942 -0
942 lines not on this page · raw message
drivers/net/sxe2/sxe2_irq.h +21 -0
@@ -45,4 +45,25 @@ struct sxe2_irq_context { int32_t *rxq_event_fd; }; +uint32_t sxe2_drv_dev_other_cause_get (struct sxe2_adapter *adapter); + +int32_t sxe2_intr_init (struct rte_eth_dev *dev); + +void sxe2_intr_uninit (struct rte_eth_dev *dev); + +int32_t sxe2_sw_irq_ctxt_init (struct rte_eth_dev *dev); + +void sxe2_sw_irq_ctxt_uninit (struct rte_eth_dev *dev); + +void sxe2_sw_irq_ctx_hw_cap_set (struct sxe2_adapter *adapter, +struct sxe2_drv_msix_caps *msix_caps); + +int32_t sxe2_rxq_intr_enable (struct rte_eth_dev *dev); + +void sxe2_rxq_intr_disable (struct rte_eth_dev *dev); + +int32_t sxe2_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); + +int32_t sxe2_rx_queue_intr_disable (struct rte_eth_dev *dev,uint16_t queue_id); +#endif /* SXE2_IRQ_H */
drivers/net/sxe2/sxe2vf_regs.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v6 12/23 net/sxe2: add NEON vec Rx/Tx burst functions
In reply to [email protected]From: Jie Liu <[email protected]>
- Implement sxe2_recv_pkts_vec_neon for bulk packet receiving.
- Implement sxe2_xmit_pkts_vec_neon for bulk packet transmission.
- Added logic to select the vectorized path based on runtime config and CPU flags (RTE_ARCH_ARM64).
Vectorized path improves throughput for small packets by processing multiple descriptors simultaneously using SIMD instructions.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_txrx.c | 39 +- drivers/net/sxe2/sxe2_txrx_vec.h | 16 +- drivers/net/sxe2/sxe2_txrx_vec_common.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 ++++++++++++++++++++++++ 5 files changed, 742 insertions(+), 5 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c
drivers/net/sxe2/meson.build +2 -0
@@ -48,6 +48,8 @@ if arch_subdir == 'x86' include_directories: includes, c_args: [cflags, '-mavx2']) objs += sxe2_avx2_lib.extract_objects('sxe2_txrx_vec_avx2.c') +elif arch_subdir == 'arm' + sources += files('sxe2_txrx_vec_neon.c') endif sources += files(
drivers/net/sxe2/sxe2_txrx.c +36 -3
@@ -175,6 +175,9 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev)if ((0 == (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ))) tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ; +#elif defined(RTE_ARCH_ARM64 ) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) ==1 ) + tx_mode_flags |= (vec_flags |SXE2_TX_MODE_VEC_NEON );#endif if (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) { ret =sxe2_tx_queues_vec_prepare (dev);
@@ -218,8 +221,15 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_burst = sxe2_tx_pkts_vec_sse_simple; } } - }else { +#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; + }#endif + }else {if (tx_mode_flags &SXE2_TX_MODE_SIMPLE_BATCH ) { dev->tx_pkt_prepare =NULL ; dev->tx_pkt_burst = sxe2_tx_pkts_simple;
@@ -227,9 +237,7 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_prepare = sxe2_tx_pkts_prepare; dev->tx_pkt_burst = sxe2_tx_pkts; } -#ifdef RTE_ARCH_X86 } -#endif } static const struct {
@@ -253,6 +261,12 @@ static const struct { { sxe2_tx_pkts_vec_sse_simple, "Vector SSE Simple" }, #endif +#ifdef RTE_ARCH_ARM64 + { sxe2_tx_pkts_vec_neon, + "Vector NEON" }, + { sxe2_tx_pkts_vec_neon_simple, + "Vector NEON Simple" }, +#endif }; int32_t sxe2_tx_burst_mode_get(struct rte_eth_dev *dev,
@@ -356,6 +370,11 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev)if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) rx_mode_flags |=SXE2_RX_MODE_VEC_SSE ; + +#elif defined(RTE_ARCH_ARM64 ) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) ==1 ) { + rx_mode_flags |= (vec_flags |SXE2_RX_MODE_VEC_NEON ); + }#endif if ((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) !=0 ) { ret =sxe2_rx_queues_vec_prepare (dev);
@@ -387,6 +406,14 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev) }return ; } +#elif defined(RTE_ARCH_ARM64) +if (rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) { +if (rx_mode_flags &SXE2_RX_MODE_VEC_OFFLOAD ) + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_neon_offload; +else + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_neon; +return ; + }#endif if (sxe2_rx_offload_en_check (dev,RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT )) dev->rx_pkt_burst = sxe2_rx_pkts_scattered_split;
@@ -416,6 +443,12 @@ static const struct { { sxe2_rx_pkts_scattered_vec_sse_offload, "Vector SSE Scattered" }, #endif +#ifdef RTE_ARCH_ARM64 + { sxe2_rx_pkts_scattered_vec_neon, + "Vector NEON Scattered" }, + { sxe2_rx_pkts_scattered_vec_neon_offload, + "Offload Vector NEON Scattered" }, +#endif }; int32_t sxe2_rx_burst_mode_get(struct rte_eth_dev *dev,
drivers/net/sxe2/sxe2_txrx_vec.h +14 -2
@@ -13,19 +13,23 @@#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2)#define SXE2_RX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4) +#define SXE2_RX_MODE_VEC_NEON RTE_BIT32(5)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ - SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512) + SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512 | \ + SXE2_RX_MODE_VEC_NEON)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2)#define SXE2_TX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4) +#define SXE2_TX_MODE_VEC_NEON RTE_BIT32(5)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ - SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512) + SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512 | \ + SXE2_TX_MODE_VEC_NEON)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -76,6 +80,14 @@ uint16_t sxe2_rx_pkts_scattered_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_avx2_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); + +#elif defined(RTE_ARCH_ARM64 ) +uint16_t sxe2_rx_pkts_scattered_vec_neon (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_neon_offload (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_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 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);
drivers/net/sxe2/sxe2_txrx_vec_common.h +1 -0
@@ -2,6 +2,7 @@* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. */ +#ifndef SXE2_TXRX_VEC_COMMON_H #define SXE2_TXRX_VEC_COMMON_H
drivers/net/sxe2/sxe2_txrx_vec_neon.c new file +689 -0
689 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v6 13/23 drivers: add support for VF representors
In reply to [email protected]From: Jie Liu <[email protected]>
Add support for VF representors in sxe2 PMD. This allows the host application (e.g., OVS-DPDK) to control and monitor virtual functions through a dedicated ethdev on the PF (Physical Function) side.
Key changes include:
- Added representor enumeration and identification logic.
- Implemented representor-specific dev_ops (link update, stats, etc.).
- Configured back-channel communication between PF and VF for control messages.
- Supported the "-a <DBDF>,representor=[0-N]" EAL parameter to instantiate representor ports.
--- drivers/common/sxe2/sxe2_common.c | 46 + drivers/common/sxe2/sxe2_common.h | 2 + drivers/net/sxe2/meson.build | 6 + drivers/net/sxe2/sxe2_cmd_chnl.c | 311 +++- drivers/net/sxe2/sxe2_cmd_chnl.h | 28 + drivers/net/sxe2/sxe2_drv_cmd.h | 55 +- drivers/net/sxe2/sxe2_ethdev.c | 203 ++- drivers/net/sxe2/sxe2_ethdev.h | 11 + drivers/net/sxe2/sxe2_ethdev_repr.c | 606 +++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 121 +- drivers/net/sxe2/sxe2_filter.h | 2 + drivers/net/sxe2/sxe2_flow.c | 1334 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 29 + drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 +++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1822 ++++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 40 + drivers/net/sxe2/sxe2_irq.c | 54 + drivers/net/sxe2/sxe2_irq.h | 4 + drivers/net/sxe2/sxe2_queue.c | 6 +- drivers/net/sxe2/sxe2_stats.c | 17 +- drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_txrx.c | 7 + drivers/net/sxe2/sxe2_txrx_poll.c | 8 + drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- 30 files changed, 6568 insertions(+), 23 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h
drivers/common/sxe2/sxe2_common.c +46 -0
@@ -169,6 +169,37 @@ static int32_t sxe2_parse_class_type(const char *key, const char *value, void *areturn ret; } +static int32_t sxe2_parse_driver (const char *key,const char *value,void *args) +{ +int32_t ret = -EINVAL ; + +if (value ==NULL || args ==NULL ) { + ret =0 ; + goto l_end; + } + +if (strcmp (value,"sxe2" ) !=0 ) { +PMD_LOG_ERR (COM ,"%s: \"%s\" is not a valid driver." , + key, value); + goto l_end; + } +l_end: +return ret; +} + +static int32_t sxe2_parse_representor (const char *key,const char *value,void *args) +{ +int32_t ret =0 ; + +if (value ==NULL || args ==NULL ) + goto l_end; + +PMD_LOG_INFO (COM ,"representor arg %s: \"%s\"." , key, value); + +l_end: +return ret; +} +static int32_t sxe2_common_device_setup (struct sxe2_common_device *cdev) {struct rte_pci_device *pci_dev =RTE_BUS_DEVICE (cdev->dev, *pci_dev);
@@ -394,6 +425,21 @@ static int32_t sxe2_common_pci_probe(struct rte_pci_driver *pci_drv __rte_unused goto l_free_args; } + ret =sxe2_kvargs_process (kv_info_p,SXE2_DEVARGS_KEY_DRIVER , + sxe2_parse_driver,NULL ); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Unsupported sxe2 driver name: %s" , + rte_dev->devargs->args); + goto l_free_args; + } + + ret =sxe2_kvargs_process (kv_info_p,SXE2_DEVARGS_KEY_REPR , + sxe2_parse_representor,NULL ); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Unsupported sxe2 driver representor: %s" , + rte_dev->devargs->args); + goto l_free_args; + } } cdev =sxe2_common_device_alloc (rte_dev, class_type);
drivers/common/sxe2/sxe2_common.h +2 -0
@@ -18,6 +18,8 @@ ((cdev)->config.cmd_fd)#define SXE2_DEVARGS_KEY_CLASS "class" +#define SXE2_DEVARGS_KEY_DRIVER "driver" +#define SXE2_DEVARGS_KEY_REPR "representor"struct sxe2_class_driver ;
drivers/net/sxe2/meson.build +6 -0
@@ -71,4 +71,10 @@ sources += files( 'sxe2_mp.c', 'sxe2_stats.c', 'sxe2_irq.c', + 'sxe2_switchdev.c', + 'sxe2_ethdev_repr.c', + 'sxe2_flow.c', + 'sxe2_flow_parse_action.c', + 'sxe2_flow_parse_pattern.c', + 'sxe2_flow_parse_engine.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +307 -4
356 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +28 -0
@@ -12,6 +12,9 @@int32_t sxe2_drv_dev_caps_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_caps_resp *dev_caps); +int32_t sxe2_drv_switchdev_info_get (struct sxe2_adapter *adapter, +struct sxe2_switchdev_info *switchdev_info); +int32_t sxe2_drv_dev_info_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_info_resp *dev_info_resp);
@@ -64,6 +67,8 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +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);
@@ -91,6 +96,15 @@ 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); +int32_t sxe2_drv_switchdev_uplink_config (struct sxe2_adapter *adapter,bool set); + +int32_t sxe2_drv_switchdev_repr_vf_config (struct sxe2_adapter *adapter, +struct sxe2_switchdev_repr_info *repr_vf,bool set); + +int32_t sxe2_drv_switchdev_cpvsi_get (struct sxe2_adapter *adapter,uint16_t *cp_vsi_id); + +int32_t sxe2_drv_switchdev_mode_get (struct sxe2_adapter *adapter,bool *is_switchdev); +int32_t sxe2_drv_mc_config (struct sxe2_adapter *adapter,struct rte_ether_addr *addr,bool add);int32_t sxe2_drv_vlan_config_query (struct sxe2_adapter *adapter);
@@ -122,4 +136,18 @@ int32_t sxe2_drv_rxq_bind_irq(struct sxe2_adapter *adapter, uint16_t rxq_idx, uiint32_t sxe2_drv_rxq_unbind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx); +int32_t sxe2_drv_flow_filter_add (struct sxe2_adapter *adapter,struct sxe2_flow *flow); + +int32_t sxe2_drv_flow_filter_del (struct sxe2_adapter *adapter,struct sxe2_flow *flow); + +int32_t sxe2_drv_flow_fnav_get_stat_id (struct sxe2_adapter *adapter,uint32_t *stat_id); + +int32_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); + +int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter, +uint16_t *vsi_list,uint16_t vsi_cnt,bool set); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +54 -1
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +197 -6
336 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +11 -0
@@ -65,6 +65,9 @@ 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
@@ -309,16 +312,20 @@ struct sxe2_adapter {struct sxe2_vsi_context vsi_ctxt;struct sxe2_filter_context filter_ctxt;struct sxe2_rss_context rss_ctxt; +struct sxe2_flow_context flow_ctxt;struct sxe2_link_context link_ctxt;struct sxe2_ptp_context ptp_ctxt;struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs;struct sxe2_security_ctx security_ctx; +struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info;bool rule_started;bool flow_isolated; +bool flow_isolate_cfg;uint16_t dev_port_id; +bool is_dev_repr;uint64_t cap_flags;enum sxe2_dev_type dev_type;struct rte_ether_addr mac_addr;
@@ -336,6 +343,8 @@ void *sxe2_pci_map_addr_get(struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type, uint16_t idx_in_func); +bool sxe2_ethdev_check (struct rte_eth_dev *dev); +uint32_t sxe2_sched_mode_get (struct sxe2_adapter *adapter); struct sxe2_pci_map_bar_info *sxe2_dev_get_bar_info(struct sxe2_adapter *adapter,
@@ -362,6 +371,8 @@ int32_t sxe2_dev_pci_map_init(struct rte_eth_dev *dev);void sxe2_dev_pci_map_uinit (struct rte_eth_dev *dev); +void sxe2_eth_uinit (struct rte_eth_dev *dev); +static inline bool sxe2_dev_port_vlan_check (struct rte_eth_dev *dev) {
drivers/net/sxe2/sxe2_ethdev_repr.c new file +606 -0
606 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev_repr.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SX2_ETHDEV_REPR_H__ +#define __SX2_ETHDEV_REPR_H__ +#include <rte_compat.h> +#include <rte_kvargs.h> +#include <rte_time.h> +#include <ethdev_driver.h> +#include <ethdev_pci.h> +#include <rte_tm_driver.h> +#include <rte_io.h> +#include <rte_ethdev.h> +#include <rte_alarm.h> +#include <rte_dev_info.h> + +#include "sxe2_vsi.h" +#include "sxe2_irq.h" +#include "sxe2_queue.h" +struct sxe2_adapter ; + +void sxe2_repr_all_close (struct rte_eth_dev *dev); + +int32_t sxe2_repr_dev_init (struct rte_eth_dev *dev, +struct sxe2_adapter *parent_adapter, +uint16_t repr_id); + +int32_t sxe2_switchdev_repr_devs_init (struct sxe2_adapter *adapter, +struct rte_eth_devargs *req_eth_da); + +#endif /* __SX2_ETHDEV_REPR_H__ */
drivers/net/sxe2/sxe2_filter.c +117 -4
145 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.h +2 -0
@@ -89,6 +89,8 @@ int32_t sxe2_l2_rule_update(struct sxe2_adapter *adapter);int32_t sxe2_filter_rule_stop (struct rte_eth_dev *dev); +int32_t sxe2_switchdev_rule_update (struct sxe2_adapter *adapter); +int32_t sxe2_filter_rule_start (struct rte_eth_dev *dev);int32_t sxe2_filter_init (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow.c new file +1334 -0
1,279 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.c new file +1182 -0
1,182 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.h new file +23 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_flow_parse_engine.c new file +106 -0
106 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_engine.h new file +13 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_flow_parse_pattern.c new file +1822 -0
1,822 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_irq.c +54 -0
54 lines not on this page · raw message
drivers/net/sxe2/sxe2_switchdev.c new file +332 -0
332 lines not on this page · raw message
drivers/net/sxe2/sxe2_switchdev.h new file +33 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_vsi.c +146 -0
146 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.52.0
Part of the diff is not shown here. View the raw message.
PATCH v6 14/23 net/sxe2: add support for custom UDP tunnel ports
In reply to [email protected]From: Jie Liu <[email protected]>
This patch enables the configuration of custom UDP port numbers for tunneling protocols in the SXE2 PMD.
The change includes:
- Adding a new entry in the tunnel port lookup table.
- Updating the hardware profile to recognize
the custom UDP port as a tunnel type.
- Enabling inner header parsing for packets arriving on these ports.
This allows the Switch module to correctly apply recipes based on inner packet fields (e.g., inner MAC or IP).
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 96 ++++++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 17 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 16 ++ drivers/net/sxe2/sxe2_ethdev.c | 200 ++++++++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 9 + drivers/net/sxe2/sxe2_flow.c | 54 ++++++ drivers/net/sxe2/sxe2_flow.h | 3 +- drivers/net/sxe2/sxe2_flow_define.h | 1 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 113 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 6 + drivers/net/sxe2/sxe2_txrx_poll.c | 46 ++++- 11 files changed, 557 insertions(+), 4 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +96 -0
@@ -1455,6 +1455,102 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,return ret; } +int32_t sxe2_drv_udp_tunnel_add (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_proto; + req.port = udp_port; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_ADD , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to add udp proto %d port %d, ret=%d" , + tunnel_proto, udp_port, ret); + +return ret; +} + +int32_t sxe2_drv_udp_tunnel_del (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_proto; + req.port = udp_port; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_DEL , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to del udp proto %d port %d, ret=%d" , + tunnel_proto, udp_port, ret); + +return ret; +} + +int32_t sxe2_drv_get_udp_tunnel_port (struct sxe2_adapter *adapter, +enum sxe2_flow_udp_tunnel_protocol proto, +uint16_t *port) +{ +int32_t ret =0 ; +static const uint16_t flow_proto_to_udp_tunnel_proto[SXE2_FLOW_UDP_TUNNEL_MAX ] = { + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_VXLAN ] =SXE2_UDP_TUNNEL_PROTOCOL_VXLAN , + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_VXLAN_GPE ] =SXE2_UDP_TUNNEL_PROTOCOL_VXLAN_GPE , + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_GENEVE ] =SXE2_UDP_TUNNEL_PROTOCOL_GENEVE , + [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 = {}; + + tunnel_config.protocol = flow_proto_to_udp_tunnel_proto[proto]; + ret =sxe2_drv_udp_tunnel_get (adapter, &tunnel_config); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to get udp tunnel port, ret=%d" , ret); + goto l_end; + } + + *port = tunnel_config.fw_port; +l_end: +return ret; +} + +int32_t sxe2_drv_udp_tunnel_get (struct sxe2_adapter *adapter, +struct sxe2_udp_tunnel_cfg *tunnel_config) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_udp_tunnel_resp resp = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_config->protocol; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_GET , + &req,sizeof (req), + &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to get udp proto %d port, ret=%d" , req.type, ret); + + tunnel_config->fw_port = resp.port; + tunnel_config->fw_status = resp.enable; + tunnel_config->fw_dst_en = resp.dst; + tunnel_config->fw_src_en = resp.src; + tunnel_config->fw_used = resp.fw_used; + +return ret; +} +int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter,struct eth_queue_stats *qstats) {struct sxe2_drv_cmd_params param = {0 };
drivers/net/sxe2/sxe2_cmd_chnl.h +17 -0
@@ -67,6 +67,23 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,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); + +int32_t sxe2_drv_udp_tunnel_del (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port); + +int32_t sxe2_drv_udp_tunnel_get (struct sxe2_adapter *adapter, +struct sxe2_udp_tunnel_cfg *tunnel_config); + +int32_t sxe2_drv_get_udp_tunnel_port (struct sxe2_adapter *adapter, +enum sxe2_flow_udp_tunnel_protocol proto, +uint16_t *port); + +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);
drivers/net/sxe2/sxe2_drv_cmd.h +16 -0
@@ -617,6 +617,22 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_flow_fnav_query_stat_resp {uint64_t stat_bytes; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_req { + uint8_t type; +uint8_t rsv; +uint16_t port; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_resp { + uint8_t type; +uint8_t enable; +uint8_t dst; +uint8_t src; +uint16_t port; +uint8_t fw_used; +uint8_t rsv; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +198 -2
247 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +9 -0
@@ -318,6 +318,7 @@ struct sxe2_adapter {struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs; +struct sxe2_udp_tunnel_ctx udp_tunnel_ctx;struct sxe2_security_ctx security_ctx;struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info;
@@ -369,6 +370,14 @@ 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); + +int32_t sxe2_udp_tunnel_port_add_common (struct sxe2_adapter *ad, +enum sxe2_udp_tunnel_protocol tunnel_proto,uint16_t udp_port); +void sxe2_dev_pci_map_uinit (struct rte_eth_dev *dev);void sxe2_eth_uinit (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow.c +54 -0
72 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow.h +2 -1
@@ -8,7 +8,6 @@#include "sxe2_osal.h" #include "sxe2_common.h" -int32_t sxe2_flow_ops_get (struct rte_eth_dev *dev,const struct rte_flow_ops **ops);int32_t sxe2_flow_init (struct rte_eth_dev *dev);
@@ -26,4 +25,6 @@ int32_t sxe2_flow_query_mgr(struct sxe2_adapter *adapter,struct sxe2_flow *flow, struct sxe2_fnav_cid_mgr **mgr_ptr, struct rte_flow_error *error); + +int32_t sxe2_flow_init_udp_tunnel_port (struct rte_eth_dev *dev);#endif /* __SXE2_FLOW_H__ */
drivers/net/sxe2/sxe2_flow_define.h +1 -0
@@ -119,6 +119,7 @@ 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; +uint16_t tunnel_port_list[SXE2_FLOW_UDP_TUNNEL_MAX ];uint32_t fnav_inited; };#define SXE2_INVALID_RSS_ATTR \
drivers/net/sxe2/sxe2_flow_parse_pattern.c +113 -0
119 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h +6 -0
@@ -37,4 +37,10 @@ int32_t sxe2_flow_parse_pattern(struct rte_eth_dev *dev,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_ */
drivers/net/sxe2/sxe2_txrx_poll.c +45 -1
58 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v6 15/23 net/sxe2: support firmware version reading
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the logic to retrieve the firmware version and Build ID from the hardware during device initialization.
The version is exposed to applications through the dev_info_get API.
--- drivers/net/sxe2/sxe2_ethdev.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
drivers/net/sxe2/sxe2_ethdev.c +34 -1
@@ -119,7 +119,8 @@ static int32_t sxe2_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *tunnel_udp);static int32_t sxe2_udp_tunnel_port_del (struct rte_eth_dev *dev,struct rte_eth_udp_tunnel *tunnel_udp); - +static int32_t sxe2_fw_version_string_get (struct rte_eth_dev *dev, +char *fw_version,size_t fw_size);static const struct eth_dev_ops sxe2_eth_dev_ops = { .dev_configure = sxe2_dev_configure,
@@ -180,6 +181,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .xstats_reset = sxe2_stats_info_reset, .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, + + .fw_version_get = sxe2_fw_version_string_get, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -1556,6 +1559,36 @@ static int32_t sxe2_eth_pmd_remove(struct sxe2_common_device *cdev)return ret; } +static int32_t sxe2_fw_version_string_get (struct rte_eth_dev *dev,char *fw_version,size_t fw_size) +{ +struct sxe2_adapter *adapter = +SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_fw_info *fw_info = &adapter->dev_info.fw; +int32_t ret_len; +int32_t ret; + + ret_len =snprintf (fw_version, fw_size, +"%u.%u.%u.%u" , + fw_info->main_version_id, + fw_info->sub_version_id, + fw_info->fix_version_id, + fw_info->build_id); + +if (ret_len <0 ) { + ret = -EINVAL ; + goto out; + } + + ret_len +=1 ; +if (fw_size < (size_t )ret_len) + ret = -EINVAL ; +else + ret =0 ; + +out: +return ret; +} +static uint16_t sxe2_switchdev_repr_id_encode_get (struct sxe2_switchdev_info *switchdev_info) {enum rte_eth_representor_type type;
Signature · 1 line
2.52.0
PATCH v6 16/23 net/sxe2: implement get monitor address
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the 'get_monitor_addr' ethdev ops in the sxe2 PMD. This interface allows the Ethernet device to provide the address of the next expected Rx descriptor to the power management library.
The implementation calculates the address of the next Rx descriptor based on the receive queue's current hardware ring position and descriptor size. Applications can then use this address with rte_power_monitor() to put the CPU into a low-power state until new packets are written to the descriptor by the hardware.
--- drivers/net/sxe2/sxe2_ethdev.c | 2 ++ drivers/net/sxe2/sxe2_rx.c | 21 +++++++++++++++++++++ drivers/net/sxe2/sxe2_rx.h | 2 ++ 3 files changed, 25 insertions(+)
drivers/net/sxe2/sxe2_ethdev.c +2 -0
@@ -183,6 +183,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, .fw_version_get = sxe2_fw_version_string_get, + + .get_monitor_addr = sxe2_get_monitor_addr, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
drivers/net/sxe2/sxe2_rx.c +21 -0
@@ -534,3 +534,24 @@ 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 ); +return (value & dd_state) == dd_state ?-1 :0 ; +} + +int32_t sxe2_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc) +{ +volatile union sxe2_rx_desc *rxdp; +struct sxe2_rx_queue *rxq = (struct sxe2_rx_queue *)rx_queue; + + rxdp = &rxq->desc_ring[rxq->processing_idx]; + + pmc->addr = &rxdp->wb.status_err_ptype_len; + pmc->fn = sxe2_monitor_callback; + pmc->size =sizeof (uint16_t ); + +return 0 ; +}
drivers/net/sxe2/sxe2_rx.h +2 -0
@@ -29,4 +29,6 @@ int32_t __rte_cold sxe2_rxqs_all_start(struct rte_eth_dev *dev); void __rte_cold sxe2_rxqs_all_stop(struct rte_eth_dev *dev); +int32_t sxe2_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc); +#endif /* SXE2_RX_H */
Signature · 1 line
2.52.0
PATCH v6 17/23 common/sxe2: add shared SFP module definitions
In reply to [email protected]From: Jie Liu <[email protected]>
This patch adds a new shared header file 'sxe2_msg.h' which contains definitions for SFP/SFP+ modules. This file is shared across Firmware, Kernel driver, and DPDK PMD to ensure consistent protocol handling.
The header includes:
- SFP EEPROM memory map offsets.
- Module type encoding definitions.
By using this shared header, the PMD can correctly identify module capabilities and report diagnostic information in a way that is consistent with the underlying firmware logic.
--- drivers/common/sxe2/sxe2_msg.h | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 drivers/common/sxe2/sxe2_msg.h
drivers/common/sxe2/sxe2_msg.h new file +118 -0
@@ -0,0 +1,118 @@ + +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_MSG_H__ +#define __SXE2_MSG_H__ + +enum sfp_type_identifier { +SXE2_SFP_TYPE_UNKNOWN =0x00 , +SXE2_SFP_TYPE_SFP =0x03 , + +SXE2_SFP_TYPE_QSFP_PLUS =0x0D , +SXE2_SFP_TYPE_QSFP28 =0x11 , + +SXE2_SFP_TYPE_MAX =0xFF , +}; + +#ifndef SFP_DEFINE +#define SFP_DEFINE + +#define SXE2_SFP_EEP_WR 0x1 +#define SXE2_SFP_EEP_QSFP 0x1 + +enum sfp_bus_addr { +SXE2_SFP_EEP_I2C_ADDR0 =0xA0 , +SXE2_SFP_EEP_I2C_ADDR1 =0xA2 , +SXE2_SFP_EEP_I2C_ADDR_NR =0xFFFF , +}; + +struct sxe2_sfp_req { +uint8_t is_wr; +uint8_t is_qsfp; +uint16_t bus_addr; +uint16_t page_cnt; +uint16_t offset; +uint16_t data_len; +uint16_t rvd; +uint8_t data[]; +}; + +struct sxe2_sfp_resp { +uint8_t is_wr; +uint8_t is_qsfp; +uint16_t data_len; +uint8_t data[]; +}; + +enum sfp_page_cnt { +SXE2_SFP_EEP_PAGE_CNT0 =0 , +SXE2_SFP_EEP_PAGE_CNT1 , +SXE2_SFP_EEP_PAGE_CNT2 , +SXE2_SFP_EEP_PAGE_CNT3 , +SXE2_SFP_EEP_PAGE_CNT20 =20 , +SXE2_SFP_EEP_PAGE_CNT21 =21 , + +SXE2_SFP_EEP_PAGE_CNT_NR =0xFFFF , +}; + +#define SXE2_SFP_E2P_I2C_7BIT_ADDR0 (SXE2_SFP_EEP_I2C_ADDR0 >> 1) +#define SXE2_SFP_E2P_I2C_7BIT_ADDR1 (SXE2_SFP_EEP_I2C_ADDR1 >> 1) + +#define SXE2_QSFP_PAGE_OFST_START 128 +#define SXE2_SFP_EEP_OFST_MAX 255 +#define SXE2_SFP_EEP_LEN_MAX 256 +#endif + +#ifndef FW_STATE_DEFINE +#define FW_STATE_DEFINE + +#define SXE2_FW_STATUS_MAIN_SHIF (16) +#define SXE2_FW_STATUS_MAIN_MASK (0xFF0000) +#define SXE2_FW_STATUS_SUB_MASK (0xFFFF) + +enum Sxe2FwStateMain { +SXE2_FW_STATE_MAIN_UNDEFINED =0x00 , +SXE2_FW_STATE_MAIN_INIT =0x10000 , +SXE2_FW_STATE_MAIN_RUN =0x20000 , +SXE2_FW_STATE_MAIN_ABNOMAL =0x30000 , +}; + +enum Sxe2FwState { +SXE2_FW_START_STATE_UNDEFINED =SXE2_FW_STATE_MAIN_UNDEFINED , +SXE2_FW_START_STATE_INIT_BASE = (SXE2_FW_STATE_MAIN_INIT +0x1 ), +SXE2_FW_START_STATE_SCAN_DEVICE = (SXE2_FW_STATE_MAIN_INIT +0x20 ), +SXE2_FW_START_STATE_FINISHED = (SXE2_FW_STATE_MAIN_RUN +0x0 ), +SXE2_FW_START_STATE_UPGRADE = (SXE2_FW_STATE_MAIN_RUN +0x1 ), +SXE2_FW_START_STATE_SYNC = (SXE2_FW_STATE_MAIN_RUN +0x2 ), +SXE2_FW_RUNNING_STATE_ABNOMAL = (SXE2_FW_STATE_MAIN_ABNOMAL +0x1 ), +SXE2_FW_RUNNING_STATE_ABNOMAL_CORE1 = (SXE2_FW_STATE_MAIN_ABNOMAL +0x2 ), +SXE2_FW_RUNNING_STATE_ABNOMAL_HEART = (SXE2_FW_STATE_MAIN_ABNOMAL +0x3 ), +SXE2_FW_START_STATE_MASK = (SXE2_FW_STATUS_MAIN_MASK |SXE2_FW_STATUS_SUB_MASK ), +}; +#endif + +#ifndef LED_DEFINE +#define LED_DEFINE + +enum sxe2_led_mode { +SXE2_IDENTIFY_LED_BLINK_ON =0 , +SXE2_IDENTIFY_LED_BLINK_OFF , +SXE2_IDENTIFY_LED_ON , +SXE2_IDENTIFY_LED_OFF , +SXE2_IDENTIFY_LED_RESET , +}; + + +typedef struct sxe2_led_ctrl { +uint32_t mode; +uint32_t duration; +}sxe2_led_ctrl_s ; + +typedef struct sxe2_led_ctrl_resp { +uint32_t ack; +}sxe2_led_ctrl_resp_s ; +#endif + +#endif /* __SXE2_MSG_H__ */
Signature · 1 line
2.52.0
PATCH v6 18/23 net/sxe2: support SFP module info and EEPROM access
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements 'get_module_info' and 'get_module_eeprom' ops for the sxe2 PMD. These interfaces allow applications to retrieve the type of the plugged-in optical module and read its internal EEPROM data.
The implementation utilizes the shared SFP header definitions to parse the module ID, connector type, and encoding. It supports reading the standard 256-byte EEPROM maps (SFF-8472 for SFP and SFF-8636 for QSFP) via hardware-specific access commands.
Key features:
- Identify module types (SFP/SFP+/QSFP/QSFP28).
- Support standard EEPROM data retrieval for diagnostic tools.
- Add boundary checks to ensure safe I2C memory access.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 46 +++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 3 + drivers/net/sxe2/sxe2_drv_cmd.h | 18 ++ drivers/net/sxe2/sxe2_ethdev.c | 298 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_ethdev.h | 9 + 5 files changed, 374 insertions(+)
drivers/net/sxe2/sxe2_cmd_chnl.c +46 -0
@@ -1833,3 +1833,49 @@ int32_t sxe2_drv_srcvsi_prune_config(struct sxe2_adapter *adapter,return ret; } + +int32_t sxe2_drv_sfp_eeprom_read (struct sxe2_adapter *adapter,struct sxe2_sfp_read_info *sfp_info) +{ +int32_t ret =-1 ; +struct sxe2_drv_sfp_req req = {0 }; +struct sxe2_drv_sfp_resp *resp =NULL ; +struct sxe2_drv_cmd_params cmd = {0 }; + + resp =rte_zmalloc ("read sfp data" ,sizeof (*resp) + sfp_info->len,0 ); +if (!resp) { +PMD_LOG_ERR (DRV ,"Alloc memory failed" ); + ret = -ENOMEM ; + goto l_end; + } + + req.is_wr = false; + req.is_qsfp = sfp_info->is_qsfp; + req.page_cnt =rte_cpu_to_le_16 (sfp_info->page_cnt); + req.offset =rte_cpu_to_le_16 (sfp_info->offset); + req.data_len =rte_cpu_to_le_16 (sfp_info->len); + req.bus_addr =rte_cpu_to_le_16 (sfp_info->bus_addr); + +PMD_DEV_LOG_INFO (adapter,DRV ,"is_qsfp=%u, page_cnt=%u, offset=%u, datalen=%u, " +"bus_addr=%u" , sfp_info->is_qsfp, sfp_info->page_cnt, sfp_info->offset, + sfp_info->len, sfp_info->bus_addr); + +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_OPT_EEP_GET , + &req,sizeof (req), + resp,sizeof (*resp) + sfp_info->len); + ret =sxe2_drv_cmd_exec (adapter->cdev, &cmd); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to read sfp, ret=%d" , ret); + goto l_end; + } + + ret =0 ; +rte_memcpy (sfp_info->data, resp->data, sfp_info->len); + +l_end: +if (resp) { +rte_free (resp); + resp =NULL ; + } + +return ret; +}
drivers/net/sxe2/sxe2_cmd_chnl.h +3 -0
@@ -167,4 +167,7 @@ int32_t sxe2_drv_flow_fnav_query_stat(struct sxe2_adapter *adapter,int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter,uint16_t *vsi_list,uint16_t vsi_cnt,bool set); +int32_t sxe2_drv_sfp_eeprom_read (struct sxe2_adapter *adapter, +struct sxe2_sfp_read_info *sfp_info); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +18 -0
@@ -633,6 +633,24 @@ 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 { + uint8_t is_wr; +uint8_t is_qsfp; +uint16_t bus_addr; +uint16_t page_cnt; +uint16_t offset; +uint16_t data_len; +uint16_t rvd; +uint8_t data[]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_resp { + uint8_t is_wr; +uint8_t is_qsfp; +uint16_t data_len; +uint8_t data[]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +298 -0
322 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +9 -0
@@ -274,6 +274,15 @@ struct sxe2_sched_hw_cap {uint8_t adj_lvl; }; +struct sxe2_sfp_read_info { +uint8_t *data; +uint16_t offset; +uint16_t len; +uint16_t bus_addr; +uint16_t page_cnt; +bool is_qsfp; +}; +struct sxe2_link_context {rte_spinlock_t link_lock;bool link_up;
Signature · 1 line
2.52.0
PATCH v6 19/23 net/sxe2: implement private dump info
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the 'eth_dev_priv_dump' ops for the sxe2 PMD. This interface allows applications to dump driver-specific internal state and configuration information to a file stream.
The output includes:
- capabilities.
- device base info.
- device args info.
- device filter info.
- reprenstor info.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_dump.c | 287 ++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_dump.h | 12 ++ drivers/net/sxe2/sxe2_ethdev.c | 3 + drivers/net/sxe2/sxe2_ethdev_repr.c | 3 + 5 files changed, 306 insertions(+) create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h
drivers/net/sxe2/meson.build +1 -0
@@ -77,4 +77,5 @@ sources += files( 'sxe2_flow_parse_action.c', 'sxe2_flow_parse_pattern.c', 'sxe2_flow_parse_engine.c', + 'sxe2_dump.c', )
drivers/net/sxe2/sxe2_dump.c new file +287 -0
287 lines not on this page · raw message
drivers/net/sxe2/sxe2_dump.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_DUMP_H__ +#define __SXE2_DUMP_H__ + +#include <ethdev_driver.h> + +int32_t sxe2_eth_dev_priv_dump (struct rte_eth_dev *dev,FILE *file); + +#endif /* __SXE2_DUMP_H__ */
drivers/net/sxe2/sxe2_ethdev.c +3 -0
@@ -37,6 +37,7 @@#include "sxe2_host_regs.h" #include "sxe2_switchdev.h" #include "sxe2_ioctl_chnl_func.h" +#include "sxe2_dump.h" #include "sxe2_ethdev_repr.h" #include "sxe2vf_regs.h" #include "sxe2_switchdev.h"
@@ -193,6 +194,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .get_module_info = sxe2_get_module_info, .get_module_eeprom = sxe2_get_module_eeprom, + + .eth_dev_priv_dump = sxe2_eth_dev_priv_dump, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
drivers/net/sxe2/sxe2_ethdev_repr.c +3 -0
@@ -11,6 +11,7 @@#include "sxe2_txrx.h" #include "sxe2_switchdev.h" #include "sxe2_mp.h" +#include "sxe2_dump.h" #include "sxe2_stats.h" #include "sxe2_flow.h"
@@ -236,6 +237,8 @@ static const struct eth_dev_ops sxe2_switchdev_repr_dev_ops = { .allmulticast_enable = sxe2_repr_allmulti_enable, .allmulticast_disable = sxe2_repr_allmulti_disable, + .eth_dev_priv_dump = sxe2_eth_dev_priv_dump, + .stats_get = sxe2_stats_info_get, .stats_reset = sxe2_stats_info_reset, .xstats_get = sxe2_xstats_info_get,
Signature · 1 line
2.52.0
PATCH v6 20/23 net/sxe2: add mbuf validation in Tx debug mode
In reply to [email protected]From: Jie Liu <[email protected]>
Introduce the sxe2_txrx_check_mbuf helper function to validate outgoing mbufs when RTE_ETHDEV_DEBUG_TX is enabled. This helps developers catch malformed mbufs (e.g., invalid segment lengths, bad offload flags, or unaligned buffers) before passing them to the hardware rings, avoiding potential hardware hangs or silent packet drops.
The validation is fully wrapped inside RTE_ETHDEV_DEBUG_TX conditional compilation blocks to ensure zero performance overhead in standard production builds.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_txrx.c | 8 +- drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++++++++++++++++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 ++ 4 files changed, 640 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h
drivers/net/sxe2/meson.build +1 -0
@@ -78,4 +78,5 @@ sources += files( 'sxe2_flow_parse_pattern.c', 'sxe2_flow_parse_engine.c', 'sxe2_dump.c', + 'sxe2_txrx_check_mbuf.c', )
drivers/net/sxe2/sxe2_txrx.c +6 -2
@@ -13,6 +13,7 @@#include "sxe2_txrx_common.h" #include "sxe2_txrx_vec.h" #include "sxe2_txrx_poll.h" +#include "sxe2_txrx_check_mbuf.h" #include "sxe2_ethdev.h" #include "sxe2_common_log.h" #include "sxe2_osal.h"
@@ -120,13 +121,11 @@ uint16_t sxe2_tx_pkts_prepare(void *tx_queue, rte_errno = -EINVAL ; goto l_end; } -#ifdef RTE_ETHDEV_DEBUG_TX ret =rte_validate_tx_offload (mbuf);if (ret !=0 ) { rte_errno = -ret; goto l_end; } -#endif ret =rte_net_intel_cksum_prepare (mbuf);if (ret !=0 ) { rte_errno = -ret;
@@ -137,6 +136,11 @@ uint16_t sxe2_tx_pkts_prepare(void *tx_queue, rte_errno = -ret; goto l_end; } + ret =sxe2_txrx_check_mbuf (mbuf); +if (ret !=0 ) { + rte_errno = -ret; + goto l_end; + } } l_end:return i;
drivers/net/sxe2/sxe2_txrx_check_mbuf.c new file +595 -0
595 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_check_mbuf.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_TXRX_CHECK_MBUF_H__ +#define __SXE2_TXRX_CHECK_MBUF_H__ + +#include <rte_common.h> +#include <rte_net.h> +#include <rte_vect.h> +#include <rte_malloc.h> +#include <rte_memzone.h> +#include <ethdev_driver.h> + +struct offload_info { +uint16_t ethertype; +uint8_t gso_enable; +uint16_t l2_len; +uint16_t l3_len; +uint16_t l4_len; +uint8_t l4_proto; +uint8_t is_tunnel; +uint16_t outer_ethertype; +uint16_t outer_l2_len; +uint16_t outer_l3_len; +uint8_t outer_l4_proto; +uint16_t tso_segsz; +uint16_t tunnel_tso_segsz; +uint32_t pkt_len; +}; + +struct simple_gre_hdr { +uint16_t flags; +uint16_t proto; +}; + +__rte_unused int32_t sxe2_txrx_check_mbuf(struct rte_mbuf *m); +#endif /* __SXE2_TXRX_CHECK_MBUF_H__ */
Signature · 1 line
2.52.0
PATCH v6 21/23 common/sxe2: add callback for memory event handling
In reply to [email protected]From: Jie Liu <[email protected]>
During memory hotplug events, the SXE2 driver needs to track memory segment layout changes to maintain internal DMA mappings. However, existing memseg walk functions (rte_memseg_walk) acquire memory locks and cannot be called from within memory event callbacks, leading to potential deadlocks.
The implementation follows the standard rte_memseg_walk_t prototype, processing each memseg to update driver-specific data structures.
--- drivers/common/sxe2/sxe2_common.c | 110 ++++++++++++++++++++++++++ drivers/common/sxe2/sxe2_common.h | 2 + drivers/common/sxe2/sxe2_ioctl_chnl.c | 2 +- 3 files changed, 113 insertions(+), 1 deletion(-)
drivers/common/sxe2/sxe2_common.c +110 -0
@@ -196,6 +196,102 @@ static int32_t sxe2_parse_representor(const char *key, const char *value, void *PMD_LOG_INFO (COM ,"representor arg %s: \"%s\"." , key, value); +l_end: +return ret; +} +static int32_t sxe2_dma_mem_map (struct sxe2_common_device *cdev, +const void *addr,size_t len,bool do_map) +{ +struct rte_memseg_list *msl; +struct rte_memseg *ms; +size_t cur_len =0 ; +int32_t ret =0 ; + + msl =rte_mem_virt2memseg_list (addr); +if (msl ==NULL ) { + ret = -EINVAL ; +PMD_LOG_ERR (COM ,"Invalid virt addr=%p." , addr); + goto l_end; + } + +if ((uintptr_t )addr !=RTE_ALIGN ((uintptr_t )addr, msl->page_sz) || + (len !=RTE_ALIGN (len, msl->page_sz))) { + ret = -EINVAL ; +PMD_LOG_ERR (COM ,"Addr=%p and len=%zu not align page size=%" PRIu64"." , + addr, len, msl->page_sz); + goto l_end; + } + +/* memsegs are contiguous in memory */ + ms =rte_mem_virt2memseg (addr, msl); +while (cur_len < len) { +/* some memory segments may have invalid IOVA */ +if (ms->iova ==RTE_BAD_IOVA ) { +PMD_LOG_WARN (COM ,"Memory segment at %p has bad IOVA, skipping." , + ms->addr); + goto next; + } +if (do_map) +sxe2_drv_dev_dma_map (cdev, ms->addr_64, + ms->iova, ms->len); +else +sxe2_drv_dev_dma_unmap (cdev, ms->iova); + +next: + cur_len += ms->len; + ++ms; + } + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_common_mem_event_cb) +void +sxe2_common_mem_event_cb (enum rte_mem_event type, + const void *addr, size_t size, void *arg __rte_unused) +{ +struct sxe2_common_device *cdev =NULL ; + +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) + goto l_end; + +pthread_mutex_lock (&sxe2_common_devices_list_lock); +switch (type) { +case RTE_MEM_EVENT_FREE : +TAILQ_FOREACH (cdev, &sxe2_common_devices_list, next) + (void)sxe2_dma_mem_map(cdev, addr, size, 0); +break ; +case RTE_MEM_EVENT_ALLOC : +TAILQ_FOREACH (cdev, &sxe2_common_devices_list, next) + (void)sxe2_dma_mem_map(cdev, addr, size, 1); +break ; +default : +break ; + } +pthread_mutex_unlock (&sxe2_common_devices_list_lock); +l_end: +return ; +} + +static int32_t sxe2_memseg_walk_cb (const struct rte_memseg_list *msl, +const struct rte_memseg *ms,void *arg) +{ +struct sxe2_common_device *cdev = arg; +int32_t ret =0 ; + +if (msl->external && !msl->heap) + goto l_end; + +if (ms->iova ==RTE_BAD_IOVA ) + goto l_end; + + ret =sxe2_drv_dev_dma_map (cdev, ms->addr_64, ms->iova, ms->len); +if (ret !=0 ) { +PMD_LOG_ERR (COM ,"Fail to memseg dma map." ); + goto l_end; + } + l_end:return ret; }
@@ -220,6 +316,18 @@ static int32_t sxe2_common_device_setup(struct sxe2_common_device *cdev) goto l_close_dev; } +rte_mcfg_mem_read_lock (); + ret =rte_memseg_walk_thread_unsafe (sxe2_memseg_walk_cb, cdev); +if (ret) { +PMD_LOG_ERR (COM ,"Fail to walk memseg, ret=%d" , ret); +rte_mcfg_mem_read_unlock (); + goto l_close_dev; + } +rte_mcfg_mem_read_unlock (); + + (void )rte_mem_event_callback_register ("SXE2_MEM_EVENT_CB" , + sxe2_common_mem_event_cb,NULL ); + goto l_end; l_close_dev:
@@ -251,6 +359,7 @@ static struct sxe2_common_device *sxe2_common_device_alloc( } cdev->dev = rte_dev; cdev->class_type = class_type; + cdev->config.cmd_fd =SXE2_CMD_FD_INVALID ; cdev->config.kernel_reset = false;pthread_mutex_init (&cdev->config.lock,NULL );
@@ -631,6 +740,7 @@ static int32_t sxe2_common_pci_id_table_update(const struct rte_pci_id *id_table updated_table =calloc (num_ids,sizeof (*updated_table));if (!updated_table) { + ret = -ENOMEM ;PMD_LOG_ERR (COM ,"Failed to allocate memory for PCI ID table" ); goto l_end; }
drivers/common/sxe2/sxe2_common.h +2 -0
@@ -14,6 +14,8 @@#define SXE2_COMMON_PCI_DRIVER_NAME "sxe2_pci" +#define SXE2_CMD_FD_INVALID (-1) +#define SXE2_CDEV_TO_CMD_FD (cdev) \ ((cdev)->config.cmd_fd)
drivers/common/sxe2/sxe2_ioctl_chnl.c +1 -1
@@ -110,7 +110,7 @@ sxe2_drv_dev_close(struct sxe2_common_device *cdev)if (fd >=0 )close (fd);PMD_LOG_INFO (COM ,"closed device fd=%d" , fd); -SXE2_CDEV_TO_CMD_FD (cdev) =-1 ; +SXE2_CDEV_TO_CMD_FD (cdev) =SXE2_CMD_FD_INVALID ; }RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_handshake)
Signature · 1 line
2.52.0
PATCH v6 22/23 net/sxe2: add private devargs parsing
In reply to [email protected]From: Jie Liu <[email protected]>
Introduce runtime private device arguments (devargs) support for the sxe2 PMD. This allows users to customize driver behavior at startup without recompiling the source code.
The parameters are parsed using the standard 'rte_kvargs' library during the PCI/vdev probing phase. Documentation for these parameters is also updated.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 21 +++ drivers/net/sxe2/sxe2_cmd_chnl.h | 3 + drivers/net/sxe2/sxe2_drv_cmd.h | 17 +++ drivers/net/sxe2/sxe2_dump.c | 17 ++- drivers/net/sxe2/sxe2_ethdev.c | 223 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_ethdev.h | 6 + drivers/net/sxe2/sxe2_flow.c | 9 +- drivers/net/sxe2/sxe2_irq.c | 30 +++++ drivers/net/sxe2/sxe2_rx.c | 12 ++ 9 files changed, 333 insertions(+), 5 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +21 -0
@@ -99,6 +99,27 @@ int32_t sxe2_drv_dev_info_get(struct sxe2_adapter *adapter,return ret; } +int32_t sxe2_drv_fc_state_get (struct sxe2_adapter *adapter, +struct sxe2_drv_vsi_fc_get_resp *dev_fc_state_resp) +{ +int32_t ret =0 ; +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_cmd_params param = {0 }; +struct sxe2_drv_vsi_fc_get_req req = {0 }; + + req.vsi_id = adapter->vsi_ctxt.main_vsi->vsi_id; +sxe2_drv_cmd_params_fill (adapter, ¶m,SXE2_DRV_CMD_VSI_FC_GET , + &req,sizeof (req), + dev_fc_state_resp, +sizeof (*dev_fc_state_resp)); + ret =sxe2_drv_cmd_exec (cdev, ¶m); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"get fc state failed, ret=%d" , ret); + ret = -EIO ; + } +return ret; +} +int32_t sxe2_drv_dev_fw_info_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_fw_info_resp *dev_fw_info_resp) {
drivers/net/sxe2/sxe2_cmd_chnl.h +3 -0
@@ -99,6 +99,9 @@ int32_t sxe2_drv_vsi_stats_reset(struct sxe2_adapter *adapter);int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter,struct eth_queue_stats *qstats); +int32_t sxe2_drv_fc_state_get (struct sxe2_adapter *adapter, +struct sxe2_drv_vsi_fc_get_resp *dev_fc_state_resp); +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_txq_mapping_set (struct rte_eth_dev *eth_dev,uint16_t queue_id,uint8_t pool_idx);
drivers/net/sxe2/sxe2_drv_cmd.h +17 -0
@@ -651,6 +651,23 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_resp {uint8_t data[]; } __rte_packed_end; +enum sxe2_fc_type { +SXE2_FC_T_DIS =0 , +SXE2_FC_T_LFC , +SXE2_FC_T_PFC , +SXE2_FC_T_UNKNOWN =255 , +}; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_fc_get_req { + uint16_t vsi_id; +uint8_t rsv[2 ]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_fc_get_resp { + uint8_t fc_enable; +uint8_t rsv[3 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_dump.c +15 -2
@@ -78,13 +78,11 @@ sxe2_dump_dev_args_info(FILE *file, struct rte_eth_dev *dev) fprintf(file, " - Device Args Info:\n" "\t -- no_sched_mode: %s\n" - "\t -- flow-duplicate-pattern: %u\n" "\t -- fnav-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.sched_layer_mode, adapter->devargs.rx_low_latency ? "On" : "Off",
@@ -186,6 +184,20 @@ static void sxe2_dump_filter_info(FILE *file, struct rte_eth_dev *dev)return ; } +static void sxe2_dump_fc_state (FILE *file,struct rte_eth_dev *dev) +{ +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev); + +if (!(adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_FC_STATE )) + goto l_end; + +fprintf (file," -- fc state:\n" +"\t -- curr_state: %u\n" , + adapter->fc_state_ctx.curr_state); +l_end: +return ; +} +static const char *sxe2_vsi_id_str (uint16_t vsi_id,char *buf,size_t len) {if (vsi_id ==SXE2_INVALID_VSI_ID )
@@ -272,6 +284,7 @@ int32_t sxe2_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file)sxe2_dump_dev_args_info (str, dev);sxe2_dump_filter_info (str, dev);sxe2_dump_switchdev_info (str, dev); +sxe2_dump_fc_state (str, dev); (void )fflush (str);
drivers/net/sxe2/sxe2_ethdev.c +223 -0
277 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +6 -0
@@ -310,6 +310,11 @@ struct sxe2_filter_context {bool cur_l2_config; }; +struct sxe2_fc_state_ctxt { +uint8_t curr_state; +uint8_t cfg_state; +}; +struct sxe2_adapter {struct sxe2_common_device *cdev;struct sxe2_dev_info dev_info;
@@ -331,6 +336,7 @@ struct sxe2_adapter {struct sxe2_security_ctx security_ctx;struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info; +struct sxe2_fc_state_ctxt fc_state_ctx;bool rule_started;bool flow_isolated;bool flow_isolate_cfg;
drivers/net/sxe2/sxe2_flow.c +6 -3
@@ -759,6 +759,7 @@ static int32_t sxe2_flow_validate_with_flow(struct rte_eth_dev *dev,const struct rte_flow_action actions[], struct rte_flow_error *error) { + struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(dev);int32_t ret =0 ;struct sxe2_flow *flow =NULL ;
@@ -801,9 +802,11 @@ static int32_t sxe2_flow_validate_with_flow(struct rte_eth_dev *dev, ret =sxe2_flow_check_flow_list_duplicate (dev, flow_list);if (ret !=0 ) { -rte_flow_error_set (error,EEXIST ,RTE_FLOW_ERROR_TYPE_ITEM , -NULL ,"Duplicate flow." ); -PMD_LOG_ERR (DRV ,"Duplicate flow." ); +rte_flow_error_set (error,EEXIST ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL , + adapter->devargs.flow_dup_pattern_mode ? +"Duplicate flow pattern." : +"Duplicate flow pattern is not allowed." ); +PMD_LOG_ERR (DRV ,"Duplicate flow pattern." ); goto l_end; } l_end:
drivers/net/sxe2/sxe2_irq.c +30 -0
@@ -10,6 +10,7 @@#include <rte_alarm.h> #include <fcntl.h> #include <rte_stdatomic.h> +#include <rte_common.h> #include "sxe2_ethdev.h" #include "sxe2_irq.h"
@@ -47,6 +48,31 @@ static struct sxe2_event_handler event_handler = {static RTE_ATOMIC (uint32_t )event_thread_run; +static int32_t sxe2_fc_state_callback (struct rte_eth_dev *dev) +{ +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_drv_vsi_fc_get_resp fc_resp = {0 }; +int32_t ret; + +if (!(adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_FC_STATE )) { + ret =0 ; + goto l_end; + } + ret =sxe2_drv_fc_state_get (adapter, &fc_resp); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to get fc state, ret=[%d]" , ret); + goto l_end; + } + adapter->fc_state_ctx.cfg_state = fc_resp.fc_enable; +if (dev->data->dev_started) { +PMD_LOG_NOTICE (DRV ,"Interrupt event: FC status changed." +"cfg_state:%u curr_state:%u" , + adapter->fc_state_ctx.cfg_state, + adapter->fc_state_ctx.curr_state); + } +l_end: +return ret; +}static void sxe2_event_irq_common_handler (struct sxe2_adapter *adapter,uint64_t oicr) {
@@ -68,6 +94,10 @@ static void sxe2_event_irq_common_handler(struct sxe2_adapter *adapter, uint64_tPMD_DEV_LOG_INFO (adapter,DRV ,"event notify legacy" ); (void )sxe2_switchdev_notify_callback (adapter, false); } +if (oicr &RTE_BIT32 (SXE2_COM_FC_ST_CHANGE )) { +PMD_DEV_LOG_INFO (adapter,DRV ,"fc event notify legacy" ); + (void )sxe2_fc_state_callback (dev); + } } static uint32_t sxe2_event_intr_handle(void *param __rte_unused)
drivers/net/sxe2/sxe2_rx.c +12 -0
@@ -467,12 +467,24 @@ int32_t __rte_cold sxe2_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queu int32_t __rte_cold sxe2_rxqs_all_start(struct rte_eth_dev *dev) {struct rte_eth_dev_data *data = dev->data; +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_drv_vsi_fc_get_resp fc_resp = {0 };struct sxe2_rx_queue *rxq;uint16_t nb_rxq;uint16_t nb_started_rxq;int32_t ret;PMD_INIT_FUNC_TRACE (); +if (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_FC_STATE ) { + ret =sxe2_drv_fc_state_get (adapter, &fc_resp); +if (ret) { +PMD_LOG_ERR (RX ,"Failed to get fc state, ret=[%d]" , ret); + goto l_end; + } + adapter->fc_state_ctx.cfg_state = fc_resp.fc_enable; + adapter->fc_state_ctx.curr_state = adapter->fc_state_ctx.cfg_state; + } +for (nb_rxq =0 ; nb_rxq < data->nb_rx_queues; nb_rxq++) { rxq = dev->data->rx_queues[nb_rxq];if (!rxq || rxq->rx_deferred_start)
Signature · 1 line
2.52.0
PATCH v6 23/23 net/sxe2: update sxe2 feature matrix docs
In reply to [email protected]From: Jie Liu <[email protected]>
Update the sxe2.ini feature sheet to accurately reflect the recently implemented hardware capabilities in the sxe2 PMD.
--- doc/guides/nics/features/sxe2.ini | 56 ++++++++++++ doc/guides/nics/sxe2.rst | 147 ++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+)
doc/guides/nics/features/sxe2.ini +56 -0
@@ -7,17 +7,73 @@ ; is selected. ; [Features] +Speed capabilities = Y +Link status = Y +Link status event = Y +Rx interrupt = Y Fast mbuf free = P Free Tx mbuf on demand = Y Burst mode info = Y Queue start/stop = Y +Power mgmt address monitor = Y Buffer split on Rx = P Scattered Rx = Y +Traffic manager = Y CRC offload = Y +VLAN offload = Y +QinQ offload = P L3 checksum offload = Y L4 checksum offload = Y +Timestamp offload = P +Inner L3 checksum = P +Inner L4 checksum = P Rx descriptor status = Y Tx descriptor status = Y +MTU update = Y +TSO = P +Promiscuous mode = Y +Allmulticast mode = Y +Unicast MAC filter = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +VLAN filter = Y +Inline crypto = Y +Packet type parsing = Y +Timesync = Y +Basic stats = Y +Extended stats = Y +FW version = Y +Module EEPROM dump = Y +Multiprocess aware = Y Linux = Y x86-32 = Y x86-64 = Y + +[rte_flow items] +eth = P +geneve = Y +gre = Y +gtpu = Y +ipv4 = Y +ipv6 = Y +ipv6_frag_ext = Y +nvgre = Y +sctp = Y +tcp = Y +udp = Y +vlan = P +vxlan = Y +vxlan_gpe = Y + +[rte_flow actions] +count = Y +drop = Y +mark = Y +passthru = Y +port_representor = Y +queue = Y +represented_port = Y +rss = Y +send_to_kernel = Y +port_id = Y
doc/guides/nics/sxe2.rst +147 -0
150 lines not on this page · raw message
Signature · 1 line
2.52.0
v7 cover net/sxe2: added Linkdata sxe2 ethernet driver
From: Jie Liu <[email protected]>
This patch set implements core functionality for the SXE2 PMD, including basic driver framework, data path setup, and advanced offload features (VLAN, RSS,TM, PTP etc.).
V7:
- Add support for flow duplicate pattern.
Jie Liu (23):
net/sxe2: remove software statistics devargs net/sxe2: add Rx framework and packet types callback net/sxe2: support AVX512 vectorized path for Rx and Tx net/sxe2: add AVX2 vector data path for Rx and Tx net/sxe2: add link update callback
net/sxe2: support L2 filtering and MAC config
drivers: support RSS feature
net/sxe2: support TM hierarchy and shaping net/sxe2: support IPsec inline protocol offload net/sxe2: support statistics and multi-process
drivers: interrupt handling
net/sxe2: add NEON vec Rx/Tx burst functions
drivers: add support for VF representors net/sxe2: add support for custom UDP tunnel ports net/sxe2: support firmware version reading net/sxe2: implement get monitor address common/sxe2: add shared SFP module definitions net/sxe2: support SFP module info and EEPROM access net/sxe2: add mbuf validation in Tx debug mode common/sxe2: add callback for memory event handling net/sxe2: add private devargs parsing net/sxe2: implement private dump info net/sxe2: update sxe2 feature matrix docs
doc/guides/nics/features/sxe2.ini | 56 + doc/guides/nics/sxe2.rst | 168 ++ drivers/common/sxe2/sxe2_common.c | 156 ++ drivers/common/sxe2/sxe2_common.h | 4 + drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++ drivers/common/sxe2/sxe2_ioctl_chnl.c | 178 +- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/common/sxe2/sxe2_msg.h | 118 ++ drivers/net/sxe2/meson.build | 52 + drivers/net/sxe2/sxe2_cmd_chnl.c | 1587 +++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 139 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 523 +++++- drivers/net/sxe2/sxe2_dump.c | 287 +++ drivers/net/sxe2/sxe2_dump.h | 12 + drivers/net/sxe2/sxe2_ethdev.c | 1485 ++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 111 +- drivers/net/sxe2/sxe2_ethdev_repr.c | 609 ++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 895 +++++++++ drivers/net/sxe2/sxe2_filter.h | 100 + drivers/net/sxe2/sxe2_flow.c | 1394 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 30 + drivers/net/sxe2/sxe2_flow_define.h | 144 ++ drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1935 +++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 46 + drivers/net/sxe2/sxe2_ipsec.c | 1565 ++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++ drivers/net/sxe2/sxe2_irq.c | 1026 ++++++++++ drivers/net/sxe2/sxe2_irq.h | 25 + drivers/net/sxe2/sxe2_mac.c | 530 ++++++ drivers/net/sxe2/sxe2_mac.h | 84 + drivers/net/sxe2/sxe2_mp.c | 414 +++++ drivers/net/sxe2/sxe2_mp.h | 67 + drivers/net/sxe2/sxe2_queue.c | 17 +- drivers/net/sxe2/sxe2_queue.h | 15 +- drivers/net/sxe2/sxe2_rss.c | 584 ++++++ drivers/net/sxe2/sxe2_rss.h | 81 + drivers/net/sxe2/sxe2_rx.c | 93 +- drivers/net/sxe2/sxe2_rx.h | 2 + drivers/net/sxe2/sxe2_security.c | 335 ++++ drivers/net/sxe2/sxe2_security.h | 77 + drivers/net/sxe2/sxe2_stats.c | 586 ++++++ drivers/net/sxe2/sxe2_stats.h | 39 + drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 + drivers/net/sxe2/sxe2_tx.c | 7 + drivers/net/sxe2/sxe2_txrx.c | 1958 +++++++++++++++++++- drivers/net/sxe2/sxe2_txrx.h | 8 + drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 + drivers/net/sxe2/sxe2_txrx_poll.c | 284 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 38 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++ drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 +++++++++ drivers/net/sxe2/sxe2_txrx_vec_common.h | 54 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 +++++++ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 38 +- drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- drivers/net/sxe2/sxe2vf_regs.h | 85 + 67 files changed, 24761 insertions(+), 273 deletions(-) create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/common/sxe2/sxe2_msg.h create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
Signature · 1 line
2.52.0
Re: [PATCH v7 00/23] net/sxe2: added Linkdata sxe2 ethernet driver
Hi stephen,
Please ignore v7 patch/series. I found an issue and will send a revised version (v8) shortly.
From: liujie5
Date: 2026-06-25 13:41
To: stephen
CC: dev; Jie Liu
Subject: [PATCH v7 00/23] net/sxe2: added Linkdata sxe2 ethernet driver
From: Jie Liu <[email protected]>
This patch set implements core functionality for the SXE2 PMD, including basic driver framework, data path setup, and advanced offload features (VLAN, RSS,TM, PTP etc.).
V7:
- Add support for flow duplicate pattern.
Jie Liu (23):
net/sxe2: remove software statistics devargs net/sxe2: add Rx framework and packet types callback net/sxe2: support AVX512 vectorized path for Rx and Tx net/sxe2: add AVX2 vector data path for Rx and Tx net/sxe2: add link update callback
net/sxe2: support L2 filtering and MAC config
drivers: support RSS feature
net/sxe2: support TM hierarchy and shaping net/sxe2: support IPsec inline protocol offload net/sxe2: support statistics and multi-process
drivers: interrupt handling
net/sxe2: add NEON vec Rx/Tx burst functions
drivers: add support for VF representors net/sxe2: add support for custom UDP tunnel ports net/sxe2: support firmware version reading net/sxe2: implement get monitor address common/sxe2: add shared SFP module definitions net/sxe2: support SFP module info and EEPROM access net/sxe2: add mbuf validation in Tx debug mode common/sxe2: add callback for memory event handling net/sxe2: add private devargs parsing net/sxe2: implement private dump info net/sxe2: update sxe2 feature matrix docs
doc/guides/nics/features/sxe2.ini | 56 + doc/guides/nics/sxe2.rst | 168 ++ drivers/common/sxe2/sxe2_common.c | 156 ++ drivers/common/sxe2/sxe2_common.h | 4 + drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++ drivers/common/sxe2/sxe2_ioctl_chnl.c | 178 +- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/common/sxe2/sxe2_msg.h | 118 ++ drivers/net/sxe2/meson.build | 52 + drivers/net/sxe2/sxe2_cmd_chnl.c | 1587 +++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 139 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 523 +++++- drivers/net/sxe2/sxe2_dump.c | 287 +++ drivers/net/sxe2/sxe2_dump.h | 12 + drivers/net/sxe2/sxe2_ethdev.c | 1485 ++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 111 +- drivers/net/sxe2/sxe2_ethdev_repr.c | 609 ++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 895 +++++++++ drivers/net/sxe2/sxe2_filter.h | 100 + drivers/net/sxe2/sxe2_flow.c | 1394 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 30 + drivers/net/sxe2/sxe2_flow_define.h | 144 ++ drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1935 +++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 46 + drivers/net/sxe2/sxe2_ipsec.c | 1565 ++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++ drivers/net/sxe2/sxe2_irq.c | 1026 ++++++++++ drivers/net/sxe2/sxe2_irq.h | 25 + drivers/net/sxe2/sxe2_mac.c | 530 ++++++ drivers/net/sxe2/sxe2_mac.h | 84 + drivers/net/sxe2/sxe2_mp.c | 414 +++++ drivers/net/sxe2/sxe2_mp.h | 67 + drivers/net/sxe2/sxe2_queue.c | 17 +- drivers/net/sxe2/sxe2_queue.h | 15 +- drivers/net/sxe2/sxe2_rss.c | 584 ++++++ drivers/net/sxe2/sxe2_rss.h | 81 + drivers/net/sxe2/sxe2_rx.c | 93 +- drivers/net/sxe2/sxe2_rx.h | 2 + drivers/net/sxe2/sxe2_security.c | 335 ++++ drivers/net/sxe2/sxe2_security.h | 77 + drivers/net/sxe2/sxe2_stats.c | 586 ++++++ drivers/net/sxe2/sxe2_stats.h | 39 + drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 + drivers/net/sxe2/sxe2_tx.c | 7 + drivers/net/sxe2/sxe2_txrx.c | 1958 +++++++++++++++++++- drivers/net/sxe2/sxe2_txrx.h | 8 + drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 + drivers/net/sxe2/sxe2_txrx_poll.c | 284 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 38 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++ drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 +++++++++ drivers/net/sxe2/sxe2_txrx_vec_common.h | 54 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 +++++++ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 38 +- drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- drivers/net/sxe2/sxe2vf_regs.h | 85 + 67 files changed, 24761 insertions(+), 273 deletions(-)
create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/common/sxe2/sxe2_msg.h create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
Signature · 1 line
2.52.0
PATCH v7 1/23 net/sxe2: remove software statistics devargs
In reply to [email protected]From: Jie Liu <[email protected]>
Remove the optional drv-sw-stats device argument and make software statistics always-on. Per-queue software statistics are point-in-time measurements used for accumulation at queue stop/dump, so atomic operations with rte_memory_order_relaxed add unnecessary overhead without correctness benefit.
Also rename high_performance_mode field to no_sched_mode to match the devargs string definition.
Changes:
- Remove sw_stats_en field from struct sxe2_devargs
- Remove RTE_ATOMIC qualifiers from sxe2_rxq_sw_stats fields
- Replace rte_atomic_fetch_add_explicit(relaxed) with plain addition
- Replace rte_atomic_store/load_explicit(relaxed) with plain assignment
- Remove sw_stats_en conditional checks in Rx fast path
- Always pass umbcast_flags to vec Rx functions
- Remove unused #include <rte_stdatomic.h>
- Rename high_performance_mode → no_sched_mode in devargs struct
- Fix int → int32_t for return type in sxe2_parse_eth_devargs
--- drivers/net/sxe2/sxe2_ethdev.c | 2 +- drivers/net/sxe2/sxe2_ethdev.h | 3 +- drivers/net/sxe2/sxe2_queue.h | 15 ++++--- drivers/net/sxe2/sxe2_rx.c | 55 +++++++------------------ drivers/net/sxe2/sxe2_txrx_poll.c | 38 ++++++----------- drivers/net/sxe2/sxe2_txrx_vec_common.h | 52 ++++++++++------------- drivers/net/sxe2/sxe2_txrx_vec_sse.c | 29 +------------ 7 files changed, 61 insertions(+), 133 deletions(-)
drivers/net/sxe2/sxe2_ethdev.c +1 -1
@@ -891,7 +891,7 @@ static int32_t sxe2_eth_pmd_probe_pf(struct sxe2_common_device *cdev,static int32_t sxe2_parse_eth_devargs (struct rte_device *dev,struct rte_eth_devargs *eth_da) { -int ret =0 ; +int32_t ret =0 ;if (dev->devargs ==NULL )return 0 ;
drivers/net/sxe2/sxe2_ethdev.h +1 -2
@@ -130,9 +130,8 @@ struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;uint8_t fnav_stat_type; -uint8_t high_performance_mode; +uint8_t no_sched_mode;uint8_t sched_layer_mode; -uint8_t sw_stats_en;uint8_t rx_low_latency; };
drivers/net/sxe2/sxe2_queue.h +7 -8
@@ -7,7 +7,6 @@#include <rte_ethdev.h> #include <rte_io.h> -#include <rte_stdatomic.h> #include <ethdev_driver.h> #include "sxe2_drv_cmd.h"
@@ -123,13 +122,13 @@ struct sxe2_rxq_stats { };struct sxe2_rxq_sw_stats { -RTE_ATOMIC (uint64_t )pkts; -RTE_ATOMIC (uint64_t )bytes; -RTE_ATOMIC (uint64_t )drop_pkts; -RTE_ATOMIC (uint64_t )drop_bytes; -RTE_ATOMIC (uint64_t )unicast_pkts; -RTE_ATOMIC (uint64_t )multicast_pkts; -RTE_ATOMIC (uint64_t )broadcast_pkts; +uint64_t pkts; +uint64_t bytes; +uint64_t drop_pkts; +uint64_t drop_bytes; +uint64_t unicast_pkts; +uint64_t multicast_pkts; +uint64_t broadcast_pkts; };struct sxe2_rx_queue {
drivers/net/sxe2/sxe2_rx.c +16 -39
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_poll.c +13 -25
@@ -682,23 +682,17 @@ sxe2_rx_sw_stats_update(struct sxe2_rx_queue *rxq, struct rte_mbuf *mbuf, union sxe2_rx_desc *rxd) {uint64_t qword1 =rte_le_to_cpu_64 (rxd->wb.status_err_ptype_len); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.pkts,1 , - rte_memory_order_relaxed); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.bytes, - mbuf->pkt_len +RTE_ETHER_CRC_LEN , - rte_memory_order_relaxed); + rxq->sw_stats.pkts +=1 ; + rxq->sw_stats.bytes += mbuf->pkt_len +RTE_ETHER_CRC_LEN ;switch (SXE2_RX_DESC_STATUS_UMBCAST_VAL_GET (qword1)) {case SXE2_RX_DESC_STATUS_UNICAST : -rte_atomic_fetch_add_explicit (&rxq->sw_stats.unicast_pkts,1 , - rte_memory_order_relaxed); + rxq->sw_stats.unicast_pkts +=1 ;break ;case SXE2_RX_DESC_STATUS_MULTICAST : -rte_atomic_fetch_add_explicit (&rxq->sw_stats.multicast_pkts,1 , - rte_memory_order_relaxed); + rxq->sw_stats.multicast_pkts +=1 ;break ;case SXE2_RX_DESC_STATUS_BROADCAST : -rte_atomic_fetch_add_explicit (&rxq->sw_stats.broadcast_pkts,1 , - rte_memory_order_relaxed); + rxq->sw_stats.broadcast_pkts +=1 ;break ;default :break ;
@@ -787,11 +781,9 @@ uint16_t sxe2_rx_pkts_scattered(void *rx_queue, struct rte_mbuf **rx_pkts, uint1if (unlikely (qword1 &SXE2_RX_DESC_ERROR_RXE_MASK ) ||unlikely (qword1 &SXE2_RX_DESC_ERROR_OVERSIZE_MASK )) { -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_pkts,1 , - rte_memory_order_relaxed); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_bytes, - first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN , - rte_memory_order_relaxed); + rxq->sw_stats.drop_pkts +=1 ; + rxq->sw_stats.drop_bytes += + first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN ;rte_pktmbuf_free (first_seg); first_seg =NULL ;continue ;
@@ -822,8 +814,7 @@ uint16_t sxe2_rx_pkts_scattered(void *rx_queue, struct rte_mbuf **rx_pkts, uint1sxe2_rx_mbuf_common_fields_fill (rxq, first_seg, &desc_tmp); -if (rxq->vsi->adapter->devargs.sw_stats_en) -sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp); +sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp);rte_prefetch0 (RTE_PTR_ADD (first_seg->buf_addr, first_seg->data_off));
@@ -990,11 +981,9 @@ uint16_t sxe2_rx_pkts_scattered_split(void *rx_queue, struct rte_mbuf **rx_pkts,if (unlikely (qword1 &SXE2_RX_DESC_ERROR_RXE_MASK ) ||unlikely (qword1 &SXE2_RX_DESC_ERROR_OVERSIZE_MASK )) { -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_pkts,1 , - rte_memory_order_relaxed); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_bytes, - first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN , - rte_memory_order_relaxed); + rxq->sw_stats.drop_pkts +=1 ; + rxq->sw_stats.drop_bytes += + first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN ;rte_pktmbuf_free (first_seg); first_seg =NULL ;continue ;
@@ -1023,8 +1012,7 @@ uint16_t sxe2_rx_pkts_scattered_split(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->port = rxq->port_id;sxe2_rx_mbuf_common_fields_fill (rxq, first_seg, &desc_tmp); -if (rxq->vsi->adapter->devargs.sw_stats_en) -sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp); +sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp);rte_prefetch0 (RTE_PTR_ADD (first_seg->buf_addr, first_seg->data_off));
drivers/net/sxe2/sxe2_txrx_vec_common.h +21 -31
70 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec_sse.c +2 -27
@@ -483,41 +483,16 @@ static __rte_always_inline uint16_t sxe2_rx_pkts_scattered_batch_vec_sse(struct sxe2_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - const uint64_t *split_rxe_flags64; uint8_t split_rxe_flags[SXE2_RX_PKTS_BURST_BATCH_NUM_VEC] = {0};uint8_t umbcast_flags[SXE2_RX_PKTS_BURST_BATCH_NUM_VEC ] = {0 };uint16_t rx_done_num;uint16_t rx_pkt_done_num; rx_pkt_done_num =0 ; -if (rxq->vsi->adapter->devargs.sw_stats_en) { - rx_done_num =sxe2_rx_pkts_common_vec_sse (rxq, rx_pkts, - nb_pkts, split_rxe_flags, umbcast_flags); - }else { - rx_done_num =sxe2_rx_pkts_common_vec_sse (rxq, rx_pkts, - nb_pkts, split_rxe_flags,NULL ); - } + rx_done_num =sxe2_rx_pkts_common_vec_sse (rxq, rx_pkts, + nb_pkts, split_rxe_flags, umbcast_flags);if (rx_done_num ==0 ) goto l_end; -if (!rxq->vsi->adapter->devargs.sw_stats_en) { - split_rxe_flags64 = (uint64_t *)split_rxe_flags; -if (rxq->pkt_first_seg ==NULL && - split_rxe_flags64[0 ] ==0 && - split_rxe_flags64[1 ] ==0 && - split_rxe_flags64[2 ] ==0 && - split_rxe_flags64[3 ] ==0 ) { - rx_pkt_done_num = rx_done_num; - goto l_end; - } -if (rxq->pkt_first_seg ==NULL ) { -while (rx_pkt_done_num < rx_done_num && - split_rxe_flags[rx_pkt_done_num] ==0 ) - rx_pkt_done_num++; -if (rx_pkt_done_num == rx_done_num) - goto l_end; - rxq->pkt_first_seg = rx_pkts[rx_pkt_done_num]; - } - } rx_pkt_done_num +=sxe2_rx_pkts_refactor (rxq, &rx_pkts[rx_pkt_done_num], rx_done_num - rx_pkt_done_num, &split_rxe_flags[rx_pkt_done_num], &umbcast_flags[rx_pkt_done_num]);
Signature · 1 line
2.52.0
PATCH v7 2/23 net/sxe2: add Rx framework and packet types callback
In reply to [email protected]From: Jie Liu <[email protected]>
Implement dev_supported_ptypes_get ethdev callback for sxe2 PMD. This allows applications to query the packet types the driver is capable of identifying, such as L2, L3 (IPv4/IPv6), and L4 (TCP/UDP/SCTP) layers.
--- drivers/net/sxe2/sxe2_ethdev.h | 1 - drivers/net/sxe2/sxe2_txrx.c | 1782 +++++++++++++++++++++++ drivers/net/sxe2/sxe2_txrx.h | 5 + drivers/net/sxe2/sxe2_txrx_poll.c | 3 +- drivers/net/sxe2/sxe2_txrx_vec_common.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_sse.c | 9 +- 6 files changed, 1793 insertions(+), 8 deletions(-)
drivers/net/sxe2/sxe2_ethdev.h +0 -1
@@ -279,7 +279,6 @@ struct sxe2_adapter {uint16_t dev_port_id;uint64_t cap_flags;enum sxe2_dev_type dev_type; -uint32_t ptype_tbl[SXE2_MAX_PTYPE_NUM ];struct rte_ether_addr mac_addr;uint8_t port_idx;uint8_t pf_idx;
drivers/net/sxe2/sxe2_txrx.c +1782 -0
1,785 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx.h +5 -0
@@ -23,4 +23,9 @@ int32_t sxe2_tx_burst_mode_get(struct rte_eth_dev *dev,int32_t sxe2_rx_burst_mode_get (struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode); +extern const uint32_t sxe2_ptype_tbl[]; + +const uint32_t *sxe2_dev_supported_ptypes_get (struct rte_eth_dev *dev, +size_t *no_of_elements); +#endif /* SXE2_TXRX_H */
drivers/net/sxe2/sxe2_txrx_poll.c +1 -2
@@ -664,13 +664,12 @@ static __rte_always_inline void sxe2_rx_mbuf_common_fields_fill(struct sxe2_rx_queue *rxq, struct rte_mbuf *mbuf, union sxe2_rx_desc *rxd) { - uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; uint64_t qword1;uint64_t pkt_flags; qword1 =rte_le_to_cpu_64 (rxd->wb.status_err_ptype_len); mbuf->ol_flags =0 ; - mbuf->packet_type = ptype_tbl[SXE2_RX_DESC_PTYPE_VAL_GET (qword1)]; + mbuf->packet_type = sxe2_ptype_tbl[SXE2_RX_DESC_PTYPE_VAL_GET (qword1)]; pkt_flags =sxe2_rx_desc_error_para (rxq, rxd);
drivers/net/sxe2/sxe2_txrx_vec_common.h +1 -0
@@ -12,6 +12,7 @@#include "sxe2_rx.h" #include "sxe2_queue.h" #include "sxe2_tx.h" +#include "sxe2_txrx.h" #include "sxe2_vsi.h" #include "sxe2_ethdev.h" #define SXE2_RX_NUM_PER_LOOP_SSE 4
drivers/net/sxe2/sxe2_txrx_vec_sse.c +4 -5
@@ -338,7 +338,6 @@ sxe2_rx_pkts_common_vec_sse(struct sxe2_rx_queue *rxq,uint32_t i;uint32_t bit_num;uint16_t done_num =0 ; -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m128i crc_adjust = _mm_set_epi16(0, 0, 0, -rxq->crc_len,
@@ -461,10 +460,10 @@ sxe2_rx_pkts_common_vec_sse(struct sxe2_rx_queue *rxq, mbuf_arr[1]);_mm_storeu_si128 ((void *)&rx_pkts[i]->rx_descriptor_fields1, mbuf_arr[0 ]); - rx_pkts[i +3 ]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,3 )]; - rx_pkts[i +2 ]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,7 )]; - rx_pkts[i +1 ]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,1 )]; - rx_pkts[i]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,5 )]; + rx_pkts[i +3 ]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,3 )]; + rx_pkts[i +2 ]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,7 )]; + rx_pkts[i +1 ]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,1 )]; + rx_pkts[i]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,5 )]; bit_num =rte_popcount64 (_mm_cvtsi128_si64 (staterr)); done_num += bit_num;if (likely (bit_num !=SXE2_RX_NUM_PER_LOOP_SSE ))
Signature · 1 line
2.52.0
PATCH v7 3/23 net/sxe2: support AVX512 vectorized path for Rx and Tx
In reply to [email protected]From: Jie Liu <[email protected]>
Add AVX512 vector data path for Rx and Tx burst functions. The decision to use AVX512 is based on:
1. CPU hardware flags (AVX512F, AVX512BW).
2. Compiler support (CC_AVX512_SUPPORT).
3. Max SIMD bitwidth configuration.
--- drivers/net/sxe2/meson.build | 24 + drivers/net/sxe2/sxe2_drv_cmd.h | 80 +-- drivers/net/sxe2/sxe2_txrx.c | 92 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 18 +- drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 ++++++++++++++++++++++++ 6 files changed, 1068 insertions(+), 59 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c
drivers/net/sxe2/meson.build +24 -0
@@ -15,6 +15,30 @@ includes += include_directories('../../common/sxe2') if arch_subdir == 'x86' sources += files('sxe2_txrx_vec_sse.c') + + sxe2_avx512_cpu_support =( + cc.get_define('__AVX512F__', args: machine_args) != '' and + cc.get_define('__AVX512BW__', args: machine_args) != '') + + sxe2_avx512_cc_support = ( + not machine_args.contains('-mno-avx512f') and + cc.has_argument('-mavx512f') and + cc.has_argument('-mavx512bw')) + + if sxe2_avx512_cpu_support == true or sxe2_avx512_cc_support == true + cflags += ['-DCC_AVX512_SUPPORT'] + avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + endif + sxe2_avx512_lib = static_library('sxe2_avx512_lib', 'sxe2_txrx_vec_avx512.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_hash, + static_rte_security, static_rte_cryptodev, static_rte_bus_pci], + include_directories: includes, + c_args: avx512_args) + objs += sxe2_avx512_lib.extract_objects('sxe2_txrx_vec_avx512.c') + endif endif sources += files(
drivers/net/sxe2/sxe2_drv_cmd.h +40 -40
189 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx.c +79 -13
139 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec.c +42 -4
58 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec.h +16 -2
@@ -11,15 +11,19 @@#define SXE2_RX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_RX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ - SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE) + SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ + SXE2_RX_MODE_VEC_AVX512)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ - SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE) + SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ + SXE2_TX_MODE_VEC_AVX512)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -54,6 +58,16 @@ uint16_t sxe2_tx_pkts_vec_sse(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_uint16_t sxe2_tx_pkts_vec_sse_simple (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_sse_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx512_simple (void *tx_queue, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx512 (void *tx_queue, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx512_ctx_offload (void *tx_queue, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx512 (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts);#endif 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);
drivers/net/sxe2/sxe2_txrx_vec_avx512.c new file +867 -0
867 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 4/23 net/sxe2: add AVX2 vector data path for Rx and Tx
In reply to [email protected]From: Jie Liu <[email protected]>
Added AVX256 vectorized versions of Rx and Tx data path functions to improve packet processing performance.
The vector path uses AVX2 SIMD instructions to process multiple descriptors per loop, significantly reducing the per-packet overhead.
net/sxe2: support AVX512 vectorized path for Rx and Tx
--- drivers/net/sxe2/meson.build | 9 + drivers/net/sxe2/sxe2_txrx.c | 38 +- drivers/net/sxe2/sxe2_txrx_vec.h | 12 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++++++++++++++++++++ 4 files changed, 801 insertions(+), 5 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c
drivers/net/sxe2/meson.build +9 -0
@@ -39,6 +39,15 @@ if arch_subdir == 'x86' c_args: avx512_args) objs += sxe2_avx512_lib.extract_objects('sxe2_txrx_vec_avx512.c') endif + sxe2_avx2_lib = static_library('sxe2_avx2_lib', + 'sxe2_txrx_vec_avx2.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_hash, + static_rte_security, static_rte_cryptodev, + static_rte_bus_pci], + include_directories: includes, + c_args: [cflags, '-mavx2']) + objs += sxe2_avx2_lib.extract_objects('sxe2_txrx_vec_avx2.c') endif sources += files(
drivers/net/sxe2/sxe2_txrx.c +35 -3
@@ -167,8 +167,14 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev)PMD_LOG_INFO (TX ,"AVX512 is not supported in build env." ); #endif } -if ((tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) ==0 ) - tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ; +if (((tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) ==0 ) && + ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ) || + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 )) && + (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 )) + tx_mode_flags |=SXE2_TX_MODE_VEC_AVX2 ; + +if ((0 == (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ))) + tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ;#endif if (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) { ret =sxe2_tx_queues_vec_prepare (dev);
@@ -197,6 +203,13 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_burst = sxe2_tx_pkts_vec_avx512_simple; }#endif + }else if (tx_mode_flags &SXE2_TX_MODE_VEC_AVX2 ) { +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_avx2; + }else { + dev->tx_pkt_burst = sxe2_tx_pkts_vec_avx2_simple; + } }else {if (tx_mode_flags &SXE2_TX_MODE_VEC_OFFLOAD ) { dev->tx_pkt_prepare = sxe2_tx_pkts_prepare;
@@ -231,6 +244,10 @@ static const struct { { sxe2_tx_pkts_vec_avx512_simple, "Vector AVX512 Simple" }, #endif + { sxe2_tx_pkts_vec_avx2, + "Vector AVX2" }, + { sxe2_tx_pkts_vec_avx2_simple, + "Vector AVX2 Simple" }, { sxe2_tx_pkts_vec_sse, "Vector SSE" }, { sxe2_tx_pkts_vec_sse_simple,
@@ -330,7 +347,13 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev)PMD_LOG_INFO (RX ,"AVX512 support detected but not enabled" ); #endif } -if ((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 && +if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) && + ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ) || + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 )) && + (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 )) + rx_mode_flags |=SXE2_RX_MODE_VEC_AVX2 ; + +if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) rx_mode_flags |=SXE2_RX_MODE_VEC_SSE ;#endif
@@ -354,6 +377,11 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev) else dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_avx512;#endif + }else if (rx_mode_flags &SXE2_RX_MODE_VEC_AVX2 ) { +if (rx_mode_flags &SXE2_RX_MODE_VEC_OFFLOAD ) + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_avx2_offload; +else + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_avx2; }else { dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_sse_offload; }
@@ -381,6 +409,10 @@ static const struct { { sxe2_rx_pkts_scattered_vec_avx512_offload, "Offload Vector AVX512 Scattered" }, #endif + { sxe2_rx_pkts_scattered_vec_avx2, + "Vector AVX2 Scattered" }, + { sxe2_rx_pkts_scattered_vec_avx2_offload, + "Offload Vector AVX2 Scattered" }, { sxe2_rx_pkts_scattered_vec_sse_offload, "Vector SSE Scattered" }, #endif
drivers/net/sxe2/sxe2_txrx_vec.h +10 -2
@@ -11,19 +11,21 @@#define SXE2_RX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_RX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_RX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ - SXE2_RX_MODE_VEC_AVX512) + SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_TX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ - SXE2_TX_MODE_VEC_AVX512) + SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -68,6 +70,12 @@ uint16_t sxe2_rx_pkts_scattered_vec_avx512(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_avx512_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx2_simple (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx2 (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx2_offload (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts);#endif 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);
drivers/net/sxe2/sxe2_txrx_vec_avx2.c new file +747 -0
747 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 5/23 net/sxe2: add link update callback
In reply to [email protected]From: Jie Liu <[email protected]>
Implement dev_link_update ethdev callback for sxe2 PMD. The driver reads the link status, speed, and duplex mode from the hardware registers and updates the ethdev link status using the appropriate atomic operations.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 22 +++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 2 + drivers/net/sxe2/sxe2_drv_cmd.h | 6 ++ drivers/net/sxe2/sxe2_ethdev.c | 158 +++++++++++++++++++++++++------ drivers/net/sxe2/sxe2_ethdev.h | 19 ++-- drivers/net/sxe2/sxe2_mac.c | 98 +++++++++++++++++++ drivers/net/sxe2/sxe2_mac.h | 50 ++++++++++ 8 files changed, 316 insertions(+), 40 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h
drivers/net/sxe2/meson.build +1 -0
@@ -60,4 +60,5 @@ sources += files( 'sxe2_txrx_poll.c', 'sxe2_txrx.c', 'sxe2_txrx_vec.c', + 'sxe2_mac.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +22 -0
@@ -321,3 +321,25 @@ int32_t sxe2_drv_txq_switch(struct sxe2_adapter *adapter, struct sxe2_tx_queue *return ret; } + +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter) +{ +int32_t ret =0 ; +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_cmd_params param = {0 }; +struct sxe2_drv_link_info_resp resp = {0 }; + +sxe2_drv_cmd_params_fill (adapter, ¶m,SXE2_DRV_CMD_LINK_STATUS_GET , +NULL ,0 , + &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, ¶m); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"link status get failed, ret=%d" , ret); + goto l_end; + } + adapter->link_ctxt.speed = resp.speed; + adapter->link_ctxt.link_up = resp.status; + +l_end: +return ret; +}
drivers/net/sxe2/sxe2_cmd_chnl.h +2 -0
@@ -34,4 +34,6 @@ int32_t sxe2_drv_txq_ctxt_cfg(struct sxe2_adapter *adapter,struct sxe2_tx_queue *txq, uint16_t txq_cnt); +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +6 -0
@@ -227,6 +227,12 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_info_get_resp {struct sxe2_drv_msix_caps used_msix; } __rte_packed_end; +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; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +127 -31
213 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +10 -9
@@ -120,12 +120,6 @@ enum {SXE2_FLAGS_NBITS }; -struct sxe2_link_context { -rte_spinlock_t link_lock; -bool link_up; -uint32_t speed; -}; -struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;
@@ -266,6 +260,12 @@ struct sxe2_sched_hw_cap {uint8_t adj_lvl; }; +struct sxe2_link_context { +rte_spinlock_t link_lock; +bool link_up; +uint32_t speed; +}; +struct sxe2_adapter {struct sxe2_common_device *cdev;struct sxe2_dev_info dev_info;
@@ -275,9 +275,10 @@ struct sxe2_adapter {struct sxe2_irq_context irq_ctxt;struct sxe2_queue_context q_ctxt;struct sxe2_vsi_context vsi_ctxt; -struct sxe2_devargs devargs; -uint16_t dev_port_id; -uint64_t cap_flags; +struct sxe2_link_context link_ctxt; +struct sxe2_devargs devargs; +uint16_t dev_port_id; +uint64_t cap_flags;enum sxe2_dev_type dev_type;struct rte_ether_addr mac_addr;uint8_t port_idx;
drivers/net/sxe2/sxe2_mac.c new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe2/sxe2_mac.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 6/23 net/sxe2: support L2 filtering and MAC config
In reply to [email protected]From: Jie Liu <[email protected]>
- Support primary/secondary MAC address setup.
- Enable L2 broadcast/multicast filter bits.
- Add multicast address update logic.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 198 ++++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 17 + drivers/net/sxe2/sxe2_drv_cmd.h | 87 ++++ drivers/net/sxe2/sxe2_ethdev.c | 70 ++- drivers/net/sxe2/sxe2_ethdev.h | 43 +- drivers/net/sxe2/sxe2_filter.c | 782 ++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_filter.h | 98 ++++ drivers/net/sxe2/sxe2_mac.c | 432 +++++++++++++++++ drivers/net/sxe2/sxe2_mac.h | 34 ++ drivers/net/sxe2/sxe2_txrx_poll.c | 49 ++ 11 files changed, 1805 insertions(+), 6 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h
drivers/net/sxe2/meson.build +1 -0
@@ -61,4 +61,5 @@ sources += files( 'sxe2_txrx.c', 'sxe2_txrx_vec.c', 'sxe2_mac.c', + 'sxe2_filter.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +198 -0
201 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +17 -0
@@ -36,4 +36,21 @@ int32_t sxe2_drv_txq_ctxt_cfg(struct sxe2_adapter *adapter,int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); +int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); + +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); + +int32_t sxe2_drv_mc_config (struct sxe2_adapter *adapter,struct rte_ether_addr *addr,bool add); + +int32_t sxe2_drv_vlan_config_query (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vlan_filter_id_config (struct sxe2_adapter *adapter, +struct sxe2_vlan *vlan,bool on); + +int32_t sxe2_drv_vlan_insert_strip_cfg (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vlan_filter_switch (struct sxe2_adapter *adapter,bool on); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +87 -0
93 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +68 -2
137 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +39 -4
75 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.c new file +782 -0
782 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.h new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe2/sxe2_mac.c +432 -0
438 lines not on this page · raw message
drivers/net/sxe2/sxe2_mac.h +34 -0
@@ -43,6 +43,40 @@ struct sxe2_mac_mc_list {int32_t sxe2_link_update_init (struct rte_eth_dev *dev); +int32_t sxe2_mac_default_cfg (struct rte_eth_dev *dev); + +int32_t sxe2_vlan_cfg_init (struct rte_eth_dev *dev); + +int32_t sxe2_mac_addr_init (struct rte_eth_dev *dev); + +void sxe2_mac_addr_uinit (struct rte_eth_dev *dev); + +int32_t sxe2_mac_addr_add (struct rte_eth_dev *dev, +struct rte_ether_addr *mac_addr, + __rte_unused uint32_t index, __rte_unused uint32_t pool); + +void sxe2_mac_addr_del (struct rte_eth_dev *dev,uint32_t index); + +int32_t sxe2_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); + +int32_t sxe2_set_mc_addr_list (struct rte_eth_dev *dev, +struct rte_ether_addr *mc_addrs, +uint32_t mc_addrs_num); + +int32_t sxe2_promisc_enable (struct rte_eth_dev *dev); + +int32_t sxe2_promisc_disable (struct rte_eth_dev *dev); + +int32_t sxe2_allmulti_enable (struct rte_eth_dev *dev); + +int32_t sxe2_allmulti_disable (struct rte_eth_dev *dev); + +int32_t sxe2_dev_vlan_filter_set (struct rte_eth_dev *dev,uint16_t vlan_id,int32_t on); + +int32_t sxe2_dev_vlan_offload_set (struct rte_eth_dev *dev,int32_t mask); + +int32_t sxe2_vlan_default_cfg (struct rte_eth_dev *dev); + int32_t sxe2_link_update(struct rte_eth_dev *dev, __rte_unused int32_t wait_to_complete);int32_t sxe2_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);
drivers/net/sxe2/sxe2_txrx_poll.c +49 -0
61 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 7/23 drivers: support RSS feature
In reply to [email protected]From: Jie Liu <[email protected]>
Add support for Receive Side Scaling (RSS) to distribute incoming traffic across multiple receive queues.
- Implement rss_hash_update and rss_hash_conf_get.
- Implement reta_update and reta_query.
- Support RSS hash configuration for IPv4, IPv6, TCP and UDP.
- Default hash key is initialized during port start.
--- drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++++++++++++++++++++ drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 173 +++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 16 + drivers/net/sxe2/sxe2_drv_cmd.h | 29 ++ drivers/net/sxe2/sxe2_ethdev.c | 37 ++ drivers/net/sxe2/sxe2_ethdev.h | 8 + drivers/net/sxe2/sxe2_flow_define.h | 143 ++++++ drivers/net/sxe2/sxe2_queue.c | 11 + drivers/net/sxe2/sxe2_rss.c | 584 +++++++++++++++++++++++ drivers/net/sxe2/sxe2_rss.h | 81 ++++ drivers/net/sxe2/sxe2_txrx.h | 3 + drivers/net/sxe2/sxe2_txrx_poll.c | 85 +++- 13 files changed, 1803 insertions(+), 1 deletion(-) create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h
drivers/common/sxe2/sxe2_flow_public.h new file +633 -0
@@ -0,0 +1,633 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_FLOW_PUBLIC_H__ +#define __SXE2_FLOW_PUBLIC_H__ +#include "sxe2_osal.h" + +enum sxe2_flow_type { +SXE2_FLOW_TYPE_NONE =0 , +SXE2_FLOW_MAC_PAY =1 , +SXE2_FLOW_MAC_IPV4_FRAG_PAY =22 , +SXE2_FLOW_MAC_IPV4_PAY =23 , +SXE2_FLOW_MAC_IPV4_UDP_PAY =24 , +SXE2_FLOW_MAC_IPV4_TCP_PAY =26 , +SXE2_FLOW_MAC_IPV4_SCTP_PAY =27 , +SXE2_FLOW_MAC_IPV4_IPV4_FRAG_PAY =29 , +SXE2_FLOW_MAC_IPV4_IPV4_PAY =30 , +SXE2_FLOW_MAC_IPV4_IPV4_UDP_PAY =31 , +SXE2_FLOW_MAC_IPV4_IPV4_TCP_PAY =33 , +SXE2_FLOW_MAC_IPV4_IPV4_SCTP_PAY =34 , +SXE2_FLOW_MAC_IPV4_IPV6_FRAG_PAY =36 , +SXE2_FLOW_MAC_IPV4_IPV6_PAY =37 , +SXE2_FLOW_MAC_IPV4_IPV6_UDP_PAY =38 , +SXE2_FLOW_MAC_IPV4_IPV6_TCP_PAY =40 , +SXE2_FLOW_MAC_IPV4_IPV6_SCTP_PAY =41 , +SXE2_FLOW_MAC_IPV4_GRE_PAY =43 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_FRAG_PAY =44 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_PAY =45 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_UDP_PAY =46 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_TCP_PAY =48 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_SCTP_PAY =49 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_FRAG_PAY =51 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_PAY =52 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_UDP_PAY =53 , +SXE2_FLOW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PE_MAX =2048 , +}; + +enum sxe2_rss_cfg_hdr_type { +SXE2_RSS_OUTER_HEADERS , +SXE2_RSS_INNER_HEADERS , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4 , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6 , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_VXLAN , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_VXLAN , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_GENEVE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_GENEVE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_GTPU , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_GTPU , +SXE2_RSS_ANY_HEADERS +}; + +enum sxe2_flow_hdr { +SXE2_FLOW_HDR_ETH =0 , +SXE2_FLOW_HDR_VLAN , +SXE2_FLOW_HDR_QINQ , +SXE2_FLOW_HDR_IPV4 , +SXE2_FLOW_HDR_IPV6 , +SXE2_FLOW_HDR_ICMP =5 , +SXE2_FLOW_HDR_TCP , +SXE2_FLOW_HDR_UDP , +SXE2_FLOW_HDR_SCTP , +SXE2_FLOW_HDR_GRE , +SXE2_FLOW_HDR_VXLAN =10 , +SXE2_FLOW_HDR_GENEVE , +SXE2_FLOW_HDR_GTPU , + +SXE2_FLOW_HDR_IPV_FRAG , + +SXE2_FLOW_HDR_IPV_OTHER , + +SXE2_FLOW_HDR_ETH_NON_IP =15 , +SXE2_FLOW_HDR_MAX =128 , +}; + +enum sxe2_flow_fld_id { +SXE2_FLOW_FLD_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HKSUM , +SXE2_FLOW_FLD_ID_SCTP_CHKSUM , + +SXE2_FLOW_FLD_ID_VXLAN_VNI , + +SXE2_FLOW_FLD_ID_GENEVE_VNI , + +SXE2_FLOW_FLD_ID_GTPU_TEID =40 , + +SXE2_FLOW_FLD_ID_NVGRE_TNI , + +SXE2_FLOW_FLD_ID_MAX =128 , +}; + +struct sxe2_ether_hdr { +uint8_t dst_addr[SXE2_ETH_ALEN ]; +uint8_t src_addr[SXE2_ETH_ALEN ]; +uint16_t ether_type; +}; + +struct sxe2_vlan_hdr { +uint16_t type; +uint16_t vlan; +}; + +struct sxe2_ipv4_hdr { +uint8_t ver_ihl; +uint8_t tos; +uint16_t tot_len; +uint16_t id; +uint16_t frag_off; +uint8_t ttl; +uint8_t protocol; +uint16_t check; +uint32_t saddr; +uint32_t daddr; +}; +#define SXE2_IPV6_ADDR_LENGTH (16) +#define SXE2_IPV6_TC_SHIFT (20) +#define SXE2_IPV6_TC_MASK (0xFF) + +struct sxe2_ipv6_hdr { +uint32_t pri_ver_flow; +uint16_t payload_len; +uint8_t nexthdr; +uint8_t hop_limit; +union { +uint8_t saddr[16 ]; +uint16_t saddr16[8 ]; +uint32_t saddr32[4 ]; + }; +union { +uint8_t daddr[16 ]; +uint16_t daddr16[8 ]; +uint32_t daddr32[4 ]; + }; +}; + +struct sxe2_tcp_hdr { +uint16_t source; +uint16_t dest; +uint32_t seq; +uint32_t ack_seq; +uint16_t flag; +uint16_t window; +uint16_t check; +uint16_t urg_ptr; +}; + +struct sxe2_udp_hdr { +uint16_t source; +uint16_t dest; +uint16_t len; +uint16_t check; +}; + +struct sxe2_sctp_hdr { +uint16_t src_port; +uint16_t dst_port; +}; + +struct sxe2_nvgre_hdr { +uint16_t flags; +uint16_t protocol; +uint32_t tni; +}; +struct sxe2_geneve_hdr { +uint16_t flags; +uint16_t protocol; +uint32_t vni; +}; +struct sxe2_gtpu_hdr { +uint8_t flag; +uint8_t msg_type; +uint16_t msg_len; +uint32_t teid; +}; +struct sxe2_vxlan_hdr { +uint8_t flag; +uint8_t resvd0; +uint8_t resvd1; +uint8_t protocol; +uint32_t vni; +}; + +enum sxe2_flow_act_type { +SXE2_FLOW_ACTION_DROP =0 , +SXE2_FLOW_ACTION_TC_REDIRECT , +SXE2_FLOW_ACTION_TO_VSI , +SXE2_FLOW_ACTION_TO_VSI_LIST , +SXE2_FLOW_ACTION_PASSTHRU , +SXE2_FLOW_ACTION_QUEUE , +SXE2_FLOW_ACTION_Q_REGION , +SXE2_FLOW_ACTION_MARK , +SXE2_FLOW_ACTION_COUNT , +SXE2_FLOW_ACTION_RSS , +SXE2_FLOW_ACTION_MAX =32 , +}; + +enum sxe2_rss_hash_key_func { +SXE2_RSS_HASH_FUNC_TOEPLITZ =0 , +SXE2_RSS_HASH_FUNC_SYM_TOEPLITZ =1 , +SXE2_RSS_HASH_FUNC_XOR =2 , +SXE2_RSS_HASH_FUNC_JEKINS =3 +}; + +struct sxe2_flow_action_rss { + DECLARE_BITMAP(hdr_out, SXE2_FLOW_HDR_MAX); + DECLARE_BITMAP(hdr_in, SXE2_FLOW_HDR_MAX); + DECLARE_BITMAP(fld, SXE2_FLOW_FLD_ID_MAX); +uint8_t is_inner; +uint8_t func; +uint8_t hdr_type; +}; + +struct sxe2_flow_action_queue { +uint16_t vsi_index; +uint16_t q_index; +}; + +struct sxe2_flow_action_queue_region { +uint16_t vsi_index; +uint16_t q_index; +uint8_t region; +}; + +struct sxe2_flow_action_passthru { +uint16_t vsi_index; +}; + +struct sxe2_flow_action_mark { +uint32_t mark_id; +}; + +#define SXE2_VSI_MAX (2048) +struct sxe2_flow_action_vsi { +uint16_t vsi_index; +}; + +struct sxe2_flow_action_vsi_list { + DECLARE_BITMAP(vsi_list_map, SXE2_VSI_MAX); +uint16_t vsi_cnt; +}; + +enum sxe2_fnav_stat_ctrl_type { +SXE2_FNAV_STAT_ENA_NONE =0 , +SXE2_FNAV_STAT_ENA_PKTS , +SXE2_FNAV_STAT_ENA_BYTES , +SXE2_FNAV_STAT_ENA_ALL , +}; + +struct sxe2_flow_action_count { +uint32_t user_id; +uint32_t driver_id; +uint32_t stat_index; +uint32_t stat_ctrl; +}; + +enum sxe2_flow_engine_type { +SXE2_FLOW_ENGINE_ACL , +SXE2_FLOW_ENGINE_SWITCH , +SXE2_FLOW_ENGINE_FNAV , +SXE2_FLOW_ENGINE_RSS , +SXE2_FLOW_ENGINE_MAX , +}; + +struct sxe2_flow_item { +struct sxe2_ether_hdr eth; +struct sxe2_vlan_hdr vlan; +struct sxe2_vlan_hdr qinq; +struct sxe2_ipv4_hdr ipv4; +struct sxe2_ipv6_hdr ipv6; +struct sxe2_udp_hdr udp; +struct sxe2_tcp_hdr tcp; +struct sxe2_sctp_hdr sctp; +struct sxe2_gtpu_hdr gtpu; +struct sxe2_vxlan_hdr vxlan; +struct sxe2_nvgre_hdr nvgre; +struct sxe2_geneve_hdr geneve; +}; + +enum sxe2_flow_sw_direct_type { +SXE2_FLOW_SW_DIRECT_TX , +SXE2_FLOW_SW_DIRECT_RX , +SXE2_FLOW_SW_DIRECT_MAX , +}; +enum sxe2_flow_sw_pattern_type { +SXE2_FLOW_SW_PATTERN_ONLY , +SXE2_FLOW_SW_PATTERN_LAST , +SXE2_FLOW_SW_PATTERN_FIRST , +SXE2_FLOW_SW_PATTERN_MAX , +}; + +enum sxe2_flow_tunnel_type { +SXE2_FLOW_TUNNEL_TYPE_NONE , +SXE2_FLOW_TUNNEL_TYPE_PARENT , +SXE2_FLOW_TUNNEL_TYPE_VXLAN , +SXE2_FLOW_TUNNEL_TYPE_GTPU , +SXE2_FLOW_TUNNEL_TYPE_GENEVE , +SXE2_FLOW_TUNNEL_TYPE_GRE , +SXE2_FLOW_TUNNEL_TYPE_IPIP , +}; + +struct sxe2_flow_meta { +uint8_t switch_pattern_dup_allow; +uint8_t switch_src_direct; +uint16_t flow_src_vsi; +uint16_t flow_rule_vsi; +uint32_t flow_prio; +uint16_t flow_type; +uint8_t tunnel_type; +uint8_t rsv; +}; + +struct sxe2_flow_pattern { + DECLARE_BITMAP(hdrs, SXE2_FLOW_HDR_MAX); + DECLARE_BITMAP(map_spec, SXE2_FLOW_FLD_ID_MAX); + DECLARE_BITMAP(map_mask, SXE2_FLOW_FLD_ID_MAX); +struct sxe2_flow_item item_spec; +struct sxe2_flow_item item_mask; +uint64_t rss_type_allow; +}; + +struct sxe2_flow_action { + DECLARE_BITMAP(act_types, SXE2_FLOW_ACTION_MAX); +struct sxe2_flow_action_rss rss; +struct sxe2_flow_action_queue queue; +struct sxe2_flow_action_queue_region q_region; +struct sxe2_flow_action_passthru passthru; +struct sxe2_flow_action_vsi vsi; +struct sxe2_flow_action_vsi_list vsi_list; +struct sxe2_flow_action_mark mark; +struct sxe2_flow_action_count count; +}; +#endif /* __SXE2_FLOW_PUBLIC_H__ */
drivers/net/sxe2/meson.build +1 -0
@@ -62,4 +62,5 @@ sources += files( 'sxe2_txrx_vec.c', 'sxe2_mac.c', 'sxe2_filter.c', + 'sxe2_rss.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +173 -0
176 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +16 -0
@@ -53,4 +53,20 @@ int32_t sxe2_drv_vlan_insert_strip_cfg(struct sxe2_adapter *adapter);int32_t sxe2_drv_vlan_filter_switch (struct sxe2_adapter *adapter,bool on); +int32_t sxe2_drv_rss_key_set (struct sxe2_adapter *adapter,uint8_t *key,uint16_t key_size); + +int32_t sxe2_drv_rss_lut_set (struct sxe2_adapter *adapter,uint8_t *lut,uint16_t lut_size); + +int32_t sxe2_drv_rss_hash_ctrl_func (struct sxe2_adapter *adapter,enum sxe2_rss_hash_key_func func); + +int32_t sxe2_drv_rss_hf_add (struct sxe2_adapter *adapter, +struct sxe2_rss_hf_config *rss_conf); + +int32_t sxe2_drv_rss_hf_del (struct sxe2_adapter *adapter, +struct sxe2_rss_hf_config *rss_conf); + +int32_t sxe2_drv_rss_hf_clear (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_ptp_gettime (struct sxe2_adapter *adapter,struct sxe2_rx_queue *rxq); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +29 -0
@@ -6,6 +6,7 @@#define SXE2_DRV_CMD_H #include "sxe2_osal.h" +#include "sxe2_flow_public.h" #define SXE2_DRV_CMD_MODULE_S (16)#define SXE2_MK_DRV_CMD (module, cmd) (((module) << SXE2_DRV_CMD_MODULE_S) | ((cmd) & 0xFFFF))
@@ -320,6 +321,34 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_vlan_filter_switch_req {uint8_t rsv; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_key_req { + uint16_t vsi_id; +uint16_t key_size; +uint8_t key[]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_lut_req { + uint16_t vsi_id; +uint16_t lut_size; +uint8_t lut[]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_func_req { + uint16_t vsi_id; +uint8_t func; +uint8_t rsv[1 ]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_hf_req { + uint16_t vsi_id; +uint8_t rsv[2 ]; +uint32_t headers[BITS_TO_U32 (SXE2_FLOW_HDR_MAX )]; +uint32_t hash_flds[BITS_TO_U32 (SXE2_FLOW_FLD_ID_MAX )]; +uint32_t hdr_type; +uint8_t symm; +uint8_t rsv1[3 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +37 -0
@@ -124,6 +124,11 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .vlan_filter_set = sxe2_dev_vlan_filter_set, .vlan_offload_set = sxe2_dev_vlan_offload_set, + + .reta_update = sxe2_dev_rss_reta_update, + .reta_query = sxe2_dev_rss_reta_query, + .rss_hash_update = sxe2_dev_rss_hash_update, + .rss_hash_conf_get = sxe2_dev_rss_hash_conf_get, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -140,6 +145,12 @@ static int32_t sxe2_dev_configure(struct rte_eth_dev *dev) goto end; } + ret =sxe2_rss_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to init rss, ret=%d" , ret); + goto end; + } + end:return ret; }
@@ -280,6 +291,22 @@ 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 (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_PTP ) + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ; + +if (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_RSS ) { + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; + dev_info->flow_type_rss_offloads |=SXE2_RSS_HF_SUPPORT_ALL ; + dev_info->reta_size = adapter->rss_ctxt.rss_lut_size; + dev_info->hash_key_size = adapter->rss_ctxt.rss_key_size; + dev_info->rss_algo_capa = +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_DEFAULT ) | +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_TOEPLITZ ) | +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ ) | +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ); + } + dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_thresh = { .pthresh =SXE2_DEFAULT_RX_PTHRESH ,
@@ -552,6 +579,8 @@ static int32_t sxe2_func_caps_get(struct sxe2_adapter *adapter)sxe2_sw_queue_ctx_hw_cap_set (adapter, &dev_caps.queue_caps); +sxe2_sw_rss_ctx_hw_cap_set (adapter, &dev_caps.rss_hash_caps); +sxe2_sw_vsi_ctx_hw_cap_set (adapter, &dev_caps.vsi_caps); l_end:
@@ -937,8 +966,15 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_eth_err; } + ret =sxe2_rss_disable (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to disable rss, ret=%d" , ret); + goto init_rss_err; + } + goto l_end; +init_rss_err: init_eth_err: init_dev_info_err:sxe2_vsi_uninit (dev);
@@ -952,6 +988,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev) { (void )sxe2_dev_stop (dev); (void )sxe2_queues_release (dev); + (void )sxe2_rss_disable (dev);sxe2_vsi_uninit (dev);sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev);
drivers/net/sxe2/sxe2_ethdev.h +8 -0
@@ -15,6 +15,7 @@#include "sxe2_common.h" #include "sxe2_vsi.h" +#include "sxe2_rss.h" #include "sxe2_irq.h" #include "sxe2_queue.h" #include "sxe2_mac.h"
@@ -122,6 +123,11 @@ enum {SXE2_FLAGS_NBITS }; +struct sxe2_ptp_context { +uint64_t mbuf_rx_ts_flag; +int32_t mbuf_rx_ts_offset; +}; +struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;
@@ -299,7 +305,9 @@ struct sxe2_adapter {struct sxe2_queue_context q_ctxt;struct sxe2_vsi_context vsi_ctxt;struct sxe2_filter_context filter_ctxt; +struct sxe2_rss_context rss_ctxt;struct sxe2_link_context link_ctxt; +struct sxe2_ptp_context ptp_ctxt;struct sxe2_devargs devargs;struct sxe2_switchdev_info switchdev_info;bool rule_started;
drivers/net/sxe2/sxe2_flow_define.h new file +143 -0
143 lines not on this page · raw message
drivers/net/sxe2/sxe2_queue.c +11 -0
@@ -17,6 +17,7 @@ void sxe2_sw_queue_ctx_hw_cap_set(struct sxe2_adapter *adapter,int32_t sxe2_queues_init (struct rte_eth_dev *dev) { +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev);int32_t ret =0 ;uint16_t buf_size;uint16_t frame_size;
@@ -36,6 +37,16 @@ int32_t sxe2_queues_init(struct rte_eth_dev *dev) dev->data->scattered_rx =1 ; } + adapter->ptp_ctxt.mbuf_rx_ts_offset =-1 ; + adapter->ptp_ctxt.mbuf_rx_ts_flag =0 ; +if (dev->data->dev_conf.rxmode.offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP ) { + ret =rte_mbuf_dyn_rx_timestamp_register + (&adapter->ptp_ctxt.mbuf_rx_ts_offset, + (uint64_t *)&adapter->ptp_ctxt.mbuf_rx_ts_flag); +if (ret) +PMD_LOG_ERR (INIT ,"Failed to enable timestamp offloads, ret=%d" , ret); + } +return ret; }
drivers/net/sxe2/sxe2_rss.c new file +584 -0
584 lines not on this page · raw message
drivers/net/sxe2/sxe2_rss.h new file +81 -0
81 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx.h +3 -0
@@ -27,5 +27,8 @@ extern const uint32_t sxe2_ptype_tbl[];const uint32_t *sxe2_dev_supported_ptypes_get (struct rte_eth_dev *dev,size_t *no_of_elements); +#ifndef RTE_LIBRTE_SXE2_16BYTE_RX_DESC +int32_t sxe2_rx_update_ptp_time (struct sxe2_rx_queue *rxq); +#endif #endif /* SXE2_TXRX_H */
drivers/net/sxe2/sxe2_txrx_poll.c +84 -1
118 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 8/23 net/sxe2: support TM hierarchy and shaping
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the traffic management ops for example PMD. It supports a 4-level hierarchy: port, vsi, queue group and queue.
- Support node add/delete and hierarchy commit.
- Support private shaper and rate limiting on each node.
The hardware requires all nodes to be configured before the hierarchy is committed to the global registers.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 163 +++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 6 + drivers/net/sxe2/sxe2_drv_cmd.h | 28 +- drivers/net/sxe2/sxe2_ethdev.c | 82 +++ drivers/net/sxe2/sxe2_ethdev.h | 5 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 ++ drivers/net/sxe2/sxe2_tx.c | 1 - 9 files changed, 1511 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h
drivers/net/sxe2/meson.build +1 -0
@@ -63,4 +63,5 @@ sources += files( 'sxe2_mac.c', 'sxe2_filter.c', 'sxe2_rss.c', + 'sxe2_tm.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +163 -0
184 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +6 -0
@@ -38,6 +38,12 @@ int32_t sxe2_drv_mac_link_status_get(struct sxe2_adapter *adapter);int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +int32_t sxe2_drv_root_tree_release (struct rte_eth_dev *dev); + +int32_t sxe2_drv_root_tree_alloc (struct rte_eth_dev *dev); + +int32_t sxe2_drv_tm_commit (struct sxe2_adapter *adapter); +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_drv_cmd.h +27 -1
@@ -29,7 +29,7 @@#define SXE2_SCHED_MODE_DEFAULT 0#define SXE2_SCHED_MODE_TM 1 -#define SXE2_SCHED_MODE_HIGH_PERFORMANCE 2 +#define SXE2_SCHED_MODE_NO_SCHED 2#define SXE2_SCHED_MODE_INVALID 3#define SXE2_SRCVSI_PRUNE_MAX_NUM 2
@@ -349,6 +349,32 @@ 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 { + uint16_t teid; +uint8_t rsv[2 ]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin 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; +uint8_t adj_lvl; +struct sxe2_tm_info info; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_tm_add_queue_msg { + uint16_t parent_teid; +uint16_t queue_id; +uint8_t adj_lvl; +struct sxe2_tm_info info; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +82 -0
120 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +5 -0
@@ -20,6 +20,7 @@#include "sxe2_queue.h" #include "sxe2_mac.h" #include "sxe2_osal.h" +#include "sxe2_tm.h" #include "sxe2_filter.h" struct sxe2_link_msg {
@@ -308,6 +309,8 @@ struct sxe2_adapter {struct sxe2_rss_context rss_ctxt;struct sxe2_link_context link_ctxt;struct sxe2_ptp_context ptp_ctxt; +struct sxe2_sched_hw_cap sched_ctxt; +struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs;struct sxe2_switchdev_info switchdev_info;bool rule_started;
@@ -330,6 +333,8 @@ void *sxe2_pci_map_addr_get(struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type, uint16_t idx_in_func); +uint32_t sxe2_sched_mode_get (struct sxe2_adapter *adapter); +struct sxe2_pci_map_bar_info *sxe2_dev_get_bar_info (struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type);
drivers/net/sxe2/sxe2_tm.c new file +1151 -0
1,151 lines not on this page · raw message
drivers/net/sxe2/sxe2_tm.h new file +76 -0
76 lines not on this page · raw message
drivers/net/sxe2/sxe2_tx.c +0 -1
@@ -304,7 +304,6 @@ int32_t __rte_cold sxe2_tx_queue_setup(struct rte_eth_dev *dev, } offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads; - txq =sxe2_tx_queue_alloc (dev, queue_idx, nb_desc, socket_id);if (txq ==NULL ) {PMD_LOG_ERR (TX ,"failed to alloc sxe2vf tx queue:%u resource" , queue_idx);
Signature · 1 line
2.52.0
PATCH v7 9/23 net/sxe2: support IPsec inline protocol offload
In reply to [email protected]From: Jie Liu <[email protected]>
This patch adds support for IPsec inline protocol offload for both inbound and outbound traffic.
- Implement rte_security_ops: session_create, session_destroy.
- Add hardware SA table management.
- Update Rx/Tx data path to handle security offload flags.
The hardware offloads the ESP encapsulation/decapsulation and cryptographic processing.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_cmd_chnl.c | 197 ++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 20 + drivers/net/sxe2/sxe2_drv_cmd.h | 61 ++ drivers/net/sxe2/sxe2_ethdev.c | 14 + drivers/net/sxe2/sxe2_ethdev.h | 3 + drivers/net/sxe2/sxe2_ipsec.c | 1565 +++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++++ drivers/net/sxe2/sxe2_rx.c | 5 + drivers/net/sxe2/sxe2_security.c | 335 ++++++ drivers/net/sxe2/sxe2_security.h | 77 ++ drivers/net/sxe2/sxe2_tx.c | 8 + drivers/net/sxe2/sxe2_txrx_poll.c | 55 + 13 files changed, 2596 insertions(+) create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h
drivers/net/sxe2/meson.build +2 -0
@@ -64,4 +64,6 @@ sources += files( 'sxe2_filter.c', 'sxe2_rss.c', 'sxe2_tm.c', + 'sxe2_ipsec.c', + 'sxe2_security.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +197 -0
200 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +20 -0
@@ -44,6 +44,26 @@ int32_t sxe2_drv_root_tree_alloc(struct rte_eth_dev *dev);int32_t sxe2_drv_tm_commit (struct sxe2_adapter *adapter); +int32_t sxe2_drv_ipsec_resource_clear (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_ipsec_get_capa (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_ipsec_rxsa_add (struct sxe2_adapter *adapter, +struct sxe2_ipsec_rx_sa *rx_sa, +struct sxe2_ipsec_rx_tcam *rx_tcam, +struct sxe2_ipsec_rx_udp_group *rx_udp_group); + +int32_t sxe2_drv_ipsec_txsa_add (struct sxe2_adapter *adapter, +struct sxe2_ipsec_tx_sa *tx_sa); + +int32_t sxe2_drv_ipsec_rxsa_delete (struct sxe2_adapter *adapter, +struct sxe2_ipsec_rx_sa *rx_sa); + +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_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_drv_cmd.h +61 -0
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +14 -0
@@ -297,6 +297,11 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,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 (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_RSS ) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->flow_type_rss_offloads |=SXE2_RSS_HF_SUPPORT_ALL ;
@@ -1040,6 +1045,12 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_eth_err; } + ret =sxe2_security_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to initialize security, ret=%d" , ret); + goto init_security_err; + } + ret =sxe2_rss_disable (dev);if (ret) {PMD_LOG_ERR (INIT ,"Failed to disable rss, ret=%d" , ret);
@@ -1054,6 +1065,8 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto l_end; +init_security_err: +sxe2_eth_uinit (dev); init_sched_err: init_rss_err: init_eth_err:
@@ -1072,6 +1085,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev) (void )sxe2_rss_disable (dev); (void )sxe2_sched_uinit (dev);sxe2_vsi_uninit (dev); +sxe2_security_uinit (dev);sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev);
drivers/net/sxe2/sxe2_ethdev.h +3 -0
@@ -20,6 +20,8 @@#include "sxe2_queue.h" #include "sxe2_mac.h" #include "sxe2_osal.h" +#include "sxe2_security.h" +#include "sxe2_ipsec.h" #include "sxe2_tm.h" #include "sxe2_filter.h"
@@ -312,6 +314,7 @@ struct sxe2_adapter {struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs; +struct sxe2_security_ctx security_ctx;struct sxe2_switchdev_info switchdev_info;bool rule_started;bool flow_isolated;
drivers/net/sxe2/sxe2_ipsec.c new file +1565 -0
1,565 lines not on this page · raw message
drivers/net/sxe2/sxe2_ipsec.h new file +254 -0
254 lines not on this page · raw message
drivers/net/sxe2/sxe2_rx.c +5 -0
@@ -294,6 +294,11 @@ int32_t __rte_cold sxe2_rx_queue_setup(struct rte_eth_dev *dev, goto l_end; } +if (!sxe2_ipsec_valid_rx_offloads (offloads)) { + ret = -EINVAL ; + goto l_end; + } + rxq =sxe2_rx_queue_alloc (dev, queue_idx, nb_desc, socket_id);if (rxq ==NULL ) {PMD_LOG_ERR (RX ,"rx queue[%d] resource alloc failed" , queue_idx);
drivers/net/sxe2/sxe2_security.c new file +335 -0
335 lines not on this page · raw message
drivers/net/sxe2/sxe2_security.h new file +77 -0
77 lines not on this page · raw message
drivers/net/sxe2/sxe2_tx.c +8 -0
@@ -304,6 +304,11 @@ int32_t __rte_cold sxe2_tx_queue_setup(struct rte_eth_dev *dev, } offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads; +if (!sxe2_ipsec_valid_tx_offloads (offloads)) { + ret = -EINVAL ; + goto end; + } + txq =sxe2_tx_queue_alloc (dev, queue_idx, nb_desc, socket_id);if (txq ==NULL ) {PMD_LOG_ERR (TX ,"failed to alloc sxe2vf tx queue:%u resource" , queue_idx);
@@ -327,6 +332,9 @@ int32_t __rte_cold sxe2_tx_queue_setup(struct rte_eth_dev *dev, txq->ops =sxe2_tx_default_ops_get (); txq->ops.queue_reset (txq); +if (sxe2_ipsec_supported (adapter) && txq->offloads &RTE_ETH_TX_OFFLOAD_SECURITY ) + txq->ipsec_pkt_md_offset =sxe2_ipsec_pkt_md_offset_get (adapter); + dev->data->tx_queues[queue_idx] = txq; ret =0 ;
drivers/net/sxe2/sxe2_txrx_poll.c +55 -0
79 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 10/23 net/sxe2: support statistics and multi-process
In reply to [email protected]From: Jie Liu <[email protected]>
- The statistics support includes:
- Basic statistics (ipackets, opackets, ibytes, obytes, etc.)
- Extended statistics (xstats) for detailed hardware counters.
- Per-queue statistics for both RX and TX.
The multi-process support allows secondary processes to retrieve statistics. Since secondary processes cannot access hardware registers directly, an IPC mechanism is implemented using the DPDK MP API.
Atomic operations are used when reading 64-bit counters to ensure data consistency between processes.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_cmd_chnl.c | 340 +++++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 23 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 120 +++++++ drivers/net/sxe2/sxe2_ethdev.c | 38 +- drivers/net/sxe2/sxe2_mp.c | 414 ++++++++++++++++++++++ drivers/net/sxe2/sxe2_mp.h | 67 ++++ drivers/net/sxe2/sxe2_stats.c | 581 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_stats.h | 39 +++ 9 files changed, 1611 insertions(+), 13 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h
drivers/net/sxe2/meson.build +2 -0
@@ -66,4 +66,6 @@ sources += files( 'sxe2_tm.c', 'sxe2_ipsec.c', 'sxe2_security.c', + 'sxe2_mp.c', + 'sxe2_stats.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +329 -11
403 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +23 -0
@@ -64,6 +64,29 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_get_mac_stats (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_mac_stats_reset (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_get_vsi_stats (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vsi_stats_reset (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter, +struct eth_queue_stats *qstats); + +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_txq_mapping_set (struct rte_eth_dev *eth_dev,uint16_t queue_id,uint8_t pool_idx); + +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_drv_cmd.h +120 -0
126 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +36 -2
@@ -30,6 +30,8 @@#include "sxe2_mac.h" #include "sxe2_common.h" #include "sxe2_common_log.h" +#include "sxe2_mp.h" +#include "sxe2_stats.h" #include "sxe2_host_regs.h" #include "sxe2_ioctl_chnl_func.h"
@@ -131,6 +133,14 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .rss_hash_conf_get = sxe2_dev_rss_hash_conf_get, .tm_ops_get = sxe2_tm_ops_get, + + .stats_get = sxe2_stats_info_get, + .stats_reset = sxe2_stats_info_reset, + .xstats_get = sxe2_xstats_info_get, + .xstats_get_names = sxe2_xstats_names_get, + .xstats_reset = sxe2_stats_info_reset, + + .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -1012,6 +1022,9 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev,if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {sxe2_rx_mode_func_set (dev);sxe2_tx_mode_func_set (dev); + ret =sxe2_mp_init (dev); +if (ret !=0 ) +PMD_LOG_ERR (INIT ,"Failed to mp init (secondary), ret=%d" , ret); goto l_end; }
@@ -1063,12 +1076,27 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_sched_err; } + ret =sxe2_stats_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to stats init, ret=%d" , ret); + goto init_xstats_err; + } + + ret =sxe2_mp_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to mp init, ret=%d" , ret); + goto init_xstats_err; + } + goto l_end; -init_security_err: -sxe2_eth_uinit (dev); +init_xstats_err: + (void )sxe2_sched_uinit (dev); init_sched_err: init_rss_err: +sxe2_security_uinit (dev); +init_security_err: +sxe2_eth_uinit (dev); init_eth_err: init_dev_info_err:sxe2_vsi_uninit (dev);
@@ -1080,8 +1108,13 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev,static int32_t sxe2_dev_close (struct rte_eth_dev *dev) { +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +sxe2_mp_uninit (dev); + goto l_end; + } (void )sxe2_dev_stop (dev); (void )sxe2_queues_release (dev); +sxe2_mp_uninit (dev); (void )sxe2_rss_disable (dev); (void )sxe2_sched_uinit (dev);sxe2_vsi_uninit (dev);
@@ -1089,6 +1122,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev)sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev); +l_end:return 0 ; }
drivers/net/sxe2/sxe2_mp.c new file +414 -0
414 lines not on this page · raw message
drivers/net/sxe2/sxe2_mp.h new file +67 -0
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_stats.c new file +581 -0
581 lines not on this page · raw message
drivers/net/sxe2/sxe2_stats.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_STATS_H__ +#define __SXE2_STATS_H__ + +#define SXE2_STATS_FIELD_NAME_SIZE 50 + +struct sxe2_stats_field { +char name[SXE2_STATS_FIELD_NAME_SIZE ]; +uint32_t offset; +}; + +struct sxe2_adapter ; + +int32_t sxe2_stats_info_get (struct rte_eth_dev *dev, +struct rte_eth_stats *stats, +struct eth_queue_stats *qstats); + +int32_t sxe2_xstats_info_get (struct rte_eth_dev *dev, +struct rte_eth_xstat *xstats,uint32_t usr_cnt); + +int32_t sxe2_xstats_names_get(__rte_unused struct rte_eth_dev *dev, +struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int usr_cnt); + +int32_t sxe2_stats_hw_reset (struct rte_eth_dev *dev); + +int32_t sxe2_stats_info_reset (struct rte_eth_dev *dev); + +int32_t sxe2_stats_init (struct rte_eth_dev *dev); + +int32_t sxe2_queue_stats_mapping_set (struct rte_eth_dev *eth_dev, +uint16_t queue_id,uint8_t pool_idx,uint8_t is_rx); + +int32_t sxe2_queue_stats_map_init (struct rte_eth_dev *dev); + +#endif
Signature · 1 line
2.52.0
PATCH v7 10/23 net/sxe2: support statistics and multi-process
In reply to [email protected]From: Jie Liu <[email protected]>
- The statistics support includes:
- Basic statistics (ipackets, opackets, ibytes, obytes, etc.)
- Extended statistics (xstats) for detailed hardware counters.
- Per-queue statistics for both RX and TX.
The multi-process support allows secondary processes to retrieve statistics. Since secondary processes cannot access hardware registers directly, an IPC mechanism is implemented using the DPDK MP API.
Atomic operations are used when reading 64-bit counters to ensure data consistency between processes.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_cmd_chnl.c | 340 +++++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 23 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 120 +++++++ drivers/net/sxe2/sxe2_ethdev.c | 38 +- drivers/net/sxe2/sxe2_mp.c | 414 ++++++++++++++++++++++ drivers/net/sxe2/sxe2_mp.h | 67 ++++ drivers/net/sxe2/sxe2_stats.c | 581 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_stats.h | 39 +++ 9 files changed, 1611 insertions(+), 13 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h
drivers/net/sxe2/meson.build +2 -0
@@ -66,4 +66,6 @@ sources += files( 'sxe2_tm.c', 'sxe2_ipsec.c', 'sxe2_security.c', + 'sxe2_mp.c', + 'sxe2_stats.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +329 -11
403 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +23 -0
@@ -64,6 +64,29 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_get_mac_stats (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_mac_stats_reset (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_get_vsi_stats (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vsi_stats_reset (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter, +struct eth_queue_stats *qstats); + +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_txq_mapping_set (struct rte_eth_dev *eth_dev,uint16_t queue_id,uint8_t pool_idx); + +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_drv_cmd.h +120 -0
126 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +36 -2
@@ -30,6 +30,8 @@#include "sxe2_mac.h" #include "sxe2_common.h" #include "sxe2_common_log.h" +#include "sxe2_mp.h" +#include "sxe2_stats.h" #include "sxe2_host_regs.h" #include "sxe2_ioctl_chnl_func.h"
@@ -131,6 +133,14 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .rss_hash_conf_get = sxe2_dev_rss_hash_conf_get, .tm_ops_get = sxe2_tm_ops_get, + + .stats_get = sxe2_stats_info_get, + .stats_reset = sxe2_stats_info_reset, + .xstats_get = sxe2_xstats_info_get, + .xstats_get_names = sxe2_xstats_names_get, + .xstats_reset = sxe2_stats_info_reset, + + .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -1012,6 +1022,9 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev,if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {sxe2_rx_mode_func_set (dev);sxe2_tx_mode_func_set (dev); + ret =sxe2_mp_init (dev); +if (ret !=0 ) +PMD_LOG_ERR (INIT ,"Failed to mp init (secondary), ret=%d" , ret); goto l_end; }
@@ -1063,12 +1076,27 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_sched_err; } + ret =sxe2_stats_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to stats init, ret=%d" , ret); + goto init_xstats_err; + } + + ret =sxe2_mp_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to mp init, ret=%d" , ret); + goto init_xstats_err; + } + goto l_end; -init_security_err: -sxe2_eth_uinit (dev); +init_xstats_err: + (void )sxe2_sched_uinit (dev); init_sched_err: init_rss_err: +sxe2_security_uinit (dev); +init_security_err: +sxe2_eth_uinit (dev); init_eth_err: init_dev_info_err:sxe2_vsi_uninit (dev);
@@ -1080,8 +1108,13 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev,static int32_t sxe2_dev_close (struct rte_eth_dev *dev) { +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +sxe2_mp_uninit (dev); + goto l_end; + } (void )sxe2_dev_stop (dev); (void )sxe2_queues_release (dev); +sxe2_mp_uninit (dev); (void )sxe2_rss_disable (dev); (void )sxe2_sched_uinit (dev);sxe2_vsi_uninit (dev);
@@ -1089,6 +1122,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev)sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev); +l_end:return 0 ; }
drivers/net/sxe2/sxe2_mp.c new file +414 -0
414 lines not on this page · raw message
drivers/net/sxe2/sxe2_mp.h new file +67 -0
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_stats.c new file +581 -0
581 lines not on this page · raw message
drivers/net/sxe2/sxe2_stats.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_STATS_H__ +#define __SXE2_STATS_H__ + +#define SXE2_STATS_FIELD_NAME_SIZE 50 + +struct sxe2_stats_field { +char name[SXE2_STATS_FIELD_NAME_SIZE ]; +uint32_t offset; +}; + +struct sxe2_adapter ; + +int32_t sxe2_stats_info_get (struct rte_eth_dev *dev, +struct rte_eth_stats *stats, +struct eth_queue_stats *qstats); + +int32_t sxe2_xstats_info_get (struct rte_eth_dev *dev, +struct rte_eth_xstat *xstats,uint32_t usr_cnt); + +int32_t sxe2_xstats_names_get(__rte_unused struct rte_eth_dev *dev, +struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int usr_cnt); + +int32_t sxe2_stats_hw_reset (struct rte_eth_dev *dev); + +int32_t sxe2_stats_info_reset (struct rte_eth_dev *dev); + +int32_t sxe2_stats_init (struct rte_eth_dev *dev); + +int32_t sxe2_queue_stats_mapping_set (struct rte_eth_dev *eth_dev, +uint16_t queue_id,uint8_t pool_idx,uint8_t is_rx); + +int32_t sxe2_queue_stats_map_init (struct rte_eth_dev *dev); + +#endif
Signature · 1 line
2.52.0
PATCH v7 11/23 drivers: interrupt handling
In reply to [email protected]From: Jie Liu <[email protected]>
This patch includes:
- MSI-X vector allocation and mapping logic.
- Support for rx_queue_intr_enable and rx_queue_intr_disable ops.
- Interrupt handler to process admin and queue events.
- Integration with EAL interrupt framework.
RX queue interrupts allow applications to use rte_eth_dev_rx_intr_wait() for power-efficient packet processing.
--- drivers/common/sxe2/sxe2_ioctl_chnl.c | 176 +++- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 42 + drivers/net/sxe2/sxe2_cmd_chnl.h | 4 + drivers/net/sxe2/sxe2_drv_cmd.h | 8 + drivers/net/sxe2/sxe2_ethdev.c | 93 +- drivers/net/sxe2/sxe2_ethdev.h | 6 + drivers/net/sxe2/sxe2_irq.c | 942 +++++++++++++++++++++ drivers/net/sxe2/sxe2_irq.h | 21 + drivers/net/sxe2/sxe2vf_regs.h | 85 ++ 11 files changed, 1393 insertions(+), 3 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
drivers/common/sxe2/sxe2_ioctl_chnl.c +174 -2
@@ -67,6 +67,7 @@ sxe2_drv_cmd_exec(struct sxe2_common_device *cdev,return ret; } +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_open) int32_tsxe2_drv_dev_open (struct sxe2_common_device *cdev,struct rte_pci_device *pci_dev)
@@ -87,7 +88,7 @@ sxe2_drv_dev_open(struct sxe2_common_device *cdev, struct rte_pci_device *pci_deif (fd <0 ) { ret = -EBADF ;PMD_LOG_ERR (COM ,"Fail to open device:%s, ret=%d, err:%s" , - drv_name, ret,strerror (errno)); + drv_name, ret,strerror (errno)); goto l_end; }
@@ -159,6 +160,177 @@ sxe2_drv_dev_handshake(struct sxe2_common_device *cdev)return ret; } +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_rxq_irq_set) +int32_t +sxe2_drv_dev_rxq_irq_set (struct sxe2_common_device *cdev, +uint16_t base_irq,int32_t *efd,uint16_t nb_irq) +{ +struct sxe2_ioctl_irq_set cmd_params; +int32_t ret =0 ; +int32_t cmd_fd =0 ; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set rxq irq, base_queue=%d, efds=%p, nb_irq=%d" , + cmd_fd, base_irq, efd, nb_irq); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_irq_set )); + cmd_params.base_irq_in_com = base_irq; + cmd_params.cnt = nb_irq; + cmd_params.event_fd = efd; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_IO_IRQS_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set io irqs, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_other_irq_set) +int32_t +sxe2_drv_dev_other_irq_set (struct sxe2_common_device *cdev, +int32_t efd,uint64_t event) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_other_evt_set cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set other irq, efd=%d, event=%" PRIu64"" , + cmd_fd, efd, event); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_other_evt_set )); + cmd_params.eventfd = efd; + cmd_params.filter_table = event; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_EVT_IRQ_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set others evt, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_other_irq_get) +int32_t +sxe2_drv_dev_other_irq_get (struct sxe2_common_device *cdev,uint64_t *event) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_other_evt_get cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to get other irq" , cmd_fd); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_other_evt_get )); + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_EVT_CAUSE_GET , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set others evt, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + *event = cmd_params.evt_cause; + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_reset_irq_set) +int32_t +sxe2_drv_dev_reset_irq_set (struct sxe2_common_device *cdev,int32_t efd) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_reset_sub_set cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set reset irq, efd=%d" , + cmd_fd, efd); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_reset_sub_set )); + cmd_params.eventfd = efd; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_RST_IRQ_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set reset irqs, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_mmap) void *sxe2_drv_dev_mmap (struct sxe2_common_device *cdev,uint8_t bar_idx,uint64_t len,uint64_t offset)
@@ -223,7 +395,7 @@ sxe2_drv_dev_munmap(struct sxe2_common_device *cdev, void *virt, uint64_t len)RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_dma_map) int32_tsxe2_drv_dev_dma_map (struct sxe2_common_device *cdev,uint64_t vaddr, -uint64_t iova,uint64_t size) +uint64_t iova,uint64_t size) {struct sxe2_ioctl_iommu_dma_map cmd_params;enum rte_iova_mode iova_mode;
drivers/common/sxe2/sxe2_ioctl_chnl_func.h +18 -0
@@ -29,6 +29,7 @@ int32_t sxe2_drv_dev_open(struct sxe2_common_device *cdev, struct rte_pci_device *pci_dev); +__rte_internal voidsxe2_drv_dev_close (struct sxe2_common_device *cdev);
@@ -37,6 +38,23 @@ __rte_internalint32_t sxe2_drv_dev_handshake (struct sxe2_common_device *cdev); +__rte_internal +int32_t +sxe2_drv_dev_rxq_irq_set (struct sxe2_common_device *cdev,uint16_t base_irq, +int32_t *efd,uint16_t nb_irq); + +__rte_internal +int32_t +sxe2_drv_dev_other_irq_set (struct sxe2_common_device *cdev,int32_t efd,uint64_t event); + +__rte_internal +int32_t +sxe2_drv_dev_other_irq_get (struct sxe2_common_device *cdev,uint64_t *event); + +__rte_internal +int32_t +sxe2_drv_dev_reset_irq_set (struct sxe2_common_device *cdev,int32_t fd); +__rte_internal void *sxe2_drv_dev_mmap(struct sxe2_common_device *cdev, uint8_t bar_idx,
drivers/net/sxe2/meson.build +1 -0
@@ -68,4 +68,5 @@ sources += files( 'sxe2_security.c', 'sxe2_mp.c', 'sxe2_stats.c', + 'sxe2_irq.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +42 -0
48 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +4 -0
@@ -118,4 +118,8 @@ int32_t sxe2_drv_rss_hf_clear(struct sxe2_adapter *adapter);int32_t sxe2_drv_ptp_gettime (struct sxe2_adapter *adapter,struct sxe2_rx_queue *rxq); +int32_t sxe2_drv_rxq_bind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx,uint16_t msix_idx); + +int32_t sxe2_drv_rxq_unbind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +8 -0
@@ -556,6 +556,14 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_tx_map_req {uint8_t pool_idx; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_queue_irq_bind_req { + uint16_t q_idx; +uint16_t msix_idx; +uint8_t itr_idx; +uint8_t bind; +uint8_t rsv[2 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +92 -1
161 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +6 -0
@@ -350,6 +350,12 @@ int32_t sxe2_dev_pci_res_seg_map(struct sxe2_adapter *adapter,uint32_t item_cnt, uint32_t item_base); +void sxe2_pci_map_write_reg (struct sxe2_adapter *adapter, +enum sxe2_pci_map_resource res_type,uint16_t idx_in_func,uint32_t value); + +uint32_t sxe2_pci_map_read_reg (struct sxe2_adapter *adapter, +enum sxe2_pci_map_resource res_type,uint16_t idx_in_func); +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);
drivers/net/sxe2/sxe2_irq.c new file +942 -0
942 lines not on this page · raw message
drivers/net/sxe2/sxe2_irq.h +21 -0
@@ -45,4 +45,25 @@ struct sxe2_irq_context { int32_t *rxq_event_fd; }; +uint32_t sxe2_drv_dev_other_cause_get (struct sxe2_adapter *adapter); + +int32_t sxe2_intr_init (struct rte_eth_dev *dev); + +void sxe2_intr_uninit (struct rte_eth_dev *dev); + +int32_t sxe2_sw_irq_ctxt_init (struct rte_eth_dev *dev); + +void sxe2_sw_irq_ctxt_uninit (struct rte_eth_dev *dev); + +void sxe2_sw_irq_ctx_hw_cap_set (struct sxe2_adapter *adapter, +struct sxe2_drv_msix_caps *msix_caps); + +int32_t sxe2_rxq_intr_enable (struct rte_eth_dev *dev); + +void sxe2_rxq_intr_disable (struct rte_eth_dev *dev); + +int32_t sxe2_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); + +int32_t sxe2_rx_queue_intr_disable (struct rte_eth_dev *dev,uint16_t queue_id); +#endif /* SXE2_IRQ_H */
drivers/net/sxe2/sxe2vf_regs.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 11/23 drivers: interrupt handling
In reply to [email protected]From: Jie Liu <[email protected]>
This patch includes:
- MSI-X vector allocation and mapping logic.
- Support for rx_queue_intr_enable and rx_queue_intr_disable ops.
- Interrupt handler to process admin and queue events.
- Integration with EAL interrupt framework.
RX queue interrupts allow applications to use rte_eth_dev_rx_intr_wait() for power-efficient packet processing.
--- drivers/common/sxe2/sxe2_ioctl_chnl.c | 176 +++- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 42 + drivers/net/sxe2/sxe2_cmd_chnl.h | 4 + drivers/net/sxe2/sxe2_drv_cmd.h | 8 + drivers/net/sxe2/sxe2_ethdev.c | 93 +- drivers/net/sxe2/sxe2_ethdev.h | 6 + drivers/net/sxe2/sxe2_irq.c | 942 +++++++++++++++++++++ drivers/net/sxe2/sxe2_irq.h | 21 + drivers/net/sxe2/sxe2vf_regs.h | 85 ++ 11 files changed, 1393 insertions(+), 3 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
drivers/common/sxe2/sxe2_ioctl_chnl.c +174 -2
@@ -67,6 +67,7 @@ sxe2_drv_cmd_exec(struct sxe2_common_device *cdev,return ret; } +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_open) int32_tsxe2_drv_dev_open (struct sxe2_common_device *cdev,struct rte_pci_device *pci_dev)
@@ -87,7 +88,7 @@ sxe2_drv_dev_open(struct sxe2_common_device *cdev, struct rte_pci_device *pci_deif (fd <0 ) { ret = -EBADF ;PMD_LOG_ERR (COM ,"Fail to open device:%s, ret=%d, err:%s" , - drv_name, ret,strerror (errno)); + drv_name, ret,strerror (errno)); goto l_end; }
@@ -159,6 +160,177 @@ sxe2_drv_dev_handshake(struct sxe2_common_device *cdev)return ret; } +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_rxq_irq_set) +int32_t +sxe2_drv_dev_rxq_irq_set (struct sxe2_common_device *cdev, +uint16_t base_irq,int32_t *efd,uint16_t nb_irq) +{ +struct sxe2_ioctl_irq_set cmd_params; +int32_t ret =0 ; +int32_t cmd_fd =0 ; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set rxq irq, base_queue=%d, efds=%p, nb_irq=%d" , + cmd_fd, base_irq, efd, nb_irq); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_irq_set )); + cmd_params.base_irq_in_com = base_irq; + cmd_params.cnt = nb_irq; + cmd_params.event_fd = efd; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_IO_IRQS_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set io irqs, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_other_irq_set) +int32_t +sxe2_drv_dev_other_irq_set (struct sxe2_common_device *cdev, +int32_t efd,uint64_t event) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_other_evt_set cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set other irq, efd=%d, event=%" PRIu64"" , + cmd_fd, efd, event); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_other_evt_set )); + cmd_params.eventfd = efd; + cmd_params.filter_table = event; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_EVT_IRQ_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set others evt, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_other_irq_get) +int32_t +sxe2_drv_dev_other_irq_get (struct sxe2_common_device *cdev,uint64_t *event) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_other_evt_get cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to get other irq" , cmd_fd); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_other_evt_get )); + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_EVT_CAUSE_GET , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set others evt, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + *event = cmd_params.evt_cause; + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_reset_irq_set) +int32_t +sxe2_drv_dev_reset_irq_set (struct sxe2_common_device *cdev,int32_t efd) +{ +int32_t ret =0 ; +int32_t cmd_fd =0 ; +struct sxe2_ioctl_reset_sub_set cmd_params; + +if (cdev->config.kernel_reset) { + ret = -EPERM ; +PMD_LOG_WARN (COM ,"kernel reset, need restart app." ); + goto l_end; + } + + cmd_fd =SXE2_CDEV_TO_CMD_FD (cdev); +if (cmd_fd <0 ) { + ret = -EBADF ; +PMD_LOG_ERR (COM ,"Failed to exec cmd, fd=%d" , cmd_fd); + goto l_end; + } + +PMD_LOG_DEBUG (COM ,"Open fd=%d to set reset irq, efd=%d" , + cmd_fd, efd); + +memset (&cmd_params,0 ,sizeof (struct sxe2_ioctl_reset_sub_set )); + cmd_params.eventfd = efd; + +pthread_mutex_lock (&cdev->config.lock); + ret =ioctl (cmd_fd,SXE2_COM_CMD_RST_IRQ_REQ , &cmd_params); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Failed to set reset irqs, fd=%d, ret=%d, err:%s" , + cmd_fd, ret,strerror (errno)); + ret = -EIO ; +pthread_mutex_unlock (&cdev->config.lock); + goto l_end; + } +pthread_mutex_unlock (&cdev->config.lock); + +l_end: +return ret; +} +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_mmap) void *sxe2_drv_dev_mmap (struct sxe2_common_device *cdev,uint8_t bar_idx,uint64_t len,uint64_t offset)
@@ -223,7 +395,7 @@ sxe2_drv_dev_munmap(struct sxe2_common_device *cdev, void *virt, uint64_t len)RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_dma_map) int32_tsxe2_drv_dev_dma_map (struct sxe2_common_device *cdev,uint64_t vaddr, -uint64_t iova,uint64_t size) +uint64_t iova,uint64_t size) {struct sxe2_ioctl_iommu_dma_map cmd_params;enum rte_iova_mode iova_mode;
drivers/common/sxe2/sxe2_ioctl_chnl_func.h +18 -0
@@ -29,6 +29,7 @@ int32_t sxe2_drv_dev_open(struct sxe2_common_device *cdev, struct rte_pci_device *pci_dev); +__rte_internal voidsxe2_drv_dev_close (struct sxe2_common_device *cdev);
@@ -37,6 +38,23 @@ __rte_internalint32_t sxe2_drv_dev_handshake (struct sxe2_common_device *cdev); +__rte_internal +int32_t +sxe2_drv_dev_rxq_irq_set (struct sxe2_common_device *cdev,uint16_t base_irq, +int32_t *efd,uint16_t nb_irq); + +__rte_internal +int32_t +sxe2_drv_dev_other_irq_set (struct sxe2_common_device *cdev,int32_t efd,uint64_t event); + +__rte_internal +int32_t +sxe2_drv_dev_other_irq_get (struct sxe2_common_device *cdev,uint64_t *event); + +__rte_internal +int32_t +sxe2_drv_dev_reset_irq_set (struct sxe2_common_device *cdev,int32_t fd); +__rte_internal void *sxe2_drv_dev_mmap(struct sxe2_common_device *cdev, uint8_t bar_idx,
drivers/net/sxe2/meson.build +1 -0
@@ -68,4 +68,5 @@ sources += files( 'sxe2_security.c', 'sxe2_mp.c', 'sxe2_stats.c', + 'sxe2_irq.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +42 -0
48 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +4 -0
@@ -118,4 +118,8 @@ int32_t sxe2_drv_rss_hf_clear(struct sxe2_adapter *adapter);int32_t sxe2_drv_ptp_gettime (struct sxe2_adapter *adapter,struct sxe2_rx_queue *rxq); +int32_t sxe2_drv_rxq_bind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx,uint16_t msix_idx); + +int32_t sxe2_drv_rxq_unbind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +8 -0
@@ -556,6 +556,14 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_tx_map_req {uint8_t pool_idx; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_queue_irq_bind_req { + uint16_t q_idx; +uint16_t msix_idx; +uint8_t itr_idx; +uint8_t bind; +uint8_t rsv[2 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +92 -1
161 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +6 -0
@@ -350,6 +350,12 @@ int32_t sxe2_dev_pci_res_seg_map(struct sxe2_adapter *adapter,uint32_t item_cnt, uint32_t item_base); +void sxe2_pci_map_write_reg (struct sxe2_adapter *adapter, +enum sxe2_pci_map_resource res_type,uint16_t idx_in_func,uint32_t value); + +uint32_t sxe2_pci_map_read_reg (struct sxe2_adapter *adapter, +enum sxe2_pci_map_resource res_type,uint16_t idx_in_func); +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);
drivers/net/sxe2/sxe2_irq.c new file +942 -0
942 lines not on this page · raw message
drivers/net/sxe2/sxe2_irq.h +21 -0
@@ -45,4 +45,25 @@ struct sxe2_irq_context { int32_t *rxq_event_fd; }; +uint32_t sxe2_drv_dev_other_cause_get (struct sxe2_adapter *adapter); + +int32_t sxe2_intr_init (struct rte_eth_dev *dev); + +void sxe2_intr_uninit (struct rte_eth_dev *dev); + +int32_t sxe2_sw_irq_ctxt_init (struct rte_eth_dev *dev); + +void sxe2_sw_irq_ctxt_uninit (struct rte_eth_dev *dev); + +void sxe2_sw_irq_ctx_hw_cap_set (struct sxe2_adapter *adapter, +struct sxe2_drv_msix_caps *msix_caps); + +int32_t sxe2_rxq_intr_enable (struct rte_eth_dev *dev); + +void sxe2_rxq_intr_disable (struct rte_eth_dev *dev); + +int32_t sxe2_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); + +int32_t sxe2_rx_queue_intr_disable (struct rte_eth_dev *dev,uint16_t queue_id); +#endif /* SXE2_IRQ_H */
drivers/net/sxe2/sxe2vf_regs.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 12/23 net/sxe2: add NEON vec Rx/Tx burst functions
In reply to [email protected]From: Jie Liu <[email protected]>
- Implement sxe2_recv_pkts_vec_neon for bulk packet receiving.
- Implement sxe2_xmit_pkts_vec_neon for bulk packet transmission.
- Added logic to select the vectorized path based on runtime config and CPU flags (RTE_ARCH_ARM64).
Vectorized path improves throughput for small packets by processing multiple descriptors simultaneously using SIMD instructions.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_txrx.c | 39 +- drivers/net/sxe2/sxe2_txrx_vec.h | 16 +- drivers/net/sxe2/sxe2_txrx_vec_common.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 ++++++++++++++++++++++++ 5 files changed, 742 insertions(+), 5 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c
drivers/net/sxe2/meson.build +2 -0
@@ -48,6 +48,8 @@ if arch_subdir == 'x86' include_directories: includes, c_args: [cflags, '-mavx2']) objs += sxe2_avx2_lib.extract_objects('sxe2_txrx_vec_avx2.c') +elif arch_subdir == 'arm' + sources += files('sxe2_txrx_vec_neon.c') endif sources += files(
drivers/net/sxe2/sxe2_txrx.c +36 -3
@@ -175,6 +175,9 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev)if ((0 == (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ))) tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ; +#elif defined(RTE_ARCH_ARM64 ) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) ==1 ) + tx_mode_flags |= (vec_flags |SXE2_TX_MODE_VEC_NEON );#endif if (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) { ret =sxe2_tx_queues_vec_prepare (dev);
@@ -218,8 +221,15 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_burst = sxe2_tx_pkts_vec_sse_simple; } } - }else { +#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; + }#endif + }else {if (tx_mode_flags &SXE2_TX_MODE_SIMPLE_BATCH ) { dev->tx_pkt_prepare =NULL ; dev->tx_pkt_burst = sxe2_tx_pkts_simple;
@@ -227,9 +237,7 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_prepare = sxe2_tx_pkts_prepare; dev->tx_pkt_burst = sxe2_tx_pkts; } -#ifdef RTE_ARCH_X86 } -#endif } static const struct {
@@ -253,6 +261,12 @@ static const struct { { sxe2_tx_pkts_vec_sse_simple, "Vector SSE Simple" }, #endif +#ifdef RTE_ARCH_ARM64 + { sxe2_tx_pkts_vec_neon, + "Vector NEON" }, + { sxe2_tx_pkts_vec_neon_simple, + "Vector NEON Simple" }, +#endif }; int32_t sxe2_tx_burst_mode_get(struct rte_eth_dev *dev,
@@ -356,6 +370,11 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev)if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) rx_mode_flags |=SXE2_RX_MODE_VEC_SSE ; + +#elif defined(RTE_ARCH_ARM64 ) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) ==1 ) { + rx_mode_flags |= (vec_flags |SXE2_RX_MODE_VEC_NEON ); + }#endif if ((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) !=0 ) { ret =sxe2_rx_queues_vec_prepare (dev);
@@ -387,6 +406,14 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev) }return ; } +#elif defined(RTE_ARCH_ARM64) +if (rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) { +if (rx_mode_flags &SXE2_RX_MODE_VEC_OFFLOAD ) + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_neon_offload; +else + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_neon; +return ; + }#endif if (sxe2_rx_offload_en_check (dev,RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT )) dev->rx_pkt_burst = sxe2_rx_pkts_scattered_split;
@@ -416,6 +443,12 @@ static const struct { { sxe2_rx_pkts_scattered_vec_sse_offload, "Vector SSE Scattered" }, #endif +#ifdef RTE_ARCH_ARM64 + { sxe2_rx_pkts_scattered_vec_neon, + "Vector NEON Scattered" }, + { sxe2_rx_pkts_scattered_vec_neon_offload, + "Offload Vector NEON Scattered" }, +#endif }; int32_t sxe2_rx_burst_mode_get(struct rte_eth_dev *dev,
drivers/net/sxe2/sxe2_txrx_vec.h +14 -2
@@ -13,19 +13,23 @@#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2)#define SXE2_RX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4) +#define SXE2_RX_MODE_VEC_NEON RTE_BIT32(5)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ - SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512) + SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512 | \ + SXE2_RX_MODE_VEC_NEON)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2)#define SXE2_TX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4) +#define SXE2_TX_MODE_VEC_NEON RTE_BIT32(5)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ - SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512) + SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512 | \ + SXE2_TX_MODE_VEC_NEON)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -76,6 +80,14 @@ uint16_t sxe2_rx_pkts_scattered_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_avx2_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); + +#elif defined(RTE_ARCH_ARM64 ) +uint16_t sxe2_rx_pkts_scattered_vec_neon (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_neon_offload (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_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 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);
drivers/net/sxe2/sxe2_txrx_vec_common.h +1 -0
@@ -2,6 +2,7 @@* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. */ +#ifndef SXE2_TXRX_VEC_COMMON_H #define SXE2_TXRX_VEC_COMMON_H
drivers/net/sxe2/sxe2_txrx_vec_neon.c new file +689 -0
689 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 12/23 net/sxe2: add NEON vec Rx/Tx burst functions
In reply to [email protected]From: Jie Liu <[email protected]>
- Implement sxe2_recv_pkts_vec_neon for bulk packet receiving.
- Implement sxe2_xmit_pkts_vec_neon for bulk packet transmission.
- Added logic to select the vectorized path based on runtime config and CPU flags (RTE_ARCH_ARM64).
Vectorized path improves throughput for small packets by processing multiple descriptors simultaneously using SIMD instructions.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_txrx.c | 39 +- drivers/net/sxe2/sxe2_txrx_vec.h | 16 +- drivers/net/sxe2/sxe2_txrx_vec_common.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 ++++++++++++++++++++++++ 5 files changed, 742 insertions(+), 5 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c
drivers/net/sxe2/meson.build +2 -0
@@ -48,6 +48,8 @@ if arch_subdir == 'x86' include_directories: includes, c_args: [cflags, '-mavx2']) objs += sxe2_avx2_lib.extract_objects('sxe2_txrx_vec_avx2.c') +elif arch_subdir == 'arm' + sources += files('sxe2_txrx_vec_neon.c') endif sources += files(
drivers/net/sxe2/sxe2_txrx.c +36 -3
@@ -175,6 +175,9 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev)if ((0 == (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ))) tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ; +#elif defined(RTE_ARCH_ARM64 ) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) ==1 ) + tx_mode_flags |= (vec_flags |SXE2_TX_MODE_VEC_NEON );#endif if (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) { ret =sxe2_tx_queues_vec_prepare (dev);
@@ -218,8 +221,15 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_burst = sxe2_tx_pkts_vec_sse_simple; } } - }else { +#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; + }#endif + }else {if (tx_mode_flags &SXE2_TX_MODE_SIMPLE_BATCH ) { dev->tx_pkt_prepare =NULL ; dev->tx_pkt_burst = sxe2_tx_pkts_simple;
@@ -227,9 +237,7 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_prepare = sxe2_tx_pkts_prepare; dev->tx_pkt_burst = sxe2_tx_pkts; } -#ifdef RTE_ARCH_X86 } -#endif } static const struct {
@@ -253,6 +261,12 @@ static const struct { { sxe2_tx_pkts_vec_sse_simple, "Vector SSE Simple" }, #endif +#ifdef RTE_ARCH_ARM64 + { sxe2_tx_pkts_vec_neon, + "Vector NEON" }, + { sxe2_tx_pkts_vec_neon_simple, + "Vector NEON Simple" }, +#endif }; int32_t sxe2_tx_burst_mode_get(struct rte_eth_dev *dev,
@@ -356,6 +370,11 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev)if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) rx_mode_flags |=SXE2_RX_MODE_VEC_SSE ; + +#elif defined(RTE_ARCH_ARM64 ) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) ==1 ) { + rx_mode_flags |= (vec_flags |SXE2_RX_MODE_VEC_NEON ); + }#endif if ((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) !=0 ) { ret =sxe2_rx_queues_vec_prepare (dev);
@@ -387,6 +406,14 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev) }return ; } +#elif defined(RTE_ARCH_ARM64) +if (rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) { +if (rx_mode_flags &SXE2_RX_MODE_VEC_OFFLOAD ) + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_neon_offload; +else + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_neon; +return ; + }#endif if (sxe2_rx_offload_en_check (dev,RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT )) dev->rx_pkt_burst = sxe2_rx_pkts_scattered_split;
@@ -416,6 +443,12 @@ static const struct { { sxe2_rx_pkts_scattered_vec_sse_offload, "Vector SSE Scattered" }, #endif +#ifdef RTE_ARCH_ARM64 + { sxe2_rx_pkts_scattered_vec_neon, + "Vector NEON Scattered" }, + { sxe2_rx_pkts_scattered_vec_neon_offload, + "Offload Vector NEON Scattered" }, +#endif }; int32_t sxe2_rx_burst_mode_get(struct rte_eth_dev *dev,
drivers/net/sxe2/sxe2_txrx_vec.h +14 -2
@@ -13,19 +13,23 @@#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2)#define SXE2_RX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4) +#define SXE2_RX_MODE_VEC_NEON RTE_BIT32(5)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ - SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512) + SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512 | \ + SXE2_RX_MODE_VEC_NEON)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2)#define SXE2_TX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4) +#define SXE2_TX_MODE_VEC_NEON RTE_BIT32(5)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ - SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512) + SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512 | \ + SXE2_TX_MODE_VEC_NEON)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -76,6 +80,14 @@ uint16_t sxe2_rx_pkts_scattered_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_avx2_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); + +#elif defined(RTE_ARCH_ARM64 ) +uint16_t sxe2_rx_pkts_scattered_vec_neon (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_neon_offload (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_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 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);
drivers/net/sxe2/sxe2_txrx_vec_common.h +1 -0
@@ -2,6 +2,7 @@* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. */ +#ifndef SXE2_TXRX_VEC_COMMON_H #define SXE2_TXRX_VEC_COMMON_H
drivers/net/sxe2/sxe2_txrx_vec_neon.c new file +689 -0
689 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 13/23 drivers: add support for VF representors
In reply to [email protected]From: Jie Liu <[email protected]>
Add support for VF representors in sxe2 PMD. This allows the host application (e.g., OVS-DPDK) to control and monitor virtual functions through a dedicated ethdev on the PF (Physical Function) side.
Key changes include:
- Added representor enumeration and identification logic.
- Implemented representor-specific dev_ops (link update, stats, etc.).
- Configured back-channel communication between PF and VF for control messages.
- Supported the "-a <DBDF>,representor=[0-N]" EAL parameter to instantiate representor ports.
--- drivers/common/sxe2/sxe2_common.c | 46 + drivers/common/sxe2/sxe2_common.h | 2 + drivers/net/sxe2/meson.build | 6 + drivers/net/sxe2/sxe2_cmd_chnl.c | 311 +++- drivers/net/sxe2/sxe2_cmd_chnl.h | 28 + drivers/net/sxe2/sxe2_drv_cmd.h | 55 +- drivers/net/sxe2/sxe2_ethdev.c | 203 ++- drivers/net/sxe2/sxe2_ethdev.h | 11 + drivers/net/sxe2/sxe2_ethdev_repr.c | 606 +++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 121 +- drivers/net/sxe2/sxe2_filter.h | 2 + drivers/net/sxe2/sxe2_flow.c | 1337 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 29 + drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 +++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1822 ++++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 40 + drivers/net/sxe2/sxe2_irq.c | 54 + drivers/net/sxe2/sxe2_irq.h | 4 + drivers/net/sxe2/sxe2_queue.c | 6 +- drivers/net/sxe2/sxe2_stats.c | 17 +- drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_txrx.c | 7 + drivers/net/sxe2/sxe2_txrx_poll.c | 8 + drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- 30 files changed, 6571 insertions(+), 23 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h
drivers/common/sxe2/sxe2_common.c +46 -0
@@ -169,6 +169,37 @@ static int32_t sxe2_parse_class_type(const char *key, const char *value, void *areturn ret; } +static int32_t sxe2_parse_driver (const char *key,const char *value,void *args) +{ +int32_t ret = -EINVAL ; + +if (value ==NULL || args ==NULL ) { + ret =0 ; + goto l_end; + } + +if (strcmp (value,"sxe2" ) !=0 ) { +PMD_LOG_ERR (COM ,"%s: \"%s\" is not a valid driver." , + key, value); + goto l_end; + } +l_end: +return ret; +} + +static int32_t sxe2_parse_representor (const char *key,const char *value,void *args) +{ +int32_t ret =0 ; + +if (value ==NULL || args ==NULL ) + goto l_end; + +PMD_LOG_INFO (COM ,"representor arg %s: \"%s\"." , key, value); + +l_end: +return ret; +} +static int32_t sxe2_common_device_setup (struct sxe2_common_device *cdev) {struct rte_pci_device *pci_dev =RTE_BUS_DEVICE (cdev->dev, *pci_dev);
@@ -394,6 +425,21 @@ static int32_t sxe2_common_pci_probe(struct rte_pci_driver *pci_drv __rte_unused goto l_free_args; } + ret =sxe2_kvargs_process (kv_info_p,SXE2_DEVARGS_KEY_DRIVER , + sxe2_parse_driver,NULL ); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Unsupported sxe2 driver name: %s" , + rte_dev->devargs->args); + goto l_free_args; + } + + ret =sxe2_kvargs_process (kv_info_p,SXE2_DEVARGS_KEY_REPR , + sxe2_parse_representor,NULL ); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Unsupported sxe2 driver representor: %s" , + rte_dev->devargs->args); + goto l_free_args; + } } cdev =sxe2_common_device_alloc (rte_dev, class_type);
drivers/common/sxe2/sxe2_common.h +2 -0
@@ -18,6 +18,8 @@ ((cdev)->config.cmd_fd)#define SXE2_DEVARGS_KEY_CLASS "class" +#define SXE2_DEVARGS_KEY_DRIVER "driver" +#define SXE2_DEVARGS_KEY_REPR "representor"struct sxe2_class_driver ;
drivers/net/sxe2/meson.build +6 -0
@@ -71,4 +71,10 @@ sources += files( 'sxe2_mp.c', 'sxe2_stats.c', 'sxe2_irq.c', + 'sxe2_switchdev.c', + 'sxe2_ethdev_repr.c', + 'sxe2_flow.c', + 'sxe2_flow_parse_action.c', + 'sxe2_flow_parse_pattern.c', + 'sxe2_flow_parse_engine.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +307 -4
356 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +28 -0
@@ -12,6 +12,9 @@int32_t sxe2_drv_dev_caps_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_caps_resp *dev_caps); +int32_t sxe2_drv_switchdev_info_get (struct sxe2_adapter *adapter, +struct sxe2_switchdev_info *switchdev_info); +int32_t sxe2_drv_dev_info_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_info_resp *dev_info_resp);
@@ -64,6 +67,8 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +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);
@@ -91,6 +96,15 @@ 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); +int32_t sxe2_drv_switchdev_uplink_config (struct sxe2_adapter *adapter,bool set); + +int32_t sxe2_drv_switchdev_repr_vf_config (struct sxe2_adapter *adapter, +struct sxe2_switchdev_repr_info *repr_vf,bool set); + +int32_t sxe2_drv_switchdev_cpvsi_get (struct sxe2_adapter *adapter,uint16_t *cp_vsi_id); + +int32_t sxe2_drv_switchdev_mode_get (struct sxe2_adapter *adapter,bool *is_switchdev); +int32_t sxe2_drv_mc_config (struct sxe2_adapter *adapter,struct rte_ether_addr *addr,bool add);int32_t sxe2_drv_vlan_config_query (struct sxe2_adapter *adapter);
@@ -122,4 +136,18 @@ int32_t sxe2_drv_rxq_bind_irq(struct sxe2_adapter *adapter, uint16_t rxq_idx, uiint32_t sxe2_drv_rxq_unbind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx); +int32_t sxe2_drv_flow_filter_add (struct sxe2_adapter *adapter,struct sxe2_flow *flow); + +int32_t sxe2_drv_flow_filter_del (struct sxe2_adapter *adapter,struct sxe2_flow *flow); + +int32_t sxe2_drv_flow_fnav_get_stat_id (struct sxe2_adapter *adapter,uint32_t *stat_id); + +int32_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); + +int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter, +uint16_t *vsi_list,uint16_t vsi_cnt,bool set); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +54 -1
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +197 -6
336 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +11 -0
@@ -65,6 +65,9 @@ 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
@@ -309,16 +312,20 @@ struct sxe2_adapter {struct sxe2_vsi_context vsi_ctxt;struct sxe2_filter_context filter_ctxt;struct sxe2_rss_context rss_ctxt; +struct sxe2_flow_context flow_ctxt;struct sxe2_link_context link_ctxt;struct sxe2_ptp_context ptp_ctxt;struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs;struct sxe2_security_ctx security_ctx; +struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info;bool rule_started;bool flow_isolated; +bool flow_isolate_cfg;uint16_t dev_port_id; +bool is_dev_repr;uint64_t cap_flags;enum sxe2_dev_type dev_type;struct rte_ether_addr mac_addr;
@@ -336,6 +343,8 @@ void *sxe2_pci_map_addr_get(struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type, uint16_t idx_in_func); +bool sxe2_ethdev_check (struct rte_eth_dev *dev); +uint32_t sxe2_sched_mode_get (struct sxe2_adapter *adapter); struct sxe2_pci_map_bar_info *sxe2_dev_get_bar_info(struct sxe2_adapter *adapter,
@@ -362,6 +371,8 @@ int32_t sxe2_dev_pci_map_init(struct rte_eth_dev *dev);void sxe2_dev_pci_map_uinit (struct rte_eth_dev *dev); +void sxe2_eth_uinit (struct rte_eth_dev *dev); +static inline bool sxe2_dev_port_vlan_check (struct rte_eth_dev *dev) {
drivers/net/sxe2/sxe2_ethdev_repr.c new file +606 -0
606 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev_repr.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SX2_ETHDEV_REPR_H__ +#define __SX2_ETHDEV_REPR_H__ +#include <rte_compat.h> +#include <rte_kvargs.h> +#include <rte_time.h> +#include <ethdev_driver.h> +#include <ethdev_pci.h> +#include <rte_tm_driver.h> +#include <rte_io.h> +#include <rte_ethdev.h> +#include <rte_alarm.h> +#include <rte_dev_info.h> + +#include "sxe2_vsi.h" +#include "sxe2_irq.h" +#include "sxe2_queue.h" +struct sxe2_adapter ; + +void sxe2_repr_all_close (struct rte_eth_dev *dev); + +int32_t sxe2_repr_dev_init (struct rte_eth_dev *dev, +struct sxe2_adapter *parent_adapter, +uint16_t repr_id); + +int32_t sxe2_switchdev_repr_devs_init (struct sxe2_adapter *adapter, +struct rte_eth_devargs *req_eth_da); + +#endif /* __SX2_ETHDEV_REPR_H__ */
drivers/net/sxe2/sxe2_filter.c +117 -4
145 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.h +2 -0
@@ -89,6 +89,8 @@ int32_t sxe2_l2_rule_update(struct sxe2_adapter *adapter);int32_t sxe2_filter_rule_stop (struct rte_eth_dev *dev); +int32_t sxe2_switchdev_rule_update (struct sxe2_adapter *adapter); +int32_t sxe2_filter_rule_start (struct rte_eth_dev *dev);int32_t sxe2_filter_init (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow.c new file +1337 -0
1,279 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.c new file +1182 -0
1,182 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.h new file +23 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_flow_parse_engine.c new file +106 -0
106 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_engine.h new file +13 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_flow_parse_pattern.c new file +1822 -0
1,822 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_irq.c +54 -0
54 lines not on this page · raw message
drivers/net/sxe2/sxe2_switchdev.c new file +332 -0
332 lines not on this page · raw message
drivers/net/sxe2/sxe2_switchdev.h new file +33 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_vsi.c +146 -0
146 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.52.0
Part of the diff is not shown here. View the raw message.
PATCH v7 13/23 drivers: add support for VF representors
In reply to [email protected]From: Jie Liu <[email protected]>
Add support for VF representors in sxe2 PMD. This allows the host application (e.g., OVS-DPDK) to control and monitor virtual functions through a dedicated ethdev on the PF (Physical Function) side.
Key changes include:
- Added representor enumeration and identification logic.
- Implemented representor-specific dev_ops (link update, stats, etc.).
- Configured back-channel communication between PF and VF for control messages.
- Supported the "-a <DBDF>,representor=[0-N]" EAL parameter to instantiate representor ports.
--- drivers/common/sxe2/sxe2_common.c | 46 + drivers/common/sxe2/sxe2_common.h | 2 + drivers/net/sxe2/meson.build | 6 + drivers/net/sxe2/sxe2_cmd_chnl.c | 311 +++- drivers/net/sxe2/sxe2_cmd_chnl.h | 28 + drivers/net/sxe2/sxe2_drv_cmd.h | 55 +- drivers/net/sxe2/sxe2_ethdev.c | 203 ++- drivers/net/sxe2/sxe2_ethdev.h | 11 + drivers/net/sxe2/sxe2_ethdev_repr.c | 606 +++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 121 +- drivers/net/sxe2/sxe2_filter.h | 2 + drivers/net/sxe2/sxe2_flow.c | 1337 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 29 + drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 +++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1822 ++++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 40 + drivers/net/sxe2/sxe2_irq.c | 54 + drivers/net/sxe2/sxe2_irq.h | 4 + drivers/net/sxe2/sxe2_queue.c | 6 +- drivers/net/sxe2/sxe2_stats.c | 17 +- drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_txrx.c | 7 + drivers/net/sxe2/sxe2_txrx_poll.c | 8 + drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- 30 files changed, 6571 insertions(+), 23 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h
drivers/common/sxe2/sxe2_common.c +46 -0
@@ -169,6 +169,37 @@ static int32_t sxe2_parse_class_type(const char *key, const char *value, void *areturn ret; } +static int32_t sxe2_parse_driver (const char *key,const char *value,void *args) +{ +int32_t ret = -EINVAL ; + +if (value ==NULL || args ==NULL ) { + ret =0 ; + goto l_end; + } + +if (strcmp (value,"sxe2" ) !=0 ) { +PMD_LOG_ERR (COM ,"%s: \"%s\" is not a valid driver." , + key, value); + goto l_end; + } +l_end: +return ret; +} + +static int32_t sxe2_parse_representor (const char *key,const char *value,void *args) +{ +int32_t ret =0 ; + +if (value ==NULL || args ==NULL ) + goto l_end; + +PMD_LOG_INFO (COM ,"representor arg %s: \"%s\"." , key, value); + +l_end: +return ret; +} +static int32_t sxe2_common_device_setup (struct sxe2_common_device *cdev) {struct rte_pci_device *pci_dev =RTE_BUS_DEVICE (cdev->dev, *pci_dev);
@@ -394,6 +425,21 @@ static int32_t sxe2_common_pci_probe(struct rte_pci_driver *pci_drv __rte_unused goto l_free_args; } + ret =sxe2_kvargs_process (kv_info_p,SXE2_DEVARGS_KEY_DRIVER , + sxe2_parse_driver,NULL ); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Unsupported sxe2 driver name: %s" , + rte_dev->devargs->args); + goto l_free_args; + } + + ret =sxe2_kvargs_process (kv_info_p,SXE2_DEVARGS_KEY_REPR , + sxe2_parse_representor,NULL ); +if (ret <0 ) { +PMD_LOG_ERR (COM ,"Unsupported sxe2 driver representor: %s" , + rte_dev->devargs->args); + goto l_free_args; + } } cdev =sxe2_common_device_alloc (rte_dev, class_type);
drivers/common/sxe2/sxe2_common.h +2 -0
@@ -18,6 +18,8 @@ ((cdev)->config.cmd_fd)#define SXE2_DEVARGS_KEY_CLASS "class" +#define SXE2_DEVARGS_KEY_DRIVER "driver" +#define SXE2_DEVARGS_KEY_REPR "representor"struct sxe2_class_driver ;
drivers/net/sxe2/meson.build +6 -0
@@ -71,4 +71,10 @@ sources += files( 'sxe2_mp.c', 'sxe2_stats.c', 'sxe2_irq.c', + 'sxe2_switchdev.c', + 'sxe2_ethdev_repr.c', + 'sxe2_flow.c', + 'sxe2_flow_parse_action.c', + 'sxe2_flow_parse_pattern.c', + 'sxe2_flow_parse_engine.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +307 -4
356 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +28 -0
@@ -12,6 +12,9 @@int32_t sxe2_drv_dev_caps_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_caps_resp *dev_caps); +int32_t sxe2_drv_switchdev_info_get (struct sxe2_adapter *adapter, +struct sxe2_switchdev_info *switchdev_info); +int32_t sxe2_drv_dev_info_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_info_resp *dev_info_resp);
@@ -64,6 +67,8 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +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);
@@ -91,6 +96,15 @@ 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); +int32_t sxe2_drv_switchdev_uplink_config (struct sxe2_adapter *adapter,bool set); + +int32_t sxe2_drv_switchdev_repr_vf_config (struct sxe2_adapter *adapter, +struct sxe2_switchdev_repr_info *repr_vf,bool set); + +int32_t sxe2_drv_switchdev_cpvsi_get (struct sxe2_adapter *adapter,uint16_t *cp_vsi_id); + +int32_t sxe2_drv_switchdev_mode_get (struct sxe2_adapter *adapter,bool *is_switchdev); +int32_t sxe2_drv_mc_config (struct sxe2_adapter *adapter,struct rte_ether_addr *addr,bool add);int32_t sxe2_drv_vlan_config_query (struct sxe2_adapter *adapter);
@@ -122,4 +136,18 @@ int32_t sxe2_drv_rxq_bind_irq(struct sxe2_adapter *adapter, uint16_t rxq_idx, uiint32_t sxe2_drv_rxq_unbind_irq (struct sxe2_adapter *adapter,uint16_t rxq_idx); +int32_t sxe2_drv_flow_filter_add (struct sxe2_adapter *adapter,struct sxe2_flow *flow); + +int32_t sxe2_drv_flow_filter_del (struct sxe2_adapter *adapter,struct sxe2_flow *flow); + +int32_t sxe2_drv_flow_fnav_get_stat_id (struct sxe2_adapter *adapter,uint32_t *stat_id); + +int32_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); + +int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter, +uint16_t *vsi_list,uint16_t vsi_cnt,bool set); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +54 -1
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +197 -6
336 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +11 -0
@@ -65,6 +65,9 @@ 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
@@ -309,16 +312,20 @@ struct sxe2_adapter {struct sxe2_vsi_context vsi_ctxt;struct sxe2_filter_context filter_ctxt;struct sxe2_rss_context rss_ctxt; +struct sxe2_flow_context flow_ctxt;struct sxe2_link_context link_ctxt;struct sxe2_ptp_context ptp_ctxt;struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs;struct sxe2_security_ctx security_ctx; +struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info;bool rule_started;bool flow_isolated; +bool flow_isolate_cfg;uint16_t dev_port_id; +bool is_dev_repr;uint64_t cap_flags;enum sxe2_dev_type dev_type;struct rte_ether_addr mac_addr;
@@ -336,6 +343,8 @@ void *sxe2_pci_map_addr_get(struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type, uint16_t idx_in_func); +bool sxe2_ethdev_check (struct rte_eth_dev *dev); +uint32_t sxe2_sched_mode_get (struct sxe2_adapter *adapter); struct sxe2_pci_map_bar_info *sxe2_dev_get_bar_info(struct sxe2_adapter *adapter,
@@ -362,6 +371,8 @@ int32_t sxe2_dev_pci_map_init(struct rte_eth_dev *dev);void sxe2_dev_pci_map_uinit (struct rte_eth_dev *dev); +void sxe2_eth_uinit (struct rte_eth_dev *dev); +static inline bool sxe2_dev_port_vlan_check (struct rte_eth_dev *dev) {
drivers/net/sxe2/sxe2_ethdev_repr.c new file +606 -0
606 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev_repr.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SX2_ETHDEV_REPR_H__ +#define __SX2_ETHDEV_REPR_H__ +#include <rte_compat.h> +#include <rte_kvargs.h> +#include <rte_time.h> +#include <ethdev_driver.h> +#include <ethdev_pci.h> +#include <rte_tm_driver.h> +#include <rte_io.h> +#include <rte_ethdev.h> +#include <rte_alarm.h> +#include <rte_dev_info.h> + +#include "sxe2_vsi.h" +#include "sxe2_irq.h" +#include "sxe2_queue.h" +struct sxe2_adapter ; + +void sxe2_repr_all_close (struct rte_eth_dev *dev); + +int32_t sxe2_repr_dev_init (struct rte_eth_dev *dev, +struct sxe2_adapter *parent_adapter, +uint16_t repr_id); + +int32_t sxe2_switchdev_repr_devs_init (struct sxe2_adapter *adapter, +struct rte_eth_devargs *req_eth_da); + +#endif /* __SX2_ETHDEV_REPR_H__ */
drivers/net/sxe2/sxe2_filter.c +117 -4
145 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.h +2 -0
@@ -89,6 +89,8 @@ int32_t sxe2_l2_rule_update(struct sxe2_adapter *adapter);int32_t sxe2_filter_rule_stop (struct rte_eth_dev *dev); +int32_t sxe2_switchdev_rule_update (struct sxe2_adapter *adapter); +int32_t sxe2_filter_rule_start (struct rte_eth_dev *dev);int32_t sxe2_filter_init (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow.c new file +1337 -0
1,279 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.c new file +1182 -0
1,182 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_action.h new file +23 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_flow_parse_engine.c new file +106 -0
106 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_engine.h new file +13 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_flow_parse_pattern.c new file +1822 -0
1,822 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_irq.c +54 -0
54 lines not on this page · raw message
drivers/net/sxe2/sxe2_switchdev.c new file +332 -0
332 lines not on this page · raw message
drivers/net/sxe2/sxe2_switchdev.h new file +33 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe2/sxe2_vsi.c +146 -0
146 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.52.0
Part of the diff is not shown here. View the raw message.
PATCH v7 14/23 net/sxe2: add support for custom UDP tunnel ports
In reply to [email protected]From: Jie Liu <[email protected]>
This patch enables the configuration of custom UDP port numbers for tunneling protocols in the SXE2 PMD.
The change includes:
- Adding a new entry in the tunnel port lookup table.
- Updating the hardware profile to recognize
the custom UDP port as a tunnel type.
- Enabling inner header parsing for packets arriving on these ports.
This allows the Switch module to correctly apply recipes based on inner packet fields (e.g., inner MAC or IP).
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 96 ++++++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 17 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 16 ++ drivers/net/sxe2/sxe2_ethdev.c | 200 ++++++++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 9 + drivers/net/sxe2/sxe2_flow.c | 54 ++++++ drivers/net/sxe2/sxe2_flow.h | 3 +- drivers/net/sxe2/sxe2_flow_define.h | 1 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 113 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 6 + drivers/net/sxe2/sxe2_txrx_poll.c | 46 ++++- 11 files changed, 557 insertions(+), 4 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +96 -0
@@ -1455,6 +1455,102 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,return ret; } +int32_t sxe2_drv_udp_tunnel_add (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_proto; + req.port = udp_port; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_ADD , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to add udp proto %d port %d, ret=%d" , + tunnel_proto, udp_port, ret); + +return ret; +} + +int32_t sxe2_drv_udp_tunnel_del (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_proto; + req.port = udp_port; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_DEL , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to del udp proto %d port %d, ret=%d" , + tunnel_proto, udp_port, ret); + +return ret; +} + +int32_t sxe2_drv_get_udp_tunnel_port (struct sxe2_adapter *adapter, +enum sxe2_flow_udp_tunnel_protocol proto, +uint16_t *port) +{ +int32_t ret =0 ; +static const uint16_t flow_proto_to_udp_tunnel_proto[SXE2_FLOW_UDP_TUNNEL_MAX ] = { + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_VXLAN ] =SXE2_UDP_TUNNEL_PROTOCOL_VXLAN , + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_VXLAN_GPE ] =SXE2_UDP_TUNNEL_PROTOCOL_VXLAN_GPE , + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_GENEVE ] =SXE2_UDP_TUNNEL_PROTOCOL_GENEVE , + [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 = {}; + + tunnel_config.protocol = flow_proto_to_udp_tunnel_proto[proto]; + ret =sxe2_drv_udp_tunnel_get (adapter, &tunnel_config); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to get udp tunnel port, ret=%d" , ret); + goto l_end; + } + + *port = tunnel_config.fw_port; +l_end: +return ret; +} + +int32_t sxe2_drv_udp_tunnel_get (struct sxe2_adapter *adapter, +struct sxe2_udp_tunnel_cfg *tunnel_config) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_udp_tunnel_resp resp = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_config->protocol; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_GET , + &req,sizeof (req), + &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to get udp proto %d port, ret=%d" , req.type, ret); + + tunnel_config->fw_port = resp.port; + tunnel_config->fw_status = resp.enable; + tunnel_config->fw_dst_en = resp.dst; + tunnel_config->fw_src_en = resp.src; + tunnel_config->fw_used = resp.fw_used; + +return ret; +} +int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter,struct eth_queue_stats *qstats) {struct sxe2_drv_cmd_params param = {0 };
drivers/net/sxe2/sxe2_cmd_chnl.h +17 -0
@@ -67,6 +67,23 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,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); + +int32_t sxe2_drv_udp_tunnel_del (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port); + +int32_t sxe2_drv_udp_tunnel_get (struct sxe2_adapter *adapter, +struct sxe2_udp_tunnel_cfg *tunnel_config); + +int32_t sxe2_drv_get_udp_tunnel_port (struct sxe2_adapter *adapter, +enum sxe2_flow_udp_tunnel_protocol proto, +uint16_t *port); + +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);
drivers/net/sxe2/sxe2_drv_cmd.h +16 -0
@@ -617,6 +617,22 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_flow_fnav_query_stat_resp {uint64_t stat_bytes; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_req { + uint8_t type; +uint8_t rsv; +uint16_t port; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_resp { + uint8_t type; +uint8_t enable; +uint8_t dst; +uint8_t src; +uint16_t port; +uint8_t fw_used; +uint8_t rsv; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +198 -2
247 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +9 -0
@@ -318,6 +318,7 @@ struct sxe2_adapter {struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs; +struct sxe2_udp_tunnel_ctx udp_tunnel_ctx;struct sxe2_security_ctx security_ctx;struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info;
@@ -369,6 +370,14 @@ 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); + +int32_t sxe2_udp_tunnel_port_add_common (struct sxe2_adapter *ad, +enum sxe2_udp_tunnel_protocol tunnel_proto,uint16_t udp_port); +void sxe2_dev_pci_map_uinit (struct rte_eth_dev *dev);void sxe2_eth_uinit (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow.c +54 -0
72 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow.h +2 -1
@@ -8,7 +8,6 @@#include "sxe2_osal.h" #include "sxe2_common.h" -int32_t sxe2_flow_ops_get (struct rte_eth_dev *dev,const struct rte_flow_ops **ops);int32_t sxe2_flow_init (struct rte_eth_dev *dev);
@@ -26,4 +25,6 @@ int32_t sxe2_flow_query_mgr(struct sxe2_adapter *adapter,struct sxe2_flow *flow, struct sxe2_fnav_cid_mgr **mgr_ptr, struct rte_flow_error *error); + +int32_t sxe2_flow_init_udp_tunnel_port (struct rte_eth_dev *dev);#endif /* __SXE2_FLOW_H__ */
drivers/net/sxe2/sxe2_flow_define.h +1 -0
@@ -119,6 +119,7 @@ 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; +uint16_t tunnel_port_list[SXE2_FLOW_UDP_TUNNEL_MAX ];uint32_t fnav_inited; };#define SXE2_INVALID_RSS_ATTR \
drivers/net/sxe2/sxe2_flow_parse_pattern.c +113 -0
119 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h +6 -0
@@ -37,4 +37,10 @@ int32_t sxe2_flow_parse_pattern(struct rte_eth_dev *dev,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_ */
drivers/net/sxe2/sxe2_txrx_poll.c +45 -1
58 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 14/23 net/sxe2: add support for custom UDP tunnel ports
In reply to [email protected]From: Jie Liu <[email protected]>
This patch enables the configuration of custom UDP port numbers for tunneling protocols in the SXE2 PMD.
The change includes:
- Adding a new entry in the tunnel port lookup table.
- Updating the hardware profile to recognize
the custom UDP port as a tunnel type.
- Enabling inner header parsing for packets arriving on these ports.
This allows the Switch module to correctly apply recipes based on inner packet fields (e.g., inner MAC or IP).
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 96 ++++++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 17 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 16 ++ drivers/net/sxe2/sxe2_ethdev.c | 200 ++++++++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 9 + drivers/net/sxe2/sxe2_flow.c | 54 ++++++ drivers/net/sxe2/sxe2_flow.h | 3 +- drivers/net/sxe2/sxe2_flow_define.h | 1 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 113 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 6 + drivers/net/sxe2/sxe2_txrx_poll.c | 46 ++++- 11 files changed, 557 insertions(+), 4 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +96 -0
@@ -1455,6 +1455,102 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,return ret; } +int32_t sxe2_drv_udp_tunnel_add (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_proto; + req.port = udp_port; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_ADD , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to add udp proto %d port %d, ret=%d" , + tunnel_proto, udp_port, ret); + +return ret; +} + +int32_t sxe2_drv_udp_tunnel_del (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_proto; + req.port = udp_port; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_DEL , + &req,sizeof (req), +NULL ,0 ); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to del udp proto %d port %d, ret=%d" , + tunnel_proto, udp_port, ret); + +return ret; +} + +int32_t sxe2_drv_get_udp_tunnel_port (struct sxe2_adapter *adapter, +enum sxe2_flow_udp_tunnel_protocol proto, +uint16_t *port) +{ +int32_t ret =0 ; +static const uint16_t flow_proto_to_udp_tunnel_proto[SXE2_FLOW_UDP_TUNNEL_MAX ] = { + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_VXLAN ] =SXE2_UDP_TUNNEL_PROTOCOL_VXLAN , + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_VXLAN_GPE ] =SXE2_UDP_TUNNEL_PROTOCOL_VXLAN_GPE , + [SXE2_FLOW_UDP_TUNNEL_PROTOCOL_GENEVE ] =SXE2_UDP_TUNNEL_PROTOCOL_GENEVE , + [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 = {}; + + tunnel_config.protocol = flow_proto_to_udp_tunnel_proto[proto]; + ret =sxe2_drv_udp_tunnel_get (adapter, &tunnel_config); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to get udp tunnel port, ret=%d" , ret); + goto l_end; + } + + *port = tunnel_config.fw_port; +l_end: +return ret; +} + +int32_t sxe2_drv_udp_tunnel_get (struct sxe2_adapter *adapter, +struct sxe2_udp_tunnel_cfg *tunnel_config) +{ +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_udp_tunnel_req req = {}; +struct sxe2_drv_udp_tunnel_resp resp = {}; +struct sxe2_drv_cmd_params cmd = {}; +int32_t ret =-1 ; + + req.type = tunnel_config->protocol; +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_UDPTUNNEL_GET , + &req,sizeof (req), + &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, &cmd); +if (ret) +PMD_LOG_ERR (DRV ,"Failed to get udp proto %d port, ret=%d" , req.type, ret); + + tunnel_config->fw_port = resp.port; + tunnel_config->fw_status = resp.enable; + tunnel_config->fw_dst_en = resp.dst; + tunnel_config->fw_src_en = resp.src; + tunnel_config->fw_used = resp.fw_used; + +return ret; +} +int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter,struct eth_queue_stats *qstats) {struct sxe2_drv_cmd_params param = {0 };
drivers/net/sxe2/sxe2_cmd_chnl.h +17 -0
@@ -67,6 +67,23 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,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); + +int32_t sxe2_drv_udp_tunnel_del (struct sxe2_adapter *adapter, +enum sxe2_udp_tunnel_protocol tunnel_proto, +uint16_t udp_port); + +int32_t sxe2_drv_udp_tunnel_get (struct sxe2_adapter *adapter, +struct sxe2_udp_tunnel_cfg *tunnel_config); + +int32_t sxe2_drv_get_udp_tunnel_port (struct sxe2_adapter *adapter, +enum sxe2_flow_udp_tunnel_protocol proto, +uint16_t *port); + +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);
drivers/net/sxe2/sxe2_drv_cmd.h +16 -0
@@ -617,6 +617,22 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_flow_fnav_query_stat_resp {uint64_t stat_bytes; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_req { + uint8_t type; +uint8_t rsv; +uint16_t port; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_udp_tunnel_resp { + uint8_t type; +uint8_t enable; +uint8_t dst; +uint8_t src; +uint16_t port; +uint8_t fw_used; +uint8_t rsv; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +198 -2
247 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +9 -0
@@ -318,6 +318,7 @@ struct sxe2_adapter {struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs; +struct sxe2_udp_tunnel_ctx udp_tunnel_ctx;struct sxe2_security_ctx security_ctx;struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info;
@@ -369,6 +370,14 @@ 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); + +int32_t sxe2_udp_tunnel_port_add_common (struct sxe2_adapter *ad, +enum sxe2_udp_tunnel_protocol tunnel_proto,uint16_t udp_port); +void sxe2_dev_pci_map_uinit (struct rte_eth_dev *dev);void sxe2_eth_uinit (struct rte_eth_dev *dev);
drivers/net/sxe2/sxe2_flow.c +54 -0
72 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow.h +2 -1
@@ -8,7 +8,6 @@#include "sxe2_osal.h" #include "sxe2_common.h" -int32_t sxe2_flow_ops_get (struct rte_eth_dev *dev,const struct rte_flow_ops **ops);int32_t sxe2_flow_init (struct rte_eth_dev *dev);
@@ -26,4 +25,6 @@ int32_t sxe2_flow_query_mgr(struct sxe2_adapter *adapter,struct sxe2_flow *flow, struct sxe2_fnav_cid_mgr **mgr_ptr, struct rte_flow_error *error); + +int32_t sxe2_flow_init_udp_tunnel_port (struct rte_eth_dev *dev);#endif /* __SXE2_FLOW_H__ */
drivers/net/sxe2/sxe2_flow_define.h +1 -0
@@ -119,6 +119,7 @@ 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; +uint16_t tunnel_port_list[SXE2_FLOW_UDP_TUNNEL_MAX ];uint32_t fnav_inited; };#define SXE2_INVALID_RSS_ATTR \
drivers/net/sxe2/sxe2_flow_parse_pattern.c +113 -0
119 lines not on this page · raw message
drivers/net/sxe2/sxe2_flow_parse_pattern.h +6 -0
@@ -37,4 +37,10 @@ int32_t sxe2_flow_parse_pattern(struct rte_eth_dev *dev,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_ */
drivers/net/sxe2/sxe2_txrx_poll.c +45 -1
58 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v7 15/23 net/sxe2: support firmware version reading
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the logic to retrieve the firmware version and Build ID from the hardware during device initialization.
The version is exposed to applications through the dev_info_get API.
--- drivers/net/sxe2/sxe2_ethdev.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
drivers/net/sxe2/sxe2_ethdev.c +34 -1
@@ -119,7 +119,8 @@ static int32_t sxe2_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *tunnel_udp);static int32_t sxe2_udp_tunnel_port_del (struct rte_eth_dev *dev,struct rte_eth_udp_tunnel *tunnel_udp); - +static int32_t sxe2_fw_version_string_get (struct rte_eth_dev *dev, +char *fw_version,size_t fw_size);static const struct eth_dev_ops sxe2_eth_dev_ops = { .dev_configure = sxe2_dev_configure,
@@ -180,6 +181,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .xstats_reset = sxe2_stats_info_reset, .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, + + .fw_version_get = sxe2_fw_version_string_get, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -1556,6 +1559,36 @@ static int32_t sxe2_eth_pmd_remove(struct sxe2_common_device *cdev)return ret; } +static int32_t sxe2_fw_version_string_get (struct rte_eth_dev *dev,char *fw_version,size_t fw_size) +{ +struct sxe2_adapter *adapter = +SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_fw_info *fw_info = &adapter->dev_info.fw; +int32_t ret_len; +int32_t ret; + + ret_len =snprintf (fw_version, fw_size, +"%u.%u.%u.%u" , + fw_info->main_version_id, + fw_info->sub_version_id, + fw_info->fix_version_id, + fw_info->build_id); + +if (ret_len <0 ) { + ret = -EINVAL ; + goto out; + } + + ret_len +=1 ; +if (fw_size < (size_t )ret_len) + ret = -EINVAL ; +else + ret =0 ; + +out: +return ret; +} +static uint16_t sxe2_switchdev_repr_id_encode_get (struct sxe2_switchdev_info *switchdev_info) {enum rte_eth_representor_type type;
Signature · 1 line
2.52.0
PATCH v7 15/23 net/sxe2: support firmware version reading
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the logic to retrieve the firmware version and Build ID from the hardware during device initialization.
The version is exposed to applications through the dev_info_get API.
--- drivers/net/sxe2/sxe2_ethdev.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
drivers/net/sxe2/sxe2_ethdev.c +34 -1
@@ -119,7 +119,8 @@ static int32_t sxe2_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *tunnel_udp);static int32_t sxe2_udp_tunnel_port_del (struct rte_eth_dev *dev,struct rte_eth_udp_tunnel *tunnel_udp); - +static int32_t sxe2_fw_version_string_get (struct rte_eth_dev *dev, +char *fw_version,size_t fw_size);static const struct eth_dev_ops sxe2_eth_dev_ops = { .dev_configure = sxe2_dev_configure,
@@ -180,6 +181,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .xstats_reset = sxe2_stats_info_reset, .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, + + .fw_version_get = sxe2_fw_version_string_get, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -1556,6 +1559,36 @@ static int32_t sxe2_eth_pmd_remove(struct sxe2_common_device *cdev)return ret; } +static int32_t sxe2_fw_version_string_get (struct rte_eth_dev *dev,char *fw_version,size_t fw_size) +{ +struct sxe2_adapter *adapter = +SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_fw_info *fw_info = &adapter->dev_info.fw; +int32_t ret_len; +int32_t ret; + + ret_len =snprintf (fw_version, fw_size, +"%u.%u.%u.%u" , + fw_info->main_version_id, + fw_info->sub_version_id, + fw_info->fix_version_id, + fw_info->build_id); + +if (ret_len <0 ) { + ret = -EINVAL ; + goto out; + } + + ret_len +=1 ; +if (fw_size < (size_t )ret_len) + ret = -EINVAL ; +else + ret =0 ; + +out: +return ret; +} +static uint16_t sxe2_switchdev_repr_id_encode_get (struct sxe2_switchdev_info *switchdev_info) {enum rte_eth_representor_type type;
Signature · 1 line
2.52.0
PATCH v7 16/23 net/sxe2: implement get monitor address
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the 'get_monitor_addr' ethdev ops in the sxe2 PMD. This interface allows the Ethernet device to provide the address of the next expected Rx descriptor to the power management library.
The implementation calculates the address of the next Rx descriptor based on the receive queue's current hardware ring position and descriptor size. Applications can then use this address with rte_power_monitor() to put the CPU into a low-power state until new packets are written to the descriptor by the hardware.
--- drivers/net/sxe2/sxe2_ethdev.c | 2 ++ drivers/net/sxe2/sxe2_rx.c | 21 +++++++++++++++++++++ drivers/net/sxe2/sxe2_rx.h | 2 ++ 3 files changed, 25 insertions(+)
drivers/net/sxe2/sxe2_ethdev.c +2 -0
@@ -183,6 +183,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, .fw_version_get = sxe2_fw_version_string_get, + + .get_monitor_addr = sxe2_get_monitor_addr, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
drivers/net/sxe2/sxe2_rx.c +21 -0
@@ -534,3 +534,24 @@ 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 ); +return (value & dd_state) == dd_state ?-1 :0 ; +} + +int32_t sxe2_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc) +{ +volatile union sxe2_rx_desc *rxdp; +struct sxe2_rx_queue *rxq = (struct sxe2_rx_queue *)rx_queue; + + rxdp = &rxq->desc_ring[rxq->processing_idx]; + + pmc->addr = &rxdp->wb.status_err_ptype_len; + pmc->fn = sxe2_monitor_callback; + pmc->size =sizeof (uint16_t ); + +return 0 ; +}
drivers/net/sxe2/sxe2_rx.h +2 -0
@@ -29,4 +29,6 @@ int32_t __rte_cold sxe2_rxqs_all_start(struct rte_eth_dev *dev); void __rte_cold sxe2_rxqs_all_stop(struct rte_eth_dev *dev); +int32_t sxe2_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc); +#endif /* SXE2_RX_H */
Signature · 1 line
2.52.0
PATCH v7 16/23 net/sxe2: implement get monitor address
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the 'get_monitor_addr' ethdev ops in the sxe2 PMD. This interface allows the Ethernet device to provide the address of the next expected Rx descriptor to the power management library.
The implementation calculates the address of the next Rx descriptor based on the receive queue's current hardware ring position and descriptor size. Applications can then use this address with rte_power_monitor() to put the CPU into a low-power state until new packets are written to the descriptor by the hardware.
--- drivers/net/sxe2/sxe2_ethdev.c | 2 ++ drivers/net/sxe2/sxe2_rx.c | 21 +++++++++++++++++++++ drivers/net/sxe2/sxe2_rx.h | 2 ++ 3 files changed, 25 insertions(+)
drivers/net/sxe2/sxe2_ethdev.c +2 -0
@@ -183,6 +183,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, .fw_version_get = sxe2_fw_version_string_get, + + .get_monitor_addr = sxe2_get_monitor_addr, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
drivers/net/sxe2/sxe2_rx.c +21 -0
@@ -534,3 +534,24 @@ 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 ); +return (value & dd_state) == dd_state ?-1 :0 ; +} + +int32_t sxe2_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc) +{ +volatile union sxe2_rx_desc *rxdp; +struct sxe2_rx_queue *rxq = (struct sxe2_rx_queue *)rx_queue; + + rxdp = &rxq->desc_ring[rxq->processing_idx]; + + pmc->addr = &rxdp->wb.status_err_ptype_len; + pmc->fn = sxe2_monitor_callback; + pmc->size =sizeof (uint16_t ); + +return 0 ; +}
drivers/net/sxe2/sxe2_rx.h +2 -0
@@ -29,4 +29,6 @@ int32_t __rte_cold sxe2_rxqs_all_start(struct rte_eth_dev *dev); void __rte_cold sxe2_rxqs_all_stop(struct rte_eth_dev *dev); +int32_t sxe2_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc); +#endif /* SXE2_RX_H */
Signature · 1 line
2.52.0
PATCH v7 17/23 common/sxe2: add shared SFP module definitions
In reply to [email protected]From: Jie Liu <[email protected]>
This patch adds a new shared header file 'sxe2_msg.h' which contains definitions for SFP/SFP+ modules. This file is shared across Firmware, Kernel driver, and DPDK PMD to ensure consistent protocol handling.
The header includes:
- SFP EEPROM memory map offsets.
- Module type encoding definitions.
By using this shared header, the PMD can correctly identify module capabilities and report diagnostic information in a way that is consistent with the underlying firmware logic.
--- drivers/common/sxe2/sxe2_msg.h | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 drivers/common/sxe2/sxe2_msg.h
drivers/common/sxe2/sxe2_msg.h new file +118 -0
@@ -0,0 +1,118 @@ + +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_MSG_H__ +#define __SXE2_MSG_H__ + +enum sfp_type_identifier { +SXE2_SFP_TYPE_UNKNOWN =0x00 , +SXE2_SFP_TYPE_SFP =0x03 , + +SXE2_SFP_TYPE_QSFP_PLUS =0x0D , +SXE2_SFP_TYPE_QSFP28 =0x11 , + +SXE2_SFP_TYPE_MAX =0xFF , +}; + +#ifndef SFP_DEFINE +#define SFP_DEFINE + +#define SXE2_SFP_EEP_WR 0x1 +#define SXE2_SFP_EEP_QSFP 0x1 + +enum sfp_bus_addr { +SXE2_SFP_EEP_I2C_ADDR0 =0xA0 , +SXE2_SFP_EEP_I2C_ADDR1 =0xA2 , +SXE2_SFP_EEP_I2C_ADDR_NR =0xFFFF , +}; + +struct sxe2_sfp_req { +uint8_t is_wr; +uint8_t is_qsfp; +uint16_t bus_addr; +uint16_t page_cnt; +uint16_t offset; +uint16_t data_len; +uint16_t rvd; +uint8_t data[]; +}; + +struct sxe2_sfp_resp { +uint8_t is_wr; +uint8_t is_qsfp; +uint16_t data_len; +uint8_t data[]; +}; + +enum sfp_page_cnt { +SXE2_SFP_EEP_PAGE_CNT0 =0 , +SXE2_SFP_EEP_PAGE_CNT1 , +SXE2_SFP_EEP_PAGE_CNT2 , +SXE2_SFP_EEP_PAGE_CNT3 , +SXE2_SFP_EEP_PAGE_CNT20 =20 , +SXE2_SFP_EEP_PAGE_CNT21 =21 , + +SXE2_SFP_EEP_PAGE_CNT_NR =0xFFFF , +}; + +#define SXE2_SFP_E2P_I2C_7BIT_ADDR0 (SXE2_SFP_EEP_I2C_ADDR0 >> 1) +#define SXE2_SFP_E2P_I2C_7BIT_ADDR1 (SXE2_SFP_EEP_I2C_ADDR1 >> 1) + +#define SXE2_QSFP_PAGE_OFST_START 128 +#define SXE2_SFP_EEP_OFST_MAX 255 +#define SXE2_SFP_EEP_LEN_MAX 256 +#endif + +#ifndef FW_STATE_DEFINE +#define FW_STATE_DEFINE + +#define SXE2_FW_STATUS_MAIN_SHIF (16) +#define SXE2_FW_STATUS_MAIN_MASK (0xFF0000) +#define SXE2_FW_STATUS_SUB_MASK (0xFFFF) + +enum Sxe2FwStateMain { +SXE2_FW_STATE_MAIN_UNDEFINED =0x00 , +SXE2_FW_STATE_MAIN_INIT =0x10000 , +SXE2_FW_STATE_MAIN_RUN =0x20000 , +SXE2_FW_STATE_MAIN_ABNOMAL =0x30000 , +}; + +enum Sxe2FwState { +SXE2_FW_START_STATE_UNDEFINED =SXE2_FW_STATE_MAIN_UNDEFINED , +SXE2_FW_START_STATE_INIT_BASE = (SXE2_FW_STATE_MAIN_INIT +0x1 ), +SXE2_FW_START_STATE_SCAN_DEVICE = (SXE2_FW_STATE_MAIN_INIT +0x20 ), +SXE2_FW_START_STATE_FINISHED = (SXE2_FW_STATE_MAIN_RUN +0x0 ), +SXE2_FW_START_STATE_UPGRADE = (SXE2_FW_STATE_MAIN_RUN +0x1 ), +SXE2_FW_START_STATE_SYNC = (SXE2_FW_STATE_MAIN_RUN +0x2 ), +SXE2_FW_RUNNING_STATE_ABNOMAL = (SXE2_FW_STATE_MAIN_ABNOMAL +0x1 ), +SXE2_FW_RUNNING_STATE_ABNOMAL_CORE1 = (SXE2_FW_STATE_MAIN_ABNOMAL +0x2 ), +SXE2_FW_RUNNING_STATE_ABNOMAL_HEART = (SXE2_FW_STATE_MAIN_ABNOMAL +0x3 ), +SXE2_FW_START_STATE_MASK = (SXE2_FW_STATUS_MAIN_MASK |SXE2_FW_STATUS_SUB_MASK ), +}; +#endif + +#ifndef LED_DEFINE +#define LED_DEFINE + +enum sxe2_led_mode { +SXE2_IDENTIFY_LED_BLINK_ON =0 , +SXE2_IDENTIFY_LED_BLINK_OFF , +SXE2_IDENTIFY_LED_ON , +SXE2_IDENTIFY_LED_OFF , +SXE2_IDENTIFY_LED_RESET , +}; + + +typedef struct sxe2_led_ctrl { +uint32_t mode; +uint32_t duration; +}sxe2_led_ctrl_s ; + +typedef struct sxe2_led_ctrl_resp { +uint32_t ack; +}sxe2_led_ctrl_resp_s ; +#endif + +#endif /* __SXE2_MSG_H__ */
Signature · 1 line
2.52.0
PATCH v7 18/23 net/sxe2: support SFP module info and EEPROM access
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements 'get_module_info' and 'get_module_eeprom' ops for the sxe2 PMD. These interfaces allow applications to retrieve the type of the plugged-in optical module and read its internal EEPROM data.
The implementation utilizes the shared SFP header definitions to parse the module ID, connector type, and encoding. It supports reading the standard 256-byte EEPROM maps (SFF-8472 for SFP and SFF-8636 for QSFP) via hardware-specific access commands.
Key features:
- Identify module types (SFP/SFP+/QSFP/QSFP28).
- Support standard EEPROM data retrieval for diagnostic tools.
- Add boundary checks to ensure safe I2C memory access.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 46 +++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 3 + drivers/net/sxe2/sxe2_drv_cmd.h | 18 ++ drivers/net/sxe2/sxe2_ethdev.c | 298 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_ethdev.h | 9 + 5 files changed, 374 insertions(+)
drivers/net/sxe2/sxe2_cmd_chnl.c +46 -0
@@ -1833,3 +1833,49 @@ int32_t sxe2_drv_srcvsi_prune_config(struct sxe2_adapter *adapter,return ret; } + +int32_t sxe2_drv_sfp_eeprom_read (struct sxe2_adapter *adapter,struct sxe2_sfp_read_info *sfp_info) +{ +int32_t ret =-1 ; +struct sxe2_drv_sfp_req req = {0 }; +struct sxe2_drv_sfp_resp *resp =NULL ; +struct sxe2_drv_cmd_params cmd = {0 }; + + resp =rte_zmalloc ("read sfp data" ,sizeof (*resp) + sfp_info->len,0 ); +if (!resp) { +PMD_LOG_ERR (DRV ,"Alloc memory failed" ); + ret = -ENOMEM ; + goto l_end; + } + + req.is_wr = false; + req.is_qsfp = sfp_info->is_qsfp; + req.page_cnt =rte_cpu_to_le_16 (sfp_info->page_cnt); + req.offset =rte_cpu_to_le_16 (sfp_info->offset); + req.data_len =rte_cpu_to_le_16 (sfp_info->len); + req.bus_addr =rte_cpu_to_le_16 (sfp_info->bus_addr); + +PMD_DEV_LOG_INFO (adapter,DRV ,"is_qsfp=%u, page_cnt=%u, offset=%u, datalen=%u, " +"bus_addr=%u" , sfp_info->is_qsfp, sfp_info->page_cnt, sfp_info->offset, + sfp_info->len, sfp_info->bus_addr); + +sxe2_drv_cmd_params_fill (adapter, &cmd,SXE2_DRV_CMD_OPT_EEP_GET , + &req,sizeof (req), + resp,sizeof (*resp) + sfp_info->len); + ret =sxe2_drv_cmd_exec (adapter->cdev, &cmd); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"Failed to read sfp, ret=%d" , ret); + goto l_end; + } + + ret =0 ; +rte_memcpy (sfp_info->data, resp->data, sfp_info->len); + +l_end: +if (resp) { +rte_free (resp); + resp =NULL ; + } + +return ret; +}
drivers/net/sxe2/sxe2_cmd_chnl.h +3 -0
@@ -167,4 +167,7 @@ int32_t sxe2_drv_flow_fnav_query_stat(struct sxe2_adapter *adapter,int32_t sxe2_drv_srcvsi_prune_config (struct sxe2_adapter *adapter,uint16_t *vsi_list,uint16_t vsi_cnt,bool set); +int32_t sxe2_drv_sfp_eeprom_read (struct sxe2_adapter *adapter, +struct sxe2_sfp_read_info *sfp_info); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +18 -0
@@ -633,6 +633,24 @@ 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 { + uint8_t is_wr; +uint8_t is_qsfp; +uint16_t bus_addr; +uint16_t page_cnt; +uint16_t offset; +uint16_t data_len; +uint16_t rvd; +uint8_t data[]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_resp { + uint8_t is_wr; +uint8_t is_qsfp; +uint16_t data_len; +uint8_t data[]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +298 -0
322 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +9 -0
@@ -274,6 +274,15 @@ struct sxe2_sched_hw_cap {uint8_t adj_lvl; }; +struct sxe2_sfp_read_info { +uint8_t *data; +uint16_t offset; +uint16_t len; +uint16_t bus_addr; +uint16_t page_cnt; +bool is_qsfp; +}; +struct sxe2_link_context {rte_spinlock_t link_lock;bool link_up;
Signature · 1 line
2.52.0
PATCH v7 19/23 net/sxe2: add mbuf validation in Tx debug mode
In reply to [email protected]From: Jie Liu <[email protected]>
Introduce the sxe2_txrx_check_mbuf helper function to validate outgoing mbufs when RTE_ETHDEV_DEBUG_TX is enabled. This helps developers catch malformed mbufs (e.g., invalid segment lengths, bad offload flags, or unaligned buffers) before passing them to the hardware rings, avoiding potential hardware hangs or silent packet drops.
The validation is fully wrapped inside RTE_ETHDEV_DEBUG_TX conditional compilation blocks to ensure zero performance overhead in standard production builds.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_txrx.c | 8 +- drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++++++++++++++++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 ++ 4 files changed, 640 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h
drivers/net/sxe2/meson.build +1 -0
@@ -77,4 +77,5 @@ sources += files( 'sxe2_flow_parse_action.c', 'sxe2_flow_parse_pattern.c', 'sxe2_flow_parse_engine.c', + 'sxe2_txrx_check_mbuf.c', )
drivers/net/sxe2/sxe2_txrx.c +6 -2
@@ -13,6 +13,7 @@#include "sxe2_txrx_common.h" #include "sxe2_txrx_vec.h" #include "sxe2_txrx_poll.h" +#include "sxe2_txrx_check_mbuf.h" #include "sxe2_ethdev.h" #include "sxe2_common_log.h" #include "sxe2_osal.h"
@@ -120,13 +121,11 @@ uint16_t sxe2_tx_pkts_prepare(void *tx_queue, rte_errno = -EINVAL ; goto l_end; } -#ifdef RTE_ETHDEV_DEBUG_TX ret =rte_validate_tx_offload (mbuf);if (ret !=0 ) { rte_errno = -ret; goto l_end; } -#endif ret =rte_net_intel_cksum_prepare (mbuf);if (ret !=0 ) { rte_errno = -ret;
@@ -137,6 +136,11 @@ uint16_t sxe2_tx_pkts_prepare(void *tx_queue, rte_errno = -ret; goto l_end; } + ret =sxe2_txrx_check_mbuf (mbuf); +if (ret !=0 ) { + rte_errno = -ret; + goto l_end; + } } l_end:return i;
drivers/net/sxe2/sxe2_txrx_check_mbuf.c new file +595 -0
595 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_check_mbuf.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_TXRX_CHECK_MBUF_H__ +#define __SXE2_TXRX_CHECK_MBUF_H__ + +#include <rte_common.h> +#include <rte_net.h> +#include <rte_vect.h> +#include <rte_malloc.h> +#include <rte_memzone.h> +#include <ethdev_driver.h> + +struct offload_info { +uint16_t ethertype; +uint8_t gso_enable; +uint16_t l2_len; +uint16_t l3_len; +uint16_t l4_len; +uint8_t l4_proto; +uint8_t is_tunnel; +uint16_t outer_ethertype; +uint16_t outer_l2_len; +uint16_t outer_l3_len; +uint8_t outer_l4_proto; +uint16_t tso_segsz; +uint16_t tunnel_tso_segsz; +uint32_t pkt_len; +}; + +struct simple_gre_hdr { +uint16_t flags; +uint16_t proto; +}; + +__rte_unused int32_t sxe2_txrx_check_mbuf(struct rte_mbuf *m); +#endif /* __SXE2_TXRX_CHECK_MBUF_H__ */
Signature · 1 line
2.52.0
PATCH v7 20/23 common/sxe2: add callback for memory event handling
In reply to [email protected]From: Jie Liu <[email protected]>
During memory hotplug events, the SXE2 driver needs to track memory segment layout changes to maintain internal DMA mappings. However, existing memseg walk functions (rte_memseg_walk) acquire memory locks and cannot be called from within memory event callbacks, leading to potential deadlocks.
The implementation follows the standard rte_memseg_walk_t prototype, processing each memseg to update driver-specific data structures.
--- drivers/common/sxe2/sxe2_common.c | 110 ++++++++++++++++++++++++++ drivers/common/sxe2/sxe2_common.h | 2 + drivers/common/sxe2/sxe2_ioctl_chnl.c | 2 +- 3 files changed, 113 insertions(+), 1 deletion(-)
drivers/common/sxe2/sxe2_common.c +110 -0
@@ -196,6 +196,102 @@ static int32_t sxe2_parse_representor(const char *key, const char *value, void *PMD_LOG_INFO (COM ,"representor arg %s: \"%s\"." , key, value); +l_end: +return ret; +} +static int32_t sxe2_dma_mem_map (struct sxe2_common_device *cdev, +const void *addr,size_t len,bool do_map) +{ +struct rte_memseg_list *msl; +struct rte_memseg *ms; +size_t cur_len =0 ; +int32_t ret =0 ; + + msl =rte_mem_virt2memseg_list (addr); +if (msl ==NULL ) { + ret = -EINVAL ; +PMD_LOG_ERR (COM ,"Invalid virt addr=%p." , addr); + goto l_end; + } + +if ((uintptr_t )addr !=RTE_ALIGN ((uintptr_t )addr, msl->page_sz) || + (len !=RTE_ALIGN (len, msl->page_sz))) { + ret = -EINVAL ; +PMD_LOG_ERR (COM ,"Addr=%p and len=%zu not align page size=%" PRIu64"." , + addr, len, msl->page_sz); + goto l_end; + } + +/* memsegs are contiguous in memory */ + ms =rte_mem_virt2memseg (addr, msl); +while (cur_len < len) { +/* some memory segments may have invalid IOVA */ +if (ms->iova ==RTE_BAD_IOVA ) { +PMD_LOG_WARN (COM ,"Memory segment at %p has bad IOVA, skipping." , + ms->addr); + goto next; + } +if (do_map) +sxe2_drv_dev_dma_map (cdev, ms->addr_64, + ms->iova, ms->len); +else +sxe2_drv_dev_dma_unmap (cdev, ms->iova); + +next: + cur_len += ms->len; + ++ms; + } + +l_end: +return ret; +} + +RTE_EXPORT_INTERNAL_SYMBOL (sxe2_common_mem_event_cb) +void +sxe2_common_mem_event_cb (enum rte_mem_event type, + const void *addr, size_t size, void *arg __rte_unused) +{ +struct sxe2_common_device *cdev =NULL ; + +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) + goto l_end; + +pthread_mutex_lock (&sxe2_common_devices_list_lock); +switch (type) { +case RTE_MEM_EVENT_FREE : +TAILQ_FOREACH (cdev, &sxe2_common_devices_list, next) + (void)sxe2_dma_mem_map(cdev, addr, size, 0); +break ; +case RTE_MEM_EVENT_ALLOC : +TAILQ_FOREACH (cdev, &sxe2_common_devices_list, next) + (void)sxe2_dma_mem_map(cdev, addr, size, 1); +break ; +default : +break ; + } +pthread_mutex_unlock (&sxe2_common_devices_list_lock); +l_end: +return ; +} + +static int32_t sxe2_memseg_walk_cb (const struct rte_memseg_list *msl, +const struct rte_memseg *ms,void *arg) +{ +struct sxe2_common_device *cdev = arg; +int32_t ret =0 ; + +if (msl->external && !msl->heap) + goto l_end; + +if (ms->iova ==RTE_BAD_IOVA ) + goto l_end; + + ret =sxe2_drv_dev_dma_map (cdev, ms->addr_64, ms->iova, ms->len); +if (ret !=0 ) { +PMD_LOG_ERR (COM ,"Fail to memseg dma map." ); + goto l_end; + } + l_end:return ret; }
@@ -220,6 +316,18 @@ static int32_t sxe2_common_device_setup(struct sxe2_common_device *cdev) goto l_close_dev; } +rte_mcfg_mem_read_lock (); + ret =rte_memseg_walk_thread_unsafe (sxe2_memseg_walk_cb, cdev); +if (ret) { +PMD_LOG_ERR (COM ,"Fail to walk memseg, ret=%d" , ret); +rte_mcfg_mem_read_unlock (); + goto l_close_dev; + } +rte_mcfg_mem_read_unlock (); + + (void )rte_mem_event_callback_register ("SXE2_MEM_EVENT_CB" , + sxe2_common_mem_event_cb,NULL ); + goto l_end; l_close_dev:
@@ -251,6 +359,7 @@ static struct sxe2_common_device *sxe2_common_device_alloc( } cdev->dev = rte_dev; cdev->class_type = class_type; + cdev->config.cmd_fd =SXE2_CMD_FD_INVALID ; cdev->config.kernel_reset = false;pthread_mutex_init (&cdev->config.lock,NULL );
@@ -631,6 +740,7 @@ static int32_t sxe2_common_pci_id_table_update(const struct rte_pci_id *id_table updated_table =calloc (num_ids,sizeof (*updated_table));if (!updated_table) { + ret = -ENOMEM ;PMD_LOG_ERR (COM ,"Failed to allocate memory for PCI ID table" ); goto l_end; }
drivers/common/sxe2/sxe2_common.h +2 -0
@@ -14,6 +14,8 @@#define SXE2_COMMON_PCI_DRIVER_NAME "sxe2_pci" +#define SXE2_CMD_FD_INVALID (-1) +#define SXE2_CDEV_TO_CMD_FD (cdev) \ ((cdev)->config.cmd_fd)
drivers/common/sxe2/sxe2_ioctl_chnl.c +1 -1
@@ -110,7 +110,7 @@ sxe2_drv_dev_close(struct sxe2_common_device *cdev)if (fd >=0 )close (fd);PMD_LOG_INFO (COM ,"closed device fd=%d" , fd); -SXE2_CDEV_TO_CMD_FD (cdev) =-1 ; +SXE2_CDEV_TO_CMD_FD (cdev) =SXE2_CMD_FD_INVALID ; }RTE_EXPORT_INTERNAL_SYMBOL (sxe2_drv_dev_handshake)
Signature · 1 line
2.52.0
PATCH v7 21/23 net/sxe2: add private devargs parsing
In reply to [email protected]From: Jie Liu <[email protected]>
Introduce runtime private device arguments (devargs) support for the sxe2 PMD. This allows users to customize driver behavior at startup without recompiling the source code.
The parameters are parsed using the standard 'rte_kvargs' library during the PCI/vdev probing phase. Documentation for these parameters is also updated.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 21 +++ drivers/net/sxe2/sxe2_cmd_chnl.h | 3 + drivers/net/sxe2/sxe2_drv_cmd.h | 17 +++ drivers/net/sxe2/sxe2_ethdev.c | 240 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_ethdev.h | 6 + drivers/net/sxe2/sxe2_flow.c | 9 +- drivers/net/sxe2/sxe2_irq.c | 30 ++++ drivers/net/sxe2/sxe2_rx.c | 12 ++ 8 files changed, 335 insertions(+), 3 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +21 -0
@@ -99,6 +99,27 @@ int32_t sxe2_drv_dev_info_get(struct sxe2_adapter *adapter,return ret; } +int32_t sxe2_drv_fc_state_get (struct sxe2_adapter *adapter, +struct sxe2_drv_vsi_fc_get_resp *dev_fc_state_resp) +{ +int32_t ret =0 ; +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_cmd_params param = {0 }; +struct sxe2_drv_vsi_fc_get_req req = {0 }; + + req.vsi_id = adapter->vsi_ctxt.main_vsi->vsi_id; +sxe2_drv_cmd_params_fill (adapter, ¶m,SXE2_DRV_CMD_VSI_FC_GET , + &req,sizeof (req), + dev_fc_state_resp, +sizeof (*dev_fc_state_resp)); + ret =sxe2_drv_cmd_exec (cdev, ¶m); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"get fc state failed, ret=%d" , ret); + ret = -EIO ; + } +return ret; +} +int32_t sxe2_drv_dev_fw_info_get (struct sxe2_adapter *adapter,struct sxe2_drv_dev_fw_info_resp *dev_fw_info_resp) {
drivers/net/sxe2/sxe2_cmd_chnl.h +3 -0
@@ -99,6 +99,9 @@ int32_t sxe2_drv_vsi_stats_reset(struct sxe2_adapter *adapter);int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter,struct eth_queue_stats *qstats); +int32_t sxe2_drv_fc_state_get (struct sxe2_adapter *adapter, +struct sxe2_drv_vsi_fc_get_resp *dev_fc_state_resp); +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_txq_mapping_set (struct rte_eth_dev *eth_dev,uint16_t queue_id,uint8_t pool_idx);
drivers/net/sxe2/sxe2_drv_cmd.h +17 -0
@@ -651,6 +651,23 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_sfp_resp {uint8_t data[]; } __rte_packed_end; +enum sxe2_fc_type { +SXE2_FC_T_DIS =0 , +SXE2_FC_T_LFC , +SXE2_FC_T_PFC , +SXE2_FC_T_UNKNOWN =255 , +}; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_fc_get_req { + uint16_t vsi_id; +uint8_t rsv[2 ]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_fc_get_resp { + uint8_t fc_enable; +uint8_t rsv[3 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +240 -0
294 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +6 -0
@@ -310,6 +310,11 @@ struct sxe2_filter_context {bool cur_l2_config; }; +struct sxe2_fc_state_ctxt { +uint8_t curr_state; +uint8_t cfg_state; +}; +struct sxe2_adapter {struct sxe2_common_device *cdev;struct sxe2_dev_info dev_info;
@@ -331,6 +336,7 @@ struct sxe2_adapter {struct sxe2_security_ctx security_ctx;struct sxe2_repr_context repr_ctxt;struct sxe2_switchdev_info switchdev_info; +struct sxe2_fc_state_ctxt fc_state_ctx;bool rule_started;bool flow_isolated;bool flow_isolate_cfg;
drivers/net/sxe2/sxe2_flow.c +6 -3
@@ -762,6 +762,7 @@ static int32_t sxe2_flow_validate_with_flow(struct rte_eth_dev *dev,const struct rte_flow_action actions[], struct rte_flow_error *error) { + struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(dev);int32_t ret =0 ;struct sxe2_flow *flow =NULL ;
@@ -804,9 +805,11 @@ static int32_t sxe2_flow_validate_with_flow(struct rte_eth_dev *dev, ret =sxe2_flow_check_flow_list_duplicate (dev, flow_list);if (ret !=0 ) { -rte_flow_error_set (error,EEXIST ,RTE_FLOW_ERROR_TYPE_ITEM , -NULL ,"Duplicate flow." ); -PMD_LOG_ERR (DRV ,"Duplicate flow." ); +rte_flow_error_set (error,EEXIST ,RTE_FLOW_ERROR_TYPE_ITEM ,NULL , + adapter->devargs.flow_dup_pattern_mode ? +"Duplicate flow pattern." : +"Duplicate flow pattern is not allowed." ); +PMD_LOG_ERR (DRV ,"Duplicate flow pattern." ); goto l_end; } l_end:
drivers/net/sxe2/sxe2_irq.c +30 -0
@@ -10,6 +10,7 @@#include <rte_alarm.h> #include <fcntl.h> #include <rte_stdatomic.h> +#include <rte_common.h> #include "sxe2_ethdev.h" #include "sxe2_irq.h"
@@ -47,6 +48,31 @@ static struct sxe2_event_handler event_handler = {static RTE_ATOMIC (uint32_t )event_thread_run; +static int32_t sxe2_fc_state_callback (struct rte_eth_dev *dev) +{ +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_drv_vsi_fc_get_resp fc_resp = {0 }; +int32_t ret; + +if (!(adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_FC_STATE )) { + ret =0 ; + goto l_end; + } + ret =sxe2_drv_fc_state_get (adapter, &fc_resp); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to get fc state, ret=[%d]" , ret); + goto l_end; + } + adapter->fc_state_ctx.cfg_state = fc_resp.fc_enable; +if (dev->data->dev_started) { +PMD_LOG_NOTICE (DRV ,"Interrupt event: FC status changed." +"cfg_state:%u curr_state:%u" , + adapter->fc_state_ctx.cfg_state, + adapter->fc_state_ctx.curr_state); + } +l_end: +return ret; +}static void sxe2_event_irq_common_handler (struct sxe2_adapter *adapter,uint64_t oicr) {
@@ -68,6 +94,10 @@ static void sxe2_event_irq_common_handler(struct sxe2_adapter *adapter, uint64_tPMD_DEV_LOG_INFO (adapter,DRV ,"event notify legacy" ); (void )sxe2_switchdev_notify_callback (adapter, false); } +if (oicr &RTE_BIT32 (SXE2_COM_FC_ST_CHANGE )) { +PMD_DEV_LOG_INFO (adapter,DRV ,"fc event notify legacy" ); + (void )sxe2_fc_state_callback (dev); + } } static uint32_t sxe2_event_intr_handle(void *param __rte_unused)
drivers/net/sxe2/sxe2_rx.c +12 -0
@@ -467,12 +467,24 @@ int32_t __rte_cold sxe2_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queu int32_t __rte_cold sxe2_rxqs_all_start(struct rte_eth_dev *dev) {struct rte_eth_dev_data *data = dev->data; +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev); +struct sxe2_drv_vsi_fc_get_resp fc_resp = {0 };struct sxe2_rx_queue *rxq;uint16_t nb_rxq;uint16_t nb_started_rxq;int32_t ret;PMD_INIT_FUNC_TRACE (); +if (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_FC_STATE ) { + ret =sxe2_drv_fc_state_get (adapter, &fc_resp); +if (ret) { +PMD_LOG_ERR (RX ,"Failed to get fc state, ret=[%d]" , ret); + goto l_end; + } + adapter->fc_state_ctx.cfg_state = fc_resp.fc_enable; + adapter->fc_state_ctx.curr_state = adapter->fc_state_ctx.cfg_state; + } +for (nb_rxq =0 ; nb_rxq < data->nb_rx_queues; nb_rxq++) { rxq = dev->data->rx_queues[nb_rxq];if (!rxq || rxq->rx_deferred_start)
Signature · 1 line
2.52.0
PATCH v7 22/23 net/sxe2: implement private dump info
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the 'eth_dev_priv_dump' ops for the sxe2 PMD. This interface allows applications to dump driver-specific internal state and configuration information to a file stream.
The output includes:
- capabilities.
- device base info.
- device args info.
- device filter info.
- reprenstor info.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_dump.c | 287 ++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_dump.h | 12 ++ drivers/net/sxe2/sxe2_ethdev.c | 3 + drivers/net/sxe2/sxe2_ethdev_repr.c | 3 + 5 files changed, 306 insertions(+) create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h
drivers/net/sxe2/meson.build +1 -0
@@ -78,4 +78,5 @@ sources += files( 'sxe2_flow_parse_pattern.c', 'sxe2_flow_parse_engine.c', 'sxe2_txrx_check_mbuf.c', + 'sxe2_dump.c', )
drivers/net/sxe2/sxe2_dump.c new file +287 -0
287 lines not on this page · raw message
drivers/net/sxe2/sxe2_dump.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_DUMP_H__ +#define __SXE2_DUMP_H__ + +#include <ethdev_driver.h> + +int32_t sxe2_eth_dev_priv_dump (struct rte_eth_dev *dev,FILE *file); + +#endif /* __SXE2_DUMP_H__ */
drivers/net/sxe2/sxe2_ethdev.c +3 -0
@@ -37,6 +37,7 @@#include "sxe2_host_regs.h" #include "sxe2_switchdev.h" #include "sxe2_ioctl_chnl_func.h" +#include "sxe2_dump.h" #include "sxe2_ethdev_repr.h" #include "sxe2vf_regs.h" #include "sxe2_switchdev.h"
@@ -202,6 +203,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .get_module_info = sxe2_get_module_info, .get_module_eeprom = sxe2_get_module_eeprom, + + .eth_dev_priv_dump = sxe2_eth_dev_priv_dump, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
drivers/net/sxe2/sxe2_ethdev_repr.c +3 -0
@@ -11,6 +11,7 @@#include "sxe2_txrx.h" #include "sxe2_switchdev.h" #include "sxe2_mp.h" +#include "sxe2_dump.h" #include "sxe2_stats.h" #include "sxe2_flow.h"
@@ -236,6 +237,8 @@ static const struct eth_dev_ops sxe2_switchdev_repr_dev_ops = { .allmulticast_enable = sxe2_repr_allmulti_enable, .allmulticast_disable = sxe2_repr_allmulti_disable, + .eth_dev_priv_dump = sxe2_eth_dev_priv_dump, + .stats_get = sxe2_stats_info_get, .stats_reset = sxe2_stats_info_reset, .xstats_get = sxe2_xstats_info_get,
Signature · 1 line
2.52.0
PATCH v7 23/23 net/sxe2: update sxe2 feature matrix docs
In reply to [email protected]From: Jie Liu <[email protected]>
Update the sxe2.ini feature sheet to accurately reflect the recently implemented hardware capabilities in the sxe2 PMD.
--- doc/guides/nics/features/sxe2.ini | 56 ++++++++++ doc/guides/nics/sxe2.rst | 168 ++++++++++++++++++++++++++++++ 2 files changed, 224 insertions(+)
doc/guides/nics/features/sxe2.ini +56 -0
@@ -7,17 +7,73 @@ ; is selected. ; [Features] +Speed capabilities = Y +Link status = Y +Link status event = Y +Rx interrupt = Y Fast mbuf free = P Free Tx mbuf on demand = Y Burst mode info = Y Queue start/stop = Y +Power mgmt address monitor = Y Buffer split on Rx = P Scattered Rx = Y +Traffic manager = Y CRC offload = Y +VLAN offload = Y +QinQ offload = P L3 checksum offload = Y L4 checksum offload = Y +Timestamp offload = P +Inner L3 checksum = P +Inner L4 checksum = P Rx descriptor status = Y Tx descriptor status = Y +MTU update = Y +TSO = P +Promiscuous mode = Y +Allmulticast mode = Y +Unicast MAC filter = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +VLAN filter = Y +Inline crypto = Y +Packet type parsing = Y +Timesync = Y +Basic stats = Y +Extended stats = Y +FW version = Y +Module EEPROM dump = Y +Multiprocess aware = Y Linux = Y x86-32 = Y x86-64 = Y + +[rte_flow items] +eth = P +geneve = Y +gre = Y +gtpu = Y +ipv4 = Y +ipv6 = Y +ipv6_frag_ext = Y +nvgre = Y +sctp = Y +tcp = Y +udp = Y +vlan = P +vxlan = Y +vxlan_gpe = Y + +[rte_flow actions] +count = Y +drop = Y +mark = Y +passthru = Y +port_representor = Y +queue = Y +represented_port = Y +rss = Y +send_to_kernel = Y +port_id = Y
doc/guides/nics/sxe2.rst +168 -0
171 lines not on this page · raw message
Signature · 1 line
2.52.0
v8 cover net/sxe2: added Linkdata sxe2 ethernet driver
From: Jie Liu <[email protected]>
This patch set implements core functionality for the SXE2 PMD, including basic driver framework, data path setup, and advanced offload features (VLAN, RSS,TM, PTP etc.).
v8:
Restore the flow-duplicate-pattern parameter
Jie Liu (23):
net/sxe2: remove software statistics devargs net/sxe2: add Rx framework and packet types callback net/sxe2: support AVX512 vectorized path for Rx and Tx net/sxe2: add AVX2 vector data path for Rx and Tx net/sxe2: add link update callback
net/sxe2: support L2 filtering and MAC config
drivers: support RSS feature
net/sxe2: support TM hierarchy and shaping net/sxe2: support IPsec inline protocol offload net/sxe2: support statistics and multi-process
drivers: interrupt handling
net/sxe2: add NEON vec Rx/Tx burst functions
drivers: add support for VF representors net/sxe2: add support for custom UDP tunnel ports net/sxe2: support firmware version reading net/sxe2: implement get monitor address common/sxe2: add shared SFP module definitions net/sxe2: support SFP module info and EEPROM access net/sxe2: add mbuf validation in Tx debug mode common/sxe2: add callback for memory event handling net/sxe2: add private devargs parsing net/sxe2: implement private dump info net/sxe2: update sxe2 feature matrix docs
doc/guides/nics/features/sxe2.ini | 56 + doc/guides/nics/sxe2.rst | 168 ++ drivers/common/sxe2/sxe2_common.c | 156 ++ drivers/common/sxe2/sxe2_common.h | 4 + drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++ drivers/common/sxe2/sxe2_ioctl_chnl.c | 178 +- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/common/sxe2/sxe2_msg.h | 118 ++ drivers/net/sxe2/meson.build | 52 + drivers/net/sxe2/sxe2_cmd_chnl.c | 1587 +++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 139 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 523 +++++- drivers/net/sxe2/sxe2_dump.c | 287 +++ drivers/net/sxe2/sxe2_dump.h | 12 + drivers/net/sxe2/sxe2_ethdev.c | 1486 ++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 111 +- drivers/net/sxe2/sxe2_ethdev_repr.c | 609 ++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 895 +++++++++ drivers/net/sxe2/sxe2_filter.h | 100 + drivers/net/sxe2/sxe2_flow.c | 1394 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 30 + drivers/net/sxe2/sxe2_flow_define.h | 144 ++ drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1935 +++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 46 + drivers/net/sxe2/sxe2_ipsec.c | 1565 ++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++ drivers/net/sxe2/sxe2_irq.c | 1026 ++++++++++ drivers/net/sxe2/sxe2_irq.h | 25 + drivers/net/sxe2/sxe2_mac.c | 530 ++++++ drivers/net/sxe2/sxe2_mac.h | 84 + drivers/net/sxe2/sxe2_mp.c | 414 +++++ drivers/net/sxe2/sxe2_mp.h | 67 + drivers/net/sxe2/sxe2_queue.c | 17 +- drivers/net/sxe2/sxe2_queue.h | 15 +- drivers/net/sxe2/sxe2_rss.c | 584 ++++++ drivers/net/sxe2/sxe2_rss.h | 81 + drivers/net/sxe2/sxe2_rx.c | 93 +- drivers/net/sxe2/sxe2_rx.h | 2 + drivers/net/sxe2/sxe2_security.c | 335 ++++ drivers/net/sxe2/sxe2_security.h | 77 + drivers/net/sxe2/sxe2_stats.c | 586 ++++++ drivers/net/sxe2/sxe2_stats.h | 39 + drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 + drivers/net/sxe2/sxe2_tx.c | 7 + drivers/net/sxe2/sxe2_txrx.c | 1958 +++++++++++++++++++- drivers/net/sxe2/sxe2_txrx.h | 8 + drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 + drivers/net/sxe2/sxe2_txrx_poll.c | 284 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 38 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++ drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 +++++++++ drivers/net/sxe2/sxe2_txrx_vec_common.h | 54 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 +++++++ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 38 +- drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- drivers/net/sxe2/sxe2vf_regs.h | 85 + 67 files changed, 24762 insertions(+), 273 deletions(-) create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/common/sxe2/sxe2_msg.h create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
Signature · 1 line
2.52.0
Re: [PATCH v8 00/23] net/sxe2: added Linkdata sxe2 ethernet driver
Quoted 134 lines · On Thu, 25 Jun 2026 21:19:36 +0800 [email protected] wrote:
From: Jie Liu <[email protected]>
This patch set implements core functionality for the SXE2 PMD, including basic driver framework, data path setup, and advanced offload features (VLAN, RSS,TM, PTP etc.).
v8:
Restore the flow-duplicate-pattern parameterJie Liu (23):
net/sxe2: remove software statistics devargs net/sxe2: add Rx framework and packet types callback net/sxe2: support AVX512 vectorized path for Rx and Tx net/sxe2: add AVX2 vector data path for Rx and Tx net/sxe2: add link update callback
net/sxe2: support L2 filtering and MAC config
drivers: support RSS feature
net/sxe2: support TM hierarchy and shaping net/sxe2: support IPsec inline protocol offload net/sxe2: support statistics and multi-process
drivers: interrupt handling
net/sxe2: add NEON vec Rx/Tx burst functions
drivers: add support for VF representors net/sxe2: add support for custom UDP tunnel ports net/sxe2: support firmware version reading net/sxe2: implement get monitor address common/sxe2: add shared SFP module definitions net/sxe2: support SFP module info and EEPROM access net/sxe2: add mbuf validation in Tx debug mode common/sxe2: add callback for memory event handling net/sxe2: add private devargs parsing net/sxe2: implement private dump info net/sxe2: update sxe2 feature matrix docsdoc/guides/nics/features/sxe2.ini | 56 + doc/guides/nics/sxe2.rst | 168 ++ drivers/common/sxe2/sxe2_common.c | 156 ++ drivers/common/sxe2/sxe2_common.h | 4 + drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++ drivers/common/sxe2/sxe2_ioctl_chnl.c | 178 +- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/common/sxe2/sxe2_msg.h | 118 ++ drivers/net/sxe2/meson.build | 52 + drivers/net/sxe2/sxe2_cmd_chnl.c | 1587 +++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 139 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 523 +++++- drivers/net/sxe2/sxe2_dump.c | 287 +++ drivers/net/sxe2/sxe2_dump.h | 12 + drivers/net/sxe2/sxe2_ethdev.c | 1486 ++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 111 +- drivers/net/sxe2/sxe2_ethdev_repr.c | 609 ++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 895 +++++++++ drivers/net/sxe2/sxe2_filter.h | 100 + drivers/net/sxe2/sxe2_flow.c | 1394 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 30 + drivers/net/sxe2/sxe2_flow_define.h | 144 ++ drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1935 +++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 46 + drivers/net/sxe2/sxe2_ipsec.c | 1565 ++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++ drivers/net/sxe2/sxe2_irq.c | 1026 ++++++++++ drivers/net/sxe2/sxe2_irq.h | 25 + drivers/net/sxe2/sxe2_mac.c | 530 ++++++ drivers/net/sxe2/sxe2_mac.h | 84 + drivers/net/sxe2/sxe2_mp.c | 414 +++++ drivers/net/sxe2/sxe2_mp.h | 67 + drivers/net/sxe2/sxe2_queue.c | 17 +- drivers/net/sxe2/sxe2_queue.h | 15 +- drivers/net/sxe2/sxe2_rss.c | 584 ++++++ drivers/net/sxe2/sxe2_rss.h | 81 + drivers/net/sxe2/sxe2_rx.c | 93 +- drivers/net/sxe2/sxe2_rx.h | 2 + drivers/net/sxe2/sxe2_security.c | 335 ++++ drivers/net/sxe2/sxe2_security.h | 77 + drivers/net/sxe2/sxe2_stats.c | 586 ++++++ drivers/net/sxe2/sxe2_stats.h | 39 + drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 + drivers/net/sxe2/sxe2_tx.c | 7 + drivers/net/sxe2/sxe2_txrx.c | 1958 +++++++++++++++++++- drivers/net/sxe2/sxe2_txrx.h | 8 + drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 + drivers/net/sxe2/sxe2_txrx_poll.c | 284 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 38 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++ drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 +++++++++ drivers/net/sxe2/sxe2_txrx_vec_common.h | 54 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 +++++++ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 38 +- drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- drivers/net/sxe2/sxe2vf_regs.h | 85 + 67 files changed, 24762 insertions(+), 273 deletions(-) create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/common/sxe2/sxe2_msg.h create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h
Quoted 8 lines
create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
Overall this is close, I don't think the flow duplicate flag you added matches mlx5 as close as you think. Adding a new variant makes sense, but try to keep original values matching other driver. My intent here is to have drivers diverge as little as possible; it makes it simpler for real world applications.
The AI chat review showed:
[PATCH v8 00/23] sxe2 driver feature additions
The v6 issues are resolved cleanly, except the flow-duplicate-pattern alignment didn't go in the direction your "align with mlx5" guidance intended.
Resolved from v6:
- The mbox is now in correct numeric order (06 before 07). git am bundle.mbox applies cleanly. The v6 bundle-order break is gone.
- All 23 commits build end-to-end at every commit. The dump-info patch was moved from position 19 to 22 - it now runs after devargs parsing, which makes its references to devargs fields consistent. sxe2_dump_fc_state() also correctly moved out of the devargs patch into the dump-info patch where it belongs.
- The v6 flow_dup_pattern_mode orphan situation is fixed. The field is now actually written by the new sxe2_parse_flow_dup_pattern_mode() parser, properly defaulted to SXE2_FLOW_SW_PATTERN_LAST in init, and read at sxe2_flow.c:310 to populate switch_pattern_dup_allow in flow metadata. The struct field, its writer, its reader, and its hardware- programming path are all consistent now.
- sxe2_parse_no_sched_mode was simplified to call the existing sxe2_parse_bool helper instead of duplicating strtoul boilerplate. Nice cleanup.
The flow-duplicate-pattern semantics:
This is the v8 redesign in response to "align to mlx5". What it does:
doc/guides/nics/sxe2.rst, the option:
0 = reject duplicates with EEXIST
1 = allow; last-added rule active (LIFO) <-- default
2 = allow; first-added rule active (FIFO)
mlx5's equivalent allow_duplicate_pattern is a {0,1} boolean. Its value=1 means "all rules are inserted but only the first rule takes effect, the next rule takes effect only if the previous rules are deleted." That is FIFO. So:
mlx5 allow_duplicate_pattern=0 == sxe2 flow-duplicate-pattern=0 mlx5 allow_duplicate_pattern=1 == sxe2 flow-duplicate-pattern=2 (FIFO) (no mlx5 equivalent) == sxe2 flow-duplicate-pattern=1 (LIFO)
This is the worst possible alignment: sxe2 picked the same value range {0,1} mlx5 has, picked the same name root, picked similar documentation wording, and made the same value 1 mean the opposite hardware behaviour. A user who runs the same -a 0000:xx:xx.x,flow-duplicate-pattern=1 on both PMDs gets FIFO on mlx5 and LIFO on sxe2 - inverted semantics under identical names.
If the hardware genuinely supports both LIFO and FIFO and exposing both is valuable, then naming and defaults should not visually parallel mlx5. Suggested resolutions, in order of preference:
(a) Drop LIFO. Document and implement only the two modes mlx5 has:
0 = reject, 1 = FIFO (mlx5's value=1 semantic). Default 1. The name allow_duplicate_pattern (mlx5's spelling) becomes valid - same parameter, same values, same defaults across PMDs.
(b) Keep both modes, but rename to make the meaning explicit and non-overlapping with mlx5:
flow-duplicate-policy=reject|fifo|lifo (string-valued)
with reject as default. mlx5 keeps its short boolean; sxe2 has its own tri-state with non-aliasing values. This is clear but slightly more typing for users.
(c) Keep current name and values but make value=1 mean FIFO (matching mlx5) and value=2 mean LIFO. The name's spelling still differs from mlx5's, but at least the integer-to-semantic mapping matches.
Personal preference is (a). The LIFO mode is unusual enough that I would want to see a concrete use case before accepting it into a public devarg. If the hardware queues rules in an order applications can observe, that ordering is an rte_flow priority concern; the devarg layer shouldn't be encoding it.
A separate small issue in the error-message ternary - sxe2_flow.c:809 prints "Duplicate flow pattern." when mode is non-zero and "Duplicate flow pattern is not allowed." when mode is zero. But the EEXIST error path should only fire when the policy is to reject, which is exactly mode 0. In modes 1 and 2, the hardware accepts the duplicate as a shadow/active rule; this error path should be unreachable. Either the ternary's first branch is dead code (in which case remove it and the ternary; print only the rejection message), or the rejection can happen in modes 1/2 too (in which case the message must explain why - table full, action conflict, etc - and the current wording is wrong in both branches).
Otherwise this revision is in good shape. Once flow-duplicate-pattern alignment lands one way or another, ready to merge.
Re: Re: [PATCH v8 00/23] net/sxe2: added Linkdata sxe2 ethernet driver
Hi,
Thanks for the detailed review and valuable suggestions.
The reason I introduced both FIFO and LIFO modes is that different hardware vendors implement different native behaviors for duplicate flow rules with the same priority. Some devices keep the first inserted rule active, while others make the most recently inserted rule active. The intention of exposing both modes is to preserve the underlying hardware semantics instead of forcing all devices into a single policy. I agree with your point that, if the interface is intended to align with mlx5, the mapping between parameter values and their semantics should also be consistent. Using the same value with opposite behavior across PMDs would indeed be confusing for users.
Therefore, I think your option (c) is a reasonable compromise:
0 = reject duplicates
1 = FIFO (matching mlx5 semantics)
2 = LIFO
This keeps the common case compatible with mlx5 while still allowing hardware with native LIFO behavior to expose its capability.
Regarding the error message, I also agree that the current ternary expression is unnecessary if EEXIST is only returned in reject mode. I'll simplify the error handling accordingly in the next revision.
Thanks again for your review.
Best regards,
Liu Jie
From: Stephen Hemminger
Date: 2026-06-26 06:50
To: liujie5
CC: dev
Subject: Re: [PATCH v8 00/23] net/sxe2: added Linkdata sxe2 ethernet driver
Quoted 134 lines · On Thu, 25 Jun 2026 21:19:36 +0800 [email protected] wrote:
From: Jie Liu <[email protected]>
This patch set implements core functionality for the SXE2 PMD, including basic driver framework, data path setup, and advanced offload features (VLAN, RSS,TM, PTP etc.).
v8:
Restore the flow-duplicate-pattern parameterJie Liu (23):
net/sxe2: remove software statistics devargs net/sxe2: add Rx framework and packet types callback net/sxe2: support AVX512 vectorized path for Rx and Tx net/sxe2: add AVX2 vector data path for Rx and Tx net/sxe2: add link update callback
net/sxe2: support L2 filtering and MAC config
drivers: support RSS feature
net/sxe2: support TM hierarchy and shaping net/sxe2: support IPsec inline protocol offload net/sxe2: support statistics and multi-process
drivers: interrupt handling
net/sxe2: add NEON vec Rx/Tx burst functions
drivers: add support for VF representors net/sxe2: add support for custom UDP tunnel ports net/sxe2: support firmware version reading net/sxe2: implement get monitor address common/sxe2: add shared SFP module definitions net/sxe2: support SFP module info and EEPROM access net/sxe2: add mbuf validation in Tx debug mode common/sxe2: add callback for memory event handling net/sxe2: add private devargs parsing net/sxe2: implement private dump info net/sxe2: update sxe2 feature matrix docsdoc/guides/nics/features/sxe2.ini | 56 + doc/guides/nics/sxe2.rst | 168 ++ drivers/common/sxe2/sxe2_common.c | 156 ++ drivers/common/sxe2/sxe2_common.h | 4 + drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++ drivers/common/sxe2/sxe2_ioctl_chnl.c | 178 +- drivers/common/sxe2/sxe2_ioctl_chnl_func.h | 18 + drivers/common/sxe2/sxe2_msg.h | 118 ++ drivers/net/sxe2/meson.build | 52 + drivers/net/sxe2/sxe2_cmd_chnl.c | 1587 +++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 139 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 523 +++++- drivers/net/sxe2/sxe2_dump.c | 287 +++ drivers/net/sxe2/sxe2_dump.h | 12 + drivers/net/sxe2/sxe2_ethdev.c | 1486 ++++++++++++++- drivers/net/sxe2/sxe2_ethdev.h | 111 +- drivers/net/sxe2/sxe2_ethdev_repr.c | 609 ++++++ drivers/net/sxe2/sxe2_ethdev_repr.h | 32 + drivers/net/sxe2/sxe2_filter.c | 895 +++++++++ drivers/net/sxe2/sxe2_filter.h | 100 + drivers/net/sxe2/sxe2_flow.c | 1394 ++++++++++++++ drivers/net/sxe2/sxe2_flow.h | 30 + drivers/net/sxe2/sxe2_flow_define.h | 144 ++ drivers/net/sxe2/sxe2_flow_parse_action.c | 1182 ++++++++++++ drivers/net/sxe2/sxe2_flow_parse_action.h | 23 + drivers/net/sxe2/sxe2_flow_parse_engine.c | 106 ++ drivers/net/sxe2/sxe2_flow_parse_engine.h | 13 + drivers/net/sxe2/sxe2_flow_parse_pattern.c | 1935 +++++++++++++++++++ drivers/net/sxe2/sxe2_flow_parse_pattern.h | 46 + drivers/net/sxe2/sxe2_ipsec.c | 1565 ++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++ drivers/net/sxe2/sxe2_irq.c | 1026 ++++++++++ drivers/net/sxe2/sxe2_irq.h | 25 + drivers/net/sxe2/sxe2_mac.c | 530 ++++++ drivers/net/sxe2/sxe2_mac.h | 84 + drivers/net/sxe2/sxe2_mp.c | 414 +++++ drivers/net/sxe2/sxe2_mp.h | 67 + drivers/net/sxe2/sxe2_queue.c | 17 +- drivers/net/sxe2/sxe2_queue.h | 15 +- drivers/net/sxe2/sxe2_rss.c | 584 ++++++ drivers/net/sxe2/sxe2_rss.h | 81 + drivers/net/sxe2/sxe2_rx.c | 93 +- drivers/net/sxe2/sxe2_rx.h | 2 + drivers/net/sxe2/sxe2_security.c | 335 ++++ drivers/net/sxe2/sxe2_security.h | 77 + drivers/net/sxe2/sxe2_stats.c | 586 ++++++ drivers/net/sxe2/sxe2_stats.h | 39 + drivers/net/sxe2/sxe2_switchdev.c | 332 ++++ drivers/net/sxe2/sxe2_switchdev.h | 33 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 + drivers/net/sxe2/sxe2_tx.c | 7 + drivers/net/sxe2/sxe2_txrx.c | 1958 +++++++++++++++++++- drivers/net/sxe2/sxe2_txrx.h | 8 + drivers/net/sxe2/sxe2_txrx_check_mbuf.c | 595 ++++++ drivers/net/sxe2/sxe2_txrx_check_mbuf.h | 38 + drivers/net/sxe2/sxe2_txrx_poll.c | 284 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 38 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++ drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 +++++++++ drivers/net/sxe2/sxe2_txrx_vec_common.h | 54 +- drivers/net/sxe2/sxe2_txrx_vec_neon.c | 689 +++++++ drivers/net/sxe2/sxe2_txrx_vec_sse.c | 38 +- drivers/net/sxe2/sxe2_vsi.c | 146 ++ drivers/net/sxe2/sxe2_vsi.h | 12 +- drivers/net/sxe2/sxe2vf_regs.h | 85 + 67 files changed, 24762 insertions(+), 273 deletions(-) create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/common/sxe2/sxe2_msg.h create mode 100644 drivers/net/sxe2/sxe2_dump.c create mode 100644 drivers/net/sxe2/sxe2_dump.h create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.c create mode 100644 drivers/net/sxe2/sxe2_ethdev_repr.h create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h create mode 100644 drivers/net/sxe2/sxe2_flow.c create mode 100644 drivers/net/sxe2/sxe2_flow.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_action.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_engine.h create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.c create mode 100644 drivers/net/sxe2/sxe2_flow_parse_pattern.h create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_irq.c create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h create mode 100644 drivers/net/sxe2/sxe2_switchdev.c create mode 100644 drivers/net/sxe2/sxe2_switchdev.h
Quoted 8 lines
create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.c create mode 100644 drivers/net/sxe2/sxe2_txrx_check_mbuf.h create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_neon.c create mode 100644 drivers/net/sxe2/sxe2vf_regs.h
Overall this is close, I don't think the flow duplicate flag you added matches mlx5 as close as you think. Adding a new variant makes sense, but try to keep original values matching other driver. My intent here is to have drivers diverge as little as possible; it makes it simpler for real world applications.
The AI chat review showed:
[PATCH v8 00/23] sxe2 driver feature additions
The v6 issues are resolved cleanly, except the flow-duplicate-pattern alignment didn't go in the direction your "align with mlx5" guidance intended.
Resolved from v6:
- The mbox is now in correct numeric order (06 before 07). git am bundle.mbox applies cleanly. The v6 bundle-order break is gone.
- All 23 commits build end-to-end at every commit. The dump-info patch was moved from position 19 to 22 - it now runs after devargs parsing, which makes its references to devargs fields consistent. sxe2_dump_fc_state() also correctly moved out of the devargs patch into the dump-info patch where it belongs.
- The v6 flow_dup_pattern_mode orphan situation is fixed. The field is now actually written by the new sxe2_parse_flow_dup_pattern_mode() parser, properly defaulted to SXE2_FLOW_SW_PATTERN_LAST in init, and read at sxe2_flow.c:310 to populate switch_pattern_dup_allow in flow metadata. The struct field, its writer, its reader, and its hardware- programming path are all consistent now.
- sxe2_parse_no_sched_mode was simplified to call the existing sxe2_parse_bool helper instead of duplicating strtoul boilerplate. Nice cleanup.
The flow-duplicate-pattern semantics:
This is the v8 redesign in response to "align to mlx5". What it does:
doc/guides/nics/sxe2.rst, the option:
0 = reject duplicates with EEXIST
1 = allow; last-added rule active (LIFO) <-- default
2 = allow; first-added rule active (FIFO)
mlx5's equivalent allow_duplicate_pattern is a {0,1} boolean. Its value=1 means "all rules are inserted but only the first rule takes effect, the next rule takes effect only if the previous rules are deleted." That is FIFO. So:
mlx5 allow_duplicate_pattern=0 == sxe2 flow-duplicate-pattern=0 mlx5 allow_duplicate_pattern=1 == sxe2 flow-duplicate-pattern=2 (FIFO) (no mlx5 equivalent) == sxe2 flow-duplicate-pattern=1 (LIFO)
This is the worst possible alignment: sxe2 picked the same value range {0,1} mlx5 has, picked the same name root, picked similar documentation wording, and made the same value 1 mean the opposite hardware behaviour. A user who runs the same -a 0000:xx:xx.x,flow-duplicate-pattern=1 on both PMDs gets FIFO on mlx5 and LIFO on sxe2 - inverted semantics under identical names.
If the hardware genuinely supports both LIFO and FIFO and exposing both is valuable, then naming and defaults should not visually parallel mlx5. Suggested resolutions, in order of preference:
(a) Drop LIFO. Document and implement only the two modes mlx5 has:
0 = reject, 1 = FIFO (mlx5's value=1 semantic). Default 1. The name allow_duplicate_pattern (mlx5's spelling) becomes valid - same parameter, same values, same defaults across PMDs.
(b) Keep both modes, but rename to make the meaning explicit and non-overlapping with mlx5:
flow-duplicate-policy=reject|fifo|lifo (string-valued)
with reject as default. mlx5 keeps its short boolean; sxe2 has its own tri-state with non-aliasing values. This is clear but slightly more typing for users.
(c) Keep current name and values but make value=1 mean FIFO (matching mlx5) and value=2 mean LIFO. The name's spelling still differs from mlx5's, but at least the integer-to-semantic mapping matches.
Personal preference is (a). The LIFO mode is unusual enough that I would want to see a concrete use case before accepting it into a public devarg. If the hardware queues rules in an order applications can observe, that ordering is an rte_flow priority concern; the devarg layer shouldn't be encoding it.
A separate small issue in the error-message ternary - sxe2_flow.c:809 prints "Duplicate flow pattern." when mode is non-zero and "Duplicate flow pattern is not allowed." when mode is zero. But the EEXIST error path should only fire when the policy is to reject, which is exactly mode 0. In modes 1 and 2, the hardware accepts the duplicate as a shadow/active rule; this error path should be unreachable. Either the ternary's first branch is dead code (in which case remove it and the ternary; print only the rejection message), or the rejection can happen in modes 1/2 too (in which case the message must explain why - table full, action conflict, etc - and the current wording is wrong in both branches).
Otherwise this revision is in good shape. Once flow-duplicate-pattern alignment lands one way or another, ready to merge.
PATCH v8 1/23 net/sxe2: remove software statistics devargs
In reply to [email protected]From: Jie Liu <[email protected]>
Remove the optional drv-sw-stats device argument and make software statistics always-on. Per-queue software statistics are point-in-time measurements used for accumulation at queue stop/dump, so atomic operations with rte_memory_order_relaxed add unnecessary overhead without correctness benefit.
Also rename high_performance_mode field to no_sched_mode to match the devargs string definition.
Changes:
- Remove sw_stats_en field from struct sxe2_devargs
- Remove RTE_ATOMIC qualifiers from sxe2_rxq_sw_stats fields
- Replace rte_atomic_fetch_add_explicit(relaxed) with plain addition
- Replace rte_atomic_store/load_explicit(relaxed) with plain assignment
- Remove sw_stats_en conditional checks in Rx fast path
- Always pass umbcast_flags to vec Rx functions
- Remove unused #include <rte_stdatomic.h>
- Rename high_performance_mode → no_sched_mode in devargs struct
- Fix int → int32_t for return type in sxe2_parse_eth_devargs
--- drivers/net/sxe2/sxe2_ethdev.c | 2 +- drivers/net/sxe2/sxe2_ethdev.h | 3 +- drivers/net/sxe2/sxe2_queue.h | 15 ++++--- drivers/net/sxe2/sxe2_rx.c | 55 +++++++------------------ drivers/net/sxe2/sxe2_txrx_poll.c | 38 ++++++----------- drivers/net/sxe2/sxe2_txrx_vec_common.h | 52 ++++++++++------------- drivers/net/sxe2/sxe2_txrx_vec_sse.c | 29 +------------ 7 files changed, 61 insertions(+), 133 deletions(-)
drivers/net/sxe2/sxe2_ethdev.c +1 -1
@@ -891,7 +891,7 @@ static int32_t sxe2_eth_pmd_probe_pf(struct sxe2_common_device *cdev,static int32_t sxe2_parse_eth_devargs (struct rte_device *dev,struct rte_eth_devargs *eth_da) { -int ret =0 ; +int32_t ret =0 ;if (dev->devargs ==NULL )return 0 ;
drivers/net/sxe2/sxe2_ethdev.h +1 -2
@@ -130,9 +130,8 @@ struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;uint8_t fnav_stat_type; -uint8_t high_performance_mode; +uint8_t no_sched_mode;uint8_t sched_layer_mode; -uint8_t sw_stats_en;uint8_t rx_low_latency; };
drivers/net/sxe2/sxe2_queue.h +7 -8
@@ -7,7 +7,6 @@#include <rte_ethdev.h> #include <rte_io.h> -#include <rte_stdatomic.h> #include <ethdev_driver.h> #include "sxe2_drv_cmd.h"
@@ -123,13 +122,13 @@ struct sxe2_rxq_stats { };struct sxe2_rxq_sw_stats { -RTE_ATOMIC (uint64_t )pkts; -RTE_ATOMIC (uint64_t )bytes; -RTE_ATOMIC (uint64_t )drop_pkts; -RTE_ATOMIC (uint64_t )drop_bytes; -RTE_ATOMIC (uint64_t )unicast_pkts; -RTE_ATOMIC (uint64_t )multicast_pkts; -RTE_ATOMIC (uint64_t )broadcast_pkts; +uint64_t pkts; +uint64_t bytes; +uint64_t drop_pkts; +uint64_t drop_bytes; +uint64_t unicast_pkts; +uint64_t multicast_pkts; +uint64_t broadcast_pkts; };struct sxe2_rx_queue {
drivers/net/sxe2/sxe2_rx.c +16 -39
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_poll.c +13 -25
@@ -682,23 +682,17 @@ sxe2_rx_sw_stats_update(struct sxe2_rx_queue *rxq, struct rte_mbuf *mbuf, union sxe2_rx_desc *rxd) {uint64_t qword1 =rte_le_to_cpu_64 (rxd->wb.status_err_ptype_len); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.pkts,1 , - rte_memory_order_relaxed); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.bytes, - mbuf->pkt_len +RTE_ETHER_CRC_LEN , - rte_memory_order_relaxed); + rxq->sw_stats.pkts +=1 ; + rxq->sw_stats.bytes += mbuf->pkt_len +RTE_ETHER_CRC_LEN ;switch (SXE2_RX_DESC_STATUS_UMBCAST_VAL_GET (qword1)) {case SXE2_RX_DESC_STATUS_UNICAST : -rte_atomic_fetch_add_explicit (&rxq->sw_stats.unicast_pkts,1 , - rte_memory_order_relaxed); + rxq->sw_stats.unicast_pkts +=1 ;break ;case SXE2_RX_DESC_STATUS_MULTICAST : -rte_atomic_fetch_add_explicit (&rxq->sw_stats.multicast_pkts,1 , - rte_memory_order_relaxed); + rxq->sw_stats.multicast_pkts +=1 ;break ;case SXE2_RX_DESC_STATUS_BROADCAST : -rte_atomic_fetch_add_explicit (&rxq->sw_stats.broadcast_pkts,1 , - rte_memory_order_relaxed); + rxq->sw_stats.broadcast_pkts +=1 ;break ;default :break ;
@@ -787,11 +781,9 @@ uint16_t sxe2_rx_pkts_scattered(void *rx_queue, struct rte_mbuf **rx_pkts, uint1if (unlikely (qword1 &SXE2_RX_DESC_ERROR_RXE_MASK ) ||unlikely (qword1 &SXE2_RX_DESC_ERROR_OVERSIZE_MASK )) { -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_pkts,1 , - rte_memory_order_relaxed); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_bytes, - first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN , - rte_memory_order_relaxed); + rxq->sw_stats.drop_pkts +=1 ; + rxq->sw_stats.drop_bytes += + first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN ;rte_pktmbuf_free (first_seg); first_seg =NULL ;continue ;
@@ -822,8 +814,7 @@ uint16_t sxe2_rx_pkts_scattered(void *rx_queue, struct rte_mbuf **rx_pkts, uint1sxe2_rx_mbuf_common_fields_fill (rxq, first_seg, &desc_tmp); -if (rxq->vsi->adapter->devargs.sw_stats_en) -sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp); +sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp);rte_prefetch0 (RTE_PTR_ADD (first_seg->buf_addr, first_seg->data_off));
@@ -990,11 +981,9 @@ uint16_t sxe2_rx_pkts_scattered_split(void *rx_queue, struct rte_mbuf **rx_pkts,if (unlikely (qword1 &SXE2_RX_DESC_ERROR_RXE_MASK ) ||unlikely (qword1 &SXE2_RX_DESC_ERROR_OVERSIZE_MASK )) { -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_pkts,1 , - rte_memory_order_relaxed); -rte_atomic_fetch_add_explicit (&rxq->sw_stats.drop_bytes, - first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN , - rte_memory_order_relaxed); + rxq->sw_stats.drop_pkts +=1 ; + rxq->sw_stats.drop_bytes += + first_seg->pkt_len - rxq->crc_len +RTE_ETHER_CRC_LEN ;rte_pktmbuf_free (first_seg); first_seg =NULL ;continue ;
@@ -1023,8 +1012,7 @@ uint16_t sxe2_rx_pkts_scattered_split(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->port = rxq->port_id;sxe2_rx_mbuf_common_fields_fill (rxq, first_seg, &desc_tmp); -if (rxq->vsi->adapter->devargs.sw_stats_en) -sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp); +sxe2_rx_sw_stats_update (rxq, first_seg, &desc_tmp);rte_prefetch0 (RTE_PTR_ADD (first_seg->buf_addr, first_seg->data_off));
drivers/net/sxe2/sxe2_txrx_vec_common.h +21 -31
70 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec_sse.c +2 -27
@@ -483,41 +483,16 @@ static __rte_always_inline uint16_t sxe2_rx_pkts_scattered_batch_vec_sse(struct sxe2_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - const uint64_t *split_rxe_flags64; uint8_t split_rxe_flags[SXE2_RX_PKTS_BURST_BATCH_NUM_VEC] = {0};uint8_t umbcast_flags[SXE2_RX_PKTS_BURST_BATCH_NUM_VEC ] = {0 };uint16_t rx_done_num;uint16_t rx_pkt_done_num; rx_pkt_done_num =0 ; -if (rxq->vsi->adapter->devargs.sw_stats_en) { - rx_done_num =sxe2_rx_pkts_common_vec_sse (rxq, rx_pkts, - nb_pkts, split_rxe_flags, umbcast_flags); - }else { - rx_done_num =sxe2_rx_pkts_common_vec_sse (rxq, rx_pkts, - nb_pkts, split_rxe_flags,NULL ); - } + rx_done_num =sxe2_rx_pkts_common_vec_sse (rxq, rx_pkts, + nb_pkts, split_rxe_flags, umbcast_flags);if (rx_done_num ==0 ) goto l_end; -if (!rxq->vsi->adapter->devargs.sw_stats_en) { - split_rxe_flags64 = (uint64_t *)split_rxe_flags; -if (rxq->pkt_first_seg ==NULL && - split_rxe_flags64[0 ] ==0 && - split_rxe_flags64[1 ] ==0 && - split_rxe_flags64[2 ] ==0 && - split_rxe_flags64[3 ] ==0 ) { - rx_pkt_done_num = rx_done_num; - goto l_end; - } -if (rxq->pkt_first_seg ==NULL ) { -while (rx_pkt_done_num < rx_done_num && - split_rxe_flags[rx_pkt_done_num] ==0 ) - rx_pkt_done_num++; -if (rx_pkt_done_num == rx_done_num) - goto l_end; - rxq->pkt_first_seg = rx_pkts[rx_pkt_done_num]; - } - } rx_pkt_done_num +=sxe2_rx_pkts_refactor (rxq, &rx_pkts[rx_pkt_done_num], rx_done_num - rx_pkt_done_num, &split_rxe_flags[rx_pkt_done_num], &umbcast_flags[rx_pkt_done_num]);
Signature · 1 line
2.52.0
PATCH v8 2/23 net/sxe2: add Rx framework and packet types callback
In reply to [email protected]From: Jie Liu <[email protected]>
Implement dev_supported_ptypes_get ethdev callback for sxe2 PMD. This allows applications to query the packet types the driver is capable of identifying, such as L2, L3 (IPv4/IPv6), and L4 (TCP/UDP/SCTP) layers.
--- drivers/net/sxe2/sxe2_ethdev.h | 1 - drivers/net/sxe2/sxe2_txrx.c | 1782 +++++++++++++++++++++++ drivers/net/sxe2/sxe2_txrx.h | 5 + drivers/net/sxe2/sxe2_txrx_poll.c | 3 +- drivers/net/sxe2/sxe2_txrx_vec_common.h | 1 + drivers/net/sxe2/sxe2_txrx_vec_sse.c | 9 +- 6 files changed, 1793 insertions(+), 8 deletions(-)
drivers/net/sxe2/sxe2_ethdev.h +0 -1
@@ -279,7 +279,6 @@ struct sxe2_adapter {uint16_t dev_port_id;uint64_t cap_flags;enum sxe2_dev_type dev_type; -uint32_t ptype_tbl[SXE2_MAX_PTYPE_NUM ];struct rte_ether_addr mac_addr;uint8_t port_idx;uint8_t pf_idx;
drivers/net/sxe2/sxe2_txrx.c +1782 -0
1,785 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx.h +5 -0
@@ -23,4 +23,9 @@ int32_t sxe2_tx_burst_mode_get(struct rte_eth_dev *dev,int32_t sxe2_rx_burst_mode_get (struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode); +extern const uint32_t sxe2_ptype_tbl[]; + +const uint32_t *sxe2_dev_supported_ptypes_get (struct rte_eth_dev *dev, +size_t *no_of_elements); +#endif /* SXE2_TXRX_H */
drivers/net/sxe2/sxe2_txrx_poll.c +1 -2
@@ -664,13 +664,12 @@ static __rte_always_inline void sxe2_rx_mbuf_common_fields_fill(struct sxe2_rx_queue *rxq, struct rte_mbuf *mbuf, union sxe2_rx_desc *rxd) { - uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; uint64_t qword1;uint64_t pkt_flags; qword1 =rte_le_to_cpu_64 (rxd->wb.status_err_ptype_len); mbuf->ol_flags =0 ; - mbuf->packet_type = ptype_tbl[SXE2_RX_DESC_PTYPE_VAL_GET (qword1)]; + mbuf->packet_type = sxe2_ptype_tbl[SXE2_RX_DESC_PTYPE_VAL_GET (qword1)]; pkt_flags =sxe2_rx_desc_error_para (rxq, rxd);
drivers/net/sxe2/sxe2_txrx_vec_common.h +1 -0
@@ -12,6 +12,7 @@#include "sxe2_rx.h" #include "sxe2_queue.h" #include "sxe2_tx.h" +#include "sxe2_txrx.h" #include "sxe2_vsi.h" #include "sxe2_ethdev.h" #define SXE2_RX_NUM_PER_LOOP_SSE 4
drivers/net/sxe2/sxe2_txrx_vec_sse.c +4 -5
@@ -338,7 +338,6 @@ sxe2_rx_pkts_common_vec_sse(struct sxe2_rx_queue *rxq,uint32_t i;uint32_t bit_num;uint16_t done_num =0 ; -const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;const __m128i crc_adjust = _mm_set_epi16(0, 0, 0, -rxq->crc_len,
@@ -461,10 +460,10 @@ sxe2_rx_pkts_common_vec_sse(struct sxe2_rx_queue *rxq, mbuf_arr[1]);_mm_storeu_si128 ((void *)&rx_pkts[i]->rx_descriptor_fields1, mbuf_arr[0 ]); - rx_pkts[i +3 ]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,3 )]; - rx_pkts[i +2 ]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,7 )]; - rx_pkts[i +1 ]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,1 )]; - rx_pkts[i]->packet_type = ptype_tbl[_mm_extract_epi16 (ptype_all,5 )]; + rx_pkts[i +3 ]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,3 )]; + rx_pkts[i +2 ]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,7 )]; + rx_pkts[i +1 ]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,1 )]; + rx_pkts[i]->packet_type = sxe2_ptype_tbl[_mm_extract_epi16 (ptype_all,5 )]; bit_num =rte_popcount64 (_mm_cvtsi128_si64 (staterr)); done_num += bit_num;if (likely (bit_num !=SXE2_RX_NUM_PER_LOOP_SSE ))
Signature · 1 line
2.52.0
PATCH v8 3/23 net/sxe2: support AVX512 vectorized path for Rx and Tx
In reply to [email protected]From: Jie Liu <[email protected]>
Add AVX512 vector data path for Rx and Tx burst functions. The decision to use AVX512 is based on:
1. CPU hardware flags (AVX512F, AVX512BW).
2. Compiler support (CC_AVX512_SUPPORT).
3. Max SIMD bitwidth configuration.
--- drivers/net/sxe2/meson.build | 24 + drivers/net/sxe2/sxe2_drv_cmd.h | 80 +-- drivers/net/sxe2/sxe2_txrx.c | 92 ++- drivers/net/sxe2/sxe2_txrx_vec.c | 46 +- drivers/net/sxe2/sxe2_txrx_vec.h | 18 +- drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 867 ++++++++++++++++++++++++ 6 files changed, 1068 insertions(+), 59 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx512.c
drivers/net/sxe2/meson.build +24 -0
@@ -15,6 +15,30 @@ includes += include_directories('../../common/sxe2') if arch_subdir == 'x86' sources += files('sxe2_txrx_vec_sse.c') + + sxe2_avx512_cpu_support =( + cc.get_define('__AVX512F__', args: machine_args) != '' and + cc.get_define('__AVX512BW__', args: machine_args) != '') + + sxe2_avx512_cc_support = ( + not machine_args.contains('-mno-avx512f') and + cc.has_argument('-mavx512f') and + cc.has_argument('-mavx512bw')) + + if sxe2_avx512_cpu_support == true or sxe2_avx512_cc_support == true + cflags += ['-DCC_AVX512_SUPPORT'] + avx512_args = [cflags, '-mavx512f', '-mavx512bw'] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + endif + sxe2_avx512_lib = static_library('sxe2_avx512_lib', 'sxe2_txrx_vec_avx512.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_hash, + static_rte_security, static_rte_cryptodev, static_rte_bus_pci], + include_directories: includes, + c_args: avx512_args) + objs += sxe2_avx512_lib.extract_objects('sxe2_txrx_vec_avx512.c') + endif endif sources += files(
drivers/net/sxe2/sxe2_drv_cmd.h +40 -40
189 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx.c +79 -13
139 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec.c +42 -4
58 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx_vec.h +16 -2
@@ -11,15 +11,19 @@#define SXE2_RX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_RX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ - SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE) + SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ + SXE2_RX_MODE_VEC_AVX512)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ - SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE) + SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ + SXE2_TX_MODE_VEC_AVX512)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -54,6 +58,16 @@ uint16_t sxe2_tx_pkts_vec_sse(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_uint16_t sxe2_tx_pkts_vec_sse_simple (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_sse_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx512_simple (void *tx_queue, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx512 (void *tx_queue, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx512_ctx_offload (void *tx_queue, +struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx512 (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts);#endif 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);
drivers/net/sxe2/sxe2_txrx_vec_avx512.c new file +867 -0
867 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v8 4/23 net/sxe2: add AVX2 vector data path for Rx and Tx
In reply to [email protected]From: Jie Liu <[email protected]>
Added AVX256 vectorized versions of Rx and Tx data path functions to improve packet processing performance.
The vector path uses AVX2 SIMD instructions to process multiple descriptors per loop, significantly reducing the per-packet overhead.
net/sxe2: support AVX512 vectorized path for Rx and Tx
--- drivers/net/sxe2/meson.build | 9 + drivers/net/sxe2/sxe2_txrx.c | 38 +- drivers/net/sxe2/sxe2_txrx_vec.h | 12 +- drivers/net/sxe2/sxe2_txrx_vec_avx2.c | 747 ++++++++++++++++++++++++++ 4 files changed, 801 insertions(+), 5 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_txrx_vec_avx2.c
drivers/net/sxe2/meson.build +9 -0
@@ -39,6 +39,15 @@ if arch_subdir == 'x86' c_args: avx512_args) objs += sxe2_avx512_lib.extract_objects('sxe2_txrx_vec_avx512.c') endif + sxe2_avx2_lib = static_library('sxe2_avx2_lib', + 'sxe2_txrx_vec_avx2.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_hash, + static_rte_security, static_rte_cryptodev, + static_rte_bus_pci], + include_directories: includes, + c_args: [cflags, '-mavx2']) + objs += sxe2_avx2_lib.extract_objects('sxe2_txrx_vec_avx2.c') endif sources += files(
drivers/net/sxe2/sxe2_txrx.c +35 -3
@@ -167,8 +167,14 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev)PMD_LOG_INFO (TX ,"AVX512 is not supported in build env." ); #endif } -if ((tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) ==0 ) - tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ; +if (((tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) ==0 ) && + ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ) || + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 )) && + (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 )) + tx_mode_flags |=SXE2_TX_MODE_VEC_AVX2 ; + +if ((0 == (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ))) + tx_mode_flags |=SXE2_TX_MODE_VEC_SSE ;#endif if (tx_mode_flags &SXE2_TX_MODE_VEC_SET_MASK ) { ret =sxe2_tx_queues_vec_prepare (dev);
@@ -197,6 +203,13 @@ void sxe2_tx_mode_func_set(struct rte_eth_dev *dev) dev->tx_pkt_burst = sxe2_tx_pkts_vec_avx512_simple; }#endif + }else if (tx_mode_flags &SXE2_TX_MODE_VEC_AVX2 ) { +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_avx2; + }else { + dev->tx_pkt_burst = sxe2_tx_pkts_vec_avx2_simple; + } }else {if (tx_mode_flags &SXE2_TX_MODE_VEC_OFFLOAD ) { dev->tx_pkt_prepare = sxe2_tx_pkts_prepare;
@@ -231,6 +244,10 @@ static const struct { { sxe2_tx_pkts_vec_avx512_simple, "Vector AVX512 Simple" }, #endif + { sxe2_tx_pkts_vec_avx2, + "Vector AVX2" }, + { sxe2_tx_pkts_vec_avx2_simple, + "Vector AVX2 Simple" }, { sxe2_tx_pkts_vec_sse, "Vector SSE" }, { sxe2_tx_pkts_vec_sse_simple,
@@ -330,7 +347,13 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev)PMD_LOG_INFO (RX ,"AVX512 support detected but not enabled" ); #endif } -if ((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 && +if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) && + ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ) || + (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 )) && + (rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 )) + rx_mode_flags |=SXE2_RX_MODE_VEC_AVX2 ; + +if (((rx_mode_flags &SXE2_RX_MODE_VEC_SET_MASK ) ==0 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) rx_mode_flags |=SXE2_RX_MODE_VEC_SSE ;#endif
@@ -354,6 +377,11 @@ void sxe2_rx_mode_func_set(struct rte_eth_dev *dev) else dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_avx512;#endif + }else if (rx_mode_flags &SXE2_RX_MODE_VEC_AVX2 ) { +if (rx_mode_flags &SXE2_RX_MODE_VEC_OFFLOAD ) + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_avx2_offload; +else + dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_avx2; }else { dev->rx_pkt_burst = sxe2_rx_pkts_scattered_vec_sse_offload; }
@@ -381,6 +409,10 @@ static const struct { { sxe2_rx_pkts_scattered_vec_avx512_offload, "Offload Vector AVX512 Scattered" }, #endif + { sxe2_rx_pkts_scattered_vec_avx2, + "Vector AVX2 Scattered" }, + { sxe2_rx_pkts_scattered_vec_avx2_offload, + "Offload Vector AVX2 Scattered" }, { sxe2_rx_pkts_scattered_vec_sse_offload, "Vector SSE Scattered" }, #endif
drivers/net/sxe2/sxe2_txrx_vec.h +10 -2
@@ -11,19 +11,21 @@#define SXE2_RX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_RX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_RX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_RX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_RX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_RX_MODE_BATCH_ALLOC RTE_BIT32(10)#define SXE2_RX_MODE_VEC_SET_MASK (SXE2_RX_MODE_VEC_SIMPLE | \ SXE2_RX_MODE_VEC_OFFLOAD | SXE2_RX_MODE_VEC_SSE | \ - SXE2_RX_MODE_VEC_AVX512) + SXE2_RX_MODE_VEC_AVX2 | SXE2_RX_MODE_VEC_AVX512)#define SXE2_TX_MODE_VEC_SIMPLE RTE_BIT32(0)#define SXE2_TX_MODE_VEC_OFFLOAD RTE_BIT32(1)#define SXE2_TX_MODE_VEC_SSE RTE_BIT32(2) +#define SXE2_TX_MODE_VEC_AVX2 RTE_BIT32(3)#define SXE2_TX_MODE_VEC_AVX512 RTE_BIT32(4)#define SXE2_TX_MODE_SIMPLE_BATCH RTE_BIT32(10)#define SXE2_TX_MODE_VEC_SET_MASK (SXE2_TX_MODE_VEC_SIMPLE | \ SXE2_TX_MODE_VEC_OFFLOAD | SXE2_TX_MODE_VEC_SSE | \ - SXE2_TX_MODE_VEC_AVX512) + SXE2_TX_MODE_VEC_AVX2 | SXE2_TX_MODE_VEC_AVX512)#define SXE2_TX_VEC_NO_SUPPORT_OFFLOAD ( \ RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
@@ -68,6 +70,12 @@ uint16_t sxe2_rx_pkts_scattered_vec_avx512(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);uint16_t sxe2_rx_pkts_scattered_vec_avx512_offload (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx2_simple (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_tx_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx2 (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t sxe2_rx_pkts_scattered_vec_avx2_offload (void *rx_queue, +struct rte_mbuf **rx_pkts,uint16_t nb_pkts);#endif 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);
drivers/net/sxe2/sxe2_txrx_vec_avx2.c new file +747 -0
747 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v8 5/23 net/sxe2: add link update callback
In reply to [email protected]From: Jie Liu <[email protected]>
Implement dev_link_update ethdev callback for sxe2 PMD. The driver reads the link status, speed, and duplex mode from the hardware registers and updates the ethdev link status using the appropriate atomic operations.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 22 +++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 2 + drivers/net/sxe2/sxe2_drv_cmd.h | 6 ++ drivers/net/sxe2/sxe2_ethdev.c | 158 +++++++++++++++++++++++++------ drivers/net/sxe2/sxe2_ethdev.h | 19 ++-- drivers/net/sxe2/sxe2_mac.c | 98 +++++++++++++++++++ drivers/net/sxe2/sxe2_mac.h | 50 ++++++++++ 8 files changed, 316 insertions(+), 40 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_mac.c create mode 100644 drivers/net/sxe2/sxe2_mac.h
drivers/net/sxe2/meson.build +1 -0
@@ -60,4 +60,5 @@ sources += files( 'sxe2_txrx_poll.c', 'sxe2_txrx.c', 'sxe2_txrx_vec.c', + 'sxe2_mac.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +22 -0
@@ -321,3 +321,25 @@ int32_t sxe2_drv_txq_switch(struct sxe2_adapter *adapter, struct sxe2_tx_queue *return ret; } + +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter) +{ +int32_t ret =0 ; +struct sxe2_common_device *cdev = adapter->cdev; +struct sxe2_drv_cmd_params param = {0 }; +struct sxe2_drv_link_info_resp resp = {0 }; + +sxe2_drv_cmd_params_fill (adapter, ¶m,SXE2_DRV_CMD_LINK_STATUS_GET , +NULL ,0 , + &resp,sizeof (resp)); + ret =sxe2_drv_cmd_exec (cdev, ¶m); +if (ret) { +PMD_DEV_LOG_ERR (adapter,DRV ,"link status get failed, ret=%d" , ret); + goto l_end; + } + adapter->link_ctxt.speed = resp.speed; + adapter->link_ctxt.link_up = resp.status; + +l_end: +return ret; +}
drivers/net/sxe2/sxe2_cmd_chnl.h +2 -0
@@ -34,4 +34,6 @@ int32_t sxe2_drv_txq_ctxt_cfg(struct sxe2_adapter *adapter,struct sxe2_tx_queue *txq, uint16_t txq_cnt); +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +6 -0
@@ -227,6 +227,12 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_drv_vsi_info_get_resp {struct sxe2_drv_msix_caps used_msix; } __rte_packed_end; +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; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +127 -31
213 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +10 -9
@@ -120,12 +120,6 @@ enum {SXE2_FLAGS_NBITS }; -struct sxe2_link_context { -rte_spinlock_t link_lock; -bool link_up; -uint32_t speed; -}; -struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;
@@ -266,6 +260,12 @@ struct sxe2_sched_hw_cap {uint8_t adj_lvl; }; +struct sxe2_link_context { +rte_spinlock_t link_lock; +bool link_up; +uint32_t speed; +}; +struct sxe2_adapter {struct sxe2_common_device *cdev;struct sxe2_dev_info dev_info;
@@ -275,9 +275,10 @@ struct sxe2_adapter {struct sxe2_irq_context irq_ctxt;struct sxe2_queue_context q_ctxt;struct sxe2_vsi_context vsi_ctxt; -struct sxe2_devargs devargs; -uint16_t dev_port_id; -uint64_t cap_flags; +struct sxe2_link_context link_ctxt; +struct sxe2_devargs devargs; +uint16_t dev_port_id; +uint64_t cap_flags;enum sxe2_dev_type dev_type;struct rte_ether_addr mac_addr;uint8_t port_idx;
drivers/net/sxe2/sxe2_mac.c new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe2/sxe2_mac.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v8 6/23 net/sxe2: support L2 filtering and MAC config
In reply to [email protected]From: Jie Liu <[email protected]>
- Support primary/secondary MAC address setup.
- Enable L2 broadcast/multicast filter bits.
- Add multicast address update logic.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 198 ++++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 17 + drivers/net/sxe2/sxe2_drv_cmd.h | 87 ++++ drivers/net/sxe2/sxe2_ethdev.c | 70 ++- drivers/net/sxe2/sxe2_ethdev.h | 43 +- drivers/net/sxe2/sxe2_filter.c | 782 ++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_filter.h | 98 ++++ drivers/net/sxe2/sxe2_mac.c | 432 +++++++++++++++++ drivers/net/sxe2/sxe2_mac.h | 34 ++ drivers/net/sxe2/sxe2_txrx_poll.c | 49 ++ 11 files changed, 1805 insertions(+), 6 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_filter.c create mode 100644 drivers/net/sxe2/sxe2_filter.h
drivers/net/sxe2/meson.build +1 -0
@@ -61,4 +61,5 @@ sources += files( 'sxe2_txrx.c', 'sxe2_txrx_vec.c', 'sxe2_mac.c', + 'sxe2_filter.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +198 -0
201 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +17 -0
@@ -36,4 +36,21 @@ int32_t sxe2_drv_txq_ctxt_cfg(struct sxe2_adapter *adapter,int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); +int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); + +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); + +int32_t sxe2_drv_mc_config (struct sxe2_adapter *adapter,struct rte_ether_addr *addr,bool add); + +int32_t sxe2_drv_vlan_config_query (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vlan_filter_id_config (struct sxe2_adapter *adapter, +struct sxe2_vlan *vlan,bool on); + +int32_t sxe2_drv_vlan_insert_strip_cfg (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vlan_filter_switch (struct sxe2_adapter *adapter,bool on); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +87 -0
93 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +68 -2
137 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +39 -4
75 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.c new file +782 -0
782 lines not on this page · raw message
drivers/net/sxe2/sxe2_filter.h new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe2/sxe2_mac.c +432 -0
438 lines not on this page · raw message
drivers/net/sxe2/sxe2_mac.h +34 -0
@@ -43,6 +43,40 @@ struct sxe2_mac_mc_list {int32_t sxe2_link_update_init (struct rte_eth_dev *dev); +int32_t sxe2_mac_default_cfg (struct rte_eth_dev *dev); + +int32_t sxe2_vlan_cfg_init (struct rte_eth_dev *dev); + +int32_t sxe2_mac_addr_init (struct rte_eth_dev *dev); + +void sxe2_mac_addr_uinit (struct rte_eth_dev *dev); + +int32_t sxe2_mac_addr_add (struct rte_eth_dev *dev, +struct rte_ether_addr *mac_addr, + __rte_unused uint32_t index, __rte_unused uint32_t pool); + +void sxe2_mac_addr_del (struct rte_eth_dev *dev,uint32_t index); + +int32_t sxe2_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); + +int32_t sxe2_set_mc_addr_list (struct rte_eth_dev *dev, +struct rte_ether_addr *mc_addrs, +uint32_t mc_addrs_num); + +int32_t sxe2_promisc_enable (struct rte_eth_dev *dev); + +int32_t sxe2_promisc_disable (struct rte_eth_dev *dev); + +int32_t sxe2_allmulti_enable (struct rte_eth_dev *dev); + +int32_t sxe2_allmulti_disable (struct rte_eth_dev *dev); + +int32_t sxe2_dev_vlan_filter_set (struct rte_eth_dev *dev,uint16_t vlan_id,int32_t on); + +int32_t sxe2_dev_vlan_offload_set (struct rte_eth_dev *dev,int32_t mask); + +int32_t sxe2_vlan_default_cfg (struct rte_eth_dev *dev); + int32_t sxe2_link_update(struct rte_eth_dev *dev, __rte_unused int32_t wait_to_complete);int32_t sxe2_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);
drivers/net/sxe2/sxe2_txrx_poll.c +49 -0
61 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v8 7/23 drivers: support RSS feature
In reply to [email protected]From: Jie Liu <[email protected]>
Add support for Receive Side Scaling (RSS) to distribute incoming traffic across multiple receive queues.
- Implement rss_hash_update and rss_hash_conf_get.
- Implement reta_update and reta_query.
- Support RSS hash configuration for IPv4, IPv6, TCP and UDP.
- Default hash key is initialized during port start.
--- drivers/common/sxe2/sxe2_flow_public.h | 633 +++++++++++++++++++++++++ drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 173 +++++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 16 + drivers/net/sxe2/sxe2_drv_cmd.h | 29 ++ drivers/net/sxe2/sxe2_ethdev.c | 37 ++ drivers/net/sxe2/sxe2_ethdev.h | 8 + drivers/net/sxe2/sxe2_flow_define.h | 143 ++++++ drivers/net/sxe2/sxe2_queue.c | 11 + drivers/net/sxe2/sxe2_rss.c | 584 +++++++++++++++++++++++ drivers/net/sxe2/sxe2_rss.h | 81 ++++ drivers/net/sxe2/sxe2_txrx.h | 3 + drivers/net/sxe2/sxe2_txrx_poll.c | 85 +++- 13 files changed, 1803 insertions(+), 1 deletion(-) create mode 100644 drivers/common/sxe2/sxe2_flow_public.h create mode 100644 drivers/net/sxe2/sxe2_flow_define.h create mode 100644 drivers/net/sxe2/sxe2_rss.c create mode 100644 drivers/net/sxe2/sxe2_rss.h
drivers/common/sxe2/sxe2_flow_public.h new file +633 -0
@@ -0,0 +1,633 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_FLOW_PUBLIC_H__ +#define __SXE2_FLOW_PUBLIC_H__ +#include "sxe2_osal.h" + +enum sxe2_flow_type { +SXE2_FLOW_TYPE_NONE =0 , +SXE2_FLOW_MAC_PAY =1 , +SXE2_FLOW_MAC_IPV4_FRAG_PAY =22 , +SXE2_FLOW_MAC_IPV4_PAY =23 , +SXE2_FLOW_MAC_IPV4_UDP_PAY =24 , +SXE2_FLOW_MAC_IPV4_TCP_PAY =26 , +SXE2_FLOW_MAC_IPV4_SCTP_PAY =27 , +SXE2_FLOW_MAC_IPV4_IPV4_FRAG_PAY =29 , +SXE2_FLOW_MAC_IPV4_IPV4_PAY =30 , +SXE2_FLOW_MAC_IPV4_IPV4_UDP_PAY =31 , +SXE2_FLOW_MAC_IPV4_IPV4_TCP_PAY =33 , +SXE2_FLOW_MAC_IPV4_IPV4_SCTP_PAY =34 , +SXE2_FLOW_MAC_IPV4_IPV6_FRAG_PAY =36 , +SXE2_FLOW_MAC_IPV4_IPV6_PAY =37 , +SXE2_FLOW_MAC_IPV4_IPV6_UDP_PAY =38 , +SXE2_FLOW_MAC_IPV4_IPV6_TCP_PAY =40 , +SXE2_FLOW_MAC_IPV4_IPV6_SCTP_PAY =41 , +SXE2_FLOW_MAC_IPV4_GRE_PAY =43 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_FRAG_PAY =44 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_PAY =45 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_UDP_PAY =46 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_TCP_PAY =48 , +SXE2_FLOW_MAC_IPV4_GRE_IPV4_SCTP_PAY =49 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_FRAG_PAY =51 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_PAY =52 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_UDP_PAY =53 , +SXE2_FLOW_MAC_IPV4_GRE_IPV6_TCP_PAY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cfg_hdr_type { +SXE2_RSS_OUTER_HEADERS , +SXE2_RSS_INNER_HEADERS , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4 , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6 , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_GRE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_VXLAN , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_VXLAN , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_GENEVE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_GENEVE , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV4_UDP_GTPU , + +SXE2_RSS_INNER_HEADERS_WITH_OUTER_IPV6_UDP_GTPU , +SXE2_RSS_ANY_HEADERS +}; + +enum sxe2_flow_hdr { +SXE2_FLOW_HDR_ETH =0 , +SXE2_FLOW_HDR_VLAN , +SXE2_FLOW_HDR_QINQ , +SXE2_FLOW_HDR_IPV4 , +SXE2_FLOW_HDR_IPV6 , +SXE2_FLOW_HDR_ICMP =5 , +SXE2_FLOW_HDR_TCP , +SXE2_FLOW_HDR_UDP , +SXE2_FLOW_HDR_SCTP , +SXE2_FLOW_HDR_GRE , +SXE2_FLOW_HDR_VXLAN =10 , +SXE2_FLOW_HDR_GENEVE , +SXE2_FLOW_HDR_GTPU , + +SXE2_FLOW_HDR_IPV_FRAG , + +SXE2_FLOW_HDR_IPV_OTHER , + +SXE2_FLOW_HDR_ETH_NON_IP =15 , +SXE2_FLOW_HDR_MAX =128 , +}; + +enum sxe2_flow_fld_id { +SXE2_FLOW_FLD_ID_ETH_DA =0 , +SXE2_FLOW_FL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TP_CHKSUM , + +SXE2_FLOW_FLD_ID_VXLAN_VNI , + +SXE2_FLOW_FLD_ID_GENEVE_VNI , + +SXE2_FLOW_FLD_ID_GTPU_TEID =40 , + +SXE2_FLOW_FLD_ID_NVGRE_TNI , + +SXE2_FLOW_FLD_ID_MAX =128 , +}; + +struct sxe2_ether_hdr { +uint8_t dst_addr[SXE2_ETH_ALEN ]; +uint8_t src_addr[SXE2_ETH_ALEN ]; +uint16_t ether_type; +}; + +struct sxe2_vlan_hdr { +uint16_t type; +uint16_t vlan; +}; + +struct sxe2_ipv4_hdr { +uint8_t ver_ihl; +uint8_t tos; +uint16_t tot_len; +uint16_t id; +uint16_t frag_off; +uint8_t ttl; +uint8_t protocol; +uint16_t check; +uint32_t saddr; +uint32_t daddr; +}; +#define SXE2_IPV6_ADDR_LENGTH (16) +#define SXE2_IPV6_TC_SHIFT (20) +#define SXE2_IPV6_TC_MASK (0xFF) + +struct sxe2_ipv6_hdr { +uint32_t pri_ver_flow; +uint16_t payload_len; +uint8_t nexthdr; +uint8_t hop_limit; +union { +uint8_t saddr[16 ]; +uint16_t saddr16[8 ]; +uint32_t saddr32[4 ]; + }; +union { +uint8_t daddr[16 ]; +uint16_t daddr16[8 ]; +uint32_t daddr32[4 ]; + }; +}; + +struct sxe2_tcp_hdr { +uint16_t source; +uint16_t dest; +uint32_t seq; +uint32_t ack_seq; +uint16_t flag; +uint16_t window; +uint16_t check; +uint16_t urg_ptr; +}; + +struct sxe2_udp_hdr { +uint16_t source; +uint16_t dest; +uint16_t len; +uint16_t check; +}; + +struct sxe2_sctp_hdr { +uint16_t src_port; +uint16_t dst_port; +}; + +struct sxe2_nvgre_hdr { +uint16_t flags; +uint16_t protocol; +uint32_t tni; +}; +struct sxe2_geneve_hdr { +uint16_t flags; +uint16_t protocol; +uint32_t vni; +}; +struct sxe2_gtpu_hdr { +uint8_t flag; +uint8_t msg_type; +uint16_t msg_len; +uint32_t teid; +}; +struct sxe2_vxlan_hdr { +uint8_t flag; +uint8_t resvd0; +uint8_t resvd1; +uint8_t protocol; +uint32_t vni; +}; + +enum sxe2_flow_act_type { +SXE2_FLOW_ACTION_DROP =0 , +SXE2_FLOW_ACTION_TC_REDIRECT , +SXE2_FLOW_ACTION_TO_VSI , +SXE2_FLOW_ACTION_TO_VSI_LIST , +SXE2_FLOW_ACTION_PASSTHRU , +SXE2_FLOW_ACTION_QUEUE , +SXE2_FLOW_ACTION_Q_REGION , +SXE2_FLOW_ACTION_MARK , +SXE2_FLOW_ACTION_COUNT , +SXE2_FLOW_ACTION_RSS , +SXE2_FLOW_ACTION_MAX =32 , +}; + +enum sxe2_rss_hash_key_func { +SXE2_RSS_HASH_FUNC_TOEPLITZ =0 , +SXE2_RSS_HASH_FUNC_SYM_TOEPLITZ =1 , +SXE2_RSS_HASH_FUNC_XOR =2 , +SXE2_RSS_HASH_FUNC_JEKINS =3 +}; + +struct sxe2_flow_action_rss { + DECLARE_BITMAP(hdr_out, SXE2_FLOW_HDR_MAX); + DECLARE_BITMAP(hdr_in, SXE2_FLOW_HDR_MAX); + DECLARE_BITMAP(fld, SXE2_FLOW_FLD_ID_MAX); +uint8_t is_inner; +uint8_t func; +uint8_t hdr_type; +}; + +struct sxe2_flow_action_queue { +uint16_t vsi_index; +uint16_t q_index; +}; + +struct sxe2_flow_action_queue_region { +uint16_t vsi_index; +uint16_t q_index; +uint8_t region; +}; + +struct sxe2_flow_action_passthru { +uint16_t vsi_index; +}; + +struct sxe2_flow_action_mark { +uint32_t mark_id; +}; + +#define SXE2_VSI_MAX (2048) +struct sxe2_flow_action_vsi { +uint16_t vsi_index; +}; + +struct sxe2_flow_action_vsi_list { + DECLARE_BITMAP(vsi_list_map, SXE2_VSI_MAX); +uint16_t vsi_cnt; +}; + +enum sxe2_fnav_stat_ctrl_type { +SXE2_FNAV_STAT_ENA_NONE =0 , +SXE2_FNAV_STAT_ENA_PKTS , +SXE2_FNAV_STAT_ENA_BYTES , +SXE2_FNAV_STAT_ENA_ALL , +}; + +struct sxe2_flow_action_count { +uint32_t user_id; +uint32_t driver_id; +uint32_t stat_index; +uint32_t stat_ctrl; +}; + +enum sxe2_flow_engine_type { +SXE2_FLOW_ENGINE_ACL , +SXE2_FLOW_ENGINE_SWITCH , +SXE2_FLOW_ENGINE_FNAV , +SXE2_FLOW_ENGINE_RSS , +SXE2_FLOW_ENGINE_MAX , +}; + +struct sxe2_flow_item { +struct sxe2_ether_hdr eth; +struct sxe2_vlan_hdr vlan; +struct sxe2_vlan_hdr qinq; +struct sxe2_ipv4_hdr ipv4; +struct sxe2_ipv6_hdr ipv6; +struct sxe2_udp_hdr udp; +struct sxe2_tcp_hdr tcp; +struct sxe2_sctp_hdr sctp; +struct sxe2_gtpu_hdr gtpu; +struct sxe2_vxlan_hdr vxlan; +struct sxe2_nvgre_hdr nvgre; +struct sxe2_geneve_hdr geneve; +}; + +enum sxe2_flow_sw_direct_type { +SXE2_FLOW_SW_DIRECT_TX , +SXE2_FLOW_SW_DIRECT_RX , +SXE2_FLOW_SW_DIRECT_MAX , +}; +enum sxe2_flow_sw_pattern_type { +SXE2_FLOW_SW_PATTERN_ONLY , +SXE2_FLOW_SW_PATTERN_LAST , +SXE2_FLOW_SW_PATTERN_FIRST , +SXE2_FLOW_SW_PATTERN_MAX , +}; + +enum sxe2_flow_tunnel_type { +SXE2_FLOW_TUNNEL_TYPE_NONE , +SXE2_FLOW_TUNNEL_TYPE_PARENT , +SXE2_FLOW_TUNNEL_TYPE_VXLAN , +SXE2_FLOW_TUNNEL_TYPE_GTPU , +SXE2_FLOW_TUNNEL_TYPE_GENEVE , +SXE2_FLOW_TUNNEL_TYPE_GRE , +SXE2_FLOW_TUNNEL_TYPE_IPIP , +}; + +struct sxe2_flow_meta { +uint8_t switch_pattern_dup_allow; +uint8_t switch_src_direct; +uint16_t flow_src_vsi; +uint16_t flow_rule_vsi; +uint32_t flow_prio; +uint16_t flow_type; +uint8_t tunnel_type; +uint8_t rsv; +}; + +struct sxe2_flow_pattern { + DECLARE_BITMAP(hdrs, SXE2_FLOW_HDR_MAX); + DECLARE_BITMAP(map_spec, SXE2_FLOW_FLD_ID_MAX); + DECLARE_BITMAP(map_mask, SXE2_FLOW_FLD_ID_MAX); +struct sxe2_flow_item item_spec; +struct sxe2_flow_item item_mask; +uint64_t rss_type_allow; +}; + +struct sxe2_flow_action { + DECLARE_BITMAP(act_types, SXE2_FLOW_ACTION_MAX); +struct sxe2_flow_action_rss rss; +struct sxe2_flow_action_queue queue; +struct sxe2_flow_action_queue_region q_region; +struct sxe2_flow_action_passthru passthru; +struct sxe2_flow_action_vsi vsi; +struct sxe2_flow_action_vsi_list vsi_list; +struct sxe2_flow_action_mark mark; +struct sxe2_flow_action_count count; +}; +#endif /* __SXE2_FLOW_PUBLIC_H__ */
drivers/net/sxe2/meson.build +1 -0
@@ -62,4 +62,5 @@ sources += files( 'sxe2_txrx_vec.c', 'sxe2_mac.c', 'sxe2_filter.c', + 'sxe2_rss.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +173 -0
176 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +16 -0
@@ -53,4 +53,20 @@ int32_t sxe2_drv_vlan_insert_strip_cfg(struct sxe2_adapter *adapter);int32_t sxe2_drv_vlan_filter_switch (struct sxe2_adapter *adapter,bool on); +int32_t sxe2_drv_rss_key_set (struct sxe2_adapter *adapter,uint8_t *key,uint16_t key_size); + +int32_t sxe2_drv_rss_lut_set (struct sxe2_adapter *adapter,uint8_t *lut,uint16_t lut_size); + +int32_t sxe2_drv_rss_hash_ctrl_func (struct sxe2_adapter *adapter,enum sxe2_rss_hash_key_func func); + +int32_t sxe2_drv_rss_hf_add (struct sxe2_adapter *adapter, +struct sxe2_rss_hf_config *rss_conf); + +int32_t sxe2_drv_rss_hf_del (struct sxe2_adapter *adapter, +struct sxe2_rss_hf_config *rss_conf); + +int32_t sxe2_drv_rss_hf_clear (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_ptp_gettime (struct sxe2_adapter *adapter,struct sxe2_rx_queue *rxq); +#endif /* SXE2_CMD_CHNL_H */
drivers/net/sxe2/sxe2_drv_cmd.h +29 -0
@@ -6,6 +6,7 @@#define SXE2_DRV_CMD_H #include "sxe2_osal.h" +#include "sxe2_flow_public.h" #define SXE2_DRV_CMD_MODULE_S (16)#define SXE2_MK_DRV_CMD (module, cmd) (((module) << SXE2_DRV_CMD_MODULE_S) | ((cmd) & 0xFFFF))
@@ -320,6 +321,34 @@ struct __rte_aligned(4) __rte_packed_begin sxe2_vlan_filter_switch_req {uint8_t rsv; } __rte_packed_end; +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_key_req { + uint16_t vsi_id; +uint16_t key_size; +uint8_t key[]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_lut_req { + uint16_t vsi_id; +uint16_t lut_size; +uint8_t lut[]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_func_req { + uint16_t vsi_id; +uint8_t func; +uint8_t rsv[1 ]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_rss_hf_req { + uint16_t vsi_id; +uint8_t rsv[2 ]; +uint32_t headers[BITS_TO_U32 (SXE2_FLOW_HDR_MAX )]; +uint32_t hash_flds[BITS_TO_U32 (SXE2_FLOW_FLD_ID_MAX )]; +uint32_t hdr_type; +uint8_t symm; +uint8_t rsv1[3 ]; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +37 -0
@@ -124,6 +124,11 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .vlan_filter_set = sxe2_dev_vlan_filter_set, .vlan_offload_set = sxe2_dev_vlan_offload_set, + + .reta_update = sxe2_dev_rss_reta_update, + .reta_query = sxe2_dev_rss_reta_query, + .rss_hash_update = sxe2_dev_rss_hash_update, + .rss_hash_conf_get = sxe2_dev_rss_hash_conf_get, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -140,6 +145,12 @@ static int32_t sxe2_dev_configure(struct rte_eth_dev *dev) goto end; } + ret =sxe2_rss_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to init rss, ret=%d" , ret); + goto end; + } + end:return ret; }
@@ -280,6 +291,22 @@ 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 (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_PTP ) + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TIMESTAMP ; + +if (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_RSS ) { + dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; + dev_info->flow_type_rss_offloads |=SXE2_RSS_HF_SUPPORT_ALL ; + dev_info->reta_size = adapter->rss_ctxt.rss_lut_size; + dev_info->hash_key_size = adapter->rss_ctxt.rss_key_size; + dev_info->rss_algo_capa = +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_DEFAULT ) | +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_TOEPLITZ ) | +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ ) | +RTE_ETH_HASH_ALGO_TO_CAPA (RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ); + } + dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_thresh = { .pthresh =SXE2_DEFAULT_RX_PTHRESH ,
@@ -552,6 +579,8 @@ static int32_t sxe2_func_caps_get(struct sxe2_adapter *adapter)sxe2_sw_queue_ctx_hw_cap_set (adapter, &dev_caps.queue_caps); +sxe2_sw_rss_ctx_hw_cap_set (adapter, &dev_caps.rss_hash_caps); +sxe2_sw_vsi_ctx_hw_cap_set (adapter, &dev_caps.vsi_caps); l_end:
@@ -937,8 +966,15 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_eth_err; } + ret =sxe2_rss_disable (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to disable rss, ret=%d" , ret); + goto init_rss_err; + } + goto l_end; +init_rss_err: init_eth_err: init_dev_info_err:sxe2_vsi_uninit (dev);
@@ -952,6 +988,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev) { (void )sxe2_dev_stop (dev); (void )sxe2_queues_release (dev); + (void )sxe2_rss_disable (dev);sxe2_vsi_uninit (dev);sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev);
drivers/net/sxe2/sxe2_ethdev.h +8 -0
@@ -15,6 +15,7 @@#include "sxe2_common.h" #include "sxe2_vsi.h" +#include "sxe2_rss.h" #include "sxe2_irq.h" #include "sxe2_queue.h" #include "sxe2_mac.h"
@@ -122,6 +123,11 @@ enum {SXE2_FLAGS_NBITS }; +struct sxe2_ptp_context { +uint64_t mbuf_rx_ts_flag; +int32_t mbuf_rx_ts_offset; +}; +struct sxe2_devargs {uint8_t flow_dup_pattern_mode;uint8_t func_flow_direct_en;
@@ -299,7 +305,9 @@ struct sxe2_adapter {struct sxe2_queue_context q_ctxt;struct sxe2_vsi_context vsi_ctxt;struct sxe2_filter_context filter_ctxt; +struct sxe2_rss_context rss_ctxt;struct sxe2_link_context link_ctxt; +struct sxe2_ptp_context ptp_ctxt;struct sxe2_devargs devargs;struct sxe2_switchdev_info switchdev_info;bool rule_started;
drivers/net/sxe2/sxe2_flow_define.h new file +143 -0
143 lines not on this page · raw message
drivers/net/sxe2/sxe2_queue.c +11 -0
@@ -17,6 +17,7 @@ void sxe2_sw_queue_ctx_hw_cap_set(struct sxe2_adapter *adapter,int32_t sxe2_queues_init (struct rte_eth_dev *dev) { +struct sxe2_adapter *adapter =SXE2_DEV_PRIVATE_TO_ADAPTER (dev);int32_t ret =0 ;uint16_t buf_size;uint16_t frame_size;
@@ -36,6 +37,16 @@ int32_t sxe2_queues_init(struct rte_eth_dev *dev) dev->data->scattered_rx =1 ; } + adapter->ptp_ctxt.mbuf_rx_ts_offset =-1 ; + adapter->ptp_ctxt.mbuf_rx_ts_flag =0 ; +if (dev->data->dev_conf.rxmode.offloads &RTE_ETH_RX_OFFLOAD_TIMESTAMP ) { + ret =rte_mbuf_dyn_rx_timestamp_register + (&adapter->ptp_ctxt.mbuf_rx_ts_offset, + (uint64_t *)&adapter->ptp_ctxt.mbuf_rx_ts_flag); +if (ret) +PMD_LOG_ERR (INIT ,"Failed to enable timestamp offloads, ret=%d" , ret); + } +return ret; }
drivers/net/sxe2/sxe2_rss.c new file +584 -0
584 lines not on this page · raw message
drivers/net/sxe2/sxe2_rss.h new file +81 -0
81 lines not on this page · raw message
drivers/net/sxe2/sxe2_txrx.h +3 -0
@@ -27,5 +27,8 @@ extern const uint32_t sxe2_ptype_tbl[];const uint32_t *sxe2_dev_supported_ptypes_get (struct rte_eth_dev *dev,size_t *no_of_elements); +#ifndef RTE_LIBRTE_SXE2_16BYTE_RX_DESC +int32_t sxe2_rx_update_ptp_time (struct sxe2_rx_queue *rxq); +#endif #endif /* SXE2_TXRX_H */
drivers/net/sxe2/sxe2_txrx_poll.c +84 -1
118 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v8 8/23 net/sxe2: support TM hierarchy and shaping
In reply to [email protected]From: Jie Liu <[email protected]>
This patch implements the traffic management ops for example PMD. It supports a 4-level hierarchy: port, vsi, queue group and queue.
- Support node add/delete and hierarchy commit.
- Support private shaper and rate limiting on each node.
The hardware requires all nodes to be configured before the hierarchy is committed to the global registers.
--- drivers/net/sxe2/meson.build | 1 + drivers/net/sxe2/sxe2_cmd_chnl.c | 163 +++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 6 + drivers/net/sxe2/sxe2_drv_cmd.h | 28 +- drivers/net/sxe2/sxe2_ethdev.c | 82 +++ drivers/net/sxe2/sxe2_ethdev.h | 5 + drivers/net/sxe2/sxe2_tm.c | 1151 ++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_tm.h | 76 ++ drivers/net/sxe2/sxe2_tx.c | 1 - 9 files changed, 1511 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_tm.c create mode 100644 drivers/net/sxe2/sxe2_tm.h
drivers/net/sxe2/meson.build +1 -0
@@ -63,4 +63,5 @@ sources += files( 'sxe2_mac.c', 'sxe2_filter.c', 'sxe2_rss.c', + 'sxe2_tm.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +163 -0
184 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +6 -0
@@ -38,6 +38,12 @@ int32_t sxe2_drv_mac_link_status_get(struct sxe2_adapter *adapter);int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +int32_t sxe2_drv_root_tree_release (struct rte_eth_dev *dev); + +int32_t sxe2_drv_root_tree_alloc (struct rte_eth_dev *dev); + +int32_t sxe2_drv_tm_commit (struct sxe2_adapter *adapter); +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_drv_cmd.h +27 -1
@@ -29,7 +29,7 @@#define SXE2_SCHED_MODE_DEFAULT 0#define SXE2_SCHED_MODE_TM 1 -#define SXE2_SCHED_MODE_HIGH_PERFORMANCE 2 +#define SXE2_SCHED_MODE_NO_SCHED 2#define SXE2_SCHED_MODE_INVALID 3#define SXE2_SRCVSI_PRUNE_MAX_NUM 2
@@ -349,6 +349,32 @@ 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 { + uint16_t teid; +uint8_t rsv[2 ]; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin 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; +uint8_t adj_lvl; +struct sxe2_tm_info info; +} __rte_packed_end; + +struct __rte_aligned(4) __rte_packed_begin sxe2_tm_add_queue_msg { + uint16_t parent_teid; +uint16_t queue_id; +uint8_t adj_lvl; +struct sxe2_tm_info info; +} __rte_packed_end; +enum sxe2_drv_cmd_module {SXE2_DRV_CMD_MODULE_HANDSHAKE =0 ,SXE2_DRV_CMD_MODULE_DEV =1 ,
drivers/net/sxe2/sxe2_ethdev.c +82 -0
120 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.h +5 -0
@@ -20,6 +20,7 @@#include "sxe2_queue.h" #include "sxe2_mac.h" #include "sxe2_osal.h" +#include "sxe2_tm.h" #include "sxe2_filter.h" struct sxe2_link_msg {
@@ -308,6 +309,8 @@ struct sxe2_adapter {struct sxe2_rss_context rss_ctxt;struct sxe2_link_context link_ctxt;struct sxe2_ptp_context ptp_ctxt; +struct sxe2_sched_hw_cap sched_ctxt; +struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs;struct sxe2_switchdev_info switchdev_info;bool rule_started;
@@ -330,6 +333,8 @@ void *sxe2_pci_map_addr_get(struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type, uint16_t idx_in_func); +uint32_t sxe2_sched_mode_get (struct sxe2_adapter *adapter); +struct sxe2_pci_map_bar_info *sxe2_dev_get_bar_info (struct sxe2_adapter *adapter,enum sxe2_pci_map_resource res_type);
drivers/net/sxe2/sxe2_tm.c new file +1151 -0
1,151 lines not on this page · raw message
drivers/net/sxe2/sxe2_tm.h new file +76 -0
76 lines not on this page · raw message
drivers/net/sxe2/sxe2_tx.c +0 -1
@@ -304,7 +304,6 @@ int32_t __rte_cold sxe2_tx_queue_setup(struct rte_eth_dev *dev, } offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads; - txq =sxe2_tx_queue_alloc (dev, queue_idx, nb_desc, socket_id);if (txq ==NULL ) {PMD_LOG_ERR (TX ,"failed to alloc sxe2vf tx queue:%u resource" , queue_idx);
Signature · 1 line
2.52.0
PATCH v8 9/23 net/sxe2: support IPsec inline protocol offload
In reply to [email protected]From: Jie Liu <[email protected]>
This patch adds support for IPsec inline protocol offload for both inbound and outbound traffic.
- Implement rte_security_ops: session_create, session_destroy.
- Add hardware SA table management.
- Update Rx/Tx data path to handle security offload flags.
The hardware offloads the ESP encapsulation/decapsulation and cryptographic processing.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_cmd_chnl.c | 197 ++++ drivers/net/sxe2/sxe2_cmd_chnl.h | 20 + drivers/net/sxe2/sxe2_drv_cmd.h | 61 ++ drivers/net/sxe2/sxe2_ethdev.c | 14 + drivers/net/sxe2/sxe2_ethdev.h | 3 + drivers/net/sxe2/sxe2_ipsec.c | 1565 +++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_ipsec.h | 254 +++++ drivers/net/sxe2/sxe2_rx.c | 5 + drivers/net/sxe2/sxe2_security.c | 335 ++++++ drivers/net/sxe2/sxe2_security.h | 77 ++ drivers/net/sxe2/sxe2_tx.c | 8 + drivers/net/sxe2/sxe2_txrx_poll.c | 55 + 13 files changed, 2596 insertions(+) create mode 100644 drivers/net/sxe2/sxe2_ipsec.c create mode 100644 drivers/net/sxe2/sxe2_ipsec.h create mode 100644 drivers/net/sxe2/sxe2_security.c create mode 100644 drivers/net/sxe2/sxe2_security.h
drivers/net/sxe2/meson.build +2 -0
@@ -64,4 +64,6 @@ sources += files( 'sxe2_filter.c', 'sxe2_rss.c', 'sxe2_tm.c', + 'sxe2_ipsec.c', + 'sxe2_security.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +197 -0
200 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +20 -0
@@ -44,6 +44,26 @@ int32_t sxe2_drv_root_tree_alloc(struct rte_eth_dev *dev);int32_t sxe2_drv_tm_commit (struct sxe2_adapter *adapter); +int32_t sxe2_drv_ipsec_resource_clear (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_ipsec_get_capa (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_ipsec_rxsa_add (struct sxe2_adapter *adapter, +struct sxe2_ipsec_rx_sa *rx_sa, +struct sxe2_ipsec_rx_tcam *rx_tcam, +struct sxe2_ipsec_rx_udp_group *rx_udp_group); + +int32_t sxe2_drv_ipsec_txsa_add (struct sxe2_adapter *adapter, +struct sxe2_ipsec_tx_sa *tx_sa); + +int32_t sxe2_drv_ipsec_rxsa_delete (struct sxe2_adapter *adapter, +struct sxe2_ipsec_rx_sa *rx_sa); + +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_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_drv_cmd.h +61 -0
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +14 -0
@@ -297,6 +297,11 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,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 (adapter->cap_flags &SXE2_DEV_CAPS_OFFLOAD_RSS ) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->flow_type_rss_offloads |=SXE2_RSS_HF_SUPPORT_ALL ;
@@ -1040,6 +1045,12 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_eth_err; } + ret =sxe2_security_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to initialize security, ret=%d" , ret); + goto init_security_err; + } + ret =sxe2_rss_disable (dev);if (ret) {PMD_LOG_ERR (INIT ,"Failed to disable rss, ret=%d" , ret);
@@ -1054,6 +1065,8 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto l_end; +init_security_err: +sxe2_eth_uinit (dev); init_sched_err: init_rss_err: init_eth_err:
@@ -1072,6 +1085,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev) (void )sxe2_rss_disable (dev); (void )sxe2_sched_uinit (dev);sxe2_vsi_uninit (dev); +sxe2_security_uinit (dev);sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev);
drivers/net/sxe2/sxe2_ethdev.h +3 -0
@@ -20,6 +20,8 @@#include "sxe2_queue.h" #include "sxe2_mac.h" #include "sxe2_osal.h" +#include "sxe2_security.h" +#include "sxe2_ipsec.h" #include "sxe2_tm.h" #include "sxe2_filter.h"
@@ -312,6 +314,7 @@ struct sxe2_adapter {struct sxe2_sched_hw_cap sched_ctxt;struct sxe2_tm_context tm_ctxt;struct sxe2_devargs devargs; +struct sxe2_security_ctx security_ctx;struct sxe2_switchdev_info switchdev_info;bool rule_started;bool flow_isolated;
drivers/net/sxe2/sxe2_ipsec.c new file +1565 -0
1,565 lines not on this page · raw message
drivers/net/sxe2/sxe2_ipsec.h new file +254 -0
254 lines not on this page · raw message
drivers/net/sxe2/sxe2_rx.c +5 -0
@@ -294,6 +294,11 @@ int32_t __rte_cold sxe2_rx_queue_setup(struct rte_eth_dev *dev, goto l_end; } +if (!sxe2_ipsec_valid_rx_offloads (offloads)) { + ret = -EINVAL ; + goto l_end; + } + rxq =sxe2_rx_queue_alloc (dev, queue_idx, nb_desc, socket_id);if (rxq ==NULL ) {PMD_LOG_ERR (RX ,"rx queue[%d] resource alloc failed" , queue_idx);
drivers/net/sxe2/sxe2_security.c new file +335 -0
335 lines not on this page · raw message
drivers/net/sxe2/sxe2_security.h new file +77 -0
77 lines not on this page · raw message
drivers/net/sxe2/sxe2_tx.c +8 -0
@@ -304,6 +304,11 @@ int32_t __rte_cold sxe2_tx_queue_setup(struct rte_eth_dev *dev, } offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads; +if (!sxe2_ipsec_valid_tx_offloads (offloads)) { + ret = -EINVAL ; + goto end; + } + txq =sxe2_tx_queue_alloc (dev, queue_idx, nb_desc, socket_id);if (txq ==NULL ) {PMD_LOG_ERR (TX ,"failed to alloc sxe2vf tx queue:%u resource" , queue_idx);
@@ -327,6 +332,9 @@ int32_t __rte_cold sxe2_tx_queue_setup(struct rte_eth_dev *dev, txq->ops =sxe2_tx_default_ops_get (); txq->ops.queue_reset (txq); +if (sxe2_ipsec_supported (adapter) && txq->offloads &RTE_ETH_TX_OFFLOAD_SECURITY ) + txq->ipsec_pkt_md_offset =sxe2_ipsec_pkt_md_offset_get (adapter); + dev->data->tx_queues[queue_idx] = txq; ret =0 ;
drivers/net/sxe2/sxe2_txrx_poll.c +55 -0
79 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v8 10/23 net/sxe2: support statistics and multi-process
In reply to [email protected]From: Jie Liu <[email protected]>
- The statistics support includes:
- Basic statistics (ipackets, opackets, ibytes, obytes, etc.)
- Extended statistics (xstats) for detailed hardware counters.
- Per-queue statistics for both RX and TX.
The multi-process support allows secondary processes to retrieve statistics. Since secondary processes cannot access hardware registers directly, an IPC mechanism is implemented using the DPDK MP API.
Atomic operations are used when reading 64-bit counters to ensure data consistency between processes.
--- drivers/net/sxe2/meson.build | 2 + drivers/net/sxe2/sxe2_cmd_chnl.c | 340 +++++++++++++++++- drivers/net/sxe2/sxe2_cmd_chnl.h | 23 ++ drivers/net/sxe2/sxe2_drv_cmd.h | 120 +++++++ drivers/net/sxe2/sxe2_ethdev.c | 38 +- drivers/net/sxe2/sxe2_mp.c | 414 ++++++++++++++++++++++ drivers/net/sxe2/sxe2_mp.h | 67 ++++ drivers/net/sxe2/sxe2_stats.c | 581 +++++++++++++++++++++++++++++++ drivers/net/sxe2/sxe2_stats.h | 39 +++ 9 files changed, 1611 insertions(+), 13 deletions(-) create mode 100644 drivers/net/sxe2/sxe2_mp.c create mode 100644 drivers/net/sxe2/sxe2_mp.h create mode 100644 drivers/net/sxe2/sxe2_stats.c create mode 100644 drivers/net/sxe2/sxe2_stats.h
drivers/net/sxe2/meson.build +2 -0
@@ -66,4 +66,6 @@ sources += files( 'sxe2_tm.c', 'sxe2_ipsec.c', 'sxe2_security.c', + 'sxe2_mp.c', + 'sxe2_stats.c', )
drivers/net/sxe2/sxe2_cmd_chnl.c +329 -11
403 lines not on this page · raw message
drivers/net/sxe2/sxe2_cmd_chnl.h +23 -0
@@ -64,6 +64,29 @@ int32_t sxe2_drv_ipsec_txsa_delete(struct sxe2_adapter *adapter,int32_t sxe2_drv_promisc_config (struct sxe2_adapter *adapter,bool set); +int32_t sxe2_drv_mac_link_status_get (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_get_mac_stats (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_mac_stats_reset (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_get_vsi_stats (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_vsi_stats_reset (struct sxe2_adapter *adapter); + +int32_t sxe2_drv_queue_info_get_update (struct sxe2_adapter *adapter, +struct eth_queue_stats *qstats); + +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_txq_mapping_set (struct rte_eth_dev *eth_dev,uint16_t queue_id,uint8_t pool_idx); + +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_drv_cmd.h +120 -0
126 lines not on this page · raw message
drivers/net/sxe2/sxe2_ethdev.c +36 -2
@@ -30,6 +30,8 @@#include "sxe2_mac.h" #include "sxe2_common.h" #include "sxe2_common_log.h" +#include "sxe2_mp.h" +#include "sxe2_stats.h" #include "sxe2_host_regs.h" #include "sxe2_ioctl_chnl_func.h"
@@ -131,6 +133,14 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = { .rss_hash_conf_get = sxe2_dev_rss_hash_conf_get, .tm_ops_get = sxe2_tm_ops_get, + + .stats_get = sxe2_stats_info_get, + .stats_reset = sxe2_stats_info_reset, + .xstats_get = sxe2_xstats_info_get, + .xstats_get_names = sxe2_xstats_names_get, + .xstats_reset = sxe2_stats_info_reset, + + .queue_stats_mapping_set = sxe2_queue_stats_mapping_set, };static int32_t sxe2_dev_configure (struct rte_eth_dev *dev)
@@ -1012,6 +1022,9 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev,if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {sxe2_rx_mode_func_set (dev);sxe2_tx_mode_func_set (dev); + ret =sxe2_mp_init (dev); +if (ret !=0 ) +PMD_LOG_ERR (INIT ,"Failed to mp init (secondary), ret=%d" , ret); goto l_end; }
@@ -1063,12 +1076,27 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, goto init_sched_err; } + ret =sxe2_stats_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to stats init, ret=%d" , ret); + goto init_xstats_err; + } + + ret =sxe2_mp_init (dev); +if (ret) { +PMD_LOG_ERR (INIT ,"Failed to mp init, ret=%d" , ret); + goto init_xstats_err; + } + goto l_end; -init_security_err: -sxe2_eth_uinit (dev); +init_xstats_err: + (void )sxe2_sched_uinit (dev); init_sched_err: init_rss_err: +sxe2_security_uinit (dev); +init_security_err: +sxe2_eth_uinit (dev); init_eth_err: init_dev_info_err:sxe2_vsi_uninit (dev);
@@ -1080,8 +1108,13 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev,static int32_t sxe2_dev_close (struct rte_eth_dev *dev) { +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) { +sxe2_mp_uninit (dev); + goto l_end; + } (void )sxe2_dev_stop (dev); (void )sxe2_queues_release (dev); +sxe2_mp_uninit (dev); (void )sxe2_rss_disable (dev); (void )sxe2_sched_uinit (dev);sxe2_vsi_uninit (dev);
@@ -1089,6 +1122,7 @@ static int32_t sxe2_dev_close(struct rte_eth_dev *dev)sxe2_dev_pci_map_uinit (dev);sxe2_eth_uinit (dev); +l_end:return 0 ; }
drivers/net/sxe2/sxe2_mp.c new file +414 -0
414 lines not on this page · raw message
drivers/net/sxe2/sxe2_mp.h new file +67 -0
67 lines not on this page · raw message
drivers/net/sxe2/sxe2_stats.c new file +581 -0
581 lines not on this page · raw message
drivers/net/sxe2/sxe2_stats.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2025, Wuxi Stars Micro System Technologies Co., Ltd. +*/ + +#ifndef __SXE2_STATS_H__ +#define __SXE2_STATS_H__ + +#define SXE2_STATS_FIELD_NAME_SIZE 50 + +struct sxe2_stats_field { +char name[SXE2_STATS_FIELD_NAME_SIZE ]; +uint32_t offset; +}; + +struct sxe2_adapter ; + +int32_t sxe2_stats_info_get (struct rte_eth_dev *dev, +struct rte_eth_stats *stats, +struct eth_queue_stats *qstats); + +int32_t sxe2_xstats_info_get (struct rte_eth_dev *dev, +struct rte_eth_xstat *xstats,uint32_t usr_cnt); + +int32_t sxe2_xstats_names_get(__rte_unused struct rte_eth_dev *dev, +struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int usr_cnt); + +int32_t sxe2_stats_hw_reset (struct rte_eth_dev *dev); + +int32_t sxe2_stats_info_reset (struct rte_eth_dev *dev); + +int32_t sxe2_stats_init (struct rte_eth_dev *dev); + +int32_t sxe2_queue_stats_mapping_set (struct rte_eth_dev *eth_dev, +uint16_t queue_id,uint8_t pool_idx,uint8_t is_rx); + +int32_t sxe2_queue_stats_map_init (struct rte_eth_dev *dev); + +#endif
Signature · 1 line
2.52.0