net/sxe: add base driver directory and doc
Subsystems (2)
PATCH v18 1/13 net/sxe: add base driver directory and doc
From: JieLiu <[email protected]>
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
--- MAINTAINERS | 6 +++ doc/guides/nics/features/sxe.ini | 82 +++++++++++++++++++++++++++++ doc/guides/nics/features/sxe_vf.ini | 39 ++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sxe.rst | 71 +++++++++++++++++++++++++ drivers/net/sxe/meson.build | 9 ++++ drivers/net/sxe/pf/sxe_ethdev.c | 3 ++ drivers/net/sxe/pf/sxe_ethdev.h | 3 ++ 8 files changed, 214 insertions(+) create mode 100644 doc/guides/nics/features/sxe.ini create mode 100644 doc/guides/nics/features/sxe_vf.ini create mode 100644 doc/guides/nics/sxe.rst create mode 100644 drivers/net/sxe/meson.build create mode 100644 drivers/net/sxe/pf/sxe_ethdev.c create mode 100644 drivers/net/sxe/pf/sxe_ethdev.h
MAINTAINERS +6 -0
@@ -2055,3 +2055,9 @@ F: examples/vmdq/ F: doc/guides/sample_app_ug/vmdq_forwarding.rst F: examples/vmdq_dcb/ F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst + +Linkdata sxe +M: Jie Li <[email protected]> +F: drivers/net/sxe/ +F: doc/guides/nics/sxe.rst +F: doc/guides/nics/features/sxe*.ini
doc/guides/nics/features/sxe.ini new file +82 -0
82 lines not on this page · raw message
doc/guides/nics/features/sxe_vf.ini new file +39 -0
@@ -0,0 +1,39 @@ +; +; Supported features of the 'sxe_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Link status = Y +Rx interrupt = Y +Power mgmt address monitor = Y +MTU update = Y +Scattered Rx = Y +LRO = Y +TSO = Y +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 +CRC offload = P +VLAN offload = P +QinQ offload = P +L3 checksum offload = P +L4 checksum offload = P +Inner L3 checksum = P +Inner L4 checksum = P +Packet type parsing = Y +Rx descriptor status = Y +Tx descriptor status = Y +Basic stats = Y +Extended stats = Y +Registers dump = Y +FreeBSD = Y +Linux = Y +ARMv8 = Y +x86-32 = Y +x86-64 = Y
doc/guides/nics/index.rst +1 -0
@@ -72,3 +72,4 @@ Network Interface Controller Drivers vmxnet3 xsc zxdh + sxe
doc/guides/nics/sxe.rst new file +71 -0
71 lines not on this page · raw message
drivers/net/sxe/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C), 2020, Wuxi Stars Micro System Technologies Co., Ltd. + +deps += ['hash'] +sources = files( + 'pf/sxe_ethdev.c', +) + +includes += include_directories('pf')
drivers/net/sxe/pf/sxe_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
drivers/net/sxe/pf/sxe_ethdev.h new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
Signature · 1 line
2.18.4
PATCH v18 2/13 net/sxe: add ethdev probe and remove
From: JieLiu <[email protected]>
Add basic modules: logs、 hardware communication、common components and support basic PCIe ethdev probe and remove.
--- drivers/net/meson.build | 1 + drivers/net/sxe/Makefile | 67 + drivers/net/sxe/base/sxe_common.c | 64 + drivers/net/sxe/base/sxe_common.h | 15 + drivers/net/sxe/base/sxe_compat_platform.h | 143 + drivers/net/sxe/base/sxe_compat_version.h | 299 + drivers/net/sxe/base/sxe_dpdk_version.h | 30 + drivers/net/sxe/base/sxe_errno.h | 61 + drivers/net/sxe/base/sxe_hw.c | 6277 ++++++++++++++++++++ drivers/net/sxe/base/sxe_hw.h | 1541 +++++ drivers/net/sxe/base/sxe_logs.h | 273 + drivers/net/sxe/base/sxe_types.h | 40 + drivers/net/sxe/include/drv_msg.h | 18 + drivers/net/sxe/include/sxe/sxe_hdc.h | 42 + drivers/net/sxe/include/sxe/sxe_msg.h | 135 + drivers/net/sxe/include/sxe/sxe_regs.h | 1280 ++++ drivers/net/sxe/include/sxe_version.h | 29 + drivers/net/sxe/meson.build | 15 +- drivers/net/sxe/pf/sxe.h | 58 + drivers/net/sxe/pf/sxe_ethdev.c | 360 +- drivers/net/sxe/pf/sxe_ethdev.h | 27 +- drivers/net/sxe/pf/sxe_irq.c | 134 + drivers/net/sxe/pf/sxe_irq.h | 45 + drivers/net/sxe/pf/sxe_main.c | 296 + drivers/net/sxe/pf/sxe_phy.h | 38 + drivers/net/sxe/pf/sxe_pmd_hdc.c | 687 +++ drivers/net/sxe/pf/sxe_pmd_hdc.h | 44 + drivers/net/sxe/sxe_drv_type.h | 23 + 28 files changed, 12039 insertions(+), 3 deletions(-) create mode 100644 drivers/net/sxe/Makefile create mode 100644 drivers/net/sxe/base/sxe_common.c create mode 100644 drivers/net/sxe/base/sxe_common.h create mode 100644 drivers/net/sxe/base/sxe_compat_platform.h create mode 100644 drivers/net/sxe/base/sxe_compat_version.h create mode 100644 drivers/net/sxe/base/sxe_dpdk_version.h create mode 100644 drivers/net/sxe/base/sxe_errno.h create mode 100644 drivers/net/sxe/base/sxe_hw.c create mode 100644 drivers/net/sxe/base/sxe_hw.h create mode 100644 drivers/net/sxe/base/sxe_logs.h create mode 100644 drivers/net/sxe/base/sxe_types.h create mode 100644 drivers/net/sxe/include/drv_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_hdc.h create mode 100644 drivers/net/sxe/include/sxe/sxe_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_regs.h create mode 100644 drivers/net/sxe/include/sxe_version.h create mode 100644 drivers/net/sxe/pf/sxe.h create mode 100644 drivers/net/sxe/pf/sxe_irq.c create mode 100644 drivers/net/sxe/pf/sxe_irq.h create mode 100644 drivers/net/sxe/pf/sxe_main.c create mode 100644 drivers/net/sxe/pf/sxe_phy.h create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.c create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.h create mode 100644 drivers/net/sxe/sxe_drv_type.h
drivers/net/meson.build +1 -0
@@ -64,6 +64,7 @@ drivers = [ 'vmxnet3', 'xsc', 'zxdh', + 'sxe', ] std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc std_deps += ['bus_pci'] # very many PMDs depend on PCI, so make std
drivers/net/sxe/Makefile new file +67 -0
67 lines not on this page · raw message
drivers/net/sxe/base/sxe_common.c new file +64 -0
64 lines not on this page · raw message
drivers/net/sxe/base/sxe_common.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifndef __SXE_DPDK_COMMON_H__ +#define __SXE_DPDK_COMMON_H__ + +u64 sxe_trace_id_gen (void ); + +void sxe_trace_id_clean (void ); + +u64 sxe_trace_id_get (void ); + +u64 sxe_time_get_real_ms (void ); + +#endif
drivers/net/sxe/base/sxe_compat_platform.h new file +143 -0
143 lines not on this page · raw message
drivers/net/sxe/base/sxe_compat_version.h new file +299 -0
299 lines not on this page · raw message
drivers/net/sxe/base/sxe_dpdk_version.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_DPDK_VERSION_H__ +#define __SXE_DPDK_VERSION_H__ + +#include <rte_version.h> + +#if (RTE_VERSION >=RTE_VERSION_NUM (19 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (19 ,12 ,0 ,0 )) +#define DPDK_19_11_6 +#elif (RTE_VERSION >=RTE_VERSION_NUM (20 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (20 ,12 ,0 ,0 )) +#define DPDK_20_11_5 +#elif (RTE_VERSION >=RTE_VERSION_NUM (21 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (21 ,12 ,0 ,0 )) +#define DPDK_21_11_5 +#elif (RTE_VERSION >=RTE_VERSION_NUM (22 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (22 ,12 ,0 ,0 )) +#define DPDK_22_11_3 +#elif (RTE_VERSION >=RTE_VERSION_NUM (23 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (23 ,12 ,0 ,0 )) +#define DPDK_23_11_3 +#if (RTE_VERSION >=RTE_VERSION_NUM (23 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (23 ,8 ,0 ,0 )) +#define DPDK_23_7 +#if (RTE_VERSION >=RTE_VERSION_NUM (23 ,0 ,0 ,0 ) &&RTE_VERSION <RTE_VERSION_NUM (23 ,4 ,0 ,0 )) +#define DPDK_23_3 +#endif +#endif +#elif (RTE_VERSION_NUM (24 ,0 ,0 ,0 ) <=RTE_VERSION ) +#define DPDK_24_11_1 +#endif + +#endif
drivers/net/sxe/base/sxe_errno.h new file +61 -0
61 lines not on this page · raw message
drivers/net/sxe/base/sxe_hw.c new file +6277 -0
2,314 lines not on this page · raw message
drivers/net/sxe/base/sxe_hw.h new file +1541 -0
1,541 lines not on this page · raw message
drivers/net/sxe/base/sxe_logs.h new file +273 -0
273 lines not on this page · raw message
drivers/net/sxe/base/sxe_types.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/drv_msg.h new file +18 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe/sxe_hdc.h new file +42 -0
42 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_msg.h new file +135 -0
135 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_regs.h new file +1280 -0
1,280 lines not on this page · raw message
drivers/net/sxe/include/sxe_version.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe.h new file +58 -0
58 lines not on this page · raw message
drivers/net/sxe/pf/sxe_ethdev.c +359 -1
360 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.c new file +134 -0
134 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.h new file +45 -0
45 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c new file +296 -0
296 lines not on this page · raw message
drivers/net/sxe/pf/sxe_pmd_hdc.c new file +687 -0
687 lines not on this page · raw message
drivers/net/sxe/pf/sxe_pmd_hdc.h new file +44 -0
44 lines not on this page · raw message
drivers/net/sxe/sxe_drv_type.h new file +23 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH 02/13] net/sxe: add ethdev probe and remove
Quoted 46 lines · On Thu, 24 Apr 2025 19:36:41 -0700 Jie Liu <[email protected]>…
drivers/net/sxe/base/sxe_logs.h new file +40
-0@@ -0,0 +1,273 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef _SXE_LOGS_H_ +#define _SXE_LOGS_H_ + +#include <stdio.h> +#include <sys/time.h> +#include <pthread.h> + +#include "sxe_types.h" + +#define LOG_FILE_NAME_LEN 256 +#define LOG_FILE_PATH "/var/log/" +#define LOG_FILE_PREFIX "sxepmd.log" + +extern s32 sxe_log_init; +extern s32 sxe_log_rx; +extern s32 sxe_log_tx; +extern s32 sxe_log_drv; +extern s32 sxe_log_hw; + +#define RTE_LOGTYPE_sxe_log_init sxe_log_init +#define RTE_LOGTYPE_sxe_log_rx sxe_log_rx +#define RTE_LOGTYPE_sxe_log_tx sxe_log_tx +#define RTE_LOGTYPE_sxe_log_drv sxe_log_drv +#define RTE_LOGTYPE_sxe_log_hw sxe_log_hw + +#define INIT sxe_log_init +#define RX sxe_log_rx +#define TX sxe_log_tx +#define HW sxe_log_hw +#define DRV sxe_log_drv + +#define UNUSED (x) ((void)(x)) + +#define TIME (log_time) \ + do { \ + struct timeval tv; \
drivers/net/sxe/base/sxe_logs.h line 50
Quoted 10 lines
drivers/net/sxe/base/sxe_logs.h new file +10
-0+struct tm *td; \ +gettimeofday (&tv,NULL ); \ + td =localtime (&tv.tv_sec); \ +strftime (log_time,sizeof (log_time),"%Y-%m-%d-%H:%M:%S" , td); \ + } while (0) + +#define filename_printf (x) (strrchr((x), '/') ? strrchr((x), '/') + 1 : (x)) + +#ifdef SXE_DPDK_DEBUG +#define PMD_LOG_DEBUG (logtype, ...) \
NAK
Not carrying custom backport code in the upstream tree.
This driver is abusing the idea behind base/ code.
In DPDK base directory is intended for code shared between multiple platforms. I.e some vendors support DPDK, BSD, VmWare, and even Linux with common code.
The base directory is not intended as a backport hook.
Re: [PATCH 02/13] net/sxe: add ethdev probe and remove
In reply to Jie LiuQuoted 14 lines · On Thu, 24 Apr 2025 19:36:41 -0700 Jie Liu <[email protected]>…
drivers/net/sxe/Makefile new file +8
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2016 Intel Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +#
drivers/net/sxe/Makefile line 18
Quoted 10 lines
drivers/net/sxe/Makefile new file +10
-0+LIB = librte_pmd_sxe.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -DSXE_DPDK +CFLAGS += -DSXE_HOST_DRIVER +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +EXPORT_MAP := rte_pmd_sxe_version.map +
NAK
No Makefile's in current DPDK
Re: [PATCH 02/13] net/sxe: add ethdev probe and remove
In reply to Jie LiuQuoted 7 lines · On Thu, 24 Apr 2025 19:36:41 -0700 Jie Liu <[email protected]>…
From: JieLiu <[email protected]>
Add basic modules: logs、 hardware communication、common components and support basic PCIe ethdev probe and remove.
Signed-off-by Jie Liu <[email protected]>---
This and other patches are getting reports of sign off mismatch.
WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email name mismatch: 'From: JieLiu <[email protected]>' != 'Signed-off-by: Jie Liu <[email protected]>'
Re: [PATCH 02/13] net/sxe: add ethdev probe and remove
In reply to Jie Liudrivers/net/meson.build drivers = [ · line 68
Quoted 10 lines · On Thu, 24 Apr 2025 19:36:41 -0700 Jie Liu <[email protected]>…
drivers/net/meson.build +1
-0@@ -64,6 +64,7 @@ drivers = [ 'vmxnet3', 'xsc', 'zxdh', + 'sxe', ]
Put new drivers in with same indentation and keep list in alpha order.
PATCH v18 3/13 net/sxe: add tx rx setup and data path
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add setup, initialization, and logic for tx and rx queues.
--- drivers/net/sxe/Makefile | 11 + drivers/net/sxe/base/sxe_offload_common.c | 59 + drivers/net/sxe/base/sxe_offload_common.h | 15 + drivers/net/sxe/base/sxe_queue_common.c | 410 ++++++ drivers/net/sxe/base/sxe_queue_common.h | 244 ++++ drivers/net/sxe/base/sxe_rx_common.c | 307 +++++ drivers/net/sxe/base/sxe_rx_common.h | 28 + drivers/net/sxe/base/sxe_tx_common.c | 47 + drivers/net/sxe/base/sxe_tx_common.h | 12 + drivers/net/sxe/include/sxe_type.h | 796 +++++++++++ drivers/net/sxe/meson.build | 8 + drivers/net/sxe/pf/rte_pmd_sxe.h | 15 + drivers/net/sxe/pf/sxe.h | 1 + drivers/net/sxe/pf/sxe_ethdev.c | 206 +++ drivers/net/sxe/pf/sxe_irq.c | 258 ++++ drivers/net/sxe/pf/sxe_irq.h | 11 + drivers/net/sxe/pf/sxe_main.c | 7 + drivers/net/sxe/pf/sxe_offload.c | 44 + drivers/net/sxe/pf/sxe_offload.h | 18 + drivers/net/sxe/pf/sxe_queue.c | 826 +++++++++++ drivers/net/sxe/pf/sxe_queue.h | 162 +++ drivers/net/sxe/pf/sxe_rx.c | 1503 +++++++++++++++++++++ drivers/net/sxe/pf/sxe_rx.h | 201 +++ drivers/net/sxe/pf/sxe_tx.c | 1072 +++++++++++++++ drivers/net/sxe/pf/sxe_tx.h | 50 + drivers/net/sxe/rte_pmd_sxe_version.map | 5 + drivers/net/sxe/version.map | 5 + 27 files changed, 6321 insertions(+) create mode 100644 drivers/net/sxe/base/sxe_offload_common.c create mode 100644 drivers/net/sxe/base/sxe_offload_common.h create mode 100644 drivers/net/sxe/base/sxe_queue_common.c create mode 100644 drivers/net/sxe/base/sxe_queue_common.h create mode 100644 drivers/net/sxe/base/sxe_rx_common.c create mode 100644 drivers/net/sxe/base/sxe_rx_common.h create mode 100644 drivers/net/sxe/base/sxe_tx_common.c create mode 100644 drivers/net/sxe/base/sxe_tx_common.h create mode 100644 drivers/net/sxe/include/sxe_type.h create mode 100644 drivers/net/sxe/pf/rte_pmd_sxe.h create mode 100644 drivers/net/sxe/pf/sxe_offload.c create mode 100644 drivers/net/sxe/pf/sxe_offload.h create mode 100644 drivers/net/sxe/pf/sxe_queue.c create mode 100644 drivers/net/sxe/pf/sxe_queue.h create mode 100644 drivers/net/sxe/pf/sxe_rx.c create mode 100644 drivers/net/sxe/pf/sxe_rx.h create mode 100644 drivers/net/sxe/pf/sxe_tx.c create mode 100644 drivers/net/sxe/pf/sxe_tx.h create mode 100644 drivers/net/sxe/rte_pmd_sxe_version.map create mode 100644 drivers/net/sxe/version.map
drivers/net/sxe/Makefile +11 -0
@@ -58,10 +58,21 @@ $(warning "file copy done") SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_hw.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_irq.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c + +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/sxe/base/sxe_offload_common.c new file +59 -0
59 lines not on this page · raw message
drivers/net/sxe/base/sxe_offload_common.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_OFFLOAD_COMMON_H__ +#define __SXE_OFFLOAD_COMMON_H__ + +u64 __sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 __sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev); + +u64 __sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); + +#endif +
drivers/net/sxe/base/sxe_queue_common.c new file +410 -0
410 lines not on this page · raw message
drivers/net/sxe/base/sxe_queue_common.h new file +244 -0
244 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.c new file +307 -0
307 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_RX_COMMON_H__ +#define __SXE_RX_COMMON_H__ + +#include "sxe_dpdk_version.h" + +void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev, +bool rx_batch_alloc_allowed,bool *rx_vec_allowed); + +#if definedDPDK_20_11_5 || definedDPDK_19_11_6 +s32 __sxe_rx_descriptor_done (void *rx_queue,u16 offset); +#endif + +s32 __sxe_rx_descriptor_status (void *rx_queue,u16 offset); + +u16 __sxe_pkts_recv (void *rx_queue,struct rte_mbuf **rx_pkts, +u16 pkts_num); + +#ifdef DPDK_24_11_1 +const u32 *__sxe_dev_supported_ptypes_get (struct rte_eth_dev *dev,size_t *no_of_elements); +#else +const u32 *__sxe_dev_supported_ptypes_get (struct rte_eth_dev *dev); +#endif +#endif +
drivers/net/sxe/base/sxe_tx_common.c new file +47 -0
47 lines not on this page · raw message
drivers/net/sxe/base/sxe_tx_common.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_TX_COMMON_H__ +#define __SXE_TX_COMMON_H__ + +int __sxe_tx_descriptor_status (void *tx_queue,u16 offset); + +u16 __sxe_pkts_xmit_with_offload (void *tx_queue,struct rte_mbuf **tx_pkts,u16 pkts_num); + +#endif
drivers/net/sxe/include/sxe_type.h new file +796 -0
796 lines not on this page · raw message
drivers/net/sxe/meson.build +8 -0
@@ -11,7 +11,15 @@ sources = files( 'pf/sxe_main.c', 'pf/sxe_irq.c', 'pf/sxe_ethdev.c', + 'pf/sxe_offload.c', + 'pf/sxe_queue.c', + 'pf/sxe_rx.c', + 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', + 'base/sxe_queue_common.c', + 'base/sxe_rx_common.c', + 'base/sxe_tx_common.c', + 'base/sxe_offload_common.c', 'base/sxe_common.c', 'base/sxe_hw.c', )
drivers/net/sxe/pf/rte_pmd_sxe.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __PMD_SXE_H__ +#define __PMD_SXE_H__ + +typedef uint8_t u8 ; +typedef uint16_t u16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; + +s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on); +#endif +
drivers/net/sxe/pf/sxe.h +1 -0
@@ -46,6 +46,7 @@ struct sxe_adapter {struct sxe_irq_context irq_ctxt; +bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ]; };
drivers/net/sxe/pf/sxe_ethdev.c +206 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.c +258 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.h +11 -0
@@ -39,7 +39,18 @@ void sxe_event_irq_delayed_handler(void *param);void sxe_irq_init (struct rte_eth_dev *eth_dev); +s32 sxe_irq_configure (struct rte_eth_dev *dev); + +void sxe_irq_enable (struct rte_eth_dev *eth_dev); + +void sxe_irq_disable (struct rte_eth_dev *eth_dev); +void sxe_irq_uninit (struct rte_eth_dev *eth_dev); +s32 sxe_rx_queue_intr_enable (struct rte_eth_dev *eth_dev,u16 queue_id); + +s32 sxe_rx_queue_intr_disable (struct rte_eth_dev *eth_dev,u16 queue_id); + +void sxe_irq_vec_free (struct rte_intr_handle *handle);#endif
drivers/net/sxe/pf/sxe_main.c +7 -0
@@ -31,9 +31,11 @@#include "sxe_ethdev.h" #include "sxe.h" #include "drv_msg.h" +#include "sxe_queue.h" #include "sxe_errno.h" #include "sxe_compat_platform.h" #include "sxe_pmd_hdc.h" +#include "sxe_queue.h" static const struct rte_pci_id sxe_pci_tbl[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_STARS ,SXE_DEV_ID_ASIC ) },
@@ -175,10 +177,15 @@ s32 sxe_hw_reset(struct sxe_hw *hw) {s32 ret; +/* Rx DBU off */ +sxe_hw_rx_cap_switch_off (hw); +sxe_hw_all_irq_disable (hw);sxe_hw_pending_irq_read_clear (hw); +sxe_hw_all_ring_disable (hw,SXE_HW_TXRX_RING_NUM_MAX ); + ret =sxe_mng_reset (hw, false);if (ret) {PMD_LOG_ERR (INIT ,"mng reset disable failed, ret=%d" , ret);
drivers/net/sxe/pf/sxe_offload.c new file +44 -0
44 lines not on this page · raw message
drivers/net/sxe/pf/sxe_offload.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_OFFLOAD_H__ +#define __SXE_OFFLOAD_H__ + +#include "sxe_hw.h" + +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_tx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); + +#endif
drivers/net/sxe/pf/sxe_queue.c new file +826 -0
358 lines not on this page · raw message
drivers/net/sxe/pf/sxe_queue.h new file +162 -0
162 lines not on this page · raw message
drivers/net/sxe/pf/sxe_rx.c new file +1503 -0
1,503 lines not on this page · raw message
drivers/net/sxe/pf/sxe_rx.h new file +201 -0
201 lines not on this page · raw message
drivers/net/sxe/pf/sxe_tx.c new file +1072 -0
1,072 lines not on this page · raw message
drivers/net/sxe/pf/sxe_tx.h new file +50 -0
50 lines not on this page · raw message
drivers/net/sxe/rte_pmd_sxe_version.map new file +5 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH 03/13] net/sxe: add tx rx setup and data path
Quoted 6 lines · On Thu, 24 Apr 2025 19:36:42 -0700 Jie Liu <[email protected]>…
drivers/net/sxe/base/sxe_offload_common.c new file +0
-0
drivers/net/sxe/base/sxe_offload_common.c line 10
Quoted 10 lines
drivers/net/sxe/base/sxe_offload_common.c new file +10
-0@@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#include "sxe_dpdk_version.h" +#if definedDPDK_20_11_5 || definedDPDK_19_11_6 +#include <rte_ethdev_driver.h> +#else +#include <ethdev_driver.h> +#endif +
NAK
You can't depend on DPDK version. We don't care about merging your driver with old versions of DPDK.
Re: [PATCH 03/13] net/sxe: add tx rx setup and data path
In reply to Jie Liudrivers/net/sxe/rte_pmd_sxe_version.map line 5
Quoted 10 lines · On Thu, 24 Apr 2025 19:36:42 -0700 Jie Liu <[email protected]>…
new file mode 100644
index 0000000000..2a5711367ddrivers/net/sxe/rte_pmd_sxe_version.map new file +5
-0@@ -0,0 +1,5 @@ +EXPERIMENTAL { + global: + rte_pmd_sxe_tx_loopback_set; + local: *; +};
The version map has been replaced in current main branch with RTE_EXPORT_EXPERIMENTAL_SYMBOL macro.
PATCH v18 4/13 net/sxe: add link, flow ctrl, mac ops, mtu ops function
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add link, flow ctrl, mac ops, mtu ops function.
--- drivers/net/sxe/Makefile | 3 + drivers/net/sxe/meson.build | 3 + drivers/net/sxe/pf/sxe.h | 18 + drivers/net/sxe/pf/sxe_ethdev.c | 287 ++++++++ drivers/net/sxe/pf/sxe_filter.c | 283 ++++++++ drivers/net/sxe/pf/sxe_filter.h | 60 ++ drivers/net/sxe/pf/sxe_flow_ctrl.c | 98 +++ drivers/net/sxe/pf/sxe_flow_ctrl.h | 16 + drivers/net/sxe/pf/sxe_irq.c | 124 +++- drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_phy.c | 1046 ++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_phy.h | 77 ++ 12 files changed, 2016 insertions(+), 1 deletion(-) create mode 100644 drivers/net/sxe/pf/sxe_filter.c create mode 100644 drivers/net/sxe/pf/sxe_filter.h create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.c create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.h create mode 100644 drivers/net/sxe/pf/sxe_phy.c
drivers/net/sxe/Makefile +3 -0
@@ -64,9 +64,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_flow_ctrl.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_irq.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_phy.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c
drivers/net/sxe/meson.build +3 -0
@@ -9,6 +9,8 @@ cflags += ['-DSXE_HOST_DRIVER'] deps += ['hash'] sources = files( 'pf/sxe_main.c', + 'pf/sxe_filter.c', + 'pf/sxe_flow_ctrl.c', 'pf/sxe_irq.c', 'pf/sxe_ethdev.c', 'pf/sxe_offload.c',
@@ -16,6 +18,7 @@ sources = files( 'pf/sxe_rx.c', 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', + 'pf/sxe_phy.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c',
drivers/net/sxe/pf/sxe.h +18 -0
@@ -45,9 +45,27 @@ struct sxe_adapter {struct sxe_hw hw;struct sxe_irq_context irq_ctxt; +struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ]; + +u32 mtu; + +#if definedDPDK_24_11_1 +RTE_ATOMIC (bool )link_thread_running; +RTE_ATOMIC (bool )is_stopping; +rte_thread_t link_thread_tid; +#elif definedDPDK_23_11_3 +bool link_thread_running; +bool is_stopping; +rte_thread_t link_thread_tid; +#else +rte_atomic32_t link_thread_running; +rte_atomic32_t is_stopping; +pthread_t link_thread_tid; +#endif +bool is_stopped; };s32 sxe_hw_reset (struct sxe_hw *hw);
drivers/net/sxe/pf/sxe_ethdev.c +287 -0
402 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.c new file +283 -0
283 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h new file +60 -0
60 lines not on this page · raw message
drivers/net/sxe/pf/sxe_flow_ctrl.c new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe/pf/sxe_flow_ctrl.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_FLOW_CTRL_H__ +#define __SXE_FLOW_CTRL_H__ + +s32 sxe_flow_ctrl_enable (struct rte_eth_dev *dev); + +s32 sxe_flow_ctrl_get (struct rte_eth_dev *dev, +struct rte_eth_fc_conf *fc_conf); + +s32 sxe_flow_ctrl_set (struct rte_eth_dev *dev, +struct rte_eth_fc_conf *fc_conf); + +#endif
drivers/net/sxe/pf/sxe_irq.c +123 -1
137 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -212,6 +212,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) { +sxe_fc_autoneg_localcap_set (hw); + hw->mac.auto_restart = true;PMD_LOG_INFO (INIT ,"auto_restart:%u." , hw->mac.auto_restart); }
drivers/net/sxe/pf/sxe_phy.c new file +1046 -0
1,046 lines not on this page · raw message
drivers/net/sxe/pf/sxe_phy.h +77 -0
82 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v18 5/13 net/sxe: support vlan filter
In reply to Jie LiuFrom: JieLiu <[email protected]>
Support vlan filter.
--- drivers/net/sxe/base/sxe_offload_common.c | 4 + drivers/net/sxe/pf/sxe.h | 4 + drivers/net/sxe/pf/sxe_ethdev.c | 17 ++ drivers/net/sxe/pf/sxe_filter.c | 277 ++++++++++++++++++++++ drivers/net/sxe/pf/sxe_filter.h | 13 + drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_rx.c | 5 + 7 files changed, 322 insertions(+)
drivers/net/sxe/base/sxe_offload_common.c +4 -0
@@ -18,6 +18,8 @@ u64 __sxe_rx_queue_offload_capa_get(struct rte_eth_dev *dev)u64 offloads =0 ; + offloads |=RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; +return offloads; }
@@ -32,6 +34,8 @@ u64 __sxe_rx_port_offload_capa_get(struct rte_eth_dev *dev)#ifdef DEV_RX_JUMBO_FRAME DEV_RX_OFFLOAD_JUMBO_FRAME | #endif +RTE_ETH_RX_OFFLOAD_VLAN_FILTER | +RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |RTE_ETH_RX_OFFLOAD_SCATTER ;if (!RTE_ETH_DEV_SRIOV (dev).active)
drivers/net/sxe/pf/sxe.h +4 -0
@@ -11,11 +11,13 @@#include <stdbool.h> #endif #include "sxe_types.h" +#include "sxe_filter.h" #include "sxe_irq.h" #include "sxe_phy.h" #include "sxe_hw.h" struct sxe_hw ; +struct sxe_vlan_context ;#define SXE_LPBK_DISABLED 0x0#define SXE_LPBK_ENABLED 0x1
@@ -45,6 +47,8 @@ struct sxe_adapter {struct sxe_hw hw;struct sxe_irq_context irq_ctxt; + +struct sxe_vlan_context vlan_ctxt;struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_ethdev.c +17 -0
@@ -260,6 +260,9 @@ static s32 sxe_dev_start(struct rte_eth_dev *dev) goto l_error; } +sxe_vlan_filter_configure (dev); + +sxe_txrx_start (dev); irq->to_pcs_init = true;
@@ -626,6 +629,11 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .flow_ctrl_get = sxe_flow_ctrl_get, .flow_ctrl_set = sxe_flow_ctrl_set, + .vlan_filter_set = sxe_vlan_filter_set, + .vlan_tpid_set = sxe_vlan_tpid_set, + .vlan_offload_set = sxe_vlan_offload_set, + .vlan_strip_queue_set = sxe_vlan_strip_queue_set, + .get_reg = sxe_get_regs, .dev_set_link_up = sxe_dev_set_link_up,
@@ -714,6 +722,14 @@ static void sxe_ethdev_mac_mem_free(struct rte_eth_dev *eth_dev) } } + +#ifdef DPDK_19_11_6 +static void sxe_pf_init (struct sxe_adapter *adapter) +{ +memset (&adapter->vlan_ctxt,0 ,sizeof (adapter->vlan_ctxt)); +} +#endif + s32 sxe_ethdev_init(struct rte_eth_dev *eth_dev, void *param __rte_unused) {s32 ret =0 ;
@@ -761,6 +777,7 @@ s32 sxe_ethdev_init(struct rte_eth_dev *eth_dev, void *param __rte_unused)#ifdef DPDK_19_11_6 eth_dev->data->dev_flags |=RTE_ETH_DEV_CLOSE_REMOVE ; +sxe_pf_init (adapter);#endif ret =sxe_hw_base_init (eth_dev);if (ret) {
drivers/net/sxe/pf/sxe_filter.c +277 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +13 -0
@@ -51,10 +51,23 @@ void sxe_mac_addr_remove(struct rte_eth_dev *dev, u32 rar_idx);s32 sxe_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +s32 sxe_vlan_filter_set (struct rte_eth_dev *eth_dev,u16 vlan_id,s32 on); + +s32 sxe_vlan_tpid_set (struct rte_eth_dev *eth_dev, +enum rte_vlan_type vlan_type,u16 tpid); + +s32 sxe_vlan_offload_set (struct rte_eth_dev *dev,s32 vlan_mask); + +void sxe_vlan_strip_queue_set (struct rte_eth_dev *dev,u16 queue,s32 on); + +void sxe_vlan_filter_configure (struct rte_eth_dev *dev); +s32 sxe_set_mc_addr_list (struct rte_eth_dev *dev,struct rte_ether_addr *mc_addr_list,u32 nb_mc_addr); +void sxe_vlan_strip_switch_set (struct rte_eth_dev *dev); +void sxe_fc_mac_addr_set (struct sxe_adapter *adapter);#endif
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -212,6 +212,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) { +sxe_hw_vlan_filter_array_clear (hw); +sxe_fc_autoneg_localcap_set (hw); hw->mac.auto_restart = true;
drivers/net/sxe/pf/sxe_rx.c +5 -0
@@ -1072,6 +1072,9 @@ static inline void rxq->crc_len =RTE_ETHER_CRC_LEN ; else rxq->crc_len = 0; + +if (rxq->offloads &RTE_ETH_RX_OFFLOAD_VLAN_STRIP ) + rx_conf->offloads |=RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; } }
@@ -1093,6 +1096,8 @@ static inline void adapter->mtu = dev->data->mtu;#endif + rx_conf->offloads &= ~RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; +if (rx_conf->offloads &RTE_ETH_RX_OFFLOAD_SCATTER ) dev->data->scattered_rx =1 ;
Signature · 1 line
2.18.4
PATCH v18 6/13 net/sxe: add mac layer filter function
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add mac layer filter function.
--- drivers/net/sxe/pf/sxe.h | 1 + drivers/net/sxe/pf/sxe_ethdev.c | 16 ++- drivers/net/sxe/pf/sxe_filter.c | 191 ++++++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_filter.h | 29 +++++ drivers/net/sxe/pf/sxe_main.c | 1 + 5 files changed, 237 insertions(+), 1 deletion(-)
drivers/net/sxe/pf/sxe.h +1 -0
@@ -49,6 +49,7 @@ struct sxe_adapter {struct sxe_irq_context irq_ctxt;struct sxe_vlan_context vlan_ctxt; +struct sxe_mac_filter_context mac_filter_ctxt;struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_ethdev.c +15 -1
@@ -399,6 +399,7 @@ static s32 sxe_dev_close(struct rte_eth_dev *dev)sxe_queues_free (dev); +sxe_mac_addr_set (dev, &adapter->mac_filter_ctxt.def_mac_addr);sxe_irq_uninit (dev); l_end:
@@ -611,6 +612,11 @@ static const struct eth_dev_ops sxe_eth_dev_ops = {#endif #endif + .promiscuous_enable = sxe_promiscuous_enable, + .promiscuous_disable = sxe_promiscuous_disable, + .allmulticast_enable = sxe_allmulticast_enable, + .allmulticast_disable = sxe_allmulticast_disable, + .rx_queue_intr_enable = sxe_rx_queue_intr_enable, .rx_queue_intr_disable = sxe_rx_queue_intr_disable,
@@ -720,13 +726,21 @@ static void sxe_ethdev_mac_mem_free(struct rte_eth_dev *eth_dev)rte_free (eth_dev->data->hash_mac_addrs); eth_dev->data->hash_mac_addrs =NULL ; } -} +if (adapter->mac_filter_ctxt.uc_addr_table) { +rte_free (adapter->mac_filter_ctxt.uc_addr_table); + adapter->mac_filter_ctxt.uc_addr_table =NULL ; + } + +}#ifdef DPDK_19_11_6 static void sxe_pf_init (struct sxe_adapter *adapter) {memset (&adapter->vlan_ctxt,0 ,sizeof (adapter->vlan_ctxt)); +memset (&adapter->mac_filter_ctxt.uta_hash_table,0 , +sizeof (adapter->mac_filter_ctxt.uta_hash_table)); + }#endif
drivers/net/sxe/pf/sxe_filter.c +191 -0
203 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +29 -0
@@ -26,6 +26,27 @@ struct sxe_adapter;RTE_ALIGN ((SXE_HW_TXRX_RING_NUM_MAX / (sizeof (u32) *BYTE_BIT_NUM )), \ sizeof(u32)) +struct sxe_vlan_context { +u32 vlan_hash_table[SXE_VFT_TBL_SIZE ]; +u32 strip_bitmap[SXE_VLAN_STRIP_BITMAP_SIZE ]; +u32 vlan_table_size; +}; + +enum sxe_uc_addr_src_type { +SXE_PF =0 , +SXE_VF , +SXE_VF_MACVLAN +}; + +struct sxe_uc_addr_table { +u8 rar_idx; +u8 pool_idx; +u8 type; +u8 original_index; +bool used; +u8 addr[SXE_MAC_ADDR_LEN ]; +}; +struct sxe_mac_filter_context {struct rte_ether_addr def_mac_addr;struct rte_ether_addr cur_mac_addr;
@@ -42,6 +63,14 @@ struct sxe_mac_filter_context {s32 sxe_mac_addr_init (struct rte_eth_dev *eth_dev); +s32 sxe_promiscuous_enable (struct rte_eth_dev *dev); + +s32 sxe_promiscuous_disable (struct rte_eth_dev *dev); + +s32 sxe_allmulticast_enable (struct rte_eth_dev *dev); + +s32 sxe_allmulticast_disable (struct rte_eth_dev *dev); +s32 sxe_mac_addr_add (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr,u32 rar_idx,u32 pool);
drivers/net/sxe/pf/sxe_main.c +1 -0
@@ -206,6 +206,7 @@ s32 sxe_hw_reset(struct sxe_hw *hw) goto l_end; } +sxe_hw_uc_addr_clear (hw); l_end:return ret; }
Signature · 1 line
2.18.4
PATCH v18 7/13 net/sxe: support rss offload
In reply to Jie LiuFrom: JieLiu <[email protected]>
Support rss offload.
--- drivers/net/sxe/base/sxe_offload_common.c | 12 +- drivers/net/sxe/pf/sxe.h | 2 + drivers/net/sxe/pf/sxe_ethdev.c | 12 +- drivers/net/sxe/pf/sxe_offload.c | 298 ++++++++++++++++++++++ drivers/net/sxe/pf/sxe_offload.h | 33 +++ 5 files changed, 350 insertions(+), 7 deletions(-)
drivers/net/sxe/base/sxe_offload_common.c +6 -6
@@ -28,15 +28,16 @@ u64 __sxe_rx_port_offload_capa_get(struct rte_eth_dev *dev)u64 rx_offload_capa; rx_offload_capa =RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | -RTE_ETH_RX_OFFLOAD_UDP_CKSUM | -RTE_ETH_RX_OFFLOAD_TCP_CKSUM | -RTE_ETH_RX_OFFLOAD_KEEP_CRC | +RTE_ETH_RX_OFFLOAD_UDP_CKSUM | +RTE_ETH_RX_OFFLOAD_TCP_CKSUM | +RTE_ETH_RX_OFFLOAD_KEEP_CRC | #ifdef DEV_RX_JUMBO_FRAME -DEV_RX_OFFLOAD_JUMBO_FRAME | +DEV_RX_OFFLOAD_JUMBO_FRAME | #endifRTE_ETH_RX_OFFLOAD_VLAN_FILTER |RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | -RTE_ETH_RX_OFFLOAD_SCATTER ; +RTE_ETH_RX_OFFLOAD_SCATTER | +RTE_ETH_RX_OFFLOAD_RSS_HASH ;if (!RTE_ETH_DEV_SRIOV (dev).active) rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TCP_LRO ;
@@ -60,4 +61,3 @@ u64 __sxe_tx_port_offload_capa_get(struct rte_eth_dev *dev)return tx_offload_capa; } -
drivers/net/sxe/pf/sxe.h +2 -0
@@ -57,6 +57,8 @@ struct sxe_adapter {u32 mtu; +bool rss_reta_updated; +#if definedDPDK_24_11_1 RTE_ATOMIC (bool )link_thread_running;RTE_ATOMIC (bool )is_stopping;
drivers/net/sxe/pf/sxe_ethdev.c +11 -1
@@ -347,6 +347,8 @@ static s32 sxe_dev_stop(struct rte_eth_dev *dev)memset (&link,0 ,sizeof (link));rte_eth_linkstatus_set (dev, &link); + adapter->rss_reta_updated = false; + dev->data->dev_started =0 ; adapter->is_stopped = true;
@@ -463,6 +465,11 @@ static s32 sxe_dev_infos_get(struct rte_eth_dev *dev, dev_info->rx_desc_lim = sxe_rx_desc_lim; dev_info->tx_desc_lim = sxe_tx_desc_lim; + + dev_info->hash_key_size =SXE_HKEY_MAX_INDEX *sizeof (u32); + dev_info->reta_size =RTE_ETH_RSS_RETA_SIZE_128 ; + dev_info->flow_type_rss_offloads =SXE_RSS_OFFLOAD_ALL ; + dev_info->speed_capa =RTE_ETH_LINK_SPEED_1G |RTE_ETH_LINK_SPEED_10G ; dev_info->default_rxportconf.burst_size =32 ;
@@ -621,7 +628,10 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .rx_queue_intr_disable = sxe_rx_queue_intr_disable, .mtu_set = sxe_mtu_set, - + .reta_update = sxe_rss_reta_update, + .reta_query = sxe_rss_reta_query, + .rss_hash_update = sxe_rss_hash_update, + .rss_hash_conf_get = sxe_rss_hash_conf_get, .mac_addr_add = sxe_mac_addr_add, .mac_addr_remove = sxe_mac_addr_remove,
drivers/net/sxe/pf/sxe_offload.c +298 -0
312 lines not on this page · raw message
drivers/net/sxe/pf/sxe_offload.h +33 -0
@@ -7,6 +7,21 @@#include "sxe_hw.h" +#define SXE_RSS_OFFLOAD_ALL ( \ + RTE_ETH_RSS_IPV4 | \ + RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ + RTE_ETH_RSS_IPV6 | \ + RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP) + +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_FILTER_CTRL +u8 *sxe_rss_hash_key_get (void ); +#endif + +void sxe_rss_hash_set (struct sxe_hw *hw, +struct rte_eth_rss_conf *rss_conf); +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev);u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev);
@@ -15,4 +30,22 @@ u64 sxe_tx_queue_offload_capa_get(struct rte_eth_dev *dev);u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); +void sxe_rss_disable (struct rte_eth_dev *dev); + +void sxe_rss_configure (struct rte_eth_dev *dev); + +s32 sxe_rss_reta_update (struct rte_eth_dev *dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +u16 reta_size); + +s32 sxe_rss_reta_query (struct rte_eth_dev *dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +u16 reta_size); + +s32 sxe_rss_hash_update (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf); + +s32 sxe_rss_hash_conf_get (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf); +#endif
Signature · 1 line
2.18.4
PATCH v18 8/13 net/sxe: add dcb function
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add dcb function.
--- drivers/net/sxe/Makefile | 2 + drivers/net/sxe/meson.build | 1 + drivers/net/sxe/pf/rte_pmd_sxe.h | 3 +- drivers/net/sxe/pf/sxe.h | 2 + drivers/net/sxe/pf/sxe_dcb.c | 944 ++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_dcb.h | 99 +++ drivers/net/sxe/pf/sxe_ethdev.c | 8 +- drivers/net/sxe/pf/sxe_main.c | 1 + drivers/net/sxe/pf/sxe_phy.c | 34 + drivers/net/sxe/pf/sxe_phy.h | 2 + drivers/net/sxe/pf/sxe_rx.c | 1 + drivers/net/sxe/rte_pmd_sxe_version.map | 1 + drivers/net/sxe/version.map | 1 + 13 files changed, 1097 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe/pf/sxe_dcb.c create mode 100644 drivers/net/sxe/pf/sxe_dcb.h
drivers/net/sxe/Makefile +2 -0
@@ -63,6 +63,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_dcb.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_filter.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_flow_ctrl.c
@@ -77,5 +78,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include += sxe_dcb.h include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/sxe/meson.build +1 -0
@@ -19,6 +19,7 @@ sources = files( 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', 'pf/sxe_phy.c', + 'pf/sxe_dcb.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c',
drivers/net/sxe/pf/rte_pmd_sxe.h +2 -1
@@ -11,5 +11,6 @@ typedef uint32_t u32;typedef int32_t s32 ;s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on); -#endif +s32 rte_pmd_sxe_tc_bw_set (u8 port,u8 tc_num,u8 *bw_weight); +#endif
drivers/net/sxe/pf/sxe.h +2 -0
@@ -14,6 +14,7 @@#include "sxe_filter.h" #include "sxe_irq.h" #include "sxe_phy.h" +#include "sxe_dcb.h" #include "sxe_hw.h" struct sxe_hw ;
@@ -51,6 +52,7 @@ struct sxe_adapter {struct sxe_vlan_context vlan_ctxt;struct sxe_mac_filter_context mac_filter_ctxt;struct sxe_phy_context phy_ctxt; +struct sxe_dcb_context dcb_ctxt;bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ];
drivers/net/sxe/pf/sxe_dcb.c new file +944 -0
944 lines not on this page · raw message
drivers/net/sxe/pf/sxe_dcb.h new file +99 -0
99 lines not on this page · raw message
drivers/net/sxe/pf/sxe_ethdev.c +7 -1
@@ -40,6 +40,7 @@#include "sxe_pmd_hdc.h" #include "sxe_flow_ctrl.h" #include "drv_msg.h" +#include "sxe_dcb.h" #include "sxe_version.h" #include "sxe_compat_version.h" #include <rte_string_fns.h>
@@ -644,6 +645,7 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .flow_ctrl_get = sxe_flow_ctrl_get, .flow_ctrl_set = sxe_flow_ctrl_set, + .priority_flow_ctrl_set = sxe_priority_flow_ctrl_set, .vlan_filter_set = sxe_vlan_filter_set, .vlan_tpid_set = sxe_vlan_tpid_set,
@@ -658,6 +660,8 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .dev_supported_ptypes_get = sxe_dev_supported_ptypes_get, + .get_dcb_info = sxe_get_dcb_info, + .set_queue_rate_limit = sxe_queue_rate_limit_set, #ifdef ETH_DEV_OPS_HAS_DESC_RELATE .rx_queue_count = sxe_rx_queue_count,
@@ -750,7 +754,7 @@ static void sxe_pf_init(struct sxe_adapter *adapter)memset (&adapter->vlan_ctxt,0 ,sizeof (adapter->vlan_ctxt));memset (&adapter->mac_filter_ctxt.uta_hash_table,0 ,sizeof (adapter->mac_filter_ctxt.uta_hash_table)); - + memset(&adapter->dcb_ctxt.config, 0, sizeof(adapter->dcb_ctxt.config)); }#endif
@@ -808,6 +812,8 @@ s32 sxe_ethdev_init(struct rte_eth_dev *eth_dev, void *param __rte_unused)PMD_LOG_ERR (INIT ,"hw base init fail.(err:%d)" , ret); goto l_out; } + +sxe_dcb_init (eth_dev); adapter->mtu =RTE_ETHER_MTU ;sxe_irq_init (eth_dev);
drivers/net/sxe/pf/sxe_main.c +1 -0
@@ -214,6 +214,7 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) {sxe_hw_vlan_filter_array_clear (hw); +sxe_hw_dcb_rate_limiter_clear (hw,SXE_TXRX_RING_NUM_MAX );sxe_fc_autoneg_localcap_set (hw);
drivers/net/sxe/pf/sxe_phy.c +34 -0
@@ -851,6 +851,40 @@ s32 sxe_fc_enable(struct sxe_adapter *adapter)return ret; } +s32 sxe_pfc_enable (struct sxe_adapter *adapter,u8 tc_idx) +{ +s32 ret; +struct sxe_hw *hw = &adapter->hw; + +if (!hw->fc.pause_time) { +LOG_ERROR_BDF ("link fc disabled since pause time is 0" ); + ret = -SXE_ERR_INVALID_LINK_SETTINGS ; + goto l_ret; + } + +if (hw->fc.current_mode &SXE_FC_TX_PAUSE ) { +if (!hw->fc.high_water[tc_idx] || !hw->fc.low_water[tc_idx]) { +LOG_ERROR_BDF ("Invalid water mark configuration" ); + ret =SXE_ERR_INVALID_LINK_SETTINGS ; + goto l_ret; + } + +if (hw->fc.low_water[tc_idx] >= hw->fc.high_water[tc_idx]) { +LOG_ERROR_BDF ("Invalid water mark configuration" ); + ret =SXE_ERR_INVALID_LINK_SETTINGS ; + goto l_ret; + } + } + +sxe_fc_autoneg (adapter); + + ret =sxe_hw_pfc_enable (hw, tc_idx); +if (ret) +PMD_LOG_ERR (INIT ,"link fc enable failed, ret=%d" , ret); + +l_ret: +return ret; +}s32 sxe_sfp_identify (struct sxe_adapter *adapter) {s32 ret;
drivers/net/sxe/pf/sxe_phy.h +2 -0
@@ -105,6 +105,8 @@ s32 sxe_fc_enable(struct sxe_adapter *adapter);void sxe_link_info_get (struct sxe_adapter *adapter,u32 *link_speed,bool *link_up); +s32 sxe_pfc_enable (struct sxe_adapter *adapter,u8 tc_idx); +void sxe_sfp_link_capabilities_get (struct sxe_adapter *adapter,u32 *speed,bool *autoneg);
drivers/net/sxe/pf/sxe_rx.c +1 -0
@@ -21,6 +21,7 @@#include "sxe_hw.h" #include "sxe_queue.h" #include "sxe_offload.h" +#include "sxe_dcb.h" #include "sxe_queue_common.h" #include "sxe_errno.h" #include "sxe_irq.h"
drivers/net/sxe/rte_pmd_sxe_version.map +1 -0
@@ -1,5 +1,6 @@ EXPERIMENTAL { global: rte_pmd_sxe_tx_loopback_set; + rte_pmd_sxe_tc_bw_set; local: *; };
drivers/net/sxe/version.map +1 -0
@@ -1,5 +1,6 @@ EXPERIMENTAL { global: rte_pmd_sxe_tx_loopback_set; + rte_pmd_sxe_tc_bw_set; local: *; };
Signature · 1 line
2.18.4
PATCH v18 9/13 net/sxe: support ptp
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add ptp module.
--- drivers/net/sxe/Makefile | 1 + drivers/net/sxe/meson.build | 1 + drivers/net/sxe/pf/sxe.h | 9 ++ drivers/net/sxe/pf/sxe_ethdev.c | 9 ++ drivers/net/sxe/pf/sxe_ptp.c | 210 ++++++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_ptp.h | 26 ++++ 6 files changed, 256 insertions(+) create mode 100644 drivers/net/sxe/pf/sxe_ptp.c create mode 100644 drivers/net/sxe/pf/sxe_ptp.h
drivers/net/sxe/Makefile +1 -0
@@ -72,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_phy.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ptp.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c
drivers/net/sxe/meson.build +1 -0
@@ -19,6 +19,7 @@ sources = files( 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', 'pf/sxe_phy.c', + 'pf/sxe_ptp.c', 'pf/sxe_dcb.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c',
drivers/net/sxe/pf/sxe.h +9 -0
@@ -44,6 +44,14 @@ struct sxe_vlan_context;#define rte_sxe_prefetch (p) do {} while (0)#endif +struct sxe_ptp_context { +struct rte_timecounter systime_tc; +struct rte_timecounter rx_tstamp_tc; +struct rte_timecounter tx_tstamp_tc; +u32 tx_hwtstamp_sec; +u32 tx_hwtstamp_nsec; +}; +struct sxe_adapter {struct sxe_hw hw;
@@ -51,6 +59,7 @@ struct sxe_adapter {struct sxe_vlan_context vlan_ctxt;struct sxe_mac_filter_context mac_filter_ctxt; +struct sxe_ptp_context ptp_ctxt;struct sxe_phy_context phy_ctxt;struct sxe_dcb_context dcb_ctxt;
drivers/net/sxe/pf/sxe_ethdev.c +9 -0
@@ -39,6 +39,7 @@#include "sxe_phy.h" #include "sxe_pmd_hdc.h" #include "sxe_flow_ctrl.h" +#include "sxe_ptp.h" #include "drv_msg.h" #include "sxe_dcb.h" #include "sxe_version.h"
@@ -647,6 +648,14 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .flow_ctrl_set = sxe_flow_ctrl_set, .priority_flow_ctrl_set = sxe_priority_flow_ctrl_set, + .timesync_enable = sxe_timesync_enable, + .timesync_disable = sxe_timesync_disable, + .timesync_read_rx_timestamp = sxe_timesync_read_rx_timestamp, + .timesync_read_tx_timestamp = sxe_timesync_read_tx_timestamp, + .timesync_adjust_time = sxe_timesync_adjust_time, + .timesync_read_time = sxe_timesync_read_time, + .timesync_write_time = sxe_timesync_write_time, + .vlan_filter_set = sxe_vlan_filter_set, .vlan_tpid_set = sxe_vlan_tpid_set, .vlan_offload_set = sxe_vlan_offload_set,
drivers/net/sxe/pf/sxe_ptp.c new file +210 -0
210 lines not on this page · raw message
drivers/net/sxe/pf/sxe_ptp.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_PTP_H__ +#define __SXE_PTP_H__ + +s32 sxe_timesync_enable (struct rte_eth_dev *dev); + +s32 sxe_timesync_disable (struct rte_eth_dev *dev); + +s32 sxe_timesync_read_rx_timestamp (struct rte_eth_dev *dev, +struct timespec *timestamp, + u32 flags __rte_unused); + +s32 sxe_timesync_read_tx_timestamp (struct rte_eth_dev *dev, +struct timespec *timestamp); + +s32 sxe_timesync_adjust_time (struct rte_eth_dev *dev,s64 delta); + +s32 sxe_timesync_read_time (struct rte_eth_dev *dev,struct timespec *ts); + +s32 sxe_timesync_write_time (struct rte_eth_dev *dev, +const struct timespec *ts); + +#endif
Signature · 1 line
2.18.4
PATCH v18 10/13 net/sxe: add xstats function
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add xstats function.
--- drivers/net/sxe/Makefile | 1 + drivers/net/sxe/meson.build | 1 + drivers/net/sxe/pf/sxe.h | 2 + drivers/net/sxe/pf/sxe_ethdev.c | 22 ++ drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_stats.c | 597 ++++++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_stats.h | 77 ++++ 7 files changed, 702 insertions(+) create mode 100644 drivers/net/sxe/pf/sxe_stats.c create mode 100644 drivers/net/sxe/pf/sxe_stats.h
drivers/net/sxe/Makefile +1 -0
@@ -75,6 +75,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ptp.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_stats.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c # install this header file
drivers/net/sxe/meson.build +1 -0
@@ -17,6 +17,7 @@ sources = files( 'pf/sxe_queue.c', 'pf/sxe_rx.c', 'pf/sxe_tx.c', + 'pf/sxe_stats.c', 'pf/sxe_pmd_hdc.c', 'pf/sxe_phy.c', 'pf/sxe_ptp.c',
drivers/net/sxe/pf/sxe.h +2 -0
@@ -13,6 +13,7 @@#include "sxe_types.h" #include "sxe_filter.h" #include "sxe_irq.h" +#include "sxe_stats.h" #include "sxe_phy.h" #include "sxe_dcb.h" #include "sxe_hw.h"
@@ -61,6 +62,7 @@ struct sxe_adapter {struct sxe_mac_filter_context mac_filter_ctxt;struct sxe_ptp_context ptp_ctxt;struct sxe_phy_context phy_ctxt; +struct sxe_stats_info stats_info;struct sxe_dcb_context dcb_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_ethdev.c +22 -0
@@ -36,6 +36,7 @@#include "sxe_offload.h" #include "sxe_queue.h" #include "sxe_irq.h" +#include "sxe_stats.h" #include "sxe_phy.h" #include "sxe_pmd_hdc.h" #include "sxe_flow_ctrl.h"
@@ -264,6 +265,7 @@ static s32 sxe_dev_start(struct rte_eth_dev *dev)sxe_vlan_filter_configure (dev); +sxe_queue_stats_map_restore (dev);sxe_txrx_start (dev);
@@ -641,6 +643,16 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .set_mc_addr_list = sxe_set_mc_addr_list, + .stats_get = sxe_eth_stats_get, + .stats_reset = sxe_stats_reset, + + .xstats_get = sxe_xstats_get, + .xstats_reset = sxe_xstats_reset, + .xstats_get_by_id = sxe_xstats_get_by_id, + .xstats_get_names = sxe_xstats_names_get, + .xstats_get_names_by_id = sxe_xstats_names_get_by_id, + .queue_stats_mapping_set = sxe_queue_stats_mapping_set, + .get_module_info = sxe_get_module_info, .get_module_eeprom = sxe_get_module_eeprom,
@@ -823,6 +835,16 @@ s32 sxe_ethdev_init(struct rte_eth_dev *eth_dev, void *param __rte_unused) }sxe_dcb_init (eth_dev); + +/* Reset stats info */ +sxe_stats_reset (eth_dev); + +sxe_queue_stats_map_reset (eth_dev); + +#ifdef SET_AUTOFILL_QUEUE_XSTATS + eth_dev->data->dev_flags |=RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; +#endif + adapter->mtu =RTE_ETHER_MTU ;sxe_irq_init (eth_dev);
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -214,6 +214,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) {sxe_hw_vlan_filter_array_clear (hw); + +sxe_hw_stats_regs_clean (hw);sxe_hw_dcb_rate_limiter_clear (hw,SXE_TXRX_RING_NUM_MAX );sxe_fc_autoneg_localcap_set (hw);
drivers/net/sxe/pf/sxe_stats.c new file +597 -0
597 lines not on this page · raw message
drivers/net/sxe/pf/sxe_stats.h new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v18 11/13 net/sxe: add custom cmd led ctrl
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add custom cmd led ctrl.
--- drivers/net/sxe/Makefile | 2 + drivers/net/sxe/include/sxe/sxe_cli.h | 218 ++++++++++++++++++++++++ drivers/net/sxe/include/sxe/sxe_ioctl.h | 21 +++ drivers/net/sxe/meson.build | 2 + drivers/net/sxe/pf/sxe_ethdev.c | 73 ++++++++ drivers/net/sxe/pf/sxe_main.c | 3 + drivers/net/sxe/sxe_testpmd.c | 69 ++++++++ 7 files changed, 388 insertions(+) create mode 100644 drivers/net/sxe/include/sxe/sxe_cli.h create mode 100644 drivers/net/sxe/include/sxe/sxe_ioctl.h create mode 100644 drivers/net/sxe/sxe_testpmd.c
drivers/net/sxe/Makefile +2 -0
@@ -56,6 +56,8 @@ $(shell cp $(SRCDIR)/include/*.h $(SRCDIR)) $(shell cp $(SRCDIR)/include/sxe/*.h $(SRCDIR)) $(warning "file copy done") +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_testpmd.c + SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_hw.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload_common.c
drivers/net/sxe/include/sxe/sxe_cli.h new file +218 -0
218 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_ioctl.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifndef _SXE_IOCTL_H_ +#define _SXE_IOCTL_H_ + +#ifdef SXE_HOST_DRIVER +#include "sxe_drv_type.h" +#endif + +struct sxe_ioctl_sync_cmd { +U64 traceid; +void *in_data; +U32 in_len; +void *out_data; +U32 out_len; +}; + +#define SXE_CMD_IOCTL_SYNC_CMD _IOWR('M', 1, struct sxe_ioctl_sync_cmd) + +#endif
drivers/net/sxe/meson.build +2 -0
@@ -30,6 +30,8 @@ sources = files( 'base/sxe_hw.c', ) +testpmd_sources = files('sxe_testpmd.c') + includes += include_directories('base') includes += include_directories('pf') includes += include_directories('include/sxe/')
drivers/net/sxe/pf/sxe_ethdev.c +73 -0
103 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c +3 -0
@@ -216,6 +216,9 @@ void sxe_hw_start(struct sxe_hw *hw)sxe_hw_vlan_filter_array_clear (hw);sxe_hw_stats_regs_clean (hw); + +sxe_hw_no_snoop_disable (hw); +sxe_hw_dcb_rate_limiter_clear (hw,SXE_TXRX_RING_NUM_MAX );sxe_fc_autoneg_localcap_set (hw);
drivers/net/sxe/sxe_testpmd.c new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v18 12/13 net/sxe: add simd function
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add simd function.
--- drivers/net/sxe/Makefile | 7 + drivers/net/sxe/base/sxe_queue_common.c | 55 ++ drivers/net/sxe/base/sxe_rx_common.c | 145 ++++- drivers/net/sxe/meson.build | 9 + drivers/net/sxe/pf/sxe.h | 3 + drivers/net/sxe/pf/sxe_ethdev.c | 5 + drivers/net/sxe/pf/sxe_rx.c | 3 + drivers/net/sxe/pf/sxe_vec_common.h | 325 ++++++++++ drivers/net/sxe/pf/sxe_vec_neon.c | 760 ++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_vec_sse.c | 638 ++++++++++++++++++++ 10 files changed, 1948 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe/pf/sxe_vec_common.h create mode 100644 drivers/net/sxe/pf/sxe_vec_neon.c create mode 100644 drivers/net/sxe/pf/sxe_vec_sse.c
drivers/net/sxe/Makefile +7 -0
@@ -11,6 +11,7 @@ LIB = librte_pmd_sxe.a CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -DSXE_DPDK CFLAGS += -DSXE_HOST_DRIVER +CFLAGS += -DSXE_DPDK_SIMD CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
@@ -80,6 +81,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_stats.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c +ifeq ($(CONFIG_RTE_ARCH_ARM64),y) +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_neon.c +else +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_sse.c +endif + # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include += sxe_dcb.h
drivers/net/sxe/base/sxe_queue_common.c +55 -0
94 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.c +143 -2
200 lines not on this page · raw message
drivers/net/sxe/meson.build +9 -0
@@ -2,6 +2,9 @@ # Copyright (C), 2022, Linkdata Technology Co., Ltd. cflags += ['-DSXE_DPDK'] cflags += ['-DSXE_HOST_DRIVER'] +cflags += ['-DSXE_DPDK_L4_FEATURES'] +cflags += ['-DSXE_DPDK_SRIOV'] +cflags += ['-DSXE_DPDK_SIMD'] #subdir('base') #objs = [base_objs]
@@ -32,6 +35,12 @@ sources = files( testpmd_sources = files('sxe_testpmd.c') +if arch_subdir == 'x86' + sources += files('pf/sxe_vec_sse.c') +elif arch_subdir == 'arm' + sources += files('pf/sxe_vec_neon.c') +endif + includes += include_directories('base') includes += include_directories('pf') includes += include_directories('include/sxe/')
drivers/net/sxe/pf/sxe.h +3 -0
@@ -66,6 +66,9 @@ struct sxe_adapter {struct sxe_dcb_context dcb_ctxt;bool rx_batch_alloc_allowed; +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD +bool rx_vec_allowed; +#endif s8 name[PCI_PRI_STR_SIZE +1 ];u32 mtu;
drivers/net/sxe/pf/sxe_ethdev.c +5 -0
@@ -98,6 +98,11 @@ static s32 sxe_dev_configure(struct rte_eth_dev *dev)/* Default use batch alloc */ adapter->rx_batch_alloc_allowed = true; + +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD + adapter->rx_vec_allowed = true; +#endif + l_end:return ret; }
drivers/net/sxe/pf/sxe_rx.c +3 -0
@@ -26,6 +26,9 @@#include "sxe_errno.h" #include "sxe_irq.h" #include "sxe_ethdev.h" +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD +#include "sxe_vec_common.h" +#endif #include "sxe_rx_common.h" #define SXE_LRO_HDR_SIZE 128
drivers/net/sxe/pf/sxe_vec_common.h new file +325 -0
325 lines not on this page · raw message
drivers/net/sxe/pf/sxe_vec_neon.c new file +760 -0
760 lines not on this page · raw message
drivers/net/sxe/pf/sxe_vec_sse.c new file +638 -0
638 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v18 13/13 net/sxe: add virtual function
In reply to Jie LiuFrom: JieLiu <[email protected]>
Add virtual function.
--- drivers/net/sxe/Makefile | 15 + drivers/net/sxe/base/sxe_queue_common.c | 4 + drivers/net/sxe/base/sxevf_hw.c | 951 +++++++++++++++ drivers/net/sxe/base/sxevf_hw.h | 349 ++++++ drivers/net/sxe/base/sxevf_regs.h | 119 ++ drivers/net/sxe/meson.build | 35 +- drivers/net/sxe/pf/rte_pmd_sxe.h | 3 + drivers/net/sxe/pf/sxe.h | 6 + drivers/net/sxe/pf/sxe_ethdev.c | 33 +- drivers/net/sxe/pf/sxe_filter.c | 177 +++ drivers/net/sxe/pf/sxe_filter.h | 15 + drivers/net/sxe/pf/sxe_irq.c | 26 + drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_phy.h | 1 + drivers/net/sxe/pf/sxe_rx.c | 1 + drivers/net/sxe/pf/sxe_stats.c | 9 +- drivers/net/sxe/pf/sxe_vf.c | 1444 +++++++++++++++++++++++ drivers/net/sxe/pf/sxe_vf.h | 223 ++++ drivers/net/sxe/sxe_testpmd.c | 130 ++ drivers/net/sxe/vf/sxevf.h | 43 + drivers/net/sxe/vf/sxevf_ethdev.c | 807 +++++++++++++ drivers/net/sxe/vf/sxevf_ethdev.h | 16 + drivers/net/sxe/vf/sxevf_filter.c | 493 ++++++++ drivers/net/sxe/vf/sxevf_filter.h | 77 ++ drivers/net/sxe/vf/sxevf_irq.c | 442 +++++++ drivers/net/sxe/vf/sxevf_irq.h | 39 + drivers/net/sxe/vf/sxevf_main.c | 93 ++ drivers/net/sxe/vf/sxevf_msg.c | 624 ++++++++++ drivers/net/sxe/vf/sxevf_msg.h | 205 ++++ drivers/net/sxe/vf/sxevf_offload.c | 35 + drivers/net/sxe/vf/sxevf_offload.h | 16 + drivers/net/sxe/vf/sxevf_queue.c | 223 ++++ drivers/net/sxe/vf/sxevf_queue.h | 81 ++ drivers/net/sxe/vf/sxevf_rx.c | 181 +++ drivers/net/sxe/vf/sxevf_rx.h | 22 + drivers/net/sxe/vf/sxevf_stats.c | 166 +++ drivers/net/sxe/vf/sxevf_stats.h | 31 + drivers/net/sxe/vf/sxevf_tx.c | 46 + drivers/net/sxe/vf/sxevf_tx.h | 14 + 39 files changed, 7180 insertions(+), 17 deletions(-) create mode 100644 drivers/net/sxe/base/sxevf_hw.c create mode 100644 drivers/net/sxe/base/sxevf_hw.h create mode 100644 drivers/net/sxe/base/sxevf_regs.h create mode 100644 drivers/net/sxe/pf/sxe_vf.c create mode 100644 drivers/net/sxe/pf/sxe_vf.h create mode 100644 drivers/net/sxe/vf/sxevf.h create mode 100644 drivers/net/sxe/vf/sxevf_ethdev.c create mode 100644 drivers/net/sxe/vf/sxevf_ethdev.h create mode 100644 drivers/net/sxe/vf/sxevf_filter.c create mode 100644 drivers/net/sxe/vf/sxevf_filter.h create mode 100644 drivers/net/sxe/vf/sxevf_irq.c create mode 100644 drivers/net/sxe/vf/sxevf_irq.h create mode 100644 drivers/net/sxe/vf/sxevf_main.c create mode 100644 drivers/net/sxe/vf/sxevf_msg.c create mode 100644 drivers/net/sxe/vf/sxevf_msg.h create mode 100644 drivers/net/sxe/vf/sxevf_offload.c create mode 100644 drivers/net/sxe/vf/sxevf_offload.h create mode 100644 drivers/net/sxe/vf/sxevf_queue.c create mode 100644 drivers/net/sxe/vf/sxevf_queue.h create mode 100644 drivers/net/sxe/vf/sxevf_rx.c create mode 100644 drivers/net/sxe/vf/sxevf_rx.h create mode 100644 drivers/net/sxe/vf/sxevf_stats.c create mode 100644 drivers/net/sxe/vf/sxevf_stats.h create mode 100644 drivers/net/sxe/vf/sxevf_tx.c create mode 100644 drivers/net/sxe/vf/sxevf_tx.h
drivers/net/sxe/Makefile +15 -0
@@ -11,6 +11,8 @@ LIB = librte_pmd_sxe.a CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -DSXE_DPDK CFLAGS += -DSXE_HOST_DRIVER +CFLAGS += -DSXE_DPDK_L4_FEATURES +CFLAGS += -DSXE_DPDK_SRIOV CFLAGS += -DSXE_DPDK_SIMD CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
@@ -65,6 +67,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_hw.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_dcb.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c
@@ -80,6 +83,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_stats.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vf.c ifeq ($(CONFIG_RTE_ARCH_ARM64),y) SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_neon.c
@@ -87,6 +91,17 @@ else SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_sse.c endif +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_main.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_msg.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_irq.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_stats.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_tx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_queue.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_offload.c + # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include += sxe_dcb.h
drivers/net/sxe/base/sxe_queue_common.c +4 -0
@@ -21,11 +21,15 @@#include "sxe_tx.h" #include "sxe_logs.h" #include "sxe_regs.h" +#include "sxevf_regs.h" #include "sxe.h" #if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD #include "sxe_vec_common.h" #include <rte_vect.h> #endif +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +#include "sxevf.h" +#endif #include "sxe_queue_common.h" #include "sxe_queue.h"
drivers/net/sxe/base/sxevf_hw.c new file +951 -0
951 lines not on this page · raw message
drivers/net/sxe/base/sxevf_hw.h new file +349 -0
349 lines not on this page · raw message
drivers/net/sxe/base/sxevf_regs.h new file +119 -0
119 lines not on this page · raw message
drivers/net/sxe/meson.build +24 -11
@@ -11,26 +11,38 @@ cflags += ['-DSXE_DPDK_SIMD'] deps += ['hash'] sources = files( - 'pf/sxe_main.c', + 'pf/sxe_main.c', 'pf/sxe_filter.c', - 'pf/sxe_flow_ctrl.c', - 'pf/sxe_irq.c', - 'pf/sxe_ethdev.c', + 'pf/sxe_flow_ctrl.c', + 'pf/sxe_irq.c', + 'pf/sxe_ethdev.c', 'pf/sxe_offload.c', 'pf/sxe_queue.c', 'pf/sxe_rx.c', 'pf/sxe_tx.c', 'pf/sxe_stats.c', - 'pf/sxe_pmd_hdc.c', - 'pf/sxe_phy.c', - 'pf/sxe_ptp.c', - 'pf/sxe_dcb.c', - 'base/sxe_queue_common.c', + 'pf/sxe_pmd_hdc.c', + 'pf/sxe_phy.c', + 'pf/sxe_ptp.c', + 'pf/sxe_vf.c', + 'pf/sxe_dcb.c', + 'vf/sxevf_main.c', + 'vf/sxevf_filter.c', + 'vf/sxevf_irq.c', + 'vf/sxevf_msg.c', + 'vf/sxevf_ethdev.c', + 'vf/sxevf_stats.c', + 'vf/sxevf_rx.c', + 'vf/sxevf_tx.c', + 'vf/sxevf_queue.c', + 'vf/sxevf_offload.c', + 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c', 'base/sxe_offload_common.c', - 'base/sxe_common.c', - 'base/sxe_hw.c', + 'base/sxe_common.c', + 'base/sxe_hw.c', + 'base/sxevf_hw.c', ) testpmd_sources = files('sxe_testpmd.c')
@@ -43,5 +55,6 @@ endif includes += include_directories('base') includes += include_directories('pf') +includes += include_directories('vf') includes += include_directories('include/sxe/') includes += include_directories('include/')
drivers/net/sxe/pf/rte_pmd_sxe.h +3 -0
@@ -13,4 +13,7 @@ typedef int32_t s32;s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on);s32 rte_pmd_sxe_tc_bw_set (u8 port,u8 tc_num,u8 *bw_weight); + +int rte_pmd_sxe_set_vf_rxmode (u16 port,u16 vf, +u16 rx_mask,u8 on);#endif
drivers/net/sxe/pf/sxe.h +6 -0
@@ -15,6 +15,7 @@#include "sxe_irq.h" #include "sxe_stats.h" #include "sxe_phy.h" +#include "sxe_vf.h" #include "sxe_dcb.h" #include "sxe_hw.h"
@@ -60,8 +61,13 @@ struct sxe_adapter {struct sxe_vlan_context vlan_ctxt;struct sxe_mac_filter_context mac_filter_ctxt; +#ifdef RTE_ADAPTER_HAVE_FNAV_CONF +struct rte_eth_fdir_conf fnav_conf; +#endif struct sxe_ptp_context ptp_ctxt;struct sxe_phy_context phy_ctxt; +struct sxe_virtual_context vt_ctxt; +struct sxe_stats_info stats_info;struct sxe_dcb_context dcb_ctxt;
drivers/net/sxe/pf/sxe_ethdev.c +32 -1
@@ -43,6 +43,7 @@#include "sxe_ptp.h" #include "sxe_cli.h" #include "drv_msg.h" +#include "sxe_vf.h" #include "sxe_dcb.h" #include "sxe_version.h" #include "sxe_compat_version.h"
@@ -255,6 +256,12 @@ static s32 sxe_dev_start(struct rte_eth_dev *dev)sxe_mac_addr_set (dev, &dev->data->mac_addrs[0 ]); +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +sxe_hw_pf_rst_done_set (hw); + +/* Configure virtualization */ +sxe_vt_configure (dev); +#endif sxe_tx_configure (dev); ret =sxe_rx_configure (dev);
@@ -296,6 +303,7 @@ static s32 sxe_dev_start(struct rte_eth_dev *dev) goto l_error; } +sxe_dcb_configure (dev); l_end:return ret;
@@ -401,6 +409,10 @@ static s32 sxe_dev_close(struct rte_eth_dev *dev) goto l_end; } +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +sxe_hw_pf_rst_done_set (hw); +#endif +#ifdef DPDK_19_11_6 sxe_dev_stop (dev);#else
@@ -414,6 +426,10 @@ static s32 sxe_dev_close(struct rte_eth_dev *dev)sxe_mac_addr_set (dev, &adapter->mac_filter_ctxt.def_mac_addr);sxe_irq_uninit (dev); +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +sxe_vt_uninit (dev); +#endif + l_end:#ifdef DPDK_19_11_6 LOG_DEBUG_BDF ("at end of dev close." );
@@ -760,6 +776,14 @@ static const struct eth_dev_ops sxe_eth_dev_ops = { .set_queue_rate_limit = sxe_queue_rate_limit_set, .fw_version_get = sxe_fw_version_get, + +#ifdef ETH_DEV_MIRROR_RULE +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV + .mirror_rule_set = sxe_mirror_rule_set, + .mirror_rule_reset = sxe_mirror_rule_reset, +#endif +#endif +#ifdef ETH_DEV_OPS_HAS_DESC_RELATE .rx_queue_count = sxe_rx_queue_count, .rx_descriptor_status = sxe_rx_descriptor_status,
@@ -811,6 +835,10 @@ static s32 sxe_hw_base_init(struct rte_eth_dev *eth_dev)sxe_hw_fc_base_init (hw); +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +sxe_hw_pf_rst_done_set (hw); +#endif + l_out:if (ret)sxe_hw_hdc_drv_status_set (hw, (u32 )false);
@@ -842,7 +870,6 @@ static void sxe_ethdev_mac_mem_free(struct rte_eth_dev *eth_dev)rte_free (adapter->mac_filter_ctxt.uc_addr_table); adapter->mac_filter_ctxt.uc_addr_table =NULL ; } - }#ifdef DPDK_19_11_6
@@ -923,6 +950,10 @@ s32 sxe_ethdev_init(struct rte_eth_dev *eth_dev, void *param __rte_unused) eth_dev->data->dev_flags |=RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ;#endif + +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +sxe_vt_init (eth_dev); +#endif adapter->mtu =RTE_ETHER_MTU ;sxe_irq_init (eth_dev);
drivers/net/sxe/pf/sxe_filter.c +177 -0
202 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +15 -0
@@ -80,6 +80,15 @@ void sxe_mac_addr_remove(struct rte_eth_dev *dev, u32 rar_idx);s32 sxe_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +s32 sxe_uc_hash_table_set (struct rte_eth_dev *dev, +struct rte_ether_addr *mac_addr,u8 on); + +s32 sxe_uc_all_hash_table_set (struct rte_eth_dev *dev,u8 on); + +s32 sxe_set_mc_addr_list (struct rte_eth_dev *dev, +struct rte_ether_addr *mc_addr_list, +u32 nb_mc_addr); +s32 sxe_vlan_filter_set (struct rte_eth_dev *eth_dev,u16 vlan_id,s32 on); s32 sxe_vlan_tpid_set(struct rte_eth_dev *eth_dev,
@@ -99,4 +108,10 @@ void sxe_vlan_strip_switch_set(struct rte_eth_dev *dev);void sxe_fc_mac_addr_set (struct sxe_adapter *adapter); +u8 sxe_sw_uc_entry_vf_add (struct sxe_adapter *adapter, +u8 vf_idx,u8 *mac_addr,bool macvlan); + +void sxe_sw_uc_entry_vf_del (struct sxe_adapter *adapter,u8 vf_idx, +bool macvlan); +#endif
drivers/net/sxe/pf/sxe_irq.c +26 -0
@@ -29,6 +29,7 @@#include "sxe_queue.h" #include "sxe_errno.h" #include "sxe_compat_version.h" +#include "sxe_vf.h" #define SXE_LINK_DOWN_TIMEOUT 4000#define SXE_LINK_UP_TIMEOUT 1000
@@ -169,6 +170,14 @@ static s32 sxe_event_irq_action(struct rte_eth_dev *eth_dev)PMD_LOG_DEBUG (DRV ,"event irq action type %d" , irq->action); +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +/* mailbox irq handler */ +if (irq->action &SXE_IRQ_MAILBOX ) { +sxe_mbx_irq_handler (eth_dev); + irq->action &= ~SXE_IRQ_MAILBOX ; + } +#endif +/* lsc irq handler */ if (irq->action &SXE_IRQ_LINK_UPDATE ) {sxe_lsc_irq_handler (eth_dev);
@@ -225,6 +234,23 @@ void sxe_irq_init(struct rte_eth_dev *eth_dev) sxe_event_irq_handler, eth_dev);rte_spinlock_init (&adapter->irq_ctxt.event_irq_lock); + +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +struct sxe_irq_context *irq = &adapter->irq_ctxt; +struct sxe_hw *hw = &adapter->hw; +u32 gpie =0 ; + +if (irq_handle->type ==RTE_INTR_HANDLE_UIO || + irq_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) { + gpie =sxe_hw_irq_general_reg_get (hw); + + gpie |=SXE_GPIE_MSIX_MODE |SXE_GPIE_OCD ; +sxe_hw_irq_general_reg_set (hw, gpie); + } +rte_intr_enable (irq_handle); + +sxe_hw_specific_irq_enable (hw, irq->enable_mask); +#endif }static s32 sxe_irq_general_config (struct rte_eth_dev *dev)
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -31,10 +31,12 @@#include "sxe_ethdev.h" #include "sxe.h" #include "drv_msg.h" +#include "sxe_cli.h" #include "sxe_queue.h" #include "sxe_errno.h" #include "sxe_compat_platform.h" #include "sxe_pmd_hdc.h" +#include "sxe_vf.h" #include "sxe_queue.h" static const struct rte_pci_id sxe_pci_tbl[] = {
drivers/net/sxe/pf/sxe_phy.h +1 -0
@@ -6,6 +6,7 @@#include <rte_ethdev.h> #include "drv_msg.h" +#include "sxe_cli.h" #include "sxe_msg.h" #define SXE_SFF_BASE_ADDR 0x0
drivers/net/sxe/pf/sxe_rx.c +1 -0
@@ -23,6 +23,7 @@#include "sxe_offload.h" #include "sxe_dcb.h" #include "sxe_queue_common.h" +#include "sxe_vf.h" #include "sxe_errno.h" #include "sxe_irq.h" #include "sxe_ethdev.h"
drivers/net/sxe/pf/sxe_stats.c +4 -5
@@ -232,10 +232,9 @@ s32 sxe_xstats_get(struct rte_eth_dev *eth_dev,u8 prio; cnt =SXE_XSTAT_CNT ; -PMD_LOG_INFO (DRV ,"xstat size:%u. hw xstat field cnt:%u " -"fc xstat field cnt:%u " , cnt, -SXE_XSTAT_MAC_CNT , -SXE_XSTAT_FC_CNT ); +PMD_LOG_INFO (DRV ,"xstat size:%u. hw xstat field cnt: %" SXE_PRIU64 +"fc xstat field cnt: %" SXE_PRIU64 , cnt, +SXE_XSTAT_MAC_CNT ,SXE_XSTAT_FC_CNT );if (usr_cnt < cnt) { ret = cnt;
@@ -346,7 +345,7 @@ s32 sxe_xstats_names_get(__rte_unused struct rte_eth_dev *dev,if (usr_cnt <SXE_XSTAT_CNT ) { ret = -SXE_ERR_PARAM ; -PMD_LOG_ERR (DRV ,"max:%u usr_cnt:%u invalid.(err:%d)" , +PMD_LOG_ERR (DRV ,"max: %" SXE_PRIU64 " usr_cnt:%u invalid.(err:%d)" ,SXE_XSTAT_CNT , usr_cnt, ret); goto l_out; }
drivers/net/sxe/pf/sxe_vf.c new file +1444 -0
1,039 lines not on this page · raw message
drivers/net/sxe/pf/sxe_vf.h new file +223 -0
223 lines not on this page · raw message
drivers/net/sxe/sxe_testpmd.c +130 -0
130 lines not on this page · raw message
drivers/net/sxe/vf/sxevf.h new file +43 -0
43 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_ethdev.c new file +807 -0
807 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_ethdev.h new file +16 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_filter.c new file +493 -0
493 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_filter.h new file +77 -0
77 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_irq.c new file +442 -0
442 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_irq.h new file +39 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_main.c new file +93 -0
93 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_msg.c new file +624 -0
624 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_msg.h new file +205 -0
205 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_offload.c new file +35 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_offload.h new file +16 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_queue.c new file +223 -0
223 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_queue.h new file +81 -0
81 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_rx.c new file +181 -0
181 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_rx.h new file +22 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_stats.c new file +166 -0
166 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_stats.h new file +31 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_tx.c new file +46 -0
46 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_tx.h new file +14 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
Quoted 7 lines · On Thu, 24 Apr 2025 19:36:40 -0700 Jie Liu <[email protected]>…
From: JieLiu <[email protected]>
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
Signed-off-by Jie Liu <[email protected]>---
The build failures are because current main branch detects usage of Variable Length Array (VLA) in drivers. VLA's don't work on Windows.
Best to just modify the code to have a fixed size buffer and process in chunks.
Quoted 6 lines · On Thu, 24 Apr 2025 19:36:40 -0700 Jie Liu <[email protected]>…
From: JieLiu <[email protected]>
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
Signed-off-by Jie Liu <[email protected]>
Fix your editor settings.
All files should end with newline.
Applying: net/sxe: add base driver directory and doc
Applying: net/sxe: add ethdev probe and remove
Applying: net/sxe: add tx rx setup and data path /home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:141: new blank line at EOF. +/home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:162: new blank line at EOF. +/home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:578: new blank line at EOF. +/home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:1141: new blank line at EOF. +/home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:1175: new blank line at EOF. +
warning: squelched 6 whitespace errors
warning: 11 lines add whitespace errors.
Applying: net/sxe: add link, flow ctrl, mac ops, mtu ops function
Applying: net/sxe: support vlan filter
Applying: net/sxe: add mac layer filter function
Applying: net/sxe: support rss offload
Applying: net/sxe: add dcb function
Applying: net/sxe: support ptp
Applying: net/sxe: add xstats function /home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:726: new blank line at EOF. +/home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:809: new blank line at EOF. +
warning: 2 lines add whitespace errors.
Applying: net/sxe: add custom cmd led ctrl
Applying: net/sxe: add simd function
Applying: net/sxe: add virtual function /home/shemminger/DPDK/main/.git/worktrees/sxe/rebase-apply/patch:4006: new blank line at EOF. +
warning: 1 line adds whitespace errors.
Quoted 6 lines · On Thu, 24 Apr 2025 19:36:40 -0700 Jie Liu <[email protected]>…
From: JieLiu <[email protected]>
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
Signed-off-by Jie Liu <[email protected]>
More check issues.
$ ./devtools/check-doc-vs-code.sh rte_flow doc out of sync for sxe item e_tag item eth item fuzzy item ipv4 item ipv6 item nvgre item raw item sctp item tcp item udp item vlan item vxlan action drop action mark action pf action queue action rss action security action vf
Quoted 6 lines · On Thu, 24 Apr 2025 19:36:40 -0700 Jie Liu <[email protected]>…
From: JieLiu <[email protected]>
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
Signed-off-by Jie Liu <[email protected]>
Build test failed for 32 bit x86
DPDK 25.07.0-rc0
User defined options
c_args : -m32
c_link_args: -m32Found ninja-1.12.1 at /usr/bin/ninja
FAILED: drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_ethdev.c.o
cc -Idrivers/libtmp_rte_net_sxe.a.p -Idrivers -I../drivers -Idrivers/net/sxe -I../drivers/net/sxe -I../drivers/net/sxe/base -I../drivers/net/sxe/pf -I../drivers/net/sxe/vf -I../drivers/net/sxe/include/sxe -I../drivers/net/sxe/include -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -I../kernel/linux -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -I/usr/include/i386-linux-gnu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-pointer-to-int-cast -D_GNU_SOURCE -m32 -fPIC -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -Wno-vla -DSXE_DPDK -DSXE_HOST_DRIVER -DSXE_DPDK_L4_FEATURES -DSXE_DPDK_SRIOV -DSXE_DPDK_SIMD -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe -MD -MQ drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_ethdev.c.o -MF drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_ethdev.c.o.d -o drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_ethdev.c.o -c ../drivers/net/sxe/pf/sxe_ethdev.c ../drivers/net/sxe/pf/sxe_ethdev.c: In function ‘sxe_dev_stop’:../drivers/net/sxe/pf/sxe_ethdev.c:342:9: warning: value computed is not used [-Wunused-value]
342 | rte_atomic_exchange_explicit(&adapter->is_stopping, 1, rte_memory_order_seq_cst);../drivers/net/sxe/pf/sxe_ethdev.c: At top level:../drivers/net/sxe/pf/sxe_ethdev.c:740:35: error: initialization of ‘int (*)(struct rte_eth_dev *, const uint64_t *, uint64_t *, unsigned int)’ {aka ‘int (*)(struct rte_eth_dev *, const long long unsigned int *, long long unsigned int *, unsigned int)’} from incompatible pointer type ‘s32 (*)(struct rte_eth_dev *, const ulong *, ulong *, u32)’ {aka ‘int (*)(struct rte_eth_dev *, const long unsigned int *, long unsigned int *, unsigned int)’} [-Wincompatible-pointer-types]
740 | .xstats_get_by_id = sxe_xstats_get_by_id,
| ^~~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_ethdev.c:740:35: note: (near initialization for ‘sxe_eth_dev_ops.xstats_get_by_id’)
../drivers/net/sxe/pf/sxe_ethdev.c:742:35: error: initialization of ‘int (*)(struct rte_eth_dev *, const uint64_t *, struct rte_eth_xstat_name *, unsigned int)’ {aka ‘int (*)(struct rte_eth_dev *, const long long unsigned int *, struct rte_eth_xstat_name *, unsigned int)’} from incompatible pointer type ‘s32 (*)(struct rte_eth_dev *, const ulong *, struct rte_eth_xstat_name *, u32)’ {aka ‘int (*)(struct rte_eth_dev *, const long unsigned int *, struct rte_eth_xstat_name *, unsigned int)’} [-Wincompatible-pointer-types]
742 | .xstats_get_names_by_id = sxe_xstats_names_get_by_id,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~../drivers/net/sxe/pf/sxe_ethdev.c:742:35: note: (near initialization for ‘sxe_eth_dev_ops.xstats_get_names_by_id’)
FAILED: drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_stats.c.o
cc -Idrivers/libtmp_rte_net_sxe.a.p -Idrivers -I../drivers -Idrivers/net/sxe -I../drivers/net/sxe -I../drivers/net/sxe/base -I../drivers/net/sxe/pf -I../drivers/net/sxe/vf -I../drivers/net/sxe/include/sxe -I../drivers/net/sxe/include -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -I../kernel/linux -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -I/usr/include/i386-linux-gnu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-pointer-to-int-cast -D_GNU_SOURCE -m32 -fPIC -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -Wno-vla -DSXE_DPDK -DSXE_HOST_DRIVER -DSXE_DPDK_L4_FEATURES -DSXE_DPDK_SRIOV -DSXE_DPDK_SIMD -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe -MD -MQ drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_stats.c.o -MF drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_stats.c.o.d -o drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_stats.c.o -c ../drivers/net/sxe/pf/sxe_stats.c In file included from ../lib/eal/include/rte_debug.h:17,
from ../lib/eal/include/rte_bitops.h:23,
from ../lib/ethdev/rte_cman.h:8,
from ../lib/ethdev/rte_ethdev.h:159,
from ../drivers/net/sxe/pf/sxe_stats.h:8,
from ../drivers/net/sxe/pf/sxe_stats.c:5:../drivers/net/sxe/pf/sxe_stats.c: In function ‘sxe_xstats_get’:../drivers/net/sxe/pf/sxe_stats.c:237:60: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘unsigned int’ [-Wformat=]
237 | SXE_XSTAT_MAC_CNT, SXE_XSTAT_FC_CNT);
| ^../lib/log/rte_log.h:334:39: note: in definition of macro ‘RTE_LOG’
334 | RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
| ^../drivers/net/sxe/base/sxe_logs.h:144:17: note: in expansion of macro ‘RTE_LOG_LINE_PREFIX’
144 | RTE_LOG_LINE_PREFIX(INFO, logtype, "%s(): ",\
| ^~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.c:235:9: note: in expansion of macro ‘PMD_LOG_INFO’
235 | PMD_LOG_INFO(DRV, "xstat size:%u. hw xstat field cnt: %" SXE_PRIU64
| ^~~~~~~~~~~~../drivers/net/sxe/pf/sxe_stats.c:237:60: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat=]
237 | SXE_XSTAT_MAC_CNT, SXE_XSTAT_FC_CNT);
| ^../lib/log/rte_log.h:334:39: note: in definition of macro ‘RTE_LOG’
334 | RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
| ^../drivers/net/sxe/base/sxe_logs.h:144:17: note: in expansion of macro ‘RTE_LOG_LINE_PREFIX’
144 | RTE_LOG_LINE_PREFIX(INFO, logtype, "%s(): ",\
| ^~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.c:235:9: note: in expansion of macro ‘PMD_LOG_INFO’
235 | PMD_LOG_INFO(DRV, "xstat size:%u. hw xstat field cnt: %" SXE_PRIU64
| ^~~~~~~~~~~~../drivers/net/sxe/pf/sxe_stats.c: In function ‘sxe_xstats_names_get’:../drivers/net/sxe/pf/sxe_stats.c:349:60: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘unsigned int’ [-Wformat=]
349 | SXE_XSTAT_CNT, usr_cnt, ret);
| ^../lib/log/rte_log.h:334:39: note: in definition of macro ‘RTE_LOG’
334 | RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
| ^../drivers/net/sxe/base/sxe_logs.h:156:17: note: in expansion of macro ‘RTE_LOG_LINE_PREFIX’
156 | RTE_LOG_LINE_PREFIX(ERR, logtype, "%s(): ",\
| ^~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.c:348:17: note: in expansion of macro ‘PMD_LOG_ERR’
348 | PMD_LOG_ERR(DRV, "max: %" SXE_PRIU64 " usr_cnt:%u invalid.(err:%d)",
| ^~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.c: At top level:
../drivers/net/sxe/pf/sxe_stats.c:441:5: error: conflicting types for ‘sxe_xstats_get_by_id’; have ‘s32(struct rte_eth_dev *, const u64 *, u64 *, u32)’ {aka ‘int(struct rte_eth_dev *, const long long unsigned int *, long long unsigned int *, unsigned int)’}
441 | s32 sxe_xstats_get_by_id(struct rte_eth_dev *eth_dev,
| ^~~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.h:51:5: note: previous declaration of ‘sxe_xstats_get_by_id’ with type ‘s32(struct rte_eth_dev *, const ulong *, ulong *, u32)’ {aka ‘int(struct rte_eth_dev *, const long unsigned int *, long unsigned int *, unsigned int)’}
51 | s32 sxe_xstats_get_by_id(struct rte_eth_dev *eth_dev,
| ^~~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.c:484:5: error: conflicting types for ‘sxe_xstats_names_get_by_id’; have ‘s32(struct rte_eth_dev *, const u64 *, struct rte_eth_xstat_name *, u32)’ {aka ‘int(struct rte_eth_dev *, const long long unsigned int *, struct rte_eth_xstat_name *, unsigned int)’}
484 | s32 sxe_xstats_names_get_by_id(struct rte_eth_dev *eth_dev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_stats.h:61:5: note: previous declaration of ‘sxe_xstats_names_get_by_id’ with type ‘s32(struct rte_eth_dev *, const ulong *, struct rte_eth_xstat_name *, u32)’ {aka ‘int(struct rte_eth_dev *, const long unsigned int *, struct rte_eth_xstat_name *, unsigned int)’}
61 | s32 sxe_xstats_names_get_by_id(struct rte_eth_dev *eth_dev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../lib/eal/include/rte_dev.h:20,
from ../lib/eal/include/dev_driver.h:9,
from ../lib/ethdev/ethdev_driver.h:19,
from ../drivers/net/sxe/pf/sxe_tx.c:12:../drivers/net/sxe/pf/sxe_tx.c: In function ‘sxe_tx_function_set’:../drivers/net/sxe/pf/sxe_tx.c:75:69: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=]
75 | (unsigned long)txq->offloads);
| ^../lib/log/rte_log.h:334:39: note: in definition of macro ‘RTE_LOG’
334 | RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
| ^../drivers/net/sxe/base/sxe_logs.h:144:17: note: in expansion of macro ‘RTE_LOG_LINE_PREFIX’
144 | RTE_LOG_LINE_PREFIX(INFO, logtype, "%s(): ",\
| ^~~~~~~~~~~~~~~~~~~
../drivers/net/sxe/pf/sxe_tx.c:74:17: note: in expansion of macro ‘PMD_LOG_INFO’
74 | PMD_LOG_INFO(INIT, " - offloads = 0x%" SXE_PRIX64,
| ^~~~~~~~~~~~ninja: build stopped: subcommand failed.
Quoted 6 lines · On Thu, 24 Apr 2025 19:36:40 -0700 Jie Liu <[email protected]>…
From: JieLiu <[email protected]>
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
Signed-off-by Jie Liu <[email protected]>
Cross build for windows fails:
DPDK 25.07.0-rc0
User defined options
Cross files: config/x86/cross-mingw
examples : helloworld
Found ninja-1.12.1 at /usr/bin/ninja
FAILED: drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_main.c.obj
x86_64-w64-mingw32-gcc -Idrivers/libtmp_rte_net_sxe.a.p -Idrivers -I../drivers -Idrivers/net/sxe -I../drivers/net/sxe -I../drivers/net/sxe/base -I../drivers/net/sxe/pf -I../drivers/net/sxe/vf -I../drivers/net/sxe/include/sxe -I../drivers/net/sxe/include -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/windows/include -I../lib/eal/windows/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal -I../lib/eal -Ilib/log -I../lib/log -Ilib/kvargs -I../lib/kvargs -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/windows -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -D_WIN32_WINNT=0x0A00 -D__USE_MINGW_ANSI_STDIO -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -DSXE_DPDK -DSXE_HOST_DRIVER -DSXE_DPDK_L4_FEATURES -DSXE_DPDK_SRIOV -DSXE_DPDK_SIMD -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe -MD -MQ drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_main.c.obj -MF drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_main.c.obj.d -o drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_main.c.obj -c ../drivers/net/sxe/pf/sxe_main.c In file included from ../drivers/net/sxe/base/sxe_hw.h:13,
from ../drivers/net/sxe/pf/sxe_main.c:30:
../drivers/net/sxe/base/sxe_compat_platform.h:32:9: warning: "min" redefined
32 | #define min(a, b) RTE_MIN(a, b)
| ^~~
In file included from /usr/share/mingw-w64/include/windef.h:9,
from /usr/share/mingw-w64/include/windows.h:69,
from ../lib/eal/windows/include/rte_windows.h:28,
from ../lib/eal/windows/include/pthread.h:17,
from ../lib/ethdev/ethdev_driver.h:17,
from ../drivers/net/sxe/pf/sxe_main.c:23:
/usr/share/mingw-w64/include/minwindef.h:177:9: note: this is the location of the previous definition
177 | #define min(a, b) (((a) < (b)) ? (a) : (b))
| ^~~
In file included from ../drivers/net/sxe/base/sxe_hw.h:16:
../drivers/net/sxe/sxe_drv_type.h:21:14: error: conflicting types for ‘BOOL’; have ‘_Bool’
21 | typedef bool BOOL;
| ^~~~/usr/share/mingw-w64/include/minwindef.h:131:15: note: previous declaration of ‘BOOL’ with type ‘BOOL’ {aka ‘int’}
131 | typedef int BOOL;
| ^~~~
In file included from ../drivers/net/sxe/pf/sxe.h:16,
from ../drivers/net/sxe/pf/sxe_ethdev.h:8,
from ../drivers/net/sxe/pf/sxe_main.c:31:
../drivers/net/sxe/pf/sxe_stats.h:52:47: error: unknown type name ‘ulong’; did you mean ‘u_long’?
52 | const ulong *ids,
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:53:41: error: unknown type name ‘ulong’; did you mean ‘u_long’?
53 | ulong *values, u32 usr_cnt);
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:62:15: error: unknown type name ‘ulong’; did you mean ‘u_long’?
62 | const ulong *ids,
| ^~~~~
| u_long
FAILED: drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_filter.c.obj
x86_64-w64-mingw32-gcc -Idrivers/libtmp_rte_net_sxe.a.p -Idrivers -I../drivers -Idrivers/net/sxe -I../drivers/net/sxe -I../drivers/net/sxe/base -I../drivers/net/sxe/pf -I../drivers/net/sxe/vf -I../drivers/net/sxe/include/sxe -I../drivers/net/sxe/include -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/windows/include -I../lib/eal/windows/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal -I../lib/eal -Ilib/log -I../lib/log -Ilib/kvargs -I../lib/kvargs -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/windows -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -D_WIN32_WINNT=0x0A00 -D__USE_MINGW_ANSI_STDIO -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -DSXE_DPDK -DSXE_HOST_DRIVER -DSXE_DPDK_L4_FEATURES -DSXE_DPDK_SRIOV -DSXE_DPDK_SIMD -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe -MD -MQ drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_filter.c.obj -MF drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_filter.c.obj.d -o drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_filter.c.obj -c ../drivers/net/sxe/pf/sxe_filter.c
In file included from ../drivers/net/sxe/base/sxe_hw.h:13,
from ../drivers/net/sxe/pf/sxe_filter.h:17,
from ../drivers/net/sxe/pf/sxe_filter.c:19:
../drivers/net/sxe/base/sxe_compat_platform.h:32:9: warning: "min" redefined
32 | #define min(a, b) RTE_MIN(a, b)
| ^~~
In file included from /usr/share/mingw-w64/include/windef.h:9,
from /usr/share/mingw-w64/include/windows.h:69,
from ../lib/eal/windows/include/rte_windows.h:28,
from ../lib/eal/windows/include/pthread.h:17,
from ../lib/ethdev/ethdev_driver.h:17,
from ../drivers/net/sxe/pf/sxe_filter.c:12:
/usr/share/mingw-w64/include/minwindef.h:177:9: note: this is the location of the previous definition
177 | #define min(a, b) (((a) < (b)) ? (a) : (b))
| ^~~
In file included from ../drivers/net/sxe/base/sxe_hw.h:16:
../drivers/net/sxe/sxe_drv_type.h:21:14: error: conflicting types for ‘BOOL’; have ‘_Bool’
21 | typedef bool BOOL;
| ^~~~/usr/share/mingw-w64/include/minwindef.h:131:15: note: previous declaration of ‘BOOL’ with type ‘BOOL’ {aka ‘int’}
131 | typedef int BOOL;
| ^~~~
In file included from ../drivers/net/sxe/pf/sxe.h:16,
from ../drivers/net/sxe/pf/sxe_filter.c:21:
../drivers/net/sxe/pf/sxe_stats.h:52:47: error: unknown type name ‘ulong’; did you mean ‘u_long’?
52 | const ulong *ids,
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:53:41: error: unknown type name ‘ulong’; did you mean ‘u_long’?
53 | ulong *values, u32 usr_cnt);
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:62:15: error: unknown type name ‘ulong’; did you mean ‘u_long’?
62 | const ulong *ids,
| ^~~~~
| u_long
FAILED: drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_flow_ctrl.c.obj
x86_64-w64-mingw32-gcc -Idrivers/libtmp_rte_net_sxe.a.p -Idrivers -I../drivers -Idrivers/net/sxe -I../drivers/net/sxe -I../drivers/net/sxe/base -I../drivers/net/sxe/pf -I../drivers/net/sxe/vf -I../drivers/net/sxe/include/sxe -I../drivers/net/sxe/include -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/windows/include -I../lib/eal/windows/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal -I../lib/eal -Ilib/log -I../lib/log -Ilib/kvargs -I../lib/kvargs -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/windows -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -D_WIN32_WINNT=0x0A00 -D__USE_MINGW_ANSI_STDIO -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -DSXE_DPDK -DSXE_HOST_DRIVER -DSXE_DPDK_L4_FEATURES -DSXE_DPDK_SRIOV -DSXE_DPDK_SIMD -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe -MD -MQ drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_flow_ctrl.c.obj -MF drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_flow_ctrl.c.obj.d -o drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_flow_ctrl.c.obj -c ../drivers/net/sxe/pf/sxe_flow_ctrl.c
In file included from ../drivers/net/sxe/base/sxe_hw.h:13,
from ../drivers/net/sxe/pf/sxe_filter.h:17,
from ../drivers/net/sxe/pf/sxe.h:14,
from ../drivers/net/sxe/pf/sxe_flow_ctrl.c:5:
../drivers/net/sxe/base/sxe_compat_platform.h:32:9: warning: "min" redefined
32 | #define min(a, b) RTE_MIN(a, b)
| ^~~
In file included from /usr/share/mingw-w64/include/windef.h:9,
from /usr/share/mingw-w64/include/windows.h:69,
from ../lib/eal/windows/include/rte_windows.h:28,
from ../lib/eal/windows/include/pthread.h:17,
from ../lib/ethdev/ethdev_driver.h:17,
from ../drivers/net/sxe/pf/sxe_filter.h:13:
/usr/share/mingw-w64/include/minwindef.h:177:9: note: this is the location of the previous definition
177 | #define min(a, b) (((a) < (b)) ? (a) : (b))
| ^~~
In file included from ../drivers/net/sxe/base/sxe_hw.h:16:
../drivers/net/sxe/sxe_drv_type.h:21:14: error: conflicting types for ‘BOOL’; have ‘_Bool’
21 | typedef bool BOOL;
| ^~~~/usr/share/mingw-w64/include/minwindef.h:131:15: note: previous declaration of ‘BOOL’ with type ‘BOOL’ {aka ‘int’}
131 | typedef int BOOL;
| ^~~~
In file included from ../drivers/net/sxe/pf/sxe.h:16:../drivers/net/sxe/pf/sxe_stats.h:52:47: error: unknown type name ‘ulong’; did you mean ‘u_long’?
52 | const ulong *ids,
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:53:41: error: unknown type name ‘ulong’; did you mean ‘u_long’?
53 | ulong *values, u32 usr_cnt);
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:62:15: error: unknown type name ‘ulong’; did you mean ‘u_long’?
62 | const ulong *ids,
| ^~~~~
| u_long
FAILED: drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_irq.c.obj
x86_64-w64-mingw32-gcc -Idrivers/libtmp_rte_net_sxe.a.p -Idrivers -I../drivers -Idrivers/net/sxe -I../drivers/net/sxe -I../drivers/net/sxe/base -I../drivers/net/sxe/pf -I../drivers/net/sxe/vf -I../drivers/net/sxe/include/sxe -I../drivers/net/sxe/include -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/windows/include -I../lib/eal/windows/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal -I../lib/eal -Ilib/log -I../lib/log -Ilib/kvargs -I../lib/kvargs -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/windows -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -D_WIN32_WINNT=0x0A00 -D__USE_MINGW_ANSI_STDIO -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -DSXE_DPDK -DSXE_HOST_DRIVER -DSXE_DPDK_L4_FEATURES -DSXE_DPDK_SRIOV -DSXE_DPDK_SIMD -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.sxe -MD -MQ drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_irq.c.obj -MF drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_irq.c.obj.d -o drivers/libtmp_rte_net_sxe.a.p/net_sxe_pf_sxe_irq.c.obj -c ../drivers/net/sxe/pf/sxe_irq.c
In file included from ../drivers/net/sxe/pf/sxe_irq.h:15,
from ../drivers/net/sxe/pf/sxe_irq.c:23:
../drivers/net/sxe/base/sxe_compat_platform.h:32:9: warning: "min" redefined
32 | #define min(a, b) RTE_MIN(a, b)
| ^~~
In file included from /usr/share/mingw-w64/include/windef.h:9,
from /usr/share/mingw-w64/include/windows.h:69,
from /usr/share/mingw-w64/include/winsock2.h:23,
from /usr/share/mingw-w64/include/ws2tcpip.h:17,
from ../lib/net/rte_ip4.h:21,
from ../lib/net/rte_ip.h:9,
from ../lib/ethdev/rte_flow.h:25,
from ../lib/ethdev/rte_eth_ctrl.h:11,
from ../lib/ethdev/rte_ethdev.h:1472,
from ../drivers/net/sxe/pf/sxe_irq.c:4:
/usr/share/mingw-w64/include/minwindef.h:177:9: note: this is the location of the previous definition
177 | #define min(a, b) (((a) < (b)) ? (a) : (b))
| ^~~
In file included from ../drivers/net/sxe/base/sxe_hw.h:16,
from ../drivers/net/sxe/pf/sxe_irq.c:26:
../drivers/net/sxe/sxe_drv_type.h:21:14: error: conflicting types for ‘BOOL’; have ‘_Bool’
21 | typedef bool BOOL;
| ^~~~/usr/share/mingw-w64/include/minwindef.h:131:15: note: previous declaration of ‘BOOL’ with type ‘BOOL’ {aka ‘int’}
131 | typedef int BOOL;
| ^~~~
In file included from ../drivers/net/sxe/pf/sxe.h:16,
from ../drivers/net/sxe/pf/sxe_irq.c:27:
../drivers/net/sxe/pf/sxe_stats.h:52:47: error: unknown type name ‘ulong’; did you mean ‘u_long’?
52 | const ulong *ids,
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:53:41: error: unknown type name ‘ulong’; did you mean ‘u_long’?
53 | ulong *values, u32 usr_cnt);
| ^~~~~
| u_long
../drivers/net/sxe/pf/sxe_stats.h:62:15: error: unknown type name ‘ulong’; did you mean ‘u_long’?
62 | const ulong *ids,
| ^~~~~
| u_longninja: build stopped: subcommand failed.
PATCH v2 1/14 net/sxe: add base driver directory and doc Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
In reply to Jie Liu--- MAINTAINERS | 6 +++ doc/guides/nics/features/sxe.ini | 80 +++++++++++++++++++++++++++++ doc/guides/nics/features/sxe_vf.ini | 39 ++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sxe.rst | 71 +++++++++++++++++++++++++ drivers/net/sxe/meson.build | 9 ++++ drivers/net/sxe/pf/sxe_ethdev.c | 3 ++ drivers/net/sxe/pf/sxe_ethdev.h | 3 ++ 8 files changed, 212 insertions(+) create mode 100644 doc/guides/nics/features/sxe.ini create mode 100644 doc/guides/nics/features/sxe_vf.ini create mode 100644 doc/guides/nics/sxe.rst create mode 100644 drivers/net/sxe/meson.build create mode 100644 drivers/net/sxe/pf/sxe_ethdev.c create mode 100644 drivers/net/sxe/pf/sxe_ethdev.h
MAINTAINERS +6 -0
@@ -2055,3 +2055,9 @@ F: examples/vmdq/ F: doc/guides/sample_app_ug/vmdq_forwarding.rst F: examples/vmdq_dcb/ F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst + +Linkdata sxe +M: Jie Li <[email protected]> +F: drivers/net/sxe/ +F: doc/guides/nics/sxe.rst +F: doc/guides/nics/features/sxe*.ini
doc/guides/nics/features/sxe.ini new file +80 -0
80 lines not on this page · raw message
doc/guides/nics/features/sxe_vf.ini new file +39 -0
@@ -0,0 +1,39 @@ +; +; Supported features of the 'sxe_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Link status = Y +Rx interrupt = Y +Power mgmt address monitor = Y +MTU update = Y +Scattered Rx = Y +LRO = Y +TSO = Y +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 +CRC offload = P +VLAN offload = P +QinQ offload = P +L3 checksum offload = P +L4 checksum offload = P +Inner L3 checksum = P +Inner L4 checksum = P +Packet type parsing = Y +Rx descriptor status = Y +Tx descriptor status = Y +Basic stats = Y +Extended stats = Y +Registers dump = Y +FreeBSD = Y +Linux = Y +ARMv8 = Y +x86-32 = Y +x86-64 = Y
doc/guides/nics/index.rst +1 -0
@@ -72,3 +72,4 @@ Network Interface Controller Drivers vmxnet3 xsc zxdh + sxe
doc/guides/nics/sxe.rst new file +71 -0
71 lines not on this page · raw message
drivers/net/sxe/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C), 2020, Wuxi Stars Micro System Technologies Co., Ltd. + +deps += ['hash'] +sources = files( + 'pf/sxe_ethdev.c', +) + +includes += include_directories('pf')
drivers/net/sxe/pf/sxe_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
drivers/net/sxe/pf/sxe_ethdev.h new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
Signature · 1 line
2.18.4
PATCH v3 1/14 net/sxe: add base driver directory and doc
Adding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
--- MAINTAINERS | 6 +++ doc/guides/nics/features/sxe.ini | 80 +++++++++++++++++++++++++++++ doc/guides/nics/features/sxe_vf.ini | 39 ++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sxe.rst | 71 +++++++++++++++++++++++++ drivers/net/sxe/meson.build | 9 ++++ drivers/net/sxe/pf/sxe_ethdev.c | 3 ++ drivers/net/sxe/pf/sxe_ethdev.h | 3 ++ 8 files changed, 212 insertions(+) create mode 100644 doc/guides/nics/features/sxe.ini create mode 100644 doc/guides/nics/features/sxe_vf.ini create mode 100644 doc/guides/nics/sxe.rst create mode 100644 drivers/net/sxe/meson.build create mode 100644 drivers/net/sxe/pf/sxe_ethdev.c create mode 100644 drivers/net/sxe/pf/sxe_ethdev.h
MAINTAINERS +6 -0
@@ -2055,3 +2055,9 @@ F: examples/vmdq/ F: doc/guides/sample_app_ug/vmdq_forwarding.rst F: examples/vmdq_dcb/ F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst + +Linkdata sxe +M: Jie Li <[email protected]> +F: drivers/net/sxe/ +F: doc/guides/nics/sxe.rst +F: doc/guides/nics/features/sxe*.ini
doc/guides/nics/features/sxe.ini new file +80 -0
80 lines not on this page · raw message
doc/guides/nics/features/sxe_vf.ini new file +39 -0
@@ -0,0 +1,39 @@ +; +; Supported features of the 'sxe_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Link status = Y +Rx interrupt = Y +Power mgmt address monitor = Y +MTU update = Y +Scattered Rx = Y +LRO = Y +TSO = Y +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 +CRC offload = P +VLAN offload = P +QinQ offload = P +L3 checksum offload = P +L4 checksum offload = P +Inner L3 checksum = P +Inner L4 checksum = P +Packet type parsing = Y +Rx descriptor status = Y +Tx descriptor status = Y +Basic stats = Y +Extended stats = Y +Registers dump = Y +FreeBSD = Y +Linux = Y +ARMv8 = Y +x86-32 = Y +x86-64 = Y
doc/guides/nics/index.rst +1 -0
@@ -72,3 +72,4 @@ Network Interface Controller Drivers vmxnet3 xsc zxdh + sxe
doc/guides/nics/sxe.rst new file +71 -0
71 lines not on this page · raw message
drivers/net/sxe/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C), 2020, Wuxi Stars Micro System Technologies Co., Ltd. + +deps += ['hash'] +sources = files( + 'pf/sxe_ethdev.c', +) + +includes += include_directories('pf')
drivers/net/sxe/pf/sxe_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
drivers/net/sxe/pf/sxe_ethdev.h new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
Signature · 1 line
2.18.4
PATCH v3 2/14 net/sxe: add ethdev probe and remove
Add basic modules: logs、 hardware communication、common components and support basic PCIe ethdev probe and remove.
--- doc/guides/nics/features/sxe.ini | 1 - doc/guides/nics/features/sxe_vf.ini | 1 - drivers/net/sxe/Makefile | 66 + drivers/net/sxe/base/sxe_common.c | 64 + drivers/net/sxe/base/sxe_common.h | 15 + drivers/net/sxe/base/sxe_compat_platform.h | 137 + drivers/net/sxe/base/sxe_compat_version.h | 38 + drivers/net/sxe/base/sxe_errno.h | 61 + drivers/net/sxe/base/sxe_hw.c | 6260 ++++++++++++++++++++ drivers/net/sxe/base/sxe_hw.h | 1541 +++++ drivers/net/sxe/base/sxe_logs.h | 273 + drivers/net/sxe/base/sxe_types.h | 40 + drivers/net/sxe/include/drv_msg.h | 18 + drivers/net/sxe/include/sxe/sxe_hdc.h | 42 + drivers/net/sxe/include/sxe/sxe_msg.h | 135 + drivers/net/sxe/include/sxe/sxe_regs.h | 1280 ++++ drivers/net/sxe/include/sxe_version.h | 29 + drivers/net/sxe/meson.build | 15 +- drivers/net/sxe/pf/sxe.h | 56 + drivers/net/sxe/pf/sxe_ethdev.c | 324 +- drivers/net/sxe/pf/sxe_ethdev.h | 27 +- drivers/net/sxe/pf/sxe_irq.c | 126 + drivers/net/sxe/pf/sxe_irq.h | 41 + drivers/net/sxe/pf/sxe_main.c | 251 + drivers/net/sxe/pf/sxe_phy.h | 38 + drivers/net/sxe/pf/sxe_pmd_hdc.c | 683 +++ drivers/net/sxe/pf/sxe_pmd_hdc.h | 44 + drivers/net/sxe/sxe_drv_type.h | 23 + 28 files changed, 11624 insertions(+), 5 deletions(-) create mode 100644 drivers/net/sxe/Makefile create mode 100644 drivers/net/sxe/base/sxe_common.c create mode 100644 drivers/net/sxe/base/sxe_common.h create mode 100644 drivers/net/sxe/base/sxe_compat_platform.h create mode 100644 drivers/net/sxe/base/sxe_compat_version.h create mode 100644 drivers/net/sxe/base/sxe_errno.h create mode 100644 drivers/net/sxe/base/sxe_hw.c create mode 100644 drivers/net/sxe/base/sxe_hw.h create mode 100644 drivers/net/sxe/base/sxe_logs.h create mode 100644 drivers/net/sxe/base/sxe_types.h create mode 100644 drivers/net/sxe/include/drv_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_hdc.h create mode 100644 drivers/net/sxe/include/sxe/sxe_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_regs.h create mode 100644 drivers/net/sxe/include/sxe_version.h create mode 100644 drivers/net/sxe/pf/sxe.h create mode 100644 drivers/net/sxe/pf/sxe_irq.c create mode 100644 drivers/net/sxe/pf/sxe_irq.h create mode 100644 drivers/net/sxe/pf/sxe_main.c create mode 100644 drivers/net/sxe/pf/sxe_phy.h create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.c create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.h create mode 100644 drivers/net/sxe/sxe_drv_type.h
doc/guides/nics/features/sxe.ini +0 -1
@@ -50,7 +50,6 @@ EEPROM dump = Y Module EEPROM dump = Y Registers dump = Y Multiprocess aware = Y -FreeBSD = Y Linux = Y ARMv8 = Y x86-32 = Y
doc/guides/nics/features/sxe_vf.ini +0 -1
@@ -32,7 +32,6 @@ Tx descriptor status = Y Basic stats = Y Extended stats = Y Registers dump = Y -FreeBSD = Y Linux = Y ARMv8 = Y x86-32 = Y
drivers/net/sxe/Makefile new file +66 -0
66 lines not on this page · raw message
drivers/net/sxe/base/sxe_common.c new file +64 -0
64 lines not on this page · raw message
drivers/net/sxe/base/sxe_common.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifndef __SXE_DPDK_COMMON_H__ +#define __SXE_DPDK_COMMON_H__ + +u64 sxe_trace_id_gen (void ); + +void sxe_trace_id_clean (void ); + +u64 sxe_trace_id_get (void ); + +u64 sxe_time_get_real_ms (void ); + +#endif
drivers/net/sxe/base/sxe_compat_platform.h new file +137 -0
137 lines not on this page · raw message
drivers/net/sxe/base/sxe_compat_version.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_COMPAT_VERSION_H__ +#define __SXE_COMPAT_VERSION_H__ + +#include <stdbool.h> +#include "sxe_dpdk_version.h" + +struct rte_eth_dev ; +enum rte_eth_event_type ; + +int sxe_eth_dev_callback_process (struct rte_eth_dev *dev, +enum rte_eth_event_type event,void *ret_param); + +#define SET_AUTOFILL_QUEUE_XSTATS +#define PCI_REG_WC_WRITE + +#ifndef PCI_REG_WC_WRITE +#define rte_write32_wc rte_write32 +#define rte_write32_wc_relaxed rte_write32_relaxed +#endif + +#define SXE_PCI_INTR_HANDLE (pci_dev) \ + ((pci_dev)->intr_handle) +#define SXE_DEV_FNAV_CONF (dev) \ + (&((struct sxe_adapter *)(dev)->data->dev_private)->fnav_conf) +#define RTE_ADAPTER_HAVE_FNAV_CONF +#define SXE_GET_FRAME_SIZE (dev) \ + ((dev)->data->mtu + SXE_ETH_OVERHEAD) + +#define ETH_DEV_OPS_MONITOR + +#define DEV_RX_OFFLOAD_CHECKSUM RTE_ETH_RX_OFFLOAD_CHECKSUM +#define ETH_DCB_NUM_USER_PRIORITIES RTE_ETH_DCB_NUM_USER_PRIORITIES + +#endif
drivers/net/sxe/base/sxe_errno.h new file +61 -0
61 lines not on this page · raw message
drivers/net/sxe/base/sxe_hw.c new file +6260 -0
2,605 lines not on this page · raw message
drivers/net/sxe/base/sxe_hw.h new file +1541 -0
1,541 lines not on this page · raw message
drivers/net/sxe/base/sxe_logs.h new file +273 -0
273 lines not on this page · raw message
drivers/net/sxe/base/sxe_types.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/drv_msg.h new file +18 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe/sxe_hdc.h new file +42 -0
42 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_msg.h new file +135 -0
135 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_regs.h new file +1280 -0
1,280 lines not on this page · raw message
drivers/net/sxe/include/sxe_version.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe.h new file +56 -0
56 lines not on this page · raw message
drivers/net/sxe/pf/sxe_ethdev.c +323 -1
324 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.c new file +126 -0
126 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.h new file +41 -0
41 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c new file +251 -0
251 lines not on this page · raw message
drivers/net/sxe/pf/sxe_pmd_hdc.c new file +683 -0
683 lines not on this page · raw message
drivers/net/sxe/pf/sxe_pmd_hdc.h new file +44 -0
44 lines not on this page · raw message
drivers/net/sxe/sxe_drv_type.h new file +23 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v3 02/14] net/sxe: add ethdev probe and remove
Quoted 63 lines
drivers/net/sxe/Makefile new file +56
-0@@ -0,0 +1,66 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2016 Intel Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_sxe.a + +CFLAGS += -DSXE_DPDK +CFLAGS += -DSXE_HOST_DRIVER +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +EXPORT_MAP := rte_pmd_sxe_version.map + + +ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) +# +# CFLAGS for icc +# +CFLAGS_BASE_DRIVER = -diag-disable 174 -diag-disable 593 -diag-disable 869 +CFLAGS_BASE_DRIVER += -diag-disable 981 -diag-disable 2259 + +else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y) +# +# CFLAGS for clang +# +CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args + +else +# +# CFLAGS for gcc +# +CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args +CFLAGS_BASE_DRIVER += -Wmissing-prototypes + +endif +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash +LDLIBS += -lrte_bus_pci +LDLIBS += -lpthread + +# +# Add extra flags for base driver files (also known as shared code) +# to disable warnings in them +# + +$(shell cp $(SRCDIR)/pf/* $(SRCDIR)) +$(shell cp $(SRCDIR)/base/* $(SRCDIR)) +$(shell cp $(SRCDIR)/include/*.h $(SRCDIR)) +$(shell cp $(SRCDIR)/include/sxe/*.h $(SRCDIR)) +$(warning "file copy done")
drivers/net/sxe/Makefile line 66
Quoted 10 lines
drivers/net/sxe/Makefile new file +10
-0+ +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_hw.c + +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_irq.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c + +include $(RTE_SDK)/mk/rte.lib.mk
DPDK uses meson not make.
The ICC compiler is deprecated and removed.
PATCH v3 3/14 net/sxe: add tx rx setup and data path
In reply to Jie LiuAdd setup, initialization, and logic for tx and rx queues.
--- drivers/net/meson.build | 1 + drivers/net/sxe/Makefile | 11 + drivers/net/sxe/base/sxe_offload_common.c | 55 + drivers/net/sxe/base/sxe_offload_common.h | 15 + drivers/net/sxe/base/sxe_queue_common.c | 398 ++++++ drivers/net/sxe/base/sxe_queue_common.h | 240 ++++ drivers/net/sxe/base/sxe_rx_common.c | 243 ++++ drivers/net/sxe/base/sxe_rx_common.h | 20 + drivers/net/sxe/base/sxe_tx_common.c | 42 + drivers/net/sxe/base/sxe_tx_common.h | 12 + drivers/net/sxe/include/sxe_type.h | 796 +++++++++++ drivers/net/sxe/meson.build | 8 + drivers/net/sxe/pf/rte_pmd_sxe.h | 15 + drivers/net/sxe/pf/sxe.h | 1 + drivers/net/sxe/pf/sxe_ethdev.c | 200 +++ drivers/net/sxe/pf/sxe_irq.c | 258 ++++ drivers/net/sxe/pf/sxe_irq.h | 11 + drivers/net/sxe/pf/sxe_main.c | 7 + drivers/net/sxe/pf/sxe_offload.c | 40 + drivers/net/sxe/pf/sxe_offload.h | 18 + drivers/net/sxe/pf/sxe_queue.c | 777 +++++++++++ drivers/net/sxe/pf/sxe_queue.h | 133 ++ drivers/net/sxe/pf/sxe_rx.c | 1491 +++++++++++++++++++++ drivers/net/sxe/pf/sxe_rx.h | 194 +++ drivers/net/sxe/pf/sxe_tx.c | 1072 +++++++++++++++ drivers/net/sxe/pf/sxe_tx.h | 50 + drivers/net/sxe/rte_pmd_sxe_version.map | 5 + drivers/net/sxe/version.map | 5 + 28 files changed, 6118 insertions(+) create mode 100644 drivers/net/sxe/base/sxe_offload_common.c create mode 100644 drivers/net/sxe/base/sxe_offload_common.h create mode 100644 drivers/net/sxe/base/sxe_queue_common.c create mode 100644 drivers/net/sxe/base/sxe_queue_common.h create mode 100644 drivers/net/sxe/base/sxe_rx_common.c create mode 100644 drivers/net/sxe/base/sxe_rx_common.h create mode 100644 drivers/net/sxe/base/sxe_tx_common.c create mode 100644 drivers/net/sxe/base/sxe_tx_common.h create mode 100644 drivers/net/sxe/include/sxe_type.h create mode 100644 drivers/net/sxe/pf/rte_pmd_sxe.h create mode 100644 drivers/net/sxe/pf/sxe_offload.c create mode 100644 drivers/net/sxe/pf/sxe_offload.h create mode 100644 drivers/net/sxe/pf/sxe_queue.c create mode 100644 drivers/net/sxe/pf/sxe_queue.h create mode 100644 drivers/net/sxe/pf/sxe_rx.c create mode 100644 drivers/net/sxe/pf/sxe_rx.h create mode 100644 drivers/net/sxe/pf/sxe_tx.c create mode 100644 drivers/net/sxe/pf/sxe_tx.h create mode 100644 drivers/net/sxe/rte_pmd_sxe_version.map create mode 100644 drivers/net/sxe/version.map
drivers/net/meson.build +1 -0
@@ -64,6 +64,7 @@ drivers = [ 'vmxnet3', 'xsc', 'zxdh', + 'sxe', ] std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc std_deps += ['bus_pci'] # very many PMDs depend on PCI, so make std
drivers/net/sxe/Makefile +11 -0
@@ -57,10 +57,21 @@ $(warning "file copy done") SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_hw.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_irq.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c + +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/sxe/base/sxe_offload_common.c new file +55 -0
55 lines not on this page · raw message
drivers/net/sxe/base/sxe_offload_common.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_OFFLOAD_COMMON_H__ +#define __SXE_OFFLOAD_COMMON_H__ + +u64 __sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 __sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev); + +u64 __sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); + +#endif +
drivers/net/sxe/base/sxe_queue_common.c new file +398 -0
398 lines not on this page · raw message
drivers/net/sxe/base/sxe_queue_common.h new file +240 -0
240 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.c new file +243 -0
243 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_RX_COMMON_H__ +#define __SXE_RX_COMMON_H__ + +#include "sxe_dpdk_version.h" + +void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev, +bool rx_batch_alloc_allowed,bool *rx_vec_allowed); + +s32 __sxe_rx_descriptor_status (void *rx_queue,u16 offset); + +u16 __sxe_pkts_recv (void *rx_queue,struct rte_mbuf **rx_pkts, +u16 pkts_num); + +const u32 *__sxe_dev_supported_ptypes_get (struct rte_eth_dev *dev,size_t *no_of_elements); +#endif +
drivers/net/sxe/base/sxe_tx_common.c new file +42 -0
42 lines not on this page · raw message
drivers/net/sxe/base/sxe_tx_common.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_TX_COMMON_H__ +#define __SXE_TX_COMMON_H__ + +int __sxe_tx_descriptor_status (void *tx_queue,u16 offset); + +u16 __sxe_pkts_xmit_with_offload (void *tx_queue,struct rte_mbuf **tx_pkts,u16 pkts_num); + +#endif
drivers/net/sxe/include/sxe_type.h new file +796 -0
796 lines not on this page · raw message
drivers/net/sxe/meson.build +8 -0
@@ -11,7 +11,15 @@ sources = files( 'pf/sxe_main.c', 'pf/sxe_irq.c', 'pf/sxe_ethdev.c', + 'pf/sxe_offload.c', + 'pf/sxe_queue.c', + 'pf/sxe_rx.c', + 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', + 'base/sxe_queue_common.c', + 'base/sxe_rx_common.c', + 'base/sxe_tx_common.c', + 'base/sxe_offload_common.c', 'base/sxe_common.c', 'base/sxe_hw.c', )
drivers/net/sxe/pf/rte_pmd_sxe.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __PMD_SXE_H__ +#define __PMD_SXE_H__ + +typedef uint8_t u8 ; +typedef uint16_t u16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; + +s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on); +#endif +
drivers/net/sxe/pf/sxe.h +1 -0
@@ -44,6 +44,7 @@ struct sxe_adapter {struct sxe_irq_context irq_ctxt; +bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ]; };
drivers/net/sxe/pf/sxe_ethdev.c +200 -0
274 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.c +258 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.h +11 -0
@@ -35,7 +35,18 @@ void sxe_event_irq_delayed_handler(void *param);void sxe_irq_init (struct rte_eth_dev *eth_dev); +s32 sxe_irq_configure (struct rte_eth_dev *dev); + +void sxe_irq_enable (struct rte_eth_dev *eth_dev); + +void sxe_irq_disable (struct rte_eth_dev *eth_dev); +void sxe_irq_uninit (struct rte_eth_dev *eth_dev); +s32 sxe_rx_queue_intr_enable (struct rte_eth_dev *eth_dev,u16 queue_id); + +s32 sxe_rx_queue_intr_disable (struct rte_eth_dev *eth_dev,u16 queue_id); + +void sxe_irq_vec_free (struct rte_intr_handle *handle);#endif
drivers/net/sxe/pf/sxe_main.c +7 -0
@@ -20,9 +20,11 @@#include "sxe_ethdev.h" #include "sxe.h" #include "drv_msg.h" +#include "sxe_queue.h" #include "sxe_errno.h" #include "sxe_compat_platform.h" #include "sxe_pmd_hdc.h" +#include "sxe_queue.h" static const struct rte_pci_id sxe_pci_tbl[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_STARS ,SXE_DEV_ID_ASIC ) },
@@ -164,10 +166,15 @@ s32 sxe_hw_reset(struct sxe_hw *hw) {s32 ret; +/* Rx DBU off */ +sxe_hw_rx_cap_switch_off (hw); +sxe_hw_all_irq_disable (hw);sxe_hw_pending_irq_read_clear (hw); +sxe_hw_all_ring_disable (hw,SXE_HW_TXRX_RING_NUM_MAX ); + ret =sxe_mng_reset (hw, false);if (ret) {PMD_LOG_ERR (INIT ,"mng reset disable failed, ret=%d" , ret);
drivers/net/sxe/pf/sxe_offload.c new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#include "sxe_dpdk_version.h" +#include <ethdev_driver.h> + +#include "sxe.h" +#include "sxe_offload.h" +#include "sxe_logs.h" +#include "sxe_compat_version.h" +#include "sxe_queue_common.h" +#include "sxe_offload_common.h" + +#define SXE_4_BIT_WIDTH (CHAR_BIT / 2) +#define SXE_4_BIT_MASK RTE_LEN2MASK(SXE_4_BIT_WIDTH, u8) +#define SXE_8_BIT_WIDTH CHAR_BIT +#define SXE_8_BIT_MASK UINT8_MAX + +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev) +{ +return __sxe_rx_queue_offload_capa_get (dev); +} + +u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev) +{ +return __sxe_rx_port_offload_capa_get (dev); +} + +u64 sxe_tx_queue_offload_capa_get (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); + +return 0 ; +} + +u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev) +{ +return __sxe_tx_port_offload_capa_get (dev); +} +
drivers/net/sxe/pf/sxe_offload.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_OFFLOAD_H__ +#define __SXE_OFFLOAD_H__ + +#include "sxe_hw.h" + +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_tx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); + +#endif
drivers/net/sxe/pf/sxe_queue.c new file +777 -0
458 lines not on this page · raw message
drivers/net/sxe/pf/sxe_queue.h new file +133 -0
133 lines not on this page · raw message
drivers/net/sxe/pf/sxe_rx.c new file +1491 -0
1,491 lines not on this page · raw message
drivers/net/sxe/pf/sxe_rx.h new file +194 -0
194 lines not on this page · raw message
drivers/net/sxe/pf/sxe_tx.c new file +1072 -0
1,072 lines not on this page · raw message
drivers/net/sxe/pf/sxe_tx.h new file +50 -0
50 lines not on this page · raw message
drivers/net/sxe/rte_pmd_sxe_version.map new file +5 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
PATCH v3 4/14 net/sxe: add link, flow ctrl, mac ops, mtu ops function
In reply to Jie LiuAdd link, flow ctrl, mac ops, mtu ops function.
--- drivers/net/sxe/Makefile | 3 + drivers/net/sxe/meson.build | 3 + drivers/net/sxe/pf/sxe.h | 11 + drivers/net/sxe/pf/sxe_ethdev.c | 443 +++++++++++++- drivers/net/sxe/pf/sxe_filter.c | 274 +++++++++ drivers/net/sxe/pf/sxe_filter.h | 55 ++ drivers/net/sxe/pf/sxe_flow_ctrl.c | 98 +++ drivers/net/sxe/pf/sxe_flow_ctrl.h | 16 + drivers/net/sxe/pf/sxe_irq.c | 147 ++++- drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_phy.c | 932 +++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_phy.h | 77 +++ 12 files changed, 2051 insertions(+), 10 deletions(-) create mode 100644 drivers/net/sxe/pf/sxe_filter.c create mode 100644 drivers/net/sxe/pf/sxe_filter.h create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.c create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.h create mode 100644 drivers/net/sxe/pf/sxe_phy.c
drivers/net/sxe/Makefile +3 -0
@@ -63,9 +63,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_flow_ctrl.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_irq.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_phy.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c
drivers/net/sxe/meson.build +3 -0
@@ -9,6 +9,8 @@ cflags += ['-DSXE_HOST_DRIVER'] deps += ['hash'] sources = files( 'pf/sxe_main.c', + 'pf/sxe_filter.c', + 'pf/sxe_flow_ctrl.c', 'pf/sxe_irq.c', 'pf/sxe_ethdev.c', 'pf/sxe_offload.c',
@@ -16,6 +18,7 @@ sources = files( 'pf/sxe_rx.c', 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', + 'pf/sxe_phy.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c',
drivers/net/sxe/pf/sxe.h +11 -0
@@ -43,9 +43,20 @@ struct sxe_adapter {struct sxe_hw hw;struct sxe_irq_context irq_ctxt; +struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ]; + +u32 mtu; + +RTE_ATOMIC (bool )link_thread_running; +RTE_ATOMIC (bool )is_stopping; +rte_thread_t link_thread_tid; +rte_atomic32_t link_thread_running; +rte_atomic32_t is_stopping; +pthread_t link_thread_tid; +bool is_stopped; };s32 sxe_hw_reset (struct sxe_hw *hw);
drivers/net/sxe/pf/sxe_ethdev.c +437 -6
606 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.c new file +274 -0
274 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h new file +55 -0
55 lines not on this page · raw message
drivers/net/sxe/pf/sxe_flow_ctrl.c new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe/pf/sxe_flow_ctrl.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_FLOW_CTRL_H__ +#define __SXE_FLOW_CTRL_H__ + +s32 sxe_flow_ctrl_enable (struct rte_eth_dev *dev); + +s32 sxe_flow_ctrl_get (struct rte_eth_dev *dev, +struct rte_eth_fc_conf *fc_conf); + +s32 sxe_flow_ctrl_set (struct rte_eth_dev *dev, +struct rte_eth_fc_conf *fc_conf); + +#endif
drivers/net/sxe/pf/sxe_irq.c +143 -4
182 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -201,6 +201,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) { +sxe_fc_autoneg_localcap_set (hw); + hw->mac.auto_restart = true;PMD_LOG_INFO (INIT ,"auto_restart:%u." , hw->mac.auto_restart); }
drivers/net/sxe/pf/sxe_phy.c new file +932 -0
932 lines not on this page · raw message
drivers/net/sxe/pf/sxe_phy.h +77 -0
82 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v3 5/14 net/sxe: support vlan filter
In reply to Jie LiuSupport vlan filter.
--- drivers/net/sxe/base/sxe_offload_common.c | 4 + drivers/net/sxe/pf/sxe.h | 5 +- drivers/net/sxe/pf/sxe_filter.c | 277 ++++++++++++++++++++++ drivers/net/sxe/pf/sxe_filter.h | 13 + drivers/net/sxe/pf/sxe_main.c | 2 + 5 files changed, 300 insertions(+), 1 deletion(-)
drivers/net/sxe/base/sxe_offload_common.c +4 -0
@@ -14,6 +14,8 @@ u64 __sxe_rx_queue_offload_capa_get(struct rte_eth_dev *dev)u64 offloads =0 ; + offloads |=RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; +return offloads; }
@@ -28,6 +30,8 @@ u64 __sxe_rx_port_offload_capa_get(struct rte_eth_dev *dev)#ifdef DEV_RX_JUMBO_FRAME DEV_RX_OFFLOAD_JUMBO_FRAME | #endif +RTE_ETH_RX_OFFLOAD_VLAN_FILTER | +RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |RTE_ETH_RX_OFFLOAD_SCATTER ;if (!RTE_ETH_DEV_SRIOV (dev).active)
drivers/net/sxe/pf/sxe.h +4 -1
@@ -6,7 +6,7 @@#include <rte_pci.h> #include <rte_time.h> - +#include "sxe_filter.h" #include <stdbool.h> #include "sxe_types.h" #include "sxe_irq.h"
@@ -14,6 +14,7 @@#include "sxe_hw.h" struct sxe_hw ; +struct sxe_vlan_context ;#define SXE_LPBK_DISABLED 0x0#define SXE_LPBK_ENABLED 0x1
@@ -43,6 +44,8 @@ struct sxe_adapter {struct sxe_hw hw;struct sxe_irq_context irq_ctxt; + +struct sxe_vlan_context vlan_ctxt;struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_filter.c +277 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +13 -0
@@ -46,10 +46,23 @@ void sxe_mac_addr_remove(struct rte_eth_dev *dev, u32 rar_idx);s32 sxe_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +s32 sxe_vlan_filter_set (struct rte_eth_dev *eth_dev,u16 vlan_id,s32 on); + +s32 sxe_vlan_tpid_set (struct rte_eth_dev *eth_dev, +enum rte_vlan_type vlan_type,u16 tpid); + +s32 sxe_vlan_offload_set (struct rte_eth_dev *dev,s32 vlan_mask); + +void sxe_vlan_strip_queue_set (struct rte_eth_dev *dev,u16 queue,s32 on); + +void sxe_vlan_filter_configure (struct rte_eth_dev *dev); +s32 sxe_set_mc_addr_list (struct rte_eth_dev *dev,struct rte_ether_addr *mc_addr_list,u32 nb_mc_addr); +void sxe_vlan_strip_switch_set (struct rte_eth_dev *dev); +void sxe_fc_mac_addr_set (struct sxe_adapter *adapter);#endif
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -201,6 +201,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) { +sxe_hw_vlan_filter_array_clear (hw); +sxe_fc_autoneg_localcap_set (hw); hw->mac.auto_restart = true;
Signature · 1 line
2.18.4
PATCH v3 6/14 net/sxe: add filter function
In reply to Jie LiuAdd filter function.
--- drivers/net/sxe/pf/sxe.h | 4 + drivers/net/sxe/pf/sxe_filter.c | 191 ++++++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_filter.h | 29 +++++ drivers/net/sxe/pf/sxe_main.c | 1 + 4 files changed, 225 insertions(+)
drivers/net/sxe/pf/sxe.h +4 -0
@@ -46,6 +46,10 @@ struct sxe_adapter {struct sxe_irq_context irq_ctxt;struct sxe_vlan_context vlan_ctxt; +struct sxe_mac_filter_context mac_filter_ctxt; +#ifdef RTE_ADAPTER_HAVE_FNAV_CONF +struct rte_eth_fdir_conf fnav_conf; +#endif struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_filter.c +191 -0
203 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +29 -0
@@ -21,6 +21,27 @@ struct sxe_adapter;RTE_ALIGN ((SXE_HW_TXRX_RING_NUM_MAX / (sizeof (u32) *BYTE_BIT_NUM )), \ sizeof(u32)) +struct sxe_vlan_context { +u32 vlan_hash_table[SXE_VFT_TBL_SIZE ]; +u32 strip_bitmap[SXE_VLAN_STRIP_BITMAP_SIZE ]; +u32 vlan_table_size; +}; + +enum sxe_uc_addr_src_type { +SXE_PF =0 , +SXE_VF , +SXE_VF_MACVLAN +}; + +struct sxe_uc_addr_table { +u8 rar_idx; +u8 pool_idx; +u8 type; +u8 original_index; +bool used; +u8 addr[SXE_MAC_ADDR_LEN ]; +}; +struct sxe_mac_filter_context {struct rte_ether_addr def_mac_addr;struct rte_ether_addr cur_mac_addr;
@@ -37,6 +58,14 @@ struct sxe_mac_filter_context {s32 sxe_mac_addr_init (struct rte_eth_dev *eth_dev); +s32 sxe_promiscuous_enable (struct rte_eth_dev *dev); + +s32 sxe_promiscuous_disable (struct rte_eth_dev *dev); + +s32 sxe_allmulticast_enable (struct rte_eth_dev *dev); + +s32 sxe_allmulticast_disable (struct rte_eth_dev *dev); +s32 sxe_mac_addr_add (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr,u32 rar_idx,u32 pool);
drivers/net/sxe/pf/sxe_main.c +1 -0
@@ -195,6 +195,7 @@ s32 sxe_hw_reset(struct sxe_hw *hw) goto l_end; } +sxe_hw_uc_addr_clear (hw); l_end:return ret; }
Signature · 1 line
2.18.4
PATCH v3 7/14 net/sxe: support rss offload
In reply to Jie LiuSupport rss offload.
--- drivers/net/sxe/base/sxe_offload_common.c | 12 +- drivers/net/sxe/pf/sxe.h | 2 + drivers/net/sxe/pf/sxe_offload.c | 298 ++++++++++++++++++++++ drivers/net/sxe/pf/sxe_offload.h | 33 +++ 4 files changed, 339 insertions(+), 6 deletions(-)
drivers/net/sxe/base/sxe_offload_common.c +6 -6
@@ -24,15 +24,16 @@ u64 __sxe_rx_port_offload_capa_get(struct rte_eth_dev *dev)u64 rx_offload_capa; rx_offload_capa =RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | -RTE_ETH_RX_OFFLOAD_UDP_CKSUM | -RTE_ETH_RX_OFFLOAD_TCP_CKSUM | -RTE_ETH_RX_OFFLOAD_KEEP_CRC | +RTE_ETH_RX_OFFLOAD_UDP_CKSUM | +RTE_ETH_RX_OFFLOAD_TCP_CKSUM | +RTE_ETH_RX_OFFLOAD_KEEP_CRC | #ifdef DEV_RX_JUMBO_FRAME -DEV_RX_OFFLOAD_JUMBO_FRAME | +DEV_RX_OFFLOAD_JUMBO_FRAME | #endifRTE_ETH_RX_OFFLOAD_VLAN_FILTER |RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | -RTE_ETH_RX_OFFLOAD_SCATTER ; +RTE_ETH_RX_OFFLOAD_SCATTER | +RTE_ETH_RX_OFFLOAD_RSS_HASH ;if (!RTE_ETH_DEV_SRIOV (dev).active) rx_offload_capa |=RTE_ETH_RX_OFFLOAD_TCP_LRO ;
@@ -56,4 +57,3 @@ u64 __sxe_tx_port_offload_capa_get(struct rte_eth_dev *dev)return tx_offload_capa; } -
drivers/net/sxe/pf/sxe.h +2 -0
@@ -57,6 +57,8 @@ struct sxe_adapter {u32 mtu; +bool rss_reta_updated; +RTE_ATOMIC (bool )link_thread_running;RTE_ATOMIC (bool )is_stopping;rte_thread_t link_thread_tid;
drivers/net/sxe/pf/sxe_offload.c +298 -0
312 lines not on this page · raw message
drivers/net/sxe/pf/sxe_offload.h +33 -0
@@ -7,6 +7,21 @@#include "sxe_hw.h" +#define SXE_RSS_OFFLOAD_ALL ( \ + RTE_ETH_RSS_IPV4 | \ + RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ + RTE_ETH_RSS_IPV6 | \ + RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP) + +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_FILTER_CTRL +u8 *sxe_rss_hash_key_get (void ); +#endif + +void sxe_rss_hash_set (struct sxe_hw *hw, +struct rte_eth_rss_conf *rss_conf); +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev);u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev);
@@ -15,4 +30,22 @@ u64 sxe_tx_queue_offload_capa_get(struct rte_eth_dev *dev);u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); +void sxe_rss_disable (struct rte_eth_dev *dev); + +void sxe_rss_configure (struct rte_eth_dev *dev); + +s32 sxe_rss_reta_update (struct rte_eth_dev *dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +u16 reta_size); + +s32 sxe_rss_reta_query (struct rte_eth_dev *dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +u16 reta_size); + +s32 sxe_rss_hash_update (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf); + +s32 sxe_rss_hash_conf_get (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf); +#endif
Signature · 1 line
2.18.4
PATCH v3 8/14 net/sxe: add dcb function
In reply to Jie LiuAdd dcb function.
--- drivers/net/sxe/Makefile | 2 + drivers/net/sxe/meson.build | 1 + drivers/net/sxe/pf/rte_pmd_sxe.h | 3 +- drivers/net/sxe/pf/sxe.h | 2 + drivers/net/sxe/pf/sxe_dcb.c | 944 ++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_dcb.h | 99 +++ drivers/net/sxe/pf/sxe_main.c | 1 + drivers/net/sxe/pf/sxe_phy.c | 34 + drivers/net/sxe/pf/sxe_phy.h | 2 + drivers/net/sxe/pf/sxe_rx.c | 1 - drivers/net/sxe/rte_pmd_sxe_version.map | 1 + drivers/net/sxe/version.map | 1 + 12 files changed, 1089 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sxe/pf/sxe_dcb.c create mode 100644 drivers/net/sxe/pf/sxe_dcb.h
drivers/net/sxe/Makefile +2 -0
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_dcb.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_filter.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_flow_ctrl.c
@@ -76,5 +77,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include += sxe_dcb.h include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/sxe/meson.build +1 -0
@@ -19,6 +19,7 @@ sources = files( 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', 'pf/sxe_phy.c', + 'pf/sxe_dcb.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c',
drivers/net/sxe/pf/rte_pmd_sxe.h +2 -1
@@ -11,5 +11,6 @@ typedef uint32_t u32;typedef int32_t s32 ;s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on); -#endif +s32 rte_pmd_sxe_tc_bw_set (u8 port,u8 tc_num,u8 *bw_weight); +#endif
drivers/net/sxe/pf/sxe.h +2 -0
@@ -11,6 +11,7 @@#include "sxe_types.h" #include "sxe_irq.h" #include "sxe_phy.h" +#include "sxe_dcb.h" #include "sxe_hw.h" struct sxe_hw ;
@@ -51,6 +52,7 @@ struct sxe_adapter {struct rte_eth_fdir_conf fnav_conf;#endif struct sxe_phy_context phy_ctxt; +struct sxe_dcb_context dcb_ctxt;bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ];
drivers/net/sxe/pf/sxe_dcb.c new file +944 -0
944 lines not on this page · raw message
drivers/net/sxe/pf/sxe_dcb.h new file +99 -0
99 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c +1 -0
@@ -203,6 +203,7 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) {sxe_hw_vlan_filter_array_clear (hw); +sxe_hw_dcb_rate_limiter_clear (hw,SXE_TXRX_RING_NUM_MAX );sxe_fc_autoneg_localcap_set (hw);
drivers/net/sxe/pf/sxe_phy.c +34 -0
@@ -737,6 +737,40 @@ s32 sxe_fc_enable(struct sxe_adapter *adapter)return ret; } +s32 sxe_pfc_enable (struct sxe_adapter *adapter,u8 tc_idx) +{ +s32 ret; +struct sxe_hw *hw = &adapter->hw; + +if (!hw->fc.pause_time) { +LOG_ERROR_BDF ("link fc disabled since pause time is 0" ); + ret = -SXE_ERR_INVALID_LINK_SETTINGS ; + goto l_ret; + } + +if (hw->fc.current_mode &SXE_FC_TX_PAUSE ) { +if (!hw->fc.high_water[tc_idx] || !hw->fc.low_water[tc_idx]) { +LOG_ERROR_BDF ("Invalid water mark configuration" ); + ret =SXE_ERR_INVALID_LINK_SETTINGS ; + goto l_ret; + } + +if (hw->fc.low_water[tc_idx] >= hw->fc.high_water[tc_idx]) { +LOG_ERROR_BDF ("Invalid water mark configuration" ); + ret =SXE_ERR_INVALID_LINK_SETTINGS ; + goto l_ret; + } + } + +sxe_fc_autoneg (adapter); + + ret =sxe_hw_pfc_enable (hw, tc_idx); +if (ret) +PMD_LOG_ERR (INIT ,"link fc enable failed, ret=%d" , ret); + +l_ret: +return ret; +}s32 sxe_sfp_identify (struct sxe_adapter *adapter) {s32 ret;
drivers/net/sxe/pf/sxe_phy.h +2 -0
@@ -105,6 +105,8 @@ s32 sxe_fc_enable(struct sxe_adapter *adapter);void sxe_link_info_get (struct sxe_adapter *adapter,u32 *link_speed,bool *link_up); +s32 sxe_pfc_enable (struct sxe_adapter *adapter,u8 tc_idx); +void sxe_sfp_link_capabilities_get (struct sxe_adapter *adapter,u32 *speed,bool *autoneg);
drivers/net/sxe/pf/sxe_rx.c +0 -1
@@ -10,7 +10,6 @@#include <rte_atomic.h> #include <ethdev_driver.h> #include "sxe_ethdev.h" -#include "sxe.h" #include "sxe_rx.h" #include "sxe_logs.h"
drivers/net/sxe/rte_pmd_sxe_version.map +1 -0
@@ -1,5 +1,6 @@ EXPERIMENTAL { global: rte_pmd_sxe_tx_loopback_set; + rte_pmd_sxe_tc_bw_set; local: *; };
drivers/net/sxe/version.map +1 -0
@@ -1,5 +1,6 @@ EXPERIMENTAL { global: rte_pmd_sxe_tx_loopback_set; + rte_pmd_sxe_tc_bw_set; local: *; };
Signature · 1 line
2.18.4
PATCH v3 9/14 net/sxe: support ptp
In reply to Jie LiuAdd ptp module.
--- drivers/net/sxe/Makefile | 1 + drivers/net/sxe/meson.build | 1 + drivers/net/sxe/pf/sxe.h | 9 ++ drivers/net/sxe/pf/sxe_ptp.c | 209 +++++++++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_ptp.h | 26 +++++ 5 files changed, 246 insertions(+) create mode 100644 drivers/net/sxe/pf/sxe_ptp.c create mode 100644 drivers/net/sxe/pf/sxe_ptp.h
drivers/net/sxe/Makefile +1 -0
@@ -71,6 +71,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_main.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_phy.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ptp.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c
drivers/net/sxe/meson.build +1 -0
@@ -19,6 +19,7 @@ sources = files( 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', 'pf/sxe_phy.c', + 'pf/sxe_ptp.c', 'pf/sxe_dcb.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c',
drivers/net/sxe/pf/sxe.h +9 -0
@@ -41,6 +41,14 @@ struct sxe_vlan_context;#define rte_sxe_prefetch (p) do {} while (0)#endif +struct sxe_ptp_context { +struct rte_timecounter systime_tc; +struct rte_timecounter rx_tstamp_tc; +struct rte_timecounter tx_tstamp_tc; +u32 tx_hwtstamp_sec; +u32 tx_hwtstamp_nsec; +}; +struct sxe_adapter {struct sxe_hw hw;
@@ -51,6 +59,7 @@ struct sxe_adapter {#ifdef RTE_ADAPTER_HAVE_FNAV_CONF struct rte_eth_fdir_conf fnav_conf;#endif +struct sxe_ptp_context ptp_ctxt;struct sxe_phy_context phy_ctxt;struct sxe_dcb_context dcb_ctxt;
drivers/net/sxe/pf/sxe_ptp.c new file +209 -0
209 lines not on this page · raw message
drivers/net/sxe/pf/sxe_ptp.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_PTP_H__ +#define __SXE_PTP_H__ + +s32 sxe_timesync_enable (struct rte_eth_dev *dev); + +s32 sxe_timesync_disable (struct rte_eth_dev *dev); + +s32 sxe_timesync_read_rx_timestamp (struct rte_eth_dev *dev, +struct timespec *timestamp, + u32 flags __rte_unused); + +s32 sxe_timesync_read_tx_timestamp (struct rte_eth_dev *dev, +struct timespec *timestamp); + +s32 sxe_timesync_adjust_time (struct rte_eth_dev *dev,s64 delta); + +s32 sxe_timesync_read_time (struct rte_eth_dev *dev,struct timespec *ts); + +s32 sxe_timesync_write_time (struct rte_eth_dev *dev, +const struct timespec *ts); + +#endif
Signature · 1 line
2.18.4
PATCH v3 10/14 net/sxe: add xstats function
In reply to Jie LiuAdd xstats function.
--- drivers/net/sxe/Makefile | 1 + drivers/net/sxe/meson.build | 1 + drivers/net/sxe/pf/sxe.h | 2 + drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_stats.c | 577 +++++++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_stats.h | 71 ++++ 6 files changed, 654 insertions(+) create mode 100644 drivers/net/sxe/pf/sxe_stats.c create mode 100644 drivers/net/sxe/pf/sxe_stats.h
drivers/net/sxe/Makefile +1 -0
@@ -74,6 +74,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_pmd_hdc.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ptp.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_stats.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c # install this header file
drivers/net/sxe/meson.build +1 -0
@@ -17,6 +17,7 @@ sources = files( 'pf/sxe_queue.c', 'pf/sxe_rx.c', 'pf/sxe_tx.c', + 'pf/sxe_stats.c', 'pf/sxe_pmd_hdc.c', 'pf/sxe_phy.c', 'pf/sxe_ptp.c',
drivers/net/sxe/pf/sxe.h +2 -0
@@ -9,6 +9,7 @@#include "sxe_filter.h" #include <stdbool.h> #include "sxe_types.h" +#include "sxe_stats.h" #include "sxe_irq.h" #include "sxe_phy.h" #include "sxe_dcb.h"
@@ -61,6 +62,7 @@ struct sxe_adapter {#endif struct sxe_ptp_context ptp_ctxt;struct sxe_phy_context phy_ctxt; +struct sxe_stats_info stats_info;struct sxe_dcb_context dcb_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -203,6 +203,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) {sxe_hw_vlan_filter_array_clear (hw); + +sxe_hw_stats_regs_clean (hw);sxe_hw_dcb_rate_limiter_clear (hw,SXE_TXRX_RING_NUM_MAX );sxe_fc_autoneg_localcap_set (hw);
drivers/net/sxe/pf/sxe_stats.c new file +577 -0
577 lines not on this page · raw message
drivers/net/sxe/pf/sxe_stats.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v3 11/14 net/sxe: add custom cmd led ctrl
In reply to Jie LiuAdd custom cmd led ctrl.
--- drivers/net/sxe/Makefile | 2 + drivers/net/sxe/include/sxe/sxe_cli.h | 218 ++++++++++++++++++++++++ drivers/net/sxe/include/sxe/sxe_ioctl.h | 21 +++ drivers/net/sxe/meson.build | 2 + drivers/net/sxe/pf/sxe_main.c | 3 + drivers/net/sxe/sxe_testpmd.c | 65 +++++++ 6 files changed, 311 insertions(+) create mode 100644 drivers/net/sxe/include/sxe/sxe_cli.h create mode 100644 drivers/net/sxe/include/sxe/sxe_ioctl.h create mode 100644 drivers/net/sxe/sxe_testpmd.c
drivers/net/sxe/Makefile +2 -0
@@ -55,6 +55,8 @@ $(shell cp $(SRCDIR)/include/*.h $(SRCDIR)) $(shell cp $(SRCDIR)/include/sxe/*.h $(SRCDIR)) $(warning "file copy done") +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_testpmd.c + SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_hw.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload_common.c
drivers/net/sxe/include/sxe/sxe_cli.h new file +218 -0
218 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_ioctl.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifndef _SXE_IOCTL_H_ +#define _SXE_IOCTL_H_ + +#ifdef SXE_HOST_DRIVER +#include "sxe_drv_type.h" +#endif + +struct sxe_ioctl_sync_cmd { +U64 traceid; +void *in_data; +U32 in_len; +void *out_data; +U32 out_len; +}; + +#define SXE_CMD_IOCTL_SYNC_CMD _IOWR('M', 1, struct sxe_ioctl_sync_cmd) + +#endif
drivers/net/sxe/meson.build +2 -0
@@ -30,6 +30,8 @@ sources = files( 'base/sxe_hw.c', ) +testpmd_sources = files('sxe_testpmd.c') + includes += include_directories('base') includes += include_directories('pf') includes += include_directories('include/sxe/')
drivers/net/sxe/pf/sxe_main.c +3 -0
@@ -205,6 +205,9 @@ void sxe_hw_start(struct sxe_hw *hw)sxe_hw_vlan_filter_array_clear (hw);sxe_hw_stats_regs_clean (hw); + +sxe_hw_no_snoop_disable (hw); +sxe_hw_dcb_rate_limiter_clear (hw,SXE_TXRX_RING_NUM_MAX );sxe_fc_autoneg_localcap_set (hw);
drivers/net/sxe/sxe_testpmd.c new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v3 12/14 net/sxe: add simd function
In reply to Jie LiuAdd simd function.
--- drivers/net/sxe/Makefile | 7 + drivers/net/sxe/base/sxe_queue_common.c | 52 +- drivers/net/sxe/base/sxe_rx_common.c | 125 ++++- drivers/net/sxe/meson.build | 9 + drivers/net/sxe/pf/sxe.h | 3 + drivers/net/sxe/pf/sxe_vec_common.h | 315 ++++++++++++ drivers/net/sxe/pf/sxe_vec_neon.c | 603 +++++++++++++++++++++++ drivers/net/sxe/pf/sxe_vec_sse.c | 625 ++++++++++++++++++++++++ 8 files changed, 1732 insertions(+), 7 deletions(-) create mode 100644 drivers/net/sxe/pf/sxe_vec_common.h create mode 100644 drivers/net/sxe/pf/sxe_vec_neon.c create mode 100644 drivers/net/sxe/pf/sxe_vec_sse.c
drivers/net/sxe/Makefile +7 -0
@@ -10,6 +10,7 @@ LIB = librte_pmd_sxe.a CFLAGS += -DSXE_DPDK CFLAGS += -DSXE_HOST_DRIVER +CFLAGS += -DSXE_DPDK_SIMD CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
@@ -79,6 +80,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_stats.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c +ifeq ($(CONFIG_RTE_ARCH_ARM64),y) +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_neon.c +else +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_sse.c +endif + # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include += sxe_dcb.h
drivers/net/sxe/base/sxe_queue_common.c +51 -1
91 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.c +119 -6
181 lines not on this page · raw message
drivers/net/sxe/meson.build +9 -0
@@ -2,6 +2,9 @@ # Copyright (C), 2022, Linkdata Technology Co., Ltd. cflags += ['-DSXE_DPDK'] cflags += ['-DSXE_HOST_DRIVER'] +cflags += ['-DSXE_DPDK_L4_FEATURES'] +cflags += ['-DSXE_DPDK_SRIOV'] +cflags += ['-DSXE_DPDK_SIMD'] #subdir('base') #objs = [base_objs]
@@ -32,6 +35,12 @@ sources = files( testpmd_sources = files('sxe_testpmd.c') +if arch_subdir == 'x86' + sources += files('pf/sxe_vec_sse.c') +elif arch_subdir == 'arm' + sources += files('pf/sxe_vec_neon.c') +endif + includes += include_directories('base') includes += include_directories('pf') includes += include_directories('include/sxe/')
drivers/net/sxe/pf/sxe.h +3 -0
@@ -66,6 +66,9 @@ struct sxe_adapter {struct sxe_dcb_context dcb_ctxt;bool rx_batch_alloc_allowed; +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD +bool rx_vec_allowed; +#endif s8 name[PCI_PRI_STR_SIZE +1 ];u32 mtu;
drivers/net/sxe/pf/sxe_vec_common.h new file +315 -0
315 lines not on this page · raw message
drivers/net/sxe/pf/sxe_vec_neon.c new file +603 -0
603 lines not on this page · raw message
drivers/net/sxe/pf/sxe_vec_sse.c new file +625 -0
625 lines not on this page · raw message
Signature · 1 line
2.18.4
PATCH v3 13/14 net/sxe: add virtual function
In reply to Jie LiuAdd virtual function.
--- drivers/net/sxe/Makefile | 15 + drivers/net/sxe/base/sxe_queue_common.c | 4 + drivers/net/sxe/base/sxevf_hw.c | 951 +++++++++++++++ drivers/net/sxe/base/sxevf_hw.h | 349 ++++++ drivers/net/sxe/base/sxevf_regs.h | 119 ++ drivers/net/sxe/meson.build | 35 +- drivers/net/sxe/pf/rte_pmd_sxe.h | 4 +- drivers/net/sxe/pf/sxe.h | 5 +- drivers/net/sxe/pf/sxe_filter.c | 177 +++ drivers/net/sxe/pf/sxe_filter.h | 15 + drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_phy.h | 1 + drivers/net/sxe/pf/sxe_stats.c | 9 +- drivers/net/sxe/pf/sxe_vf.c | 1427 +++++++++++++++++++++++ drivers/net/sxe/pf/sxe_vf.h | 219 ++++ drivers/net/sxe/sxe_testpmd.c | 130 +++ drivers/net/sxe/vf/sxevf.h | 43 + drivers/net/sxe/vf/sxevf_ethdev.c | 768 ++++++++++++ drivers/net/sxe/vf/sxevf_ethdev.h | 16 + drivers/net/sxe/vf/sxevf_filter.c | 493 ++++++++ drivers/net/sxe/vf/sxevf_filter.h | 72 ++ drivers/net/sxe/vf/sxevf_irq.c | 434 +++++++ drivers/net/sxe/vf/sxevf_irq.h | 35 + drivers/net/sxe/vf/sxevf_main.c | 83 ++ drivers/net/sxe/vf/sxevf_msg.c | 624 ++++++++++ drivers/net/sxe/vf/sxevf_msg.h | 201 ++++ drivers/net/sxe/vf/sxevf_offload.c | 31 + drivers/net/sxe/vf/sxevf_offload.h | 16 + drivers/net/sxe/vf/sxevf_queue.c | 210 ++++ drivers/net/sxe/vf/sxevf_queue.h | 70 ++ drivers/net/sxe/vf/sxevf_rx.c | 163 +++ drivers/net/sxe/vf/sxevf_rx.h | 18 + drivers/net/sxe/vf/sxevf_stats.c | 162 +++ drivers/net/sxe/vf/sxevf_stats.h | 31 + drivers/net/sxe/vf/sxevf_tx.c | 46 + drivers/net/sxe/vf/sxevf_tx.h | 14 + 36 files changed, 6974 insertions(+), 18 deletions(-) create mode 100644 drivers/net/sxe/base/sxevf_hw.c create mode 100644 drivers/net/sxe/base/sxevf_hw.h create mode 100644 drivers/net/sxe/base/sxevf_regs.h create mode 100644 drivers/net/sxe/pf/sxe_vf.c create mode 100644 drivers/net/sxe/pf/sxe_vf.h create mode 100644 drivers/net/sxe/vf/sxevf.h create mode 100644 drivers/net/sxe/vf/sxevf_ethdev.c create mode 100644 drivers/net/sxe/vf/sxevf_ethdev.h create mode 100644 drivers/net/sxe/vf/sxevf_filter.c create mode 100644 drivers/net/sxe/vf/sxevf_filter.h create mode 100644 drivers/net/sxe/vf/sxevf_irq.c create mode 100644 drivers/net/sxe/vf/sxevf_irq.h create mode 100644 drivers/net/sxe/vf/sxevf_main.c create mode 100644 drivers/net/sxe/vf/sxevf_msg.c create mode 100644 drivers/net/sxe/vf/sxevf_msg.h create mode 100644 drivers/net/sxe/vf/sxevf_offload.c create mode 100644 drivers/net/sxe/vf/sxevf_offload.h create mode 100644 drivers/net/sxe/vf/sxevf_queue.c create mode 100644 drivers/net/sxe/vf/sxevf_queue.h create mode 100644 drivers/net/sxe/vf/sxevf_rx.c create mode 100644 drivers/net/sxe/vf/sxevf_rx.h create mode 100644 drivers/net/sxe/vf/sxevf_stats.c create mode 100644 drivers/net/sxe/vf/sxevf_stats.h create mode 100644 drivers/net/sxe/vf/sxevf_tx.c create mode 100644 drivers/net/sxe/vf/sxevf_tx.h
drivers/net/sxe/Makefile +15 -0
@@ -10,6 +10,8 @@ LIB = librte_pmd_sxe.a CFLAGS += -DSXE_DPDK CFLAGS += -DSXE_HOST_DRIVER +CFLAGS += -DSXE_DPDK_L4_FEATURES +CFLAGS += -DSXE_DPDK_SRIOV CFLAGS += -DSXE_DPDK_SIMD CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
@@ -64,6 +66,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_offload_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx_common.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx_common.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_hw.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_dcb.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_ethdev.c
@@ -79,6 +82,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_queue.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_rx.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_stats.c SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_tx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vf.c ifeq ($(CONFIG_RTE_ARCH_ARM64),y) SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_neon.c
@@ -86,6 +90,17 @@ else SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxe_vec_sse.c endif +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_main.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_msg.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_irq.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_stats.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_tx.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_queue.c +SRCS-$(CONFIG_RTE_LIBRTE_SXE_PMD) += sxevf_offload.c + # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include := rte_pmd_sxe.h SYMLINK-$(CONFIG_RTE_LIBRTE_SXE_PMD)-include += sxe_dcb.h
drivers/net/sxe/base/sxe_queue_common.c +4 -0
@@ -13,11 +13,15 @@#include "sxe_tx.h" #include "sxe_logs.h" #include "sxe_regs.h" +#include "sxevf_regs.h" #include "sxe.h" #if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD #include "sxe_vec_common.h" #include <rte_vect.h> #endif +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV +#include "sxevf.h" +#endif #include "sxe_queue_common.h" #include "sxe_queue.h"
drivers/net/sxe/base/sxevf_hw.c new file +951 -0
951 lines not on this page · raw message
drivers/net/sxe/base/sxevf_hw.h new file +349 -0
349 lines not on this page · raw message
drivers/net/sxe/base/sxevf_regs.h new file +119 -0
119 lines not on this page · raw message
drivers/net/sxe/meson.build +24 -11
@@ -11,26 +11,38 @@ cflags += ['-DSXE_DPDK_SIMD'] deps += ['hash'] sources = files( - 'pf/sxe_main.c', + 'pf/sxe_main.c', 'pf/sxe_filter.c', - 'pf/sxe_flow_ctrl.c', - 'pf/sxe_irq.c', - 'pf/sxe_ethdev.c', + 'pf/sxe_flow_ctrl.c', + 'pf/sxe_irq.c', + 'pf/sxe_ethdev.c', 'pf/sxe_offload.c', 'pf/sxe_queue.c', 'pf/sxe_rx.c', 'pf/sxe_tx.c', 'pf/sxe_stats.c', - 'pf/sxe_pmd_hdc.c', - 'pf/sxe_phy.c', - 'pf/sxe_ptp.c', - 'pf/sxe_dcb.c', - 'base/sxe_queue_common.c', + 'pf/sxe_pmd_hdc.c', + 'pf/sxe_phy.c', + 'pf/sxe_ptp.c', + 'pf/sxe_vf.c', + 'pf/sxe_dcb.c', + 'vf/sxevf_main.c', + 'vf/sxevf_filter.c', + 'vf/sxevf_irq.c', + 'vf/sxevf_msg.c', + 'vf/sxevf_ethdev.c', + 'vf/sxevf_stats.c', + 'vf/sxevf_rx.c', + 'vf/sxevf_tx.c', + 'vf/sxevf_queue.c', + 'vf/sxevf_offload.c', + 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c', 'base/sxe_offload_common.c', - 'base/sxe_common.c', - 'base/sxe_hw.c', + 'base/sxe_common.c', + 'base/sxe_hw.c', + 'base/sxevf_hw.c', ) testpmd_sources = files('sxe_testpmd.c')
@@ -43,5 +55,6 @@ endif includes += include_directories('base') includes += include_directories('pf') +includes += include_directories('vf') includes += include_directories('include/sxe/') includes += include_directories('include/')
drivers/net/sxe/pf/rte_pmd_sxe.h +3 -1
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#ifndef __PMD_SXE_H__#define __PMD_SXE_H__
@@ -13,4 +12,7 @@ typedef int32_t s32;s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on);s32 rte_pmd_sxe_tc_bw_set (u8 port,u8 tc_num,u8 *bw_weight); + +int rte_pmd_sxe_set_vf_rxmode (u16 port,u16 vf, +u16 rx_mask,u8 on);#endif
drivers/net/sxe/pf/sxe.h +4 -1
@@ -11,8 +11,9 @@#include "sxe_types.h" #include "sxe_stats.h" #include "sxe_irq.h" -#include "sxe_phy.h" +#include "sxe_vf.h" #include "sxe_dcb.h" +#include "sxe_phy.h" #include "sxe_hw.h" struct sxe_hw ;
@@ -62,6 +63,8 @@ struct sxe_adapter {#endif struct sxe_ptp_context ptp_ctxt;struct sxe_phy_context phy_ctxt; +struct sxe_virtual_context vt_ctxt; +struct sxe_stats_info stats_info;struct sxe_dcb_context dcb_ctxt;
drivers/net/sxe/pf/sxe_filter.c +177 -0
202 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +15 -0
@@ -75,6 +75,15 @@ void sxe_mac_addr_remove(struct rte_eth_dev *dev, u32 rar_idx);s32 sxe_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +s32 sxe_uc_hash_table_set (struct rte_eth_dev *dev, +struct rte_ether_addr *mac_addr,u8 on); + +s32 sxe_uc_all_hash_table_set (struct rte_eth_dev *dev,u8 on); + +s32 sxe_set_mc_addr_list (struct rte_eth_dev *dev, +struct rte_ether_addr *mc_addr_list, +u32 nb_mc_addr); +s32 sxe_vlan_filter_set (struct rte_eth_dev *eth_dev,u16 vlan_id,s32 on); s32 sxe_vlan_tpid_set(struct rte_eth_dev *eth_dev,
@@ -94,4 +103,10 @@ void sxe_vlan_strip_switch_set(struct rte_eth_dev *dev);void sxe_fc_mac_addr_set (struct sxe_adapter *adapter); +u8 sxe_sw_uc_entry_vf_add (struct sxe_adapter *adapter, +u8 vf_idx,u8 *mac_addr,bool macvlan); + +void sxe_sw_uc_entry_vf_del (struct sxe_adapter *adapter,u8 vf_idx, +bool macvlan); +#endif
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -20,10 +20,12 @@#include "sxe_ethdev.h" #include "sxe.h" #include "drv_msg.h" +#include "sxe_cli.h" #include "sxe_queue.h" #include "sxe_errno.h" #include "sxe_compat_platform.h" #include "sxe_pmd_hdc.h" +#include "sxe_vf.h" #include "sxe_queue.h" static const struct rte_pci_id sxe_pci_tbl[] = {
drivers/net/sxe/pf/sxe_phy.h +1 -0
@@ -6,6 +6,7 @@#include <rte_ethdev.h> #include "drv_msg.h" +#include "sxe_cli.h" #include "sxe_msg.h" #define SXE_SFF_BASE_ADDR 0x0
drivers/net/sxe/pf/sxe_stats.c +4 -5
@@ -219,10 +219,9 @@ s32 sxe_xstats_get(struct rte_eth_dev *eth_dev,u8 prio; cnt =SXE_XSTAT_CNT ; -PMD_LOG_INFO (DRV ,"xstat size:%u. hw xstat field cnt:%u " -"fc xstat field cnt:%u " , cnt, -SXE_XSTAT_MAC_CNT , -SXE_XSTAT_FC_CNT ); +PMD_LOG_INFO (DRV ,"xstat size:%u. hw xstat field cnt: %" SXE_PRIU64 +"fc xstat field cnt: %" SXE_PRIU64 , cnt, +SXE_XSTAT_MAC_CNT ,SXE_XSTAT_FC_CNT );if (usr_cnt < cnt) { ret = cnt;
@@ -333,7 +332,7 @@ s32 sxe_xstats_names_get(__rte_unused struct rte_eth_dev *dev,if (usr_cnt <SXE_XSTAT_CNT ) { ret = -SXE_ERR_PARAM ; -PMD_LOG_ERR (DRV ,"max:%u usr_cnt:%u invalid.(err:%d)" , +PMD_LOG_ERR (DRV ,"max: %" SXE_PRIU64 " usr_cnt:%u invalid.(err:%d)" ,SXE_XSTAT_CNT , usr_cnt, ret); goto l_out; }
drivers/net/sxe/pf/sxe_vf.c new file +1427 -0
1,172 lines not on this page · raw message
drivers/net/sxe/pf/sxe_vf.h new file +219 -0
219 lines not on this page · raw message
drivers/net/sxe/sxe_testpmd.c +130 -0
130 lines not on this page · raw message
drivers/net/sxe/vf/sxevf.h new file +43 -0
43 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_ethdev.c new file +768 -0
768 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_ethdev.h new file +16 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_filter.c new file +493 -0
493 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_filter.h new file +72 -0
72 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_irq.c new file +434 -0
434 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_irq.h new file +35 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_main.c new file +83 -0
83 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_msg.c new file +624 -0
624 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_msg.h new file +201 -0
201 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_offload.c new file +31 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_offload.h new file +16 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_queue.c new file +210 -0
210 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_queue.h new file +70 -0
70 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_rx.c new file +163 -0
163 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_rx.h new file +18 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_stats.c new file +162 -0
162 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_stats.h new file +31 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/vf/sxevf_tx.c new file +46 -0
46 lines not on this page · raw message
drivers/net/sxe/vf/sxevf_tx.h new file +14 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
PATCH v3 14/14 net/sxe: add Solve compilation problems.
In reply to Jie LiuAdd Fix compiling issues.
--- drivers/net/sxe/base/sxe_compat_version.h | 1 - drivers/net/sxe/base/sxe_hw.c | 21 ++++++++++++++------- drivers/net/sxe/base/sxe_offload_common.c | 1 - drivers/net/sxe/base/sxe_queue_common.c | 3 ++- drivers/net/sxe/base/sxe_rx_common.c | 10 ++++++---- drivers/net/sxe/base/sxe_rx_common.h | 2 -- drivers/net/sxe/base/sxe_tx_common.c | 1 - drivers/net/sxe/base/sxevf_hw.c | 1 - drivers/net/sxe/pf/sxe.h | 11 +++++------ drivers/net/sxe/pf/sxe_filter.c | 1 - drivers/net/sxe/pf/sxe_filter.h | 1 - drivers/net/sxe/pf/sxe_irq.h | 2 -- drivers/net/sxe/pf/sxe_main.c | 15 --------------- drivers/net/sxe/pf/sxe_offload.c | 2 -- drivers/net/sxe/pf/sxe_phy.c | 9 +++++---- drivers/net/sxe/pf/sxe_pmd_hdc.c | 1 - drivers/net/sxe/pf/sxe_queue.c | 2 -- drivers/net/sxe/pf/sxe_queue.h | 2 -- drivers/net/sxe/pf/sxe_rx.c | 1 - drivers/net/sxe/pf/sxe_stats.c | 21 +++++++++++++++++---- drivers/net/sxe/pf/sxe_stats.h | 2 -- drivers/net/sxe/pf/sxe_tx.c | 20 -------------------- drivers/net/sxe/pf/sxe_vec_common.h | 7 ++++++- drivers/net/sxe/pf/sxe_vec_neon.c | 2 -- drivers/net/sxe/pf/sxe_vec_sse.c | 1 - drivers/net/sxe/pf/sxe_vf.c | 1 - drivers/net/sxe/pf/sxe_vf.h | 1 - drivers/net/sxe/sxe_drv_type.h | 4 ---- drivers/net/sxe/sxe_testpmd.c | 3 ++- drivers/net/sxe/vf/sxevf_ethdev.c | 6 ++---- drivers/net/sxe/vf/sxevf_filter.h | 4 ++-- drivers/net/sxe/vf/sxevf_irq.c | 2 -- drivers/net/sxe/vf/sxevf_irq.h | 1 - drivers/net/sxe/vf/sxevf_main.c | 1 - drivers/net/sxe/vf/sxevf_offload.c | 1 - drivers/net/sxe/vf/sxevf_queue.c | 2 -- drivers/net/sxe/vf/sxevf_queue.h | 1 - drivers/net/sxe/vf/sxevf_rx.c | 1 - 38 files changed, 61 insertions(+), 107 deletions(-)
drivers/net/sxe/base/sxe_compat_version.h +0 -1
@@ -6,7 +6,6 @@#define __SXE_COMPAT_VERSION_H__#include <stdbool.h> -#include "sxe_dpdk_version.h" struct rte_eth_dev ;enum rte_eth_event_type ;
drivers/net/sxe/base/sxe_hw.c +14 -7
@@ -3,6 +3,7 @@*/ #ifdef SXE_PHY_CONFIGURE #include <linux/mdio.h> +#include <rte_compat.h> #endif #if defined(__KERNEL__) || defined(SXE_KERNEL_TEST )#include "sxe_pci.h"
@@ -1893,7 +1894,7 @@ static void sxe_hw_rx_pkt_buf_size_configure(struct sxe_hw *hw,for (i =0 ; i < (num_pb /2 ); i++)SXE_REG_WRITE (hw,SXE_RXPBSIZE (i), rx_buf_size); - fallthrough; +/* fallthrough */ case (PBA_STRATEGY_EQUAL ): rx_buf_size = (total_buf_size / (num_pb - i)) <<SXE_RX_PKT_BUF_SIZE_SHIFT ;
@@ -2231,7 +2232,7 @@ static s32 sxe_hw_fnav_vm_pool_mask_get(struct sxe_hw *hw,switch (vm_pool &SXE_SAMPLE_VM_POOL_MASK ) {case 0x0 : *fnavm |=SXE_FNAVM_POOL ; - fallthrough; +/* fallthrough */ case 0x7F :break ;default :
@@ -2279,13 +2280,13 @@ static s32 sxe_hw_fnav_vlan_mask_get(struct sxe_hw *hw,switch (ntohs (vlan_id) &SXE_SAMPLE_VLAN_MASK ) {case 0x0000 : *fnavm |=SXE_FNAVM_VLANID ; - fallthrough; +/* fallthrough */ case 0x0FFF : *fnavm |=SXE_FNAVM_VLANP ;break ;case 0xE000 : *fnavm |=SXE_FNAVM_VLANID ; - fallthrough; +/* fallthrough */ case 0xEFFF :break ;default :
@@ -2305,7 +2306,7 @@ static s32 sxe_hw_fnav_flex_bytes_mask_get(struct sxe_hw *hw,switch ((__force u16 )flex_bytes &SXE_SAMPLE_FLEX_BYTES_MASK ) {case 0x0000 : *fnavm |=SXE_FNAVM_FLEX ; - fallthrough; +/* fallthrough */ case 0xFFFF :break ;default :
@@ -4963,7 +4964,14 @@ bool sxe_hw_is_rss_enabled(struct sxe_hw *hw) {bool rss_enable = false;u32 mrqc =SXE_REG_READ (hw,SXE_MRQC ); -if (mrqc &SXE_MRQC_RSSEN ) + + +u32 mrqe_val = mrqc &SXE_MRQC_MRQE_MASK ; +if (mrqe_val ==SXE_MRQC_RSSEN || + mrqe_val ==SXE_MRQC_RTRSS8TCEN || + mrqe_val ==SXE_MRQC_RTRSS4TCEN || + mrqe_val ==SXE_MRQC_VMDQRSS32EN || + mrqe_val ==SXE_MRQC_VMDQRSS64EN ) rss_enable = true;return rss_enable;
@@ -5497,7 +5505,6 @@ void sxe_hw_rss_cap_switch(struct sxe_hw *hw, bool is_on) {u32 mrqc =SXE_REG_READ (hw,SXE_MRQC );u32 mrqe_val; - mrqe_val = mrqc &SXE_MRQC_MRQE_MASK ;if (is_on) { mrqe_val =SXE_MRQC_RSSEN ;
drivers/net/sxe/base/sxe_offload_common.c +0 -1
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_types.h"
drivers/net/sxe/base/sxe_queue_common.c +2 -1
@@ -4,7 +4,6 @@#include <rte_ethdev.h> #include <rte_malloc.h> -#include "sxe_dpdk_version.h" #include "sxe_compat_version.h" #include <ethdev_driver.h> #include <bus_pci_driver.h>
@@ -294,6 +293,7 @@ void __sxe_recycle_rxq_info_get(struct rte_eth_dev *dev, u16 queue_id, q_info->mp = rxq->mb_pool; q_info->mbuf_ring_size = rxq->ring_depth; q_info->receive_tail = &rxq->processing_idx; +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD if (adapter->rx_vec_allowed) {#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM )
@@ -308,6 +308,7 @@ void __sxe_recycle_rxq_info_get(struct rte_eth_dev *dev, u16 queue_id, q_info->refill_requirement = rxq->batch_alloc_size; q_info->refill_head = &rxq->batch_alloc_trigger;#endif +return ; }
drivers/net/sxe/base/sxe_rx_common.c +6 -4
@@ -5,7 +5,6 @@#include <rte_memory.h> #include <rte_memzone.h> #include <rte_mbuf.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <rte_prefetch.h> #include <rte_malloc.h>
@@ -80,8 +79,6 @@ void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev,u16 i, is_using_sse;if (sxe_rx_vec_condition_check (dev) || - !rx_batch_alloc_allowed || - rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_128 !rx_batch_alloc_allowed ) { PMD_LOG_DEBUG(INIT, "Port[%d] doesn't meet Vector Rx "
@@ -111,6 +108,7 @@ void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev,#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM ) dev->recycle_rx_descriptors_refill = sxe_recycle_rx_descriptors_refill_vec; +#endif dev->rx_pkt_burst = sxe_scattered_pkts_vec_recv;
@@ -138,12 +136,13 @@ void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev, dev->rx_pkt_burst = sxe_single_alloc_lro_pkts_recv; } } -#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD else if (*rx_vec_allowed) {PMD_LOG_DEBUG (INIT ,"Vector rx enabled, please make sure RX " "burst size no less than %d (port=%d)." ,SXE_DESCS_PER_LOOP , dev->data->port_id); +#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM ) dev->recycle_rx_descriptors_refill = sxe_recycle_rx_descriptors_refill_vec;
@@ -166,6 +165,7 @@ void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev, dev->rx_pkt_burst = sxe_pkts_recv; } +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD is_using_sse = (dev->rx_pkt_burst == sxe_scattered_pkts_vec_recv ||
@@ -177,6 +177,7 @@ void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev, rxq->is_using_sse = is_using_sse; }#endif + }s32 __sxe_rx_descriptor_status (void *rx_queue,u16 offset)
@@ -340,6 +341,7 @@ const u32 *__sxe_dev_supported_ptypes_get(struct rte_eth_dev *dev, size_t *no_of ptypes = ptypes_arr; goto l_end; } +#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD #if defined(RTE_ARCH_X86 ) if (dev->rx_pkt_burst == sxe_pkts_vec_recv ||
drivers/net/sxe/base/sxe_rx_common.h +0 -2
@@ -5,8 +5,6 @@#ifndef __SXE_RX_COMMON_H__#define __SXE_RX_COMMON_H__ -#include "sxe_dpdk_version.h" - void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev,bool rx_batch_alloc_allowed,bool *rx_vec_allowed);
drivers/net/sxe/base/sxe_tx_common.c +0 -1
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <ethdev_pci.h> #include <rte_net.h>
drivers/net/sxe/base/sxevf_hw.c +0 -1
@@ -15,7 +15,6 @@#else #include "sxe_errno.h" #include "sxe_logs.h" -#include "sxe_dpdk_version.h" #include "sxe_compat_version.h" #include "sxevf.h" #include "sxevf_hw.h"
drivers/net/sxe/pf/sxe.h +5 -6
@@ -6,14 +6,16 @@#include <rte_pci.h> #include <rte_time.h> -#include "sxe_filter.h" +#include <stdbool.h> +#include "sxe_types.h" -#include "sxe_stats.h" +#include "sxe_filter.h" #include "sxe_irq.h" +#include "sxe_stats.h" +#include "sxe_phy.h" #include "sxe_vf.h" #include "sxe_dcb.h" -#include "sxe_phy.h" #include "sxe_hw.h" struct sxe_hw ;
@@ -81,9 +83,6 @@ struct sxe_adapter {RTE_ATOMIC (bool )link_thread_running;RTE_ATOMIC (bool )is_stopping;rte_thread_t link_thread_tid; -rte_atomic32_t link_thread_running; -rte_atomic32_t is_stopping; -pthread_t link_thread_tid;bool is_stopped; };
drivers/net/sxe/pf/sxe_filter.c +0 -1
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <bus_pci_driver.h> #include <rte_malloc.h>
drivers/net/sxe/pf/sxe_filter.h +0 -1
@@ -6,7 +6,6 @@#define __SXE_FILTER_H__#include <rte_ether.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_types.h" #include "sxe_hw.h"
drivers/net/sxe/pf/sxe_irq.h +0 -2
@@ -4,8 +4,6 @@#ifndef __SXE_IRQ_H__#define __SXE_IRQ_H__ - -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_compat_platform.h"
drivers/net/sxe/pf/sxe_main.c +0 -15
@@ -8,7 +8,6 @@#include <rte_pci.h> #include "sxe_version.h" -#include "sxe_dpdk_version.h" #include <bus_pci_driver.h> #include <ethdev_driver.h> #include <ethdev_pci.h>
@@ -245,24 +244,10 @@ RTE_LOG_REGISTER_SUFFIX(sxe_log_rx, pmd.net.sxe.rx, DEBUG);RTE_LOG_REGISTER_SUFFIX (sxe_log_tx, pmd.net.sxe.tx,DEBUG );RTE_LOG_REGISTER_SUFFIX (sxe_log_hw, pmd.net.sxe.tx_hw,DEBUG );#else -#ifdef DPDK_19_11_6 -s32 sxe_log_init; -s32 sxe_log_drv; -RTE_INIT (sxe_init_log) -{ - sxe_log_init =rte_log_register ("pmd.net.sxe.init" ); -if (sxe_log_init >=0 ) -rte_log_set_level (sxe_log_init,RTE_LOG_NOTICE ); - sxe_log_drv =rte_log_register ("pmd.net.sxe.drv" ); -if (sxe_log_drv >=0 ) -rte_log_set_level (sxe_log_drv,RTE_LOG_NOTICE ); -} -#else RTE_LOG_REGISTER_SUFFIX (sxe_log_init, pmd.net.sxe.init,NOTICE );RTE_LOG_REGISTER_SUFFIX (sxe_log_drv, pmd.net.sxe.drv,NOTICE );#endif -#endif int sxe_eth_dev_callback_process (struct rte_eth_dev *dev,enum rte_eth_event_type event,void *ret_param)
drivers/net/sxe/pf/sxe_offload.c +0 -2
@@ -1,9 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> -#include "sxe.h" #include "sxe_offload.h" #include "sxe_logs.h"
drivers/net/sxe/pf/sxe_phy.c +5 -4
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <dev_driver.h> #include <rte_cycles.h>
@@ -58,7 +57,7 @@ static uint32_t sxe_setup_link_thread_handler(void *param)PMD_LOG_ERR (INIT ,"link setup failed, ret=%d" , ret); irq->action &= ~SXE_IRQ_LINK_CONFIG ; -rte_atomic_store_explicit (&adapter->link_thread_running,0 , rte_memory_order_seq_cst); +rte_atomic_store_explicit (&(adapter->link_thread_running),0 , rte_memory_order_seq_cst);return 0 ; }
@@ -69,7 +68,9 @@ void sxe_wait_setup_link_complete(struct rte_eth_dev *dev,struct sxe_adapter *adapter = dev->data->dev_private;uint32_t timeout = timeout_ms ? timeout_ms :SXE_WARNING_TIMEOUT ; -while (rte_atomic_load_explicit (&adapter->link_thread_running, rte_memory_order_seq_cst)) { +while (rte_atomic_load_explicit (&(adapter->link_thread_running), + rte_memory_order_seq_cst)) { +rte_delay_us_sleep (1000 ); timeout--;
@@ -150,7 +151,7 @@ s32 sxe_link_update(struct rte_eth_dev *dev, int wait_to_complete)if (!link_up) {sxe_wait_setup_link_complete (dev,0 ); -if (!rte_atomic_exchange_explicit (&adapter->link_thread_running,1 , +if (!rte_atomic_exchange_explicit (&(adapter->link_thread_running),1 , rte_memory_order_seq_cst)) { if (rte_atomic_load_explicit(&adapter->is_stopping, rte_memory_order_seq_cst) ||
drivers/net/sxe/pf/sxe_pmd_hdc.c +0 -1
@@ -3,7 +3,6 @@*/ #include <rte_malloc.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_compat_version.h" #include <semaphore.h>
drivers/net/sxe/pf/sxe_queue.c +0 -2
@@ -1,11 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <dev_driver.h> #include "sxe_ethdev.h" -#include "rte_malloc.h" #include "sxe.h" #include "sxe_hw.h"
drivers/net/sxe/pf/sxe_queue.h +0 -2
@@ -3,8 +3,6 @@*/ #ifndef __SXE_QUEUE_H__#define __SXE_QUEUE_H__ - -#include "sxe_dpdk_version.h" #include "sxe_queue_common.h" #define SXE_TXRX_RING_NUM_MAX 64
drivers/net/sxe/pf/sxe_rx.c +0 -1
@@ -113,7 +113,6 @@const alignas(RTE_CACHE_LINE_SIZE )u32 sxe_ptype_table[SXE_PACKET_TYPE_MAX ] = { - [SXE_PACKET_TYPE_ETHER ] =RTE_PTYPE_L2_ETHER , [SXE_PACKET_TYPE_IPV4 ] =RTE_PTYPE_L2_ETHER |RTE_PTYPE_L3_IPV4 ,
drivers/net/sxe/pf/sxe_stats.c +17 -4
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include "sxe_stats.h" #include "sxe.h" #include "sxe_logs.h"
@@ -432,7 +431,11 @@ s32 sxe_xstats_get_by_id(struct rte_eth_dev *eth_dev,s32 ret;u32 size =SXE_XSTAT_CNT ;u32 i; -u64 value_all[size]; +u64 *value_all = (u64 *)malloc (size *sizeof (u64)); +if (value_all ==NULL ) { +perror ("value_all malloc failed" ); +return -ENOMEM ; + }if (ids ==NULL ) { ret =sxe_all_xstats_value_get (eth_dev, values, usr_cnt);
@@ -459,6 +462,9 @@ s32 sxe_xstats_get_by_id(struct rte_eth_dev *eth_dev, ret = usr_cnt; l_out: +if (value_all !=NULL ) +free (value_all); +return ret; }
@@ -470,7 +476,12 @@ s32 sxe_xstats_names_get_by_id(struct rte_eth_dev *eth_dev,s32 ret;u32 i;u32 size =SXE_XSTAT_CNT ; -struct rte_eth_xstat_name xstat_names_all[size]; +struct rte_eth_xstat_name *xstat_names_all = + (struct rte_eth_xstat_name *)malloc (size *sizeof (struct rte_eth_xstat_name )); +if (xstat_names_all ==NULL ) { +perror ("xstat_names_all malloc failed" ); +return -ENOMEM ; + }if (ids ==NULL ) { ret =sxe_xstats_names_get (eth_dev, xstats_names, usr_cnt);
@@ -490,6 +501,9 @@ s32 sxe_xstats_names_get_by_id(struct rte_eth_dev *eth_dev, ret = usr_cnt; l_out: +if (xstat_names_all !=NULL ) +free (xstat_names_all); +return ret; }
@@ -573,4 +587,3 @@ void sxe_queue_stats_map_reset(struct rte_eth_dev *eth_dev)sxe_hw_rxq_stat_map_set (hw, reg_idx,0 ); } } -
drivers/net/sxe/pf/sxe_stats.h +0 -2
@@ -7,8 +7,6 @@#include <rte_ethdev.h> #include <rte_ethdev_core.h> - -#include "sxe_dpdk_version.h" #include "sxe_hw.h" #define SXE_STATS_FIELD_NAME_SIZE 50
drivers/net/sxe/pf/sxe_tx.c +0 -20
@@ -1,17 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" -#if definedDPDK_20_11_5 || definedDPDK_19_11_6 -#include <rte_ethdev_driver.h> -#include <rte_ethdev_pci.h> -#elif definedDPDK_21_11_5 -#include <ethdev_driver.h> -#include <rte_dev.h> -#else #include <ethdev_driver.h> #include <dev_driver.h> -#endif #include <rte_net.h>
@@ -43,17 +34,10 @@ void __rte_cold sxe_tx_function_set(struct rte_eth_dev *dev, dev->tx_pkt_prepare =NULL ;#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD if (txq->rs_thresh <=RTE_SXE_MAX_TX_FREE_BUF_SZ && -#ifndef DPDK_19_11_6 - rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128 && -#endif (rte_eal_process_type () !=RTE_PROC_PRIMARY ||sxe_txq_vec_setup (txq) ==0 )) { -#if defined DPDK_23_11_3 || defined DPDK_24_11_1 -#ifndef DPDK_23_7#if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM ) dev->recycle_tx_mbufs_reuse = sxe_recycle_tx_mbufs_reuse_vec; -#endif -#endif#endif dev->tx_pkt_burst = sxe_pkts_vector_xmit;PMD_LOG_INFO (INIT ,"using vector tx code path" );
@@ -370,8 +354,6 @@ u16 sxe_pkts_simple_xmit(void *tx_queue, struct rte_mbuf **tx_pkts, u16 pkts_num }#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD -#if definedDPDK_23_11_3 || definedDPDK_24_11_1 -#ifndef DPDK_23_7 #if defined(RTE_ARCH_X86 ) || defined(RTE_ARCH_ARM )u16 sxe_recycle_tx_mbufs_reuse_vec (void *tx_queue,struct rte_eth_recycle_rxq_info *recycle_rxq_info)
@@ -438,8 +420,6 @@ u16 sxe_recycle_tx_mbufs_reuse_vec(void *tx_queue, return nb_recycle_mbufs; }#endif -#endif -#endif u16 sxe_pkts_vector_xmit (void *tx_queue,struct rte_mbuf **tx_pkts,u16 pkts_num)
drivers/net/sxe/pf/sxe_vec_common.h +6 -1
@@ -77,7 +77,11 @@ static inline u16 sxe_packets_reassemble(sxe_rx_queue_s *rxq, struct rte_mbuf **rx_bufs, u16 bufs_num, u8 *split_flags) { -struct rte_mbuf *pkts[bufs_num]; +struct rte_mbuf **pkts = (struct rte_mbuf **)malloc (bufs_num *sizeof (struct rte_mbuf *)); +if (pkts ==NULL ) { +perror ("pkts malloc failed" ); +exit (EXIT_FAILURE ); + }struct rte_mbuf *start = rxq->pkt_first_seg;struct rte_mbuf *end = rxq->pkt_last_seg;u32 pkt_idx, buf_idx;
@@ -129,6 +133,7 @@ sxe_packets_reassemble(sxe_rx_queue_s *rxq, struct rte_mbuf **rx_bufs, rxq->pkt_last_seg = end;memcpy (rx_bufs, pkts, pkt_idx * (sizeof (*pkts))); +free (pkts);return pkt_idx; }
drivers/net/sxe/pf/sxe_vec_neon.c +0 -2
@@ -1,10 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD #include <stdint.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <rte_malloc.h>
drivers/net/sxe/pf/sxe_vec_sse.c +0 -1
@@ -4,7 +4,6 @@#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SIMD #include <stdint.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <rte_malloc.h> #include <rte_vect.h>
drivers/net/sxe/pf/sxe_vf.c +0 -1
@@ -6,7 +6,6 @@#include <rte_ethdev.h> #include <rte_ether.h> #include <rte_memcpy.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <ethdev_pci.h> #include <bus_pci_driver.h>
drivers/net/sxe/pf/sxe_vf.h +0 -1
@@ -5,7 +5,6 @@#ifndef __SXE_VF_H__#define __SXE_VF_H__ -#include "sxe_dpdk_version.h" #include <rte_ethdev.h> #include <bus_pci_driver.h>
drivers/net/sxe/sxe_drv_type.h +0 -4
@@ -5,14 +5,10 @@#ifndef __SXE_DRV_TYPEDEF_H__#define __SXE_DRV_TYPEDEF_H__ -#ifdef SXE_DPDK #include "sxe_types.h" #ifndef bool#define bool _Bool#endif -#else -#include <linux/types.h> -#endif typedef u8 U8 ;typedef u16 U16 ;
drivers/net/sxe/sxe_testpmd.c +2 -1
@@ -1,10 +1,11 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ +#include <ethdev_driver.h> +#include "sxe_drv_type.h" #include "sxe_ethdev.h" #include "rte_pmd_sxe.h" -#include <cmdline_parse_etheraddr.h> #include <cmdline_parse_num.h> #include <cmdline_parse_string.h>
drivers/net/sxe/vf/sxevf_ethdev.c +2 -4
@@ -11,7 +11,7 @@#include <unistd.h> #include <stdarg.h> #include <inttypes.h> -#include "sxe_dpdk_version.h" +#include <ethdev_driver.h> #include <ethdev_pci.h> #include <bus_pci_driver.h>
@@ -252,6 +252,7 @@ static void sxevf_txrx_start(struct rte_eth_dev *eth_dev) txq = eth_dev->data->tx_queues[i];sxevf_tx_ring_switch (hw, txq->reg_idx, true); eth_dev->data->tx_queue_state[i] =RTE_ETH_QUEUE_STATE_STARTED ; + }for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) {
@@ -332,7 +333,6 @@ static s32 sxevf_dev_stop(struct rte_eth_dev *dev)sxevf_irq_free (dev); l_out: -return 0 ; }
@@ -362,7 +362,6 @@ static s32 sxevf_dev_close(struct rte_eth_dev *dev)sxevf_irq_unregister (dev); l_out: -return ret; }
@@ -470,7 +469,6 @@ static s32 sxevf_mtu_set(struct rte_eth_dev *dev, u16 mtu) goto l_out; } - dev->data->dev_conf.rxmode.max_rx_pkt_len = max_frame;LOG_INFO_BDF ("change max frame size to %u success." , max_frame); l_out:
drivers/net/sxe/vf/sxevf_filter.h +2 -2
@@ -6,9 +6,7 @@#define __SXEVF_FILTER_H__#include <rte_ether.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> -#endif #define SXEVF_MTA_ENTRY_NUM_MAX 128#define SXEVF_UTA_HASH_BIT_MAX 4096
@@ -70,3 +68,5 @@ s32 sxevf_mac_addr_add(struct rte_eth_dev *dev,s32 sxevf_set_mc_addr_list (struct rte_eth_dev *dev,struct rte_ether_addr *mc_addr_list,u32 nb_mc_addr); + +#endif
drivers/net/sxe/vf/sxevf_irq.c +0 -2
@@ -9,10 +9,8 @@#include <rte_alarm.h> #include <rte_interrupts.h> #include <rte_malloc.h> -#include "sxe_dpdk_version.h" #include <bus_pci_driver.h> #include <eal_interrupts.h> -#include "sxevf.h" #include "sxe_logs.h" #include "sxe_errno.h"
drivers/net/sxe/vf/sxevf_irq.h +0 -1
@@ -5,7 +5,6 @@#ifndef __SXEVF_IRQ_H__#define __SXEVF_IRQ_H__ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_compat_platform.h"
drivers/net/sxe/vf/sxevf_main.c +0 -1
@@ -12,7 +12,6 @@#include <rte_dev.h> #include "sxe_version.h" -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include <ethdev_pci.h> #include <bus_pci_driver.h>
drivers/net/sxe/vf/sxevf_offload.c +0 -1
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright (C), 2022, Linkdata Technology Co., Ltd. */ -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_types.h"
drivers/net/sxe/vf/sxevf_queue.c +0 -2
@@ -7,8 +7,6 @@#include <rte_byteorder.h> #include <rte_mbuf_core.h> #include <rte_ethdev.h> - -#include "sxe_dpdk_version.h" #include "sxevf_rx.h" #include "sxevf_tx.h" #include "sxe_logs.h"
drivers/net/sxe/vf/sxevf_queue.h +0 -1
@@ -5,7 +5,6 @@#ifndef __SXEVF_QUEUEU_H__#define __SXEVF_QUEUEU_H__ -#include "sxe_dpdk_version.h" #include "sxe_types.h" #include "sxe_queue_common.h"
drivers/net/sxe/vf/sxevf_rx.c +0 -1
@@ -5,7 +5,6 @@#if definedSXE_DPDK_L4_FEATURES && definedSXE_DPDK_SRIOV #include <rte_common.h> -#include "sxe_dpdk_version.h" #include <ethdev_driver.h> #include "sxe_logs.h"
Signature · 1 line
2.18.4
Re: [PATCH v3 14/14] net/sxe: add Solve compilation problems.
Quoted 3 lines · On Mon, 7 Jul 2025 07:58:19 -0400 Jie Liu <[email protected]>…
Add Fix compiling issues.
Signed-off-by Jie Liu <[email protected]>
Please integrate these into the individual patches.
Each patch in series must compile cleanly because at some later time a developer will be needing to do "git bisect" and if one of these patches is bad, the bisect step will fail to build.
Re: [PATCH v3 14/14] net/sxe: add Solve compilation problems.
In reply to Jie LiuQuoted 4 lines · On Mon, 7 Jul 2025 07:58:19 -0400 Jie Liu <[email protected]>…
Add Fix compiling issues.
Signed-off-by Jie Liu <[email protected]>---
The patch series is not build in CI.
Please fix each patch so that it builds on Linux with GCC and Clang. The overall patch set needs to build on all supported platforms before review. If driver doesn't support windows, that should be handled via meson.build
PATCH v4 1/2 net/sxe: add base driver directory and doc
In reply to Jie LiuAdding a minimum maintainable directory structure for the network driver and request maintenance of the sxe driver.
--- MAINTAINERS | 6 +++ doc/guides/nics/features/sxe.ini | 78 +++++++++++++++++++++++++++++ doc/guides/nics/features/sxe_vf.ini | 37 ++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sxe.rst | 71 ++++++++++++++++++++++++++ drivers/net/sxe/meson.build | 9 ++++ drivers/net/sxe/pf/sxe_ethdev.c | 3 ++ drivers/net/sxe/pf/sxe_ethdev.h | 3 ++ 8 files changed, 208 insertions(+) create mode 100644 doc/guides/nics/features/sxe.ini create mode 100644 doc/guides/nics/features/sxe_vf.ini create mode 100644 doc/guides/nics/sxe.rst create mode 100644 drivers/net/sxe/meson.build create mode 100644 drivers/net/sxe/pf/sxe_ethdev.c create mode 100644 drivers/net/sxe/pf/sxe_ethdev.h
MAINTAINERS +6 -0
@@ -2055,3 +2055,9 @@ F: examples/vmdq/ F: doc/guides/sample_app_ug/vmdq_forwarding.rst F: examples/vmdq_dcb/ F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst + +Linkdata sxe +M: Jie Li <[email protected]> +F: drivers/net/sxe/ +F: doc/guides/nics/sxe.rst +F: doc/guides/nics/features/sxe*.ini
doc/guides/nics/features/sxe.ini new file +78 -0
78 lines not on this page · raw message
doc/guides/nics/features/sxe_vf.ini new file +37 -0
@@ -0,0 +1,37 @@ +; +; Supported features of the 'sxe_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Link status = Y +Rx interrupt = Y +Power mgmt address monitor = Y +MTU update = Y +Scattered Rx = Y +LRO = Y +TSO = Y +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 +CRC offload = P +VLAN offload = P +QinQ offload = P +L3 checksum offload = P +L4 checksum offload = P +Inner L3 checksum = P +Inner L4 checksum = P +Packet type parsing = Y +Rx descriptor status = Y +Tx descriptor status = Y +Basic stats = Y +Extended stats = Y +Registers dump = Y +Linux = Y +ARMv8 = Y +x86-64 = Y
doc/guides/nics/index.rst +1 -0
@@ -61,6 +61,7 @@ Network Interface Controller Drivers pfe qede r8169 + sxe sfc_efx softnic tap
doc/guides/nics/sxe.rst new file +71 -0
71 lines not on this page · raw message
drivers/net/sxe/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C), 2020, Wuxi Stars Micro System Technologies Co., Ltd. + +deps += ['hash'] +sources = files( + 'pf/sxe_ethdev.c', +) + +includes += include_directories('pf')
drivers/net/sxe/pf/sxe_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
drivers/net/sxe/pf/sxe_ethdev.h new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2024 +*/
Signature · 1 line
2.18.4
PATCH v4 2/2 net/sxe: add ethdev probe and remove
Add basic modules: logs、 hardware communication、common components and support basic PCIe ethdev probe and remove.
--- drivers/net/sxe/base/sxe_common.c | 64 + drivers/net/sxe/base/sxe_common.h | 15 + drivers/net/sxe/base/sxe_compat_platform.h | 137 + drivers/net/sxe/base/sxe_compat_version.h | 38 + drivers/net/sxe/base/sxe_errno.h | 61 + drivers/net/sxe/base/sxe_hw.c | 6260 ++++++++++++++++++++ drivers/net/sxe/base/sxe_hw.h | 1541 +++++ drivers/net/sxe/base/sxe_logs.h | 273 + drivers/net/sxe/base/sxe_types.h | 40 + drivers/net/sxe/include/drv_msg.h | 18 + drivers/net/sxe/include/sxe/sxe_hdc.h | 42 + drivers/net/sxe/include/sxe/sxe_msg.h | 135 + drivers/net/sxe/include/sxe/sxe_regs.h | 1280 ++++ drivers/net/sxe/include/sxe_version.h | 29 + drivers/net/sxe/meson.build | 15 +- drivers/net/sxe/pf/sxe.h | 56 + drivers/net/sxe/pf/sxe_ethdev.c | 324 +- drivers/net/sxe/pf/sxe_ethdev.h | 27 +- drivers/net/sxe/pf/sxe_irq.c | 126 + drivers/net/sxe/pf/sxe_irq.h | 41 + drivers/net/sxe/pf/sxe_main.c | 251 + drivers/net/sxe/pf/sxe_phy.h | 38 + drivers/net/sxe/pf/sxe_pmd_hdc.c | 683 +++ drivers/net/sxe/pf/sxe_pmd_hdc.h | 44 + drivers/net/sxe/sxe_drv_type.h | 23 + 25 files changed, 11558 insertions(+), 3 deletions(-) create mode 100644 drivers/net/sxe/base/sxe_common.c create mode 100644 drivers/net/sxe/base/sxe_common.h create mode 100644 drivers/net/sxe/base/sxe_compat_platform.h create mode 100644 drivers/net/sxe/base/sxe_compat_version.h create mode 100644 drivers/net/sxe/base/sxe_errno.h create mode 100644 drivers/net/sxe/base/sxe_hw.c create mode 100644 drivers/net/sxe/base/sxe_hw.h create mode 100644 drivers/net/sxe/base/sxe_logs.h create mode 100644 drivers/net/sxe/base/sxe_types.h create mode 100644 drivers/net/sxe/include/drv_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_hdc.h create mode 100644 drivers/net/sxe/include/sxe/sxe_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_regs.h create mode 100644 drivers/net/sxe/include/sxe_version.h create mode 100644 drivers/net/sxe/pf/sxe.h create mode 100644 drivers/net/sxe/pf/sxe_irq.c create mode 100644 drivers/net/sxe/pf/sxe_irq.h create mode 100644 drivers/net/sxe/pf/sxe_main.c create mode 100644 drivers/net/sxe/pf/sxe_phy.h create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.c create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.h create mode 100644 drivers/net/sxe/sxe_drv_type.h
drivers/net/sxe/base/sxe_common.c new file +64 -0
@@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#include <pthread.h> +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + +#include "sxe_types.h" +#include "sxe_common.h" + +#define SXE_TRACE_ID_COUNT_MASK 0x00000000000000FFLLU +#define SXE_TRACE_ID_TID_MASK 0x0000000000FFFF00LLU +#define SXE_TRACE_ID_TIME_MASK 0x00FFFFFFFF000000LLU +#define SXE_TRACE_ID_FLAG 0xFF00000000000000LLU + +#define SXE_TRACE_ID_COUNT_SHIFT 0 +#define SXE_TRACE_ID_TID_SHIFT 8 +#define SXE_TRACE_ID_TIME_SHIFT 24 + +#define SXE_SEC_TO_MS (sec) ((sec) * 1000ULL) +#define SXE_SEC_TO_NS (sec) ((sec) * 1000000000ULL) + +#define SXE_USEC_PER_MS 1000 + +u64 sxe_trace_id; + +u64 sxe_time_get_real_ms (void ) +{ +u64 ms =0 ; +struct timeval tv = {0 }; +s32 ret =gettimeofday (&tv,NULL ); +if (ret <0 ) + goto l_end; + + ms =SXE_SEC_TO_MS (tv.tv_sec) + tv.tv_usec /SXE_USEC_PER_MS ; + +l_end: +return ms; +} + +u64 sxe_trace_id_gen (void ) +{ +u64 tid =getpid () + (pthread_self () <<20 ); +u64 index =0 ; +u64 timestamp =sxe_time_get_real_ms (); + + sxe_trace_id = (SXE_TRACE_ID_FLAG ) + | ((timestamp <<SXE_TRACE_ID_TIME_SHIFT ) &SXE_TRACE_ID_TIME_MASK ) + | ((tid <<SXE_TRACE_ID_TID_SHIFT ) &SXE_TRACE_ID_TID_MASK ) + | ((index <<SXE_TRACE_ID_COUNT_SHIFT ) &SXE_TRACE_ID_COUNT_MASK ); +return sxe_trace_id; +} + +void sxe_trace_id_clean (void ) +{ + sxe_trace_id =0 ; +} + +u64 sxe_trace_id_get (void ) +{ +return sxe_trace_id++; +}
drivers/net/sxe/base/sxe_common.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifndef __SXE_DPDK_COMMON_H__ +#define __SXE_DPDK_COMMON_H__ + +u64 sxe_trace_id_gen (void ); + +void sxe_trace_id_clean (void ); + +u64 sxe_trace_id_get (void ); + +u64 sxe_time_get_real_ms (void ); + +#endif
drivers/net/sxe/base/sxe_compat_platform.h new file +137 -0
137 lines not on this page · raw message
drivers/net/sxe/base/sxe_compat_version.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_COMPAT_VERSION_H__ +#define __SXE_COMPAT_VERSION_H__ + +#include <stdbool.h> +#include "sxe_dpdk_version.h" + +struct rte_eth_dev ; +enum rte_eth_event_type ; + +int sxe_eth_dev_callback_process (struct rte_eth_dev *dev, +enum rte_eth_event_type event,void *ret_param); + +#define SET_AUTOFILL_QUEUE_XSTATS +#define PCI_REG_WC_WRITE + +#ifndef PCI_REG_WC_WRITE +#define rte_write32_wc rte_write32 +#define rte_write32_wc_relaxed rte_write32_relaxed +#endif + +#define SXE_PCI_INTR_HANDLE (pci_dev) \ + ((pci_dev)->intr_handle) +#define SXE_DEV_FNAV_CONF (dev) \ + (&((struct sxe_adapter *)(dev)->data->dev_private)->fnav_conf) +#define RTE_ADAPTER_HAVE_FNAV_CONF +#define SXE_GET_FRAME_SIZE (dev) \ + ((dev)->data->mtu + SXE_ETH_OVERHEAD) + +#define ETH_DEV_OPS_MONITOR + +#define DEV_RX_OFFLOAD_CHECKSUM RTE_ETH_RX_OFFLOAD_CHECKSUM +#define ETH_DCB_NUM_USER_PRIORITIES RTE_ETH_DCB_NUM_USER_PRIORITIES + +#endif
drivers/net/sxe/base/sxe_errno.h new file +61 -0
61 lines not on this page · raw message
drivers/net/sxe/base/sxe_hw.c new file +6260 -0
2,685 lines not on this page · raw message
drivers/net/sxe/base/sxe_hw.h new file +1541 -0
1,541 lines not on this page · raw message
drivers/net/sxe/base/sxe_logs.h new file +273 -0
273 lines not on this page · raw message
drivers/net/sxe/base/sxe_types.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/drv_msg.h new file +18 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe/sxe_hdc.h new file +42 -0
42 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_msg.h new file +135 -0
135 lines not on this page · raw message
drivers/net/sxe/include/sxe/sxe_regs.h new file +1280 -0
1,280 lines not on this page · raw message
drivers/net/sxe/include/sxe_version.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe.h new file +56 -0
56 lines not on this page · raw message
drivers/net/sxe/pf/sxe_ethdev.c +323 -1
324 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.c new file +126 -0
126 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.h new file +41 -0
41 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c new file +251 -0
251 lines not on this page · raw message
drivers/net/sxe/pf/sxe_pmd_hdc.c new file +683 -0
683 lines not on this page · raw message
drivers/net/sxe/pf/sxe_pmd_hdc.h new file +44 -0
44 lines not on this page · raw message
drivers/net/sxe/sxe_drv_type.h new file +23 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v4 2/2] net/sxe: add ethdev probe and remove
drivers/net/sxe/sxe_drv_type.h
Quoted 11,767 lines · On Wed, 9 Jul 2025 04:43:02 -0400 Jie Liu <[email protected]>…
Add basic modules: logs、 hardware communication、common components and support basic PCIe ethdev probe and remove.
Signed-off-by Jie Liu <[email protected]>--- drivers/net/sxe/base/sxe_common.c | 64 + drivers/net/sxe/base/sxe_common.h | 15 + drivers/net/sxe/base/sxe_compat_platform.h | 137 + drivers/net/sxe/base/sxe_compat_version.h | 38 + drivers/net/sxe/base/sxe_errno.h | 61 + drivers/net/sxe/base/sxe_hw.c | 6260 ++++++++++++++++++++ drivers/net/sxe/base/sxe_hw.h | 1541 +++++ drivers/net/sxe/base/sxe_logs.h | 273 + drivers/net/sxe/base/sxe_types.h | 40 + drivers/net/sxe/include/drv_msg.h | 18 + drivers/net/sxe/include/sxe/sxe_hdc.h | 42 + drivers/net/sxe/include/sxe/sxe_msg.h | 135 + drivers/net/sxe/include/sxe/sxe_regs.h | 1280 ++++ drivers/net/sxe/include/sxe_version.h | 29 + drivers/net/sxe/meson.build | 15 +- drivers/net/sxe/pf/sxe.h | 56 + drivers/net/sxe/pf/sxe_ethdev.c | 324 +- drivers/net/sxe/pf/sxe_ethdev.h | 27 +- drivers/net/sxe/pf/sxe_irq.c | 126 + drivers/net/sxe/pf/sxe_irq.h | 41 + drivers/net/sxe/pf/sxe_main.c | 251 + drivers/net/sxe/pf/sxe_phy.h | 38 + drivers/net/sxe/pf/sxe_pmd_hdc.c | 683 +++ drivers/net/sxe/pf/sxe_pmd_hdc.h | 44 + drivers/net/sxe/sxe_drv_type.h | 23 + 25 files changed, 11558 insertions(+), 3 deletions(-) create mode 100644 drivers/net/sxe/base/sxe_common.c create mode 100644 drivers/net/sxe/base/sxe_common.h create mode 100644 drivers/net/sxe/base/sxe_compat_platform.h create mode 100644 drivers/net/sxe/base/sxe_compat_version.h create mode 100644 drivers/net/sxe/base/sxe_errno.h create mode 100644 drivers/net/sxe/base/sxe_hw.c create mode 100644 drivers/net/sxe/base/sxe_hw.h create mode 100644 drivers/net/sxe/base/sxe_logs.h create mode 100644 drivers/net/sxe/base/sxe_types.h create mode 100644 drivers/net/sxe/include/drv_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_hdc.h create mode 100644 drivers/net/sxe/include/sxe/sxe_msg.h create mode 100644 drivers/net/sxe/include/sxe/sxe_regs.h create mode 100644 drivers/net/sxe/include/sxe_version.h create mode 100644 drivers/net/sxe/pf/sxe.h create mode 100644 drivers/net/sxe/pf/sxe_irq.c create mode 100644 drivers/net/sxe/pf/sxe_irq.h create mode 100644 drivers/net/sxe/pf/sxe_main.c create mode 100644 drivers/net/sxe/pf/sxe_phy.h create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.c create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.h create mode 100644 drivers/net/sxe/sxe_drv_type.hdrivers/net/sxe/base/sxe_common.c new file +64
-0@@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#include <pthread.h> +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + +#include "sxe_types.h" +#include "sxe_common.h" + +#define SXE_TRACE_ID_COUNT_MASK 0x00000000000000FFLLU +#define SXE_TRACE_ID_TID_MASK 0x0000000000FFFF00LLU +#define SXE_TRACE_ID_TIME_MASK 0x00FFFFFFFF000000LLU +#define SXE_TRACE_ID_FLAG 0xFF00000000000000LLU + +#define SXE_TRACE_ID_COUNT_SHIFT 0 +#define SXE_TRACE_ID_TID_SHIFT 8 +#define SXE_TRACE_ID_TIME_SHIFT 24 + +#define SXE_SEC_TO_MS (sec) ((sec) * 1000ULL) +#define SXE_SEC_TO_NS (sec) ((sec) * 1000000000ULL) + +#define SXE_USEC_PER_MS 1000 + +u64 sxe_trace_id; + +u64 sxe_time_get_real_ms (void ) +{ +u64 ms =0 ; +struct timeval tv = {0 }; +s32 ret =gettimeofday (&tv,NULL ); +if (ret <0 ) + goto l_end; + + ms =SXE_SEC_TO_MS (tv.tv_sec) + tv.tv_usec /SXE_USEC_PER_MS ; + +l_end: +return ms; +} + +u64 sxe_trace_id_gen (void ) +{ +u64 tid =getpid () + (pthread_self () <<20 ); +u64 index =0 ; +u64 timestamp =sxe_time_get_real_ms (); + + sxe_trace_id = (SXE_TRACE_ID_FLAG ) + | ((timestamp <<SXE_TRACE_ID_TIME_SHIFT ) &SXE_TRACE_ID_TIME_MASK ) + | ((tid <<SXE_TRACE_ID_TID_SHIFT ) &SXE_TRACE_ID_TID_MASK ) + | ((index <<SXE_TRACE_ID_COUNT_SHIFT ) &SXE_TRACE_ID_COUNT_MASK ); +return sxe_trace_id; +} + +void sxe_trace_id_clean (void ) +{ + sxe_trace_id =0 ; +} + +u64 sxe_trace_id_get (void ) +{ +return sxe_trace_id++; +}drivers/net/sxe/base/sxe_common.h new file +15
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifndef __SXE_DPDK_COMMON_H__ +#define __SXE_DPDK_COMMON_H__ + +u64 sxe_trace_id_gen (void ); + +void sxe_trace_id_clean (void ); + +u64 sxe_trace_id_get (void ); + +u64 sxe_time_get_real_ms (void ); + +#endif drivers/net/sxe/base/sxe_compat_platform.h new file +137
-0@@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_COMPAT_PLATFORM_H__ +#define __SXE_COMPAT_PLATFORM_H__ + +#include <rte_cycles.h> +#include <rte_branch_prediction.h> +#include <rte_byteorder.h> +#include <rte_io.h> +#include <rte_common.h> + +#include "sxe_types.h" + +#define false 0 +#define true 1 + +#ifdef SXE_TEST +#define STATIC +#else +#define STATIC static +#endif + +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) +#endif + +#define __iomem +#define __force + +#define min (a, b) RTE_MIN(a, b) + +#ifndef fallthrough +# define fallthrough do {} while (0) +#endif + +#define __swab32 (_value) \ + (((u32)(_value) >> 24) | (((u32)(_value) & 0x00FF0000) >> 8) | \ + (((u32)(_value) & 0x0000FF00) << 8) | ((u32)(_value) << 24)) + +#define __swab16 (_value) \ + (((u16)(_value) >> 8) | ((u16)(_value) << 8)) + +#define cpu_to_be16 (o) rte_cpu_to_be_16(o) +#define cpu_to_be32 (o) rte_cpu_to_be_32(o) +#define cpu_to_be64 (o) rte_cpu_to_be_64(o) +#define cpu_to_le32 (o) rte_cpu_to_le_32(o) +#define be16_to_cpu (o) rte_be_to_cpu_16(o) +#define be32_to_cpu (o) rte_be_to_cpu_32(o) +#define be64_to_cpu (o) rte_be_to_cpu_64(o) +#define le32_to_cpu (o) rte_le_to_cpu_32(o) + +#ifndef ntohs +#define ntohs (o) be16_to_cpu(o) +#endif + +#ifndef ntohl +#define ntohl (o) be32_to_cpu(o) +#endif + +#ifndef htons +#define htons (o) cpu_to_be16(o) +#endif + +#ifndef htonl +#define htonl (o) cpu_to_be32(o) +#endif +#define mdelay rte_delay_ms +#define sxe_udelay rte_delay_us +#define usleep_range (min, max) rte_delay_us(min) +#define msleep (x) rte_delay_us((x) * 1000) + +#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0])) +#define BIT (x) (1UL << (x)) +#define DMA_BIT_MASK (n) (((n) == 64) ? ~0ULL : ((1ULL << (n)) - 1)) + +#define NSEC_PER_SEC 1000000000L + +#define ETH_P_1588 0x88F7 + +#define VLAN_PRIO_SHIFT 13 + +static inline void +set_bit (unsigned long nr,void *addr) +{ +int *m = ((int *)addr) + (nr >>5 ); + *m |=1 << (nr &31 ); +} + +static inline int +test_bit (int nr,const void *addr) +{ +return (1UL & (((const int *)addr)[nr >>5 ] >> (nr &31 ))) !=0UL ; +} + +static inline void +clear_bit (unsigned long nr,void *addr) +{ +int *m = ((int *)addr) + (nr >>5 ); + *m &= ~(1 << (nr &31 )); +} + +static inline int +test_and_clear_bit (unsigned long nr,void *addr) +{ +unsigned long mask =1 << (nr &0x1f ); +int *m = ((int *)addr) + (nr >>5 ); +int old = *m; + + *m = old & ~mask; +return (old & mask) !=0 ; +} + +static __rte_always_inline uint64_t +readq (volatile void *addr) +{ +return rte_le_to_cpu_64 (rte_read64 (addr)); +} + +static __rte_always_inline void +writeq (uint64_t value,volatile void *addr) +{ +rte_write64 (rte_cpu_to_le_64 (value), addr); +} + +static inline u32 sxe_read_addr (const volatile void *addr) +{ +return rte_le_to_cpu_32 (rte_read32 (addr)); +} + +static inline void sxe_write_addr (u32 value,volatile void *addr) +{ +rte_write32 ((rte_cpu_to_le_32 (value)), addr); +} + +#endif drivers/net/sxe/base/sxe_compat_version.h new file +38
-0@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_COMPAT_VERSION_H__ +#define __SXE_COMPAT_VERSION_H__ + +#include <stdbool.h> +#include "sxe_dpdk_version.h" + +struct rte_eth_dev ; +enum rte_eth_event_type ; + +int sxe_eth_dev_callback_process (struct rte_eth_dev *dev, +enum rte_eth_event_type event,void *ret_param); + +#define SET_AUTOFILL_QUEUE_XSTATS +#define PCI_REG_WC_WRITE + +#ifndef PCI_REG_WC_WRITE +#define rte_write32_wc rte_write32 +#define rte_write32_wc_relaxed rte_write32_relaxed +#endif + +#define SXE_PCI_INTR_HANDLE (pci_dev) \ + ((pci_dev)->intr_handle) +#define SXE_DEV_FNAV_CONF (dev) \ + (&((struct sxe_adapter *)(dev)->data->dev_private)->fnav_conf) +#define RTE_ADAPTER_HAVE_FNAV_CONF +#define SXE_GET_FRAME_SIZE (dev) \ + ((dev)->data->mtu + SXE_ETH_OVERHEAD) + +#define ETH_DEV_OPS_MONITOR + +#define DEV_RX_OFFLOAD_CHECKSUM RTE_ETH_RX_OFFLOAD_CHECKSUM +#define ETH_DCB_NUM_USER_PRIORITIES RTE_ETH_DCB_NUM_USER_PRIORITIES + +#endif drivers/net/sxe/base/sxe_errno.h new file +61
-0@@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_ERRNO_H__ +#define __SXE_ERRNO_H__ + +#define SXE_ERR_MODULE_STANDARD 0 +#define SXE_ERR_MODULE_PF 1 +#define SXE_ERR_MODULE_VF 2 +#define SXE_ERR_MODULE_HDC 3 + +#define SXE_ERR_MODULE_OFFSET 16 +#define SXE_ERR_MODULE (module, errcode) \ + (((module) << SXE_ERR_MODULE_OFFSET) | (errcode)) +#define SXE_ERR_PF (errcode) SXE_ERR_MODULE(SXE_ERR_MODULE_PF, errcode) +#define SXE_ERR_VF (errcode) SXE_ERR_MODULE(SXE_ERR_MODULE_VF, errcode) +#define SXE_ERR_HDC (errcode) SXE_ERR_MODULE(SXE_ERR_MODULE_HDC, errcode) + +#define SXE_ERR_CONFIG EINVAL +#define SXE_ERR_PARAM EINVAL +#define SXE_ERR_RESET_FAILED EPERM +#define SXE_ERR_NO_SPACE ENOSPC +#define SXE_ERR_FNAV_CMD_INCOMPLETE EBUSY +#define SXE_ERR_MBX_LOCK_FAIL EBUSY +#define SXE_ERR_OPRATION_NOT_PERM EPERM +#define SXE_ERR_LINK_STATUS_INVALID EINVAL +#define SXE_ERR_LINK_SPEED_INVALID EINVAL +#define SXE_ERR_DEVICE_NOT_SUPPORTED EOPNOTSUPP +#define SXE_ERR_HDC_LOCK_BUSY EBUSY +#define SXE_ERR_HDC_FW_OV_TIMEOUT ETIMEDOUT +#define SXE_ERR_MDIO_CMD_TIMEOUT ETIMEDOUT +#define SXE_ERR_INVALID_LINK_SETTINGS EINVAL +#define SXE_ERR_FNAV_REINIT_FAILED EIO +#define SXE_ERR_CLI_FAILED EIO +#define SXE_ERR_MASTER_REQUESTS_PENDING SXE_ERR_PF(1) +#define SXE_ERR_SFP_NO_INIT_SEQ_PRESENT SXE_ERR_PF(2) +#define SXE_ERR_ENABLE_SRIOV_FAIL SXE_ERR_PF(3) +#define SXE_ERR_IPSEC_SA_STATE_NOT_EXSIT SXE_ERR_PF(4) +#define SXE_ERR_SFP_NOT_PERSENT SXE_ERR_PF(5) +#define SXE_ERR_PHY_NOT_PERSENT SXE_ERR_PF(6) +#define SXE_ERR_PHY_RESET_FAIL SXE_ERR_PF(7) +#define SXE_ERR_FC_NOT_NEGOTIATED SXE_ERR_PF(8) +#define SXE_ERR_SFF_NOT_SUPPORTED SXE_ERR_PF(9) + +#define SXEVF_ERR_MAC_ADDR_INVALID EINVAL +#define SXEVF_ERR_RESET_FAILED EIO +#define SXEVF_ERR_ARGUMENT_INVALID EINVAL +#define SXEVF_ERR_NOT_READY EBUSY +#define SXEVF_ERR_POLL_ACK_FAIL EIO +#define SXEVF_ERR_POLL_MSG_FAIL EIO +#define SXEVF_ERR_MBX_LOCK_FAIL EBUSY +#define SXEVF_ERR_REPLY_INVALID EINVAL +#define SXEVF_ERR_IRQ_NUM_INVALID EINVAL +#define SXEVF_ERR_PARAM EINVAL +#define SXEVF_ERR_MAILBOX_FAIL SXE_ERR_VF(1) +#define SXEVF_ERR_MSG_HANDLE_ERR SXE_ERR_VF(2) +#define SXEVF_ERR_DEVICE_NOT_SUPPORTED SXE_ERR_VF(3) +#define SXEVF_ERR_IPSEC_SA_STATE_NOT_EXSIT SXE_ERR_VF(4) + +#endif drivers/net/sxe/base/sxe_hw.c new file +6260
-0@@ -0,0 +1,6260 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#ifdef SXE_PHY_CONFIGURE +#include <linux/mdio.h> +#endif +#if defined(__KERNEL__) || defined(SXE_KERNEL_TEST ) +#include "sxe_pci.h" +#include "sxe_log.h" +#include "sxe_debug.h" +#include "sxe_host_hdc.h" +#include "sxe_sriov.h" +#include "sxe_compat.h" +#else +#include "sxe_errno.h" +#include "sxe_logs.h" +#include "sxe.h" + +#include "sxe_hw.h" +#endif + + +#define SXE_PFMSG_MASK (0xFF00) + +#define SXE_MSGID_MASK (0xFFFFFFFF) + +#define SXE_CTRL_MSG_MASK (0x700) + +#define SXE_RING_WAIT_LOOP 10 +#define SXE_REG_NAME_LEN 16 +#define SXE_DUMP_REG_STRING_LEN 73 +#define SXE_DUMP_REGS_NUM 64 +#define SXE_MAX_RX_DESC_POLL 10 +#define SXE_LPBK_EN 0x00000001 +#define SXE_MACADDR_LOW_4_BYTE 4 +#define SXE_MACADDR_HIGH_2_BYTE 2 +#define SXE_RSS_FIELD_MASK 0xffff0000 +#define SXE_MRQE_MASK 0x0000000f + +#define SXE_HDC_DATA_LEN_MAX 256 + +#define SXE_8_TC_MSB (0x11111111) + +static u32 sxe_read_reg (struct sxe_hw *hw,u32 reg); +static void sxe_write_reg (struct sxe_hw *hw,u32 reg,u32 value); +static void sxe_write_reg64 (struct sxe_hw *hw,u32 reg,u64 value); + +#define SXE_WRITE_REG_ARRAY_32 (a, reg, offset, value) \ + sxe_write_reg(a, (reg) + ((offset) << 2), value) +#define SXE_READ_REG_ARRAY_32 (a, reg, offset) \ + sxe_read_reg(a, (reg) + ((offset) << 2)) + +#define SXE_REG_READ (hw, addr) sxe_read_reg(hw, addr) +#define SXE_REG_WRITE (hw, reg, value) sxe_write_reg(hw, reg, value) +#define SXE_WRITE_FLUSH (a) sxe_read_reg(a, SXE_STATUS) +#define SXE_REG_WRITE_ARRAY (hw, reg, offset, value) \ + sxe_write_reg(hw, (reg) + ((offset) << 2), (value)) + +#define SXE_SWAP_32 (_value) __swab32((_value)) + +#define SXE_REG_WRITE_BE32 (a, reg, value) \ + SXE_REG_WRITE((a), (reg), SXE_SWAP_32(ntohl(value))) + +#define SXE_SWAP_16 (_value) __swab16((_value)) + +#define SXE_REG64_WRITE (a, reg, value) sxe_write_reg64((a), (reg), (value)) + +enum sxe_ipsec_table { +SXE_IPSEC_IP_TABLE =0 , +SXE_IPSEC_SPI_TABLE , +SXE_IPSEC_KEY_TABLE , +}; + +u32 mac_regs[] = { +SXE_COMCTRL , +SXE_PCCTRL , +SXE_LPBKCTRL , +SXE_MAXFS , +SXE_VLANCTRL , +SXE_VLANID , +SXE_LINKS , +SXE_HLREG0 , +SXE_MFLCN , +SXE_MACC , +}; + +u16 sxe_mac_reg_num_get (void ) +{ +return ARRAY_SIZE (mac_regs); +} + + +#ifndef SXE_DPDK + +void sxe_hw_fault_handle (struct sxe_hw *hw) +{ +struct sxe_adapter *adapter = hw->adapter; + +if (test_bit (SXE_HW_FAULT , &hw->state)) +return ; + +set_bit (SXE_HW_FAULT , &hw->state); + +LOG_DEV_ERR ("sxe nic hw fault" ); + +if (hw->fault_handle !=NULL && hw->priv !=NULL ) + hw->fault_handle (hw->priv); +} + +static u32 sxe_hw_fault_check (struct sxe_hw *hw,u32 reg) +{ +u32 i, value; +u8 __iomem *base_addr = hw->reg_base_addr; +struct sxe_adapter *adapter = hw->adapter; + +if (sxe_is_hw_fault (hw)) + goto l_out; + +for (i =0 ; i <SXE_REG_READ_RETRY ; i++) { + value = hw->reg_read (base_addr +SXE_STATUS ); +if (value !=SXE_REG_READ_FAIL ) +break ; + +mdelay (3 ); + } + +if (value ==SXE_REG_READ_FAIL ) { +LOG_ERROR_BDF ("read registers multiple times failed, ret=%#x" , value); +sxe_hw_fault_handle (hw); + }else { + value = hw->reg_read (base_addr + reg); + } + +return value; +l_out: +return SXE_REG_READ_FAIL ; +} + +static u32 sxe_read_reg (struct sxe_hw *hw,u32 reg) +{ +u32 value; +u8 __iomem *base_addr = hw->reg_base_addr; +struct sxe_adapter *adapter = hw->adapter; + +if (sxe_is_hw_fault (hw)) { + value =SXE_REG_READ_FAIL ; + goto l_ret; + } + + value = hw->reg_read (base_addr + reg); +if (unlikely (value ==SXE_REG_READ_FAIL )) { +LOG_ERROR_BDF ("reg[0x%x] read failed, ret=%#x" , reg, value); + value =sxe_hw_fault_check (hw, reg); + } + +l_ret: +return value; +} + +static void sxe_write_reg (struct sxe_hw *hw,u32 reg,u32 value) +{ +u8 __iomem *base_addr = hw->reg_base_addr; + +if (sxe_is_hw_fault (hw)) +return ; + + hw->reg_write (value, base_addr + reg); +} + +#else + +static u32 sxe_read_reg (struct sxe_hw *hw,u32 reg) +{ +u32 i, value; +u8 __iomem *base_addr = hw->reg_base_addr; + + value =rte_le_to_cpu_32 (rte_read32 (base_addr + reg)); +if (unlikely (value ==SXE_REG_READ_FAIL )) { + value =rte_le_to_cpu_32 (rte_read32 (base_addr +SXE_STATUS )); +if (unlikely (value !=SXE_REG_READ_FAIL )) { + value =rte_le_to_cpu_32 (rte_read32 (base_addr + reg)); + }else { +LOG_ERROR ("reg[0x%x] and reg[0x%x] read failed, ret=%#x" , + reg,SXE_STATUS , value); +for (i =0 ; i <SXE_REG_READ_RETRY ; i++) { + value =rte_le_to_cpu_32 (rte_read32 (base_addr +SXE_STATUS )); +if (unlikely (value !=SXE_REG_READ_FAIL )) { + value =rte_le_to_cpu_32 (rte_read32 (base_addr + reg)); +LOG_INFO ("reg[0x%x] read ok, value=%#x" , + reg, value); +break ; + } +LOG_ERROR ("reg[0x%x] and reg[0x%x] read failed, ret=%#x" , + reg,SXE_STATUS , value); + +mdelay (3 ); + } + } + } + +return value; +} + +static void sxe_write_reg (struct sxe_hw *hw,u32 reg,u32 value) +{ +u8 __iomem *base_addr = hw->reg_base_addr; + +rte_write32 ((rte_cpu_to_le_32 (value)), (base_addr + reg)); +} +#endif + +static void sxe_write_reg64 (struct sxe_hw *hw,u32 reg,u64 value) +{ +u8 __iomem *reg_addr = hw->reg_base_addr; + +if (sxe_is_hw_fault (hw)) +return ; + +writeq (value, reg_addr + reg); +} + + +void sxe_hw_no_snoop_disable (struct sxe_hw *hw) +{ +u32 ctrl_ext; + + ctrl_ext =SXE_REG_READ (hw,SXE_CTRL_EXT ); + ctrl_ext |=SXE_CTRL_EXT_NS_DIS ; +SXE_REG_WRITE (hw,SXE_CTRL_EXT , ctrl_ext); +SXE_WRITE_FLUSH (hw); +} + +static void sxe_hw_uc_addr_pool_add (struct sxe_hw *hw,u32 rar_idx,u32 pool_idx) +{ +u32 value; + +if (sxe_is_hw_fault (hw)) + goto l_end; + +if (pool_idx <32 ) { + value =SXE_REG_READ (hw,SXE_MPSAR_LOW (rar_idx)); + value |=BIT (pool_idx); +SXE_REG_WRITE (hw,SXE_MPSAR_LOW (rar_idx), value); + }else { + value =SXE_REG_READ (hw,SXE_MPSAR_HIGH (rar_idx)); + value |=BIT (pool_idx -32 ); +SXE_REG_WRITE (hw,SXE_MPSAR_HIGH (rar_idx), value); + } + +l_end: +return ; +} + +void sxe_hw_uc_addr_pool_del (struct sxe_hw *hw,u32 rar_idx,u32 pool_idx) +{ +u32 value; + +if (sxe_is_hw_fault (hw)) + goto l_end; + +if (pool_idx <32 ) { + value =SXE_REG_READ (hw,SXE_MPSAR_LOW (rar_idx)); + value &= ~BIT (pool_idx); +SXE_REG_WRITE (hw,SXE_MPSAR_LOW (rar_idx), value); + }else { + value =SXE_REG_READ (hw,SXE_MPSAR_HIGH (rar_idx)); + value &= ~BIT (pool_idx -32 ); +SXE_REG_WRITE (hw,SXE_MPSAR_HIGH (rar_idx), value); + } + +l_end: +return ; +} + +s32 sxe_hw_uc_addr_pool_enable (struct sxe_hw *hw, +u8 rar_idx,u8 pool_idx) +{ +s32 ret =0 ; +u32 value; +struct sxe_adapter *adapter = hw->adapter; + +if (rar_idx >SXE_UC_ENTRY_NUM_MAX ) { + ret = -SXE_ERR_PARAM ; +LOG_DEV_ERR ("pool_idx:%d rar_idx:%d invalid." , + pool_idx, rar_idx); + goto l_end; + } + +if (pool_idx <32 ) { + value =SXE_REG_READ (hw,SXE_MPSAR_LOW (rar_idx)); + value |=BIT (pool_idx); +SXE_REG_WRITE (hw,SXE_MPSAR_LOW (rar_idx), value); + }else { + value =SXE_REG_READ (hw,SXE_MPSAR_HIGH (rar_idx)); + value |=BIT (pool_idx -32 ); +SXE_REG_WRITE (hw,SXE_MPSAR_HIGH (rar_idx), value); + } + +l_end: +return ret; +} + +static s32 sxe_hw_uc_addr_pool_disable (struct sxe_hw *hw,u8 rar_idx) +{ +u32 hi; +u32 low; +struct sxe_adapter *adapter = hw->adapter; + + hi =SXE_REG_READ (hw,SXE_MPSAR_HIGH (rar_idx)); + low =SXE_REG_READ (hw,SXE_MPSAR_LOW (rar_idx)); + +if (sxe_is_hw_fault (hw)) + goto l_end; + +if (!hi & !low) { +LOG_DEBUG_BDF ("no need clear rar-pool relation register." ); + goto l_end; + } + +if (low) +SXE_REG_WRITE (hw,SXE_MPSAR_LOW (rar_idx),0 ); + +if (hi) +SXE_REG_WRITE (hw,SXE_MPSAR_HIGH (rar_idx),0 ); + + +l_end: +return 0 ; +} + +s32 sxe_hw_nic_reset (struct sxe_hw *hw) +{ +s32 ret =0 ; +u32 ctrl, i; +struct sxe_adapter *adapter = hw->adapter; + + ctrl =SXE_CTRL_RST ; + ctrl |=SXE_REG_READ (hw,SXE_CTRL ); + ctrl &= ~SXE_CTRL_GIO_DIS ; +SXE_REG_WRITE (hw,SXE_CTRL , ctrl); + +SXE_WRITE_FLUSH (hw); +usleep_range (1000 ,1200 ); + +for (i =0 ; i <10 ; i++) { + ctrl =SXE_REG_READ (hw,SXE_CTRL ); +if (!(ctrl &SXE_CTRL_RST_MASK )) +break ; + +sxe_udelay (1 ); + } + +if (ctrl &SXE_CTRL_RST_MASK ) { + ret = -SXE_ERR_RESET_FAILED ; +LOG_DEV_ERR ("reset polling failed to complete" ); + } + +return ret; +} + +void sxe_hw_pf_rst_done_set (struct sxe_hw *hw) +{ +u32 value; + + value =SXE_REG_READ (hw,SXE_CTRL_EXT ); + value |=SXE_CTRL_EXT_PFRSTD ; +SXE_REG_WRITE (hw,SXE_CTRL_EXT , value); +} + +static void sxe_hw_regs_flush (struct sxe_hw *hw) +{ +SXE_WRITE_FLUSH (hw); +} + +static const struct sxe_reg_info sxe_reg_info_tbl[] = { + {SXE_CTRL ,1 ,1 ,"CTRL" }, + {SXE_STATUS ,1 ,1 ,"STATUS" }, + {SXE_CTRL_EXT ,1 ,1 ,"CTRL_EXT" }, + + {SXE_EICR ,1 ,1 ,"EICR" }, + + {SXE_SRRCTL (0 ),16 ,0x4 ,"SRRCTL" }, + {SXE_RDH (0 ),64 ,0x40 ,"RDH" }, + {SXE_RDT (0 ),64 ,0x40 ,"RDT" }, + {SXE_RXDCTL (0 ),64 ,0x40 ,"RXDCTL" }, + {SXE_RDBAL (0 ),64 ,0x40 ,"RDBAL" }, + {SXE_RDBAH (0 ),64 ,0x40 ,"RDBAH" }, + + {SXE_TDBAL (0 ),32 ,0x40 ,"TDBAL" }, + {SXE_TDBAH (0 ),32 ,0x40 ,"TDBAH" }, + {SXE_TDLEN (0 ),32 ,0x40 ,"TDLEN" }, + {SXE_TDH (0 ),32 ,0x40 ,"TDH" }, + {SXE_TDT (0 ),32 ,0x40 ,"TDT" }, + {SXE_TXDCTL (0 ),32 ,0x40 ,"TXDCTL" }, + + { .name =NULL } +}; + +static void sxe_hw_reg_print (struct sxe_hw *hw, +const struct sxe_reg_info *reginfo) +{ +u32 i, j; +s8 *value; +u32 first_reg_idx =0 ; +u32 regs[SXE_DUMP_REGS_NUM ]; +s8 reg_name[SXE_REG_NAME_LEN ]; +s8 buf[SXE_DUMP_REG_STRING_LEN ]; +struct sxe_adapter *adapter = hw->adapter; + +switch (reginfo->addr) { +case SXE_SRRCTL (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_SRRCTL (i)); + +break ; +case SXE_RDLEN (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_RDLEN (i)); + +break ; +case SXE_RDH (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_RDH (i)); + +break ; +case SXE_RDT (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_RDT (i)); + +break ; +case SXE_RXDCTL (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_RXDCTL (i)); + +break ; +case SXE_RDBAL (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_RDBAL (i)); + +break ; +case SXE_RDBAH (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_RDBAH (i)); + +break ; +case SXE_TDBAL (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_TDBAL (i)); + +break ; +case SXE_TDBAH (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_TDBAH (i)); + +break ; +case SXE_TDLEN (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_TDLEN (i)); + +break ; +case SXE_TDH (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_TDH (i)); + +break ; +case SXE_TDT (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_TDT (i)); + +break ; +case SXE_TXDCTL (0 ): +for (i =0 ; i <SXE_DUMP_REGS_NUM ; i++) + regs[i] =SXE_REG_READ (hw,SXE_TXDCTL (i)); + +break ; +default : +LOG_DEV_INFO ("%-15s %08x" , + reginfo->name,SXE_REG_READ (hw, reginfo->addr)); +return ; + } + +while (first_reg_idx <SXE_DUMP_REGS_NUM ) { + value = buf; +snprintf (reg_name,SXE_REG_NAME_LEN , +"%s[%d-%d]" , reginfo->name, + first_reg_idx, (first_reg_idx +7 )); + +for (j =0 ; j <8 ; j++) + value +=sprintf (value," %08x" , regs[first_reg_idx++]); + +LOG_DEV_ERR ("%-15s%s" , reg_name, buf); + } +} + +static void sxe_hw_reg_dump (struct sxe_hw *hw) +{ +const struct sxe_reg_info *reginfo; + +for (reginfo = (const struct sxe_reg_info *)sxe_reg_info_tbl; + reginfo->name; reginfo++) { +sxe_hw_reg_print (hw, reginfo); + } +} + +static s32 sxe_hw_status_reg_test (struct sxe_hw *hw) +{ +s32 ret =0 ; +u32 value, before, after; +u32 toggle =0x7FFFF30F ; +struct sxe_adapter *adapter = hw->adapter; + + before =SXE_REG_READ (hw,SXE_STATUS ); + value = (SXE_REG_READ (hw,SXE_STATUS ) & toggle); +SXE_REG_WRITE (hw,SXE_STATUS , toggle); + after =SXE_REG_READ (hw,SXE_STATUS ) & toggle; +if (value != after) { +LOG_MSG_ERR (drv,"failed status register test got: " +"0x%08X expected: 0x%08X" , + after, value); + ret = -SXE_DIAG_TEST_BLOCKED ; + goto l_end; + } + +SXE_REG_WRITE (hw,SXE_STATUS , before); + +l_end: +return ret; +} + +#define PATTERN_TEST 1 +#define SET_READ_TEST 2 +#define WRITE_NO_TEST 3 +#define TABLE32_TEST 4 +#define TABLE64_TEST_LO 5 +#define TABLE64_TEST_HI 6 + +struct sxe_self_test_reg { +u32 reg; +u8 array_len; +u8 test_type; +u32 mask; +u32 write; +}; + +static const struct sxe_self_test_reg self_test_reg[] = { + {SXE_FCRTL (0 ),1 ,PATTERN_TEST ,0x8007FFE0 ,0x8007FFF0 }, + {SXE_FCRTH (0 ),1 ,PATTERN_TEST ,0x8007FFE0 ,0x8007FFF0 }, + {SXE_PFCTOP ,1 ,PATTERN_TEST ,0xFFFFFFFF ,0xFFFFFFFF }, + {SXE_FCTTV (0 ),1 ,PATTERN_TEST ,0xFFFFFFFF ,0xFFFFFFFF }, + {SXE_VLNCTRL ,1 ,PATTERN_TEST ,0x00000000 ,0x00000000 }, + {SXE_RDBAL (0 ),4 ,PATTERN_TEST ,0xFFFFFF80 ,0xFFFFFF80 }, + {SXE_RDBAH (0 ),4 ,PATTERN_TEST ,0xFFFFFFFF ,0xFFFFFFFF }, + {SXE_RDLEN (0 ),4 ,PATTERN_TEST ,0x000FFFFF ,0x000FFFFF }, + {SXE_RXDCTL (0 ),4 ,WRITE_NO_TEST ,0 ,SXE_RXDCTL_ENABLE }, + {SXE_RDT (0 ),4 ,PATTERN_TEST ,0x0000FFFF ,0x0000FFFF }, + {SXE_RXDCTL (0 ),4 ,WRITE_NO_TEST ,0 ,0 }, + {SXE_TDBAL (0 ),4 ,PATTERN_TEST ,0xFFFFFF80 ,0xFFFFFFFF }, + {SXE_TDBAH (0 ),4 ,PATTERN_TEST ,0xFFFFFFFF ,0xFFFFFFFF }, + {SXE_TDLEN (0 ),4 ,PATTERN_TEST ,0x000FFF80 ,0x000FFF80 }, + {SXE_RXCTRL ,1 ,SET_READ_TEST ,0x00000001 ,0x00000001 }, + {SXE_RAL (0 ),16 ,TABLE64_TEST_LO ,0xFFFFFFFF ,0xFFFFFFFF }, + {SXE_RAL (0 ),16 ,TABLE64_TEST_HI ,0x8001FFFF ,0x800CFFFF }, + {SXE_MTA (0 ),128 ,TABLE32_TEST ,0xFFFFFFFF ,0xFFFFFFFF }, + { .reg =0 } +}; + +static s32 sxe_hw_reg_pattern_test (struct sxe_hw *hw,u32 reg, +u32 mask,u32 write) +{ +s32 ret =0 ; +u32 pat, val, before; +struct sxe_adapter *adapter = hw->adapter; +static const u32 test_pattern[] = { +0x5A5A5A5A ,0xA5A5A5A5 ,0x00000000 ,0xFFFFFFFE }; + +if (sxe_is_hw_fault (hw)) { +LOG_ERROR_BDF ("hw fault" ); + ret = -SXE_DIAG_TEST_BLOCKED ; + goto l_end; + } + +for (pat =0 ; pat <ARRAY_SIZE (test_pattern); pat++) { + before =SXE_REG_READ (hw, reg); + +SXE_REG_WRITE (hw, reg, test_pattern[pat] & write); + val =SXE_REG_READ (hw, reg); +if (val != (test_pattern[pat] & write & mask)) { +LOG_MSG_ERR (drv,"pattern test reg %04X failed: " +"got 0x%08X expected 0x%08X" , + reg, val, (test_pattern[pat] & write & mask)); +SXE_REG_WRITE (hw, reg, before); + ret = -SXE_DIAG_REG_PATTERN_TEST_ERR ; + goto l_end; + } + +SXE_REG_WRITE (hw, reg, before); + } + +l_end: +return ret; +} + +static s32 sxe_hw_reg_set_and_check (struct sxe_hw *hw,int reg, +u32 mask,u32 write) +{ +s32 ret =0 ; +u32 val, before; +struct sxe_adapter *adapter = hw->adapter; + +if (sxe_is_hw_fault (hw)) { +LOG_ERROR_BDF ("hw fault" ); + ret = -SXE_DIAG_TEST_BLOCKED ; + goto l_end; + } + + before =SXE_REG_READ (hw, reg); +SXE_REG_WRITE (hw, reg, write & mask); + val =SXE_REG_READ (hw, reg); +if ((write & mask) != (val & mask)) { +LOG_MSG_ERR (drv,"set/check reg %04X test failed: " +"got 0x%08X expected 0x%08X" , + reg, (val & mask), (write & mask)); +SXE_REG_WRITE (hw, reg, before); + ret = -SXE_DIAG_CHECK_REG_TEST_ERR ; + goto l_end; + } + +SXE_REG_WRITE (hw, reg, before); + +l_end: +return ret; +} + +static s32 sxe_hw_regs_test (struct sxe_hw *hw) +{ +u32 i; +s32 ret =0 ; +const struct sxe_self_test_reg *test = self_test_reg; +struct sxe_adapter *adapter = hw->adapter; + + ret =sxe_hw_status_reg_test (hw); +if (ret) { +LOG_MSG_ERR (drv,"status register test failed" ); + goto l_end; + } + +while (test->reg) { +for (i =0 ; i < test->array_len; i++) { +switch (test->test_type) { +case PATTERN_TEST : + ret =sxe_hw_reg_pattern_test (hw, + test->reg + (i *0x40 ), + test->mask, test->write); +break ; +case TABLE32_TEST : + ret =sxe_hw_reg_pattern_test (hw, + test->reg + (i *4 ), + test->mask, test->write); +break ; +case TABLE64_TEST_LO : + ret =sxe_hw_reg_pattern_test (hw, + test->reg + (i *8 ), + test->mask, test->write); +break ; +case TABLE64_TEST_HI : + ret =sxe_hw_reg_pattern_test (hw, + (test->reg +4 ) + (i *8 ), + test->mask, test->write); +break ; +case SET_READ_TEST : + ret =sxe_hw_reg_set_and_check (hw, + test->reg + (i *0x40 ), + test->mask, test->write); +break ; +case WRITE_NO_TEST : +SXE_REG_WRITE (hw, test->reg + (i *0x40 ), + test->write); +break ; +default : +LOG_ERROR_BDF ("reg test mod err, type=%d" , + test->test_type); +break ; + } + +if (ret) + goto l_end; + } + test++; + } + +l_end: +return ret; +} + +static const struct sxe_setup_operations sxe_setup_ops = { + .regs_dump = sxe_hw_reg_dump, + .reg_read = sxe_read_reg, + .reg_write = sxe_write_reg, + .regs_test = sxe_hw_regs_test, + .reset = sxe_hw_nic_reset, + .regs_flush = sxe_hw_regs_flush, + .pf_rst_done_set = sxe_hw_pf_rst_done_set, + .no_snoop_disable = sxe_hw_no_snoop_disable, +}; + + +static void sxe_hw_ring_irq_enable (struct sxe_hw *hw,u64 qmask) +{ +u32 mask0, mask1; + + mask0 = qmask &0xFFFFFFFF ; + mask1 = qmask >>32 ; + +if (mask0 && mask1) { +SXE_REG_WRITE (hw,SXE_EIMS_EX (0 ), mask0); +SXE_REG_WRITE (hw,SXE_EIMS_EX (1 ), mask1); + }else if (mask0) { +SXE_REG_WRITE (hw,SXE_EIMS_EX (0 ), mask0); + }else if (mask1) { +SXE_REG_WRITE (hw,SXE_EIMS_EX (1 ), mask1); + } +} + +u32 sxe_hw_pending_irq_read_clear (struct sxe_hw *hw) +{ +return SXE_REG_READ (hw,SXE_EICR ); +} + +void sxe_hw_pending_irq_write_clear (struct sxe_hw *hw,u32 value) +{ +SXE_REG_WRITE (hw,SXE_EICR , value); +} + +u32 sxe_hw_irq_cause_get (struct sxe_hw *hw) +{ +return SXE_REG_READ (hw,SXE_EICS ); +} + +static void sxe_hw_event_irq_trigger (struct sxe_hw *hw) +{ +SXE_REG_WRITE (hw,SXE_EICS , (SXE_EICS_TCP_TIMER |SXE_EICS_OTHER )); +} + +static void sxe_hw_ring_irq_trigger (struct sxe_hw *hw,u64 eics) +{ +u32 mask; + + mask = (eics &0xFFFFFFFF ); +SXE_REG_WRITE (hw,SXE_EICS_EX (0 ), mask); + mask = (eics >>32 ); +SXE_REG_WRITE (hw,SXE_EICS_EX (1 ), mask); +} + +void sxe_hw_ring_irq_auto_disable (struct sxe_hw *hw, +bool is_msix) +{ +if (is_msix) { +SXE_REG_WRITE (hw,SXE_EIAM_EX (0 ),0xFFFFFFFF ); +SXE_REG_WRITE (hw,SXE_EIAM_EX (1 ),0xFFFFFFFF ); + }else { +SXE_REG_WRITE (hw,SXE_EIAM ,SXE_EICS_RTX_QUEUE ); + } +} + +void sxe_hw_irq_general_reg_set (struct sxe_hw *hw,u32 value) +{ +SXE_REG_WRITE (hw,SXE_GPIE , value); +} + +u32 sxe_hw_irq_general_reg_get (struct sxe_hw *hw) +{ +return SXE_REG_READ (hw,SXE_GPIE ); +} + +static void sxe_hw_set_eitrsel (struct sxe_hw *hw,u32 value) +{ +SXE_REG_WRITE (hw,SXE_EITRSEL , value); +} + +void sxe_hw_event_irq_map (struct sxe_hw *hw,u8 offset,u16 irq_idx) +{ +u8 allocation; +u32 ivar, position; + + allocation = irq_idx |SXE_IVAR_ALLOC_VALID ; + + position = (offset &1 ) *8 ; + + ivar =SXE_REG_READ (hw,SXE_IVAR_MISC ); + ivar &= ~(0xFF << position); + ivar |= (allocation << position); + +SXE_REG_WRITE (hw,SXE_IVAR_MISC , ivar); +} + +void sxe_hw_ring_irq_map (struct sxe_hw *hw,bool is_tx, +u16 reg_idx,u16 irq_idx) +{ +u8 allocation; +u32 ivar, position; + + allocation = irq_idx |SXE_IVAR_ALLOC_VALID ; + + position = ((reg_idx &1 ) *16 ) + (8 * is_tx); + + ivar =SXE_REG_READ (hw,SXE_IVAR (reg_idx >>1 )); + ivar &= ~(0xFF << position); + ivar |= (allocation << position); + +SXE_REG_WRITE (hw,SXE_IVAR (reg_idx >>1 ), ivar); +} + +void sxe_hw_ring_irq_interval_set (struct sxe_hw *hw, +u16 irq_idx,u32 interval) +{ +u32 eitr = interval &SXE_EITR_ITR_MASK ; + + eitr |=SXE_EITR_CNT_WDIS ; + +SXE_REG_WRITE (hw,SXE_EITR (irq_idx), eitr); +} + +static void sxe_hw_event_irq_interval_set (struct sxe_hw *hw, +u16 irq_idx,u32 value) +{ +SXE_REG_WRITE (hw,SXE_EITR (irq_idx), value); +} + +void sxe_hw_event_irq_auto_clear_set (struct sxe_hw *hw,u32 value) +{ +SXE_REG_WRITE (hw,SXE_EIAC , value); +} + +void sxe_hw_specific_irq_disable (struct sxe_hw *hw,u32 value) +{ +SXE_REG_WRITE (hw,SXE_EIMC , value); +} + +void sxe_hw_specific_irq_enable (struct sxe_hw *hw,u32 value) +{ +SXE_REG_WRITE (hw,SXE_EIMS , value); +} + +static u32 sxe_hw_spp_state_get (struct sxe_hw *hw) +{ +return SXE_REG_READ (hw,SXE_SPP_STATE ); +} + +static void sxe_hw_rx_los_disable (struct sxe_hw *hw) +{ +u32 value; + + value =SXE_REG_READ (hw,SXE_EIMS ); + value &= ~SXE_EIMS_GPI_SPP1 ; +SXE_REG_WRITE (hw,SXE_EIMS , value); +} + +static void sxe_hw_rx_los_enable (struct sxe_hw *hw) +{ +u32 value; + + value =SXE_REG_READ (hw,SXE_EIMS ); + value |=SXE_EIMS_GPI_SPP1 ; +SXE_REG_WRITE (hw,SXE_EIMS , value); +} + +void sxe_hw_all_irq_disable (struct sxe_hw *hw) +{ +SXE_REG_WRITE (hw,SXE_EIMC ,0xFFFF0000 ); + +SXE_REG_WRITE (hw,SXE_EIMC_EX (0 ), ~0 ); +SXE_REG_WRITE (hw,SXE_EIMC_EX (1 ), ~0 ); + +SXE_WRITE_FLUSH (hw); +} + +static void sxe_hw_spp_configure (struct sxe_hw *hw,u32 hw_spp_proc_delay_us) +{ +u32 reg =SXE_REG_READ (hw,SXE_SPP_PROC ); + + reg &= ~SXE_SPP_PROC_DELAY_US_MASK ; + reg |= hw_spp_proc_delay_us; + reg &=SXE_SPP_PROC_SPP2_TRIGGER_MASK ; + reg |=SXE_SPP_PROC_SPP2_TRIGGER ; + +SXE_REG_WRITE (hw,SXE_SPP_PROC , reg); +} + +static s32 sxe_hw_irq_test (struct sxe_hw *hw,u32 *icr,bool shared) +{ +s32 ret =0 ; +u32 i, mask; +struct sxe_adapter *adapter = hw->adapter; + +sxe_hw_specific_irq_disable (hw,0xFFFFFFFF ); +sxe_hw_regs_flush (hw); +usleep_range (10000 ,20000 ); + +for (i =0 ; i <10 ; i++) { + mask =BIT (i); +if (!shared) { +LOG_INFO_BDF ("test irq: irq test start" ); + *icr =0 ; +SXE_REG_WRITE (hw,SXE_EIMC , ~mask &0x00007FFF ); +SXE_REG_WRITE (hw,SXE_EICS , ~mask &0x00007FFF ); +sxe_hw_regs_flush (hw); +usleep_range (10000 ,20000 ); + +if (*icr & mask) { +LOG_ERROR_BDF ("test irq: failed, eicr = %x" , *icr); + ret = -SXE_DIAG_DISABLE_IRQ_TEST_ERR ; +break ; + } +LOG_INFO_BDF ("test irq: irq test end" ); + } + +LOG_INFO_BDF ("test irq: mask irq test start" ); + *icr =0 ; +SXE_REG_WRITE (hw,SXE_EIMS , mask); +SXE_REG_WRITE (hw,SXE_EICS , mask); +sxe_hw_regs_flush (hw); +usleep_range (10000 ,20000 ); + +if (!(*icr & mask)) { +LOG_ERROR_BDF ("test irq: mask failed, eicr = %x" , *icr); + ret = -SXE_DIAG_ENABLE_IRQ_TEST_ERR ; +break ; + } +LOG_INFO_BDF ("test irq: mask irq test end" ); + +sxe_hw_specific_irq_disable (hw, mask); +sxe_hw_regs_flush (hw); +usleep_range (10000 ,20000 ); + +if (!shared) { +LOG_INFO_BDF ("test irq: other irq test start" ); + *icr =0 ; +SXE_REG_WRITE (hw,SXE_EIMC , ~mask &0x00007FFF ); +SXE_REG_WRITE (hw,SXE_EICS , ~mask &0x00007FFF ); +sxe_hw_regs_flush (hw); +usleep_range (10000 ,20000 ); + +if (*icr) { +LOG_ERROR_BDF ("test irq: other irq failed, eicr = %x" , *icr); + ret = -SXE_DIAG_DISABLE_OTHER_IRQ_TEST_ERR ; +break ; + } +LOG_INFO_BDF ("test irq: other irq test end" ); + } + } + +sxe_hw_specific_irq_disable (hw,0xFFFFFFFF ); +sxe_hw_regs_flush (hw); +usleep_range (10000 ,20000 ); + +return ret; +} + +static const struct sxe_irq_operations sxe_irq_ops = { + .event_irq_auto_clear_set = sxe_hw_event_irq_auto_clear_set, + .ring_irq_interval_set = sxe_hw_ring_irq_interval_set, + .event_irq_interval_set = sxe_hw_event_irq_interval_set, + .set_eitrsel = sxe_hw_set_eitrsel, + .ring_irq_map = sxe_hw_ring_irq_map, + .event_irq_map = sxe_hw_event_irq_map, + .irq_general_reg_set = sxe_hw_irq_general_reg_set, + .irq_general_reg_get = sxe_hw_irq_general_reg_get, + .ring_irq_auto_disable = sxe_hw_ring_irq_auto_disable, + .pending_irq_read_clear = sxe_hw_pending_irq_read_clear, + .pending_irq_write_clear = sxe_hw_pending_irq_write_clear, + .ring_irq_enable = sxe_hw_ring_irq_enable, + .irq_cause_get = sxe_hw_irq_cause_get, + .event_irq_trigger = sxe_hw_event_irq_trigger, + .ring_irq_trigger = sxe_hw_ring_irq_trigger, + .specific_irq_disable = sxe_hw_specific_irq_disable, + .specific_irq_enable = sxe_hw_specific_irq_enable, + .spp_state_get = sxe_hw_spp_state_get, + .rx_los_disable = sxe_hw_rx_los_disable, + .rx_los_enable = sxe_hw_rx_los_enable, + .all_irq_disable = sxe_hw_all_irq_disable, + .spp_configure = sxe_hw_spp_configure, + .irq_test = sxe_hw_irq_test, +}; + + +u32 sxe_hw_link_speed_get (struct sxe_hw *hw) +{ +u32 speed, value; +struct sxe_adapter *adapter = hw->adapter; + value =SXE_REG_READ (hw,SXE_COMCTRL ); + +if ((value &SXE_COMCTRL_SPEED_10G ) ==SXE_COMCTRL_SPEED_10G ) + speed =SXE_LINK_SPEED_10GB_FULL ; +else if ((value &SXE_COMCTRL_SPEED_1G ) ==SXE_COMCTRL_SPEED_1G ) + speed =SXE_LINK_SPEED_1GB_FULL ; +else + speed =SXE_LINK_SPEED_UNKNOWN ; + +LOG_DEBUG_BDF ("hw link speed=%x, (0x80=10G, 0x20=1G), reg=%x" , + speed, value); + +return speed; +} + +void sxe_hw_link_speed_set (struct sxe_hw *hw,u32 speed) +{ +u32 ctrl; + + ctrl =SXE_REG_READ (hw,SXE_COMCTRL ); + +if (speed ==SXE_LINK_SPEED_1GB_FULL ) + ctrl |=SXE_COMCTRL_SPEED_1G ; +else if (speed ==SXE_LINK_SPEED_10GB_FULL ) + ctrl |=SXE_COMCTRL_SPEED_10G ; + +SXE_REG_WRITE (hw,SXE_COMCTRL , ctrl); +} + +static bool sxe_hw_1g_link_up_check (struct sxe_hw *hw) +{ +return (SXE_REG_READ (hw,SXE_LINKS ) &SXE_LINKS_UP ) ? true : false; +} + +bool sxe_hw_is_link_state_up (struct sxe_hw *hw) +{ +bool ret = false; +u32 links_reg, link_speed; +struct sxe_adapter *adapter = hw->adapter; + + links_reg =SXE_REG_READ (hw,SXE_LINKS ); + +LOG_DEBUG_BDF ("nic link reg: 0x%x" , links_reg); + +if (links_reg &SXE_LINKS_UP ) { + ret = true; + + link_speed =sxe_hw_link_speed_get (hw); +if (link_speed ==SXE_LINK_SPEED_10GB_FULL && + links_reg &SXE_10G_LINKS_DOWN ) + ret = false; + } + +return ret; +} + +void sxe_hw_mac_pad_enable (struct sxe_hw *hw) +{ +u32 ctl; + + ctl =SXE_REG_READ (hw,SXE_MACCFG ); + ctl |=SXE_MACCFG_PAD_EN ; +SXE_REG_WRITE (hw,SXE_MACCFG , ctl); +} + +s32 sxe_hw_fc_enable (struct sxe_hw *hw) +{ +s32 ret =0 ; +u8 i; +u32 reg; +u32 flctrl_val; +u32 fcrtl, fcrth; +struct sxe_adapter *adapter = hw->adapter; + + flctrl_val =SXE_REG_READ (hw,SXE_FLCTRL ); + flctrl_val &= ~(SXE_FCTRL_TFCE_MASK |SXE_FCTRL_RFCE_MASK | +SXE_FCTRL_TFCE_FCEN_MASK |SXE_FCTRL_TFCE_XONE_MASK ); + +switch (hw->fc.current_mode) { +case SXE_FC_NONE : +break ; +case SXE_FC_RX_PAUSE : + flctrl_val |=SXE_FCTRL_RFCE_LFC_EN ; +break ; +case SXE_FC_TX_PAUSE : + flctrl_val |=SXE_FCTRL_TFCE_LFC_EN ; +break ; +case SXE_FC_FULL : + flctrl_val |=SXE_FCTRL_RFCE_LFC_EN ; + flctrl_val |=SXE_FCTRL_TFCE_LFC_EN ; +break ; +default : +LOG_DEV_DEBUG ("flow control param set incorrectly" ); + ret = -SXE_ERR_CONFIG ; + goto l_ret; + } + +for (i =0 ; i <MAX_TRAFFIC_CLASS ; i++) { +if ((hw->fc.current_mode &SXE_FC_TX_PAUSE ) && + hw->fc.high_water[i]) { + fcrtl = (hw->fc.low_water[i] <<9 ) |SXE_FCRTL_XONE ; +SXE_REG_WRITE (hw,SXE_FCRTL (i), fcrtl); + fcrth = (hw->fc.high_water[i] <<9 ) |SXE_FCRTH_FCEN ; + }else { +SXE_REG_WRITE (hw,SXE_FCRTL (i),0 ); + fcrth = (SXE_REG_READ (hw,SXE_RXPBSIZE (i)) -24576 ) >>1 ; + } + +SXE_REG_WRITE (hw,SXE_FCRTH (i), fcrth); + } + + flctrl_val |=SXE_FCTRL_TFCE_DPF_EN ; + +if ((hw->fc.current_mode &SXE_FC_TX_PAUSE )) + flctrl_val |= (SXE_FCTRL_TFCE_FCEN_MASK |SXE_FCTRL_TFCE_XONE_MASK ); + +SXE_REG_WRITE (hw,SXE_FLCTRL , flctrl_val); + + reg =SXE_REG_READ (hw,SXE_PFCTOP ); + reg &= ~SXE_PFCTOP_FCOP_MASK ; + reg |=SXE_PFCTOP_FCT ; + reg |=SXE_PFCTOP_FCOP_LFC ; +SXE_REG_WRITE (hw,SXE_PFCTOP , reg); + + reg = hw->fc.pause_time *0x00010001U ; +for (i =0 ; i < (MAX_TRAFFIC_CLASS /2 ); i++) +SXE_REG_WRITE (hw,SXE_FCTTV (i), reg); + +SXE_REG_WRITE (hw,SXE_FCRTV , hw->fc.pause_time /2 ); + +l_ret: +return ret; +} + +void sxe_fc_autoneg_localcap_set (struct sxe_hw *hw) +{ +u32 reg =0 ; + +if (hw->fc.requested_mode ==SXE_FC_DEFAULT ) + hw->fc.requested_mode =SXE_FC_FULL ; + + reg =SXE_REG_READ (hw,SXE_PCS1GANA ); + +switch (hw->fc.requested_mode) { +case SXE_FC_NONE : + reg &= ~(SXE_PCS1GANA_SYM_PAUSE |SXE_PCS1GANA_ASM_PAUSE ); +break ; +case SXE_FC_TX_PAUSE : + reg |=SXE_PCS1GANA_ASM_PAUSE ; + reg &= ~SXE_PCS1GANA_SYM_PAUSE ; +break ; +case SXE_FC_RX_PAUSE : +case SXE_FC_FULL : + reg |=SXE_PCS1GANA_SYM_PAUSE |SXE_PCS1GANA_ASM_PAUSE ; +break ; +default : +LOG_ERROR ("Flow control param set incorrectly." ); +break ; + } + +SXE_REG_WRITE (hw,SXE_PCS1GANA , reg); +} + +s32 sxe_hw_pfc_enable (struct sxe_hw *hw,u8 tc_idx) +{ +s32 ret =0 ; +u8 i; +u32 reg; +u32 flctrl_val; +u32 fcrtl, fcrth; +struct sxe_adapter *adapter = hw->adapter; +u8 rx_en_num; + + flctrl_val =SXE_REG_READ (hw,SXE_FLCTRL ); + flctrl_val &= ~(SXE_FCTRL_TFCE_MASK |SXE_FCTRL_RFCE_MASK | +SXE_FCTRL_TFCE_FCEN_MASK |SXE_FCTRL_TFCE_XONE_MASK ); + +switch (hw->fc.current_mode) { +case SXE_FC_NONE : + rx_en_num =0 ; +for (i =0 ; i <MAX_TRAFFIC_CLASS ; i++) { + reg =SXE_REG_READ (hw,SXE_FCRTH (i)); +if (reg &SXE_FCRTH_FCEN ) + rx_en_num++; + } +if (rx_en_num >1 ) + flctrl_val |=SXE_FCTRL_TFCE_PFC_EN ; + +break ; + +case SXE_FC_RX_PAUSE : + flctrl_val |=SXE_FCTRL_RFCE_PFC_EN ; + + rx_en_num =0 ; +for (i =0 ; i <MAX_TRAFFIC_CLASS ; i++) { + reg =SXE_REG_READ (hw,SXE_FCRTH (i)); +if (reg &SXE_FCRTH_FCEN ) + rx_en_num++; + } + +if (rx_en_num >1 ) + flctrl_val |=SXE_FCTRL_TFCE_PFC_EN ; + +break ; +case SXE_FC_TX_PAUSE : + flctrl_val |=SXE_FCTRL_TFCE_PFC_EN ; +break ; +case SXE_FC_FULL : + flctrl_val |=SXE_FCTRL_RFCE_PFC_EN ; + flctrl_val |=SXE_FCTRL_TFCE_PFC_EN ; +break ; +default : +LOG_DEV_DEBUG ("flow control param set incorrectly" ); + ret = -SXE_ERR_CONFIG ; + goto l_ret; + } + +if ((hw->fc.current_mode &SXE_FC_TX_PAUSE ) && + hw->fc.high_water[tc_idx]) { + fcrtl = (hw->fc.low_water[tc_idx] <<9 ) |SXE_FCRTL_XONE ; +SXE_REG_WRITE (hw,SXE_FCRTL (tc_idx), fcrtl); + fcrth = (hw->fc.high_water[tc_idx] <<9 ) |SXE_FCRTH_FCEN ; + }else { +SXE_REG_WRITE (hw,SXE_FCRTL (tc_idx),0 ); + fcrth = (SXE_REG_READ (hw,SXE_RXPBSIZE (tc_idx)) -24576 ) >>1 ; + } + +SXE_REG_WRITE (hw,SXE_FCRTH (tc_idx), fcrth); + + flctrl_val |=SXE_FCTRL_TFCE_DPF_EN ; + +if ((hw->fc.current_mode &SXE_FC_TX_PAUSE )) { + flctrl_val |= (BIT (tc_idx) <<16 ) &SXE_FCTRL_TFCE_FCEN_MASK ; + flctrl_val |= (BIT (tc_idx) <<24 ) &SXE_FCTRL_TFCE_XONE_MASK ; + } + +SXE_REG_WRITE (hw,SXE_FLCTRL , flctrl_val); + + reg =SXE_REG_READ (hw,SXE_PFCTOP ); + reg &= ~SXE_PFCTOP_FCOP_MASK ; + reg |=SXE_PFCTOP_FCT ; + reg |=SXE_PFCTOP_FCOP_PFC ; +SXE_REG_WRITE (hw,SXE_PFCTOP , reg); + + reg = hw->fc.pause_time *0x00010001U ; +for (i =0 ; i < (MAX_TRAFFIC_CLASS /2 ); i++) +SXE_REG_WRITE (hw,SXE_FCTTV (i), reg); + +SXE_REG_WRITE (hw,SXE_FCRTV , hw->fc.pause_time /2 ); + +l_ret: +return ret; +} + +void sxe_hw_crc_configure (struct sxe_hw *hw) +{ +u32 ctrl =SXE_REG_READ (hw,SXE_PCCTRL ); + + ctrl |=SXE_PCCTRL_TXCE |SXE_PCCTRL_RXCE |SXE_PCCTRL_PCSC_ALL ; +SXE_REG_WRITE (hw,SXE_PCCTRL , ctrl); +} + +void sxe_hw_loopback_switch (struct sxe_hw *hw,bool is_enable) +{ +u32 value; + + value = is_enable ?SXE_LPBK_EN :0 ; + +SXE_REG_WRITE (hw,SXE_LPBKCTRL , value); +} + +void sxe_hw_mac_txrx_enable (struct sxe_hw *hw) +{ +u32 ctl; + + ctl =SXE_REG_READ (hw,SXE_COMCTRL ); + ctl |=SXE_COMCTRL_TXEN |SXE_COMCTRL_RXEN |SXE_COMCTRL_EDSEL ; +SXE_REG_WRITE (hw,SXE_COMCTRL , ctl); +} + +void sxe_hw_mac_max_frame_set (struct sxe_hw *hw,u32 max_frame) +{ +u32 maxfs =SXE_REG_READ (hw,SXE_MAXFS ); + +if (max_frame != (maxfs >>SXE_MAXFS_MFS_SHIFT )) { + maxfs &= ~SXE_MAXFS_MFS_MASK ; + maxfs |= max_frame <<SXE_MAXFS_MFS_SHIFT ; + } + + maxfs |=SXE_MAXFS_RFSEL |SXE_MAXFS_TFSEL ; +SXE_REG_WRITE (hw,SXE_MAXFS , maxfs); +} + +u32 sxe_hw_mac_max_frame_get (struct sxe_hw *hw) +{ +u32 maxfs =SXE_REG_READ (hw,SXE_MAXFS ); + + maxfs &=SXE_MAXFS_MFS_MASK ; + maxfs >>=SXE_MAXFS_MFS_SHIFT ; + +return maxfs; +} + +bool sxe_device_supports_autoneg_fc (struct sxe_hw *hw) +{ +bool supported = true; +bool link_up =sxe_hw_is_link_state_up (hw); +u32 link_speed =sxe_hw_link_speed_get (hw); + +if (link_up) { + supported = (link_speed ==SXE_LINK_SPEED_1GB_FULL ) ? + true : false; + } + +return supported; +} + +static void sxe_hw_fc_param_init (struct sxe_hw *hw) +{ + hw->fc.requested_mode =SXE_FC_FULL ; + hw->fc.current_mode =SXE_FC_FULL ; + hw->fc.pause_time =SXE_DEFAULT_FCPAUSE ; + + hw->fc.disable_fc_autoneg = true; +} + +void sxe_hw_fc_tc_high_water_mark_set (struct sxe_hw *hw, +u8 tc_idx,u32 mark) +{ + hw->fc.high_water[tc_idx] = mark; +} + +void sxe_hw_fc_tc_low_water_mark_set (struct sxe_hw *hw, +u8 tc_idx,u32 mark) +{ + hw->fc.low_water[tc_idx] = mark; +} + +bool sxe_hw_is_fc_autoneg_disabled (struct sxe_hw *hw) +{ +return hw->fc.disable_fc_autoneg; +} + +void sxe_hw_fc_autoneg_disable_set (struct sxe_hw *hw, +bool is_disabled) +{ + hw->fc.disable_fc_autoneg = is_disabled; +} + +static enum sxe_fc_mode sxe_hw_fc_current_mode_get (struct sxe_hw *hw) +{ +return hw->fc.current_mode; +} + +static enum sxe_fc_mode sxe_hw_fc_requested_mode_get (struct sxe_hw *hw) +{ +return hw->fc.requested_mode; +} + +void sxe_hw_fc_requested_mode_set (struct sxe_hw *hw, +enum sxe_fc_mode mode) +{ + hw->fc.requested_mode = mode; +} + +static const struct sxe_mac_operations sxe_mac_ops = { + .link_up_1g_check = sxe_hw_1g_link_up_check, + .link_state_is_up = sxe_hw_is_link_state_up, + .link_speed_get = sxe_hw_link_speed_get, + .link_speed_set = sxe_hw_link_speed_set, + .pad_enable = sxe_hw_mac_pad_enable, + .crc_configure = sxe_hw_crc_configure, + .loopback_switch = sxe_hw_loopback_switch, + .txrx_enable = sxe_hw_mac_txrx_enable, + .max_frame_set = sxe_hw_mac_max_frame_set, + .max_frame_get = sxe_hw_mac_max_frame_get, + .fc_enable = sxe_hw_fc_enable, + .fc_autoneg_localcap_set = sxe_fc_autoneg_localcap_set, + .fc_tc_high_water_mark_set = sxe_hw_fc_tc_high_water_mark_set, + .fc_tc_low_water_mark_set = sxe_hw_fc_tc_low_water_mark_set, + .fc_param_init = sxe_hw_fc_param_init, + .fc_current_mode_get = sxe_hw_fc_current_mode_get, + .fc_requested_mode_get = sxe_hw_fc_requested_mode_get, + .fc_requested_mode_set = sxe_hw_fc_requested_mode_set, + .is_fc_autoneg_disabled = sxe_hw_is_fc_autoneg_disabled, + .fc_autoneg_disable_set = sxe_hw_fc_autoneg_disable_set, +}; + +u32 sxe_hw_rx_mode_get (struct sxe_hw *hw) +{ +return SXE_REG_READ (hw,SXE_FCTRL ); +} + +u32 sxe_hw_pool_rx_mode_get (struct sxe_hw *hw,u16 pool_idx) +{ +return SXE_REG_READ (hw,SXE_VMOLR (pool_idx)); +} + +void sxe_hw_rx_mode_set (struct sxe_hw *hw,u32 filter_ctrl) +{ +SXE_REG_WRITE (hw,SXE_FCTRL , filter_ctrl); +} + +void sxe_hw_pool_rx_mode_set (struct sxe_hw *hw, +u32 vmolr,u16 pool_idx) +{ +SXE_REG_WRITE (hw,SXE_VMOLR (pool_idx), vmolr); +} + +void sxe_hw_rx_lro_enable (struct sxe_hw *hw,bool is_enable) +{ +u32 rfctl =SXE_REG_READ (hw,SXE_RFCTL ); + rfctl &= ~SXE_RFCTL_LRO_DIS ; + +if (!is_enable) + rfctl |=SXE_RFCTL_LRO_DIS ; + +SXE_REG_WRITE (hw,SXE_RFCTL , rfctl); +} + +void sxe_hw_rx_nfs_filter_disable (struct sxe_hw *hw) +{ +u32 rfctl =0 ; + + rfctl |= (SXE_RFCTL_NFSW_DIS |SXE_RFCTL_NFSR_DIS ); +SXE_REG_WRITE (hw,SXE_RFCTL , rfctl); +} + +void sxe_hw_rx_udp_frag_checksum_disable (struct sxe_hw *hw) +{ +u32 rxcsum; + + rxcsum =SXE_REG_READ (hw,SXE_RXCSUM ); + rxcsum |=SXE_RXCSUM_PCSD ; +SXE_REG_WRITE (hw,SXE_RXCSUM , rxcsum); +} + +void sxe_hw_fc_mac_addr_set (struct sxe_hw *hw,u8 *mac_addr) +{ +u32 mac_addr_h, mac_addr_l; + + mac_addr_l = ((u32 )mac_addr[5 ] | + ((u32 )mac_addr[4 ] <<8 ) | + ((u32 )mac_addr[3 ] <<16 ) | + ((u32 )mac_addr[2 ] <<24 )); + mac_addr_h = (((u32 )mac_addr[1 ] <<16 ) | + ((u32 )mac_addr[0 ] <<24 )); + +SXE_REG_WRITE (hw,SXE_SACONH , mac_addr_h); +SXE_REG_WRITE (hw,SXE_SACONL , mac_addr_l); +} + +s32 sxe_hw_uc_addr_add (struct sxe_hw *hw,u32 rar_idx, +u8 *addr,u32 pool_idx) +{ +s32 ret =0 ; +u32 rar_low, rar_high; +struct sxe_adapter *adapter = hw->adapter; + +if (rar_idx >=SXE_UC_ENTRY_NUM_MAX ) { +LOG_DEV_DEBUG ("RAR rar_idx %d is out of range:%u." , + rar_idx,SXE_UC_ENTRY_NUM_MAX ); + ret = -SXE_ERR_PARAM ; + goto l_end; + } + +sxe_hw_uc_addr_pool_enable (hw, rar_idx, pool_idx); + + rar_low = ((u32 )addr[0 ] | + ((u32 )addr[1 ] <<8 ) | + ((u32 )addr[2 ] <<16 ) | + ((u32 )addr[3 ] <<24 )); + + rar_high =SXE_REG_READ (hw,SXE_RAH (rar_idx)); + rar_high &= ~(0x0000FFFF |SXE_RAH_AV ); + rar_high |= ((u32 )addr[4 ] | ((u32 )addr[5 ] <<8 )); + + rar_high |=SXE_RAH_AV ; + +SXE_REG_WRITE (hw,SXE_RAL (rar_idx), rar_low); +SXE_WRITE_FLUSH (hw); +SXE_REG_WRITE (hw,SXE_RAH (rar_idx), rar_high); + +LOG_DEBUG_BDF ("rar_idx:%d pool_idx:%u addr:%pM add to rar done" , + rar_idx, pool_idx, addr); + +l_end: +return ret; +} + +s32 sxe_hw_uc_addr_del (struct sxe_hw *hw,u32 index) +{ +s32 ret =0 ; +u32 rar_high; +struct sxe_adapter *adapter = hw->adapter; + +if (index >=SXE_UC_ENTRY_NUM_MAX ) { + ret = -SXE_ERR_PARAM ; +LOG_ERROR_BDF ("uc_entry_num:%d index:%u invalid.(err:%d)" , +SXE_UC_ENTRY_NUM_MAX , index, ret); + goto l_end; + } + + rar_high =SXE_REG_READ (hw,SXE_RAH (index)); + rar_high &= ~(0x0000FFFF |SXE_RAH_AV ); + +SXE_REG_WRITE (hw,SXE_RAH (index), rar_high); +SXE_WRITE_FLUSH (hw); +SXE_REG_WRITE (hw,SXE_RAL (index),0 ); + +sxe_hw_uc_addr_pool_disable (hw, index); + +l_end: +return ret; +} + +void sxe_hw_mta_hash_table_set (struct sxe_hw *hw, +u8 index,u32 value) +{ +SXE_REG_WRITE (hw,SXE_MTA (index), value); +} + +void sxe_hw_mta_hash_table_update (struct sxe_hw *hw, +u8 reg_idx,u8 bit_idx) +{ +u32 value =SXE_REG_READ (hw,SXE_MTA (reg_idx)); + + value |=BIT (bit_idx); + +LOG_INFO ("mta update value:0x%x." , value); +SXE_REG_WRITE (hw,SXE_MTA (reg_idx), value); +} + +u32 sxe_hw_mc_filter_get (struct sxe_hw *hw) +{ +return SXE_REG_READ (hw,SXE_MCSTCTRL ); +} + +void sxe_hw_mc_filter_enable (struct sxe_hw *hw) +{ +u32 value =SXE_MC_FILTER_TYPE0 |SXE_MCSTCTRL_MFE ; + +SXE_REG_WRITE (hw,SXE_MCSTCTRL , value); +} + +static void sxe_hw_mc_filter_disable (struct sxe_hw *hw) +{ +u32 value =SXE_REG_READ (hw,SXE_MCSTCTRL ); + + value &= ~SXE_MCSTCTRL_MFE ; + +SXE_REG_WRITE (hw,SXE_MCSTCTRL , value); +} + +static void sxe_hw_uta_all_set (struct sxe_hw *hw,u32 value) +{ +u32 i; +for (i =0 ; i <SXE_UTA_ENTRY_NUM_MAX ; i++) +SXE_REG_WRITE (hw,SXE_UTA (i), value); +} + +void sxe_hw_uc_addr_clear (struct sxe_hw *hw) +{ +u32 i; +struct sxe_adapter *adapter = hw->adapter; + +sxe_hw_uc_addr_pool_disable (hw,0 ); + +LOG_DEV_DEBUG ("clear uc filter addr register:0-%d" , +SXE_UC_ENTRY_NUM_MAX -1 ); +for (i =0 ; i <SXE_UC_ENTRY_NUM_MAX ; i++) { +SXE_REG_WRITE (hw,SXE_RAL (i),0 ); +SXE_REG_WRITE (hw,SXE_RAH (i),0 ); + } + +LOG_DEV_DEBUG ("clear %u uta filter addr register" , +SXE_UTA_ENTRY_NUM_MAX ); +for (i =0 ; i <SXE_UTA_ENTRY_NUM_MAX ; i++) +SXE_REG_WRITE (hw,SXE_UTA (i),0 ); + +SXE_REG_WRITE (hw,SXE_MCSTCTRL ,SXE_MC_FILTER_TYPE0 ); + +LOG_DEV_DEBUG ("clear %u mta filter addr register" , +SXE_MTA_ENTRY_NUM_MAX ); +for (i =0 ; i <SXE_MTA_ENTRY_NUM_MAX ; i++) +SXE_REG_WRITE (hw,SXE_MTA (i),0 ); +} + +static void sxe_hw_ethertype_filter_set (struct sxe_hw *hw, +u8 filter_type,u32 value) +{ +SXE_REG_WRITE (hw,SXE_ETQF (filter_type), value); +} + +void sxe_hw_vt_ctrl_cfg (struct sxe_hw *hw,u8 default_pool) +{ +u32 ctrl; + + ctrl =SXE_REG_READ (hw,SXE_VT_CTL ); + + ctrl |=SXE_VT_CTL_VT_ENABLE ; + ctrl &= ~SXE_VT_CTL_POOL_MASK ; + ctrl |= default_pool <<SXE_VT_CTL_POOL_SHIFT ; + ctrl |=SXE_VT_CTL_REPLEN ; + +SXE_REG_WRITE (hw,SXE_VT_CTL , ctrl); +} + +void sxe_hw_vt_disable (struct sxe_hw *hw) +{ +u32 vmdctl; + + vmdctl =SXE_REG_READ (hw,SXE_VT_CTL ); + vmdctl &= ~SXE_VMD_CTL_POOL_EN ; +SXE_REG_WRITE (hw,SXE_VT_CTL , vmdctl); +} + +#ifdef SXE_WOL_CONFIGURE + +static void sxe_hw_wol_status_set (struct sxe_hw *hw) +{ +SXE_REG_WRITE (hw,SXE_WUS , ~0 ); +} + +static void sxe_hw_wol_mode_set (struct sxe_hw *hw,u32 wol_status) +{ +u32 fctrl; + +SXE_REG_WRITE (hw,SXE_WUC ,SXE_WUC_PME_EN ); + + fctrl =SXE_REG_READ (hw,SXE_FCTRL ); + fctrl |=SXE_FCTRL_BAM ; +if (wol_status &SXE_WUFC_MC ) + fctrl |=SXE_FCTRL_MPE ; + +SXE_REG_WRITE (hw,SXE_FCTRL , fctrl); + +SXE_REG_WRITE (hw,SXE_WUFC , wol_status); +sxe_hw_wol_status_set (hw); +} + +static void sxe_hw_wol_mode_clean (struct sxe_hw *hw) +{ +SXE_REG_WRITE (hw,SXE_WUC ,0 ); +SXE_REG_WRITE (hw,SXE_WUFC ,0 ); +} +#endif + +static const struct sxe_filter_mac_operations sxe_filter_mac_ops = { + .rx_mode_get = sxe_hw_rx_mode_get, + .rx_mode_set = sxe_hw_rx_mode_set, + .pool_rx_mode_get = sxe_hw_pool_rx_mode_get, + .pool_rx_mode_set = sxe_hw_pool_rx_mode_set, + .rx_lro_enable = sxe_hw_rx_lro_enable, + .uc_addr_pool_add = sxe_hw_uc_addr_pool_add, + .uc_addr_pool_del = sxe_hw_uc_addr_pool_del, + .uc_addr_add = sxe_hw_uc_addr_add, + .uc_addr_del = sxe_hw_uc_addr_del, + .uc_addr_clear = sxe_hw_uc_addr_clear, + .uta_all_set = sxe_hw_uta_all_set, + .fc_mac_addr_set = sxe_hw_fc_mac_addr_set, + .mta_hash_table_set = sxe_hw_mta_hash_table_set, + .mta_hash_table_update = sxe_hw_mta_hash_table_update, + + .mc_filter_enable = sxe_hw_mc_filter_enable, + .mc_filter_disable = sxe_hw_mc_filter_disable, + .rx_nfs_filter_disable = sxe_hw_rx_nfs_filter_disable, + .ethertype_filter_set = sxe_hw_ethertype_filter_set, + .vt_ctrl_configure = sxe_hw_vt_ctrl_cfg, + .uc_addr_pool_enable = sxe_hw_uc_addr_pool_enable, + .uc_addr_pool_disable = sxe_hw_uc_addr_pool_disable, + .rx_udp_frag_checksum_disable = sxe_hw_rx_udp_frag_checksum_disable, + +#ifdef SXE_WOL_CONFIGURE + .wol_mode_set = sxe_hw_wol_mode_set, + .wol_mode_clean = sxe_hw_wol_mode_clean, + .wol_status_set = sxe_hw_wol_status_set, +#endif + + .vt_disable = sxe_hw_vt_disable, +}; + +u32 sxe_hw_vlan_pool_filter_read (struct sxe_hw *hw,u16 reg_index) +{ +return SXE_REG_READ (hw,SXE_VLVF (reg_index)); +} + +static void sxe_hw_vlan_pool_filter_write (struct sxe_hw *hw, +u16 reg_index,u32 value) +{ +SXE_REG_WRITE (hw,SXE_VLVF (reg_index), value); +} + +static u32 sxe_hw_vlan_pool_filter_bitmap_read (struct sxe_hw *hw, +u16 reg_index) +{ +return SXE_REG_READ (hw,SXE_VLVFB (reg_index)); +} + +static void sxe_hw_vlan_pool_filter_bitmap_write (struct sxe_hw *hw, +u16 reg_index,u32 value) +{ +SXE_REG_WRITE (hw,SXE_VLVFB (reg_index), value); +} + +void sxe_hw_vlan_filter_array_write (struct sxe_hw *hw, +u16 reg_index,u32 value) +{ +SXE_REG_WRITE (hw,SXE_VFTA (reg_index), value); +} + +u32 sxe_hw_vlan_filter_array_read (struct sxe_hw *hw,u16 reg_index) +{ +return SXE_REG_READ (hw,SXE_VFTA (reg_index)); +} + +void sxe_hw_vlan_filter_switch (struct sxe_hw *hw,bool is_enable) +{ +u32 vlnctrl; + + vlnctrl =SXE_REG_READ (hw,SXE_VLNCTRL ); +if (is_enable) + vlnctrl |=SXE_VLNCTRL_VFE ; +else + vlnctrl &= ~SXE_VLNCTRL_VFE ; + +SXE_REG_WRITE (hw,SXE_VLNCTRL , vlnctrl); +} + +static void sxe_hw_vlan_untagged_pkts_rcv_switch (struct sxe_hw *hw, +u32 vf,bool accept) +{ +u32 vmolr =SXE_REG_READ (hw,SXE_VMOLR (vf)); + vmolr |=SXE_VMOLR_BAM ; +if (accept) + vmolr |=SXE_VMOLR_AUPE ; +else + vmolr &= ~SXE_VMOLR_AUPE ; + +LOG_WARN ("vf:%u value:0x%x." , vf, vmolr); +SXE_REG_WRITE (hw,SXE_VMOLR (vf), vmolr); +} + +s32 sxe_hw_vlvf_slot_find (struct sxe_hw *hw,u32 vlan,bool vlvf_bypass) +{ +s32 ret, regindex, first_empty_slot; +u32 bits; +struct sxe_adapter *adapter = hw->adapter; + +if (vlan ==0 ) { + ret =0 ; + goto l_end; + } + + first_empty_slot = vlvf_bypass ? -SXE_ERR_NO_SPACE :0 ; + + vlan |=SXE_VLVF_VIEN ; + +for (regindex =SXE_VLVF_ENTRIES ; --regindex;) { + bits =SXE_REG_READ (hw,SXE_VLVF (regindex)); +if (bits == vlan) { + ret = regindex; + goto l_end; + } + +if (!first_empty_slot && !bits) + first_empty_slot = regindex; + } + +if (!first_empty_slot) +LOG_DEV_WARN ("no space in VLVF." ); + + ret = first_empty_slot ? : -SXE_ERR_NO_SPACE ; +l_end: +return ret; +} + +s32 sxe_hw_vlan_filter_configure (struct sxe_hw *hw, +u32 vid,u32 pool, +bool vlan_on,bool vlvf_bypass) +{ +s32 ret =0 ; +u32 regidx, vfta_delta, vfta, bits; +s32 vlvf_index; + +LOG_DEBUG ("vid: %u, pool: %u, vlan_on: %d, vlvf_bypass: %d" , + vid, pool, vlan_on, vlvf_bypass); + +if (vid >4095 || pool >63 ) { + ret = -SXE_ERR_PARAM ; + goto l_end; + } + + + regidx = vid /32 ; + vfta_delta =BIT (vid %32 ); + vfta =SXE_REG_READ (hw,SXE_VFTA (regidx)); + + vfta_delta &= vlan_on ? ~vfta : vfta; + vfta ^= vfta_delta; + +if (!(SXE_REG_READ (hw,SXE_VT_CTL ) &SXE_VT_CTL_VT_ENABLE )) + goto vfta_update; + + vlvf_index =sxe_hw_vlvf_slot_find (hw, vid, vlvf_bypass); +if (vlvf_index <0 ) { +if (vlvf_bypass) + goto vfta_update; + + ret = vlvf_index; + goto l_end; + } + + bits =SXE_REG_READ (hw,SXE_VLVFB (vlvf_index *2 + pool /32 )); + + bits |=BIT (pool %32 ); +if (vlan_on) + goto vlvf_update; + + bits ^=BIT (pool %32 ); + +if (!bits && + !SXE_REG_READ (hw,SXE_VLVFB (vlvf_index *2 +1 - pool /32 ))) { +if (vfta_delta) +SXE_REG_WRITE (hw,SXE_VFTA (regidx), vfta); + +SXE_REG_WRITE (hw,SXE_VLVF (vlvf_index),0 ); +SXE_REG_WRITE (hw,SXE_VLVFB (vlvf_index *2 + pool /32 ),0 ); + + goto l_end; + } + + vfta_delta =0 ; + +vlvf_update: +SXE_REG_WRITE (hw,SXE_VLVFB (vlvf_index *2 + pool /32 ), bits); +SXE_REG_WRITE (hw,SXE_VLVF (vlvf_index),SXE_VLVF_VIEN | vid); + +vfta_update: +if (vfta_delta) +SXE_REG_WRITE (hw,SXE_VFTA (regidx), vfta); + +l_end: +return ret; +} + +void sxe_hw_vlan_filter_array_clear (struct sxe_hw *hw) +{ +u32 offset; + +for (offset =0 ; offset <SXE_VFT_TBL_SIZE ; offset++) +SXE_REG_WRITE (hw,SXE_VFTA (offset),0 ); + +for (offset =0 ; offset <SXE_VLVF_ENTRIES ; offset++) { +SXE_REG_WRITE (hw,SXE_VLVF (offset),0 ); +SXE_REG_WRITE (hw,SXE_VLVFB (offset *2 ),0 ); +SXE_REG_WRITE (hw,SXE_VLVFB (offset *2 +1 ),0 ); + } +} + +static const struct sxe_filter_vlan_operations sxe_filter_vlan_ops = { + .pool_filter_read = sxe_hw_vlan_pool_filter_read, + .pool_filter_write = sxe_hw_vlan_pool_filter_write, + .pool_filter_bitmap_read = sxe_hw_vlan_pool_filter_bitmap_read, + .pool_filter_bitmap_write = sxe_hw_vlan_pool_filter_bitmap_write, + .filter_array_write = sxe_hw_vlan_filter_array_write, + .filter_array_read = sxe_hw_vlan_filter_array_read, + .filter_array_clear = sxe_hw_vlan_filter_array_clear, + .filter_switch = sxe_hw_vlan_filter_switch, + .untagged_pkts_rcv_switch = sxe_hw_vlan_untagged_pkts_rcv_switch, + .filter_configure = sxe_hw_vlan_filter_configure, +}; + + +static void sxe_hw_rx_pkt_buf_switch (struct sxe_hw *hw,bool is_on) +{ +u32 dbucfg =SXE_REG_READ (hw,SXE_DRXCFG ); + +if (is_on) + dbucfg |=SXE_DRXCFG_DBURX_START ; +else + dbucfg &= ~SXE_DRXCFG_DBURX_START ; + +SXE_REG_WRITE (hw,SXE_DRXCFG , dbucfg); +} + +static void sxe_hw_rx_pkt_buf_size_configure (struct sxe_hw *hw, +u8 num_pb, +u32 headroom, +u16 strategy) +{ +u16 total_buf_size = (SXE_RX_PKT_BUF_SIZE - headroom); +u32 rx_buf_size; +u16 i =0 ; + +if (!num_pb) + num_pb =1 ; + +switch (strategy) { +case (PBA_STRATEGY_WEIGHTED ): + rx_buf_size = ((total_buf_size *5 *2 ) / (num_pb *8 )); + total_buf_size -= rx_buf_size * (num_pb /2 ); + rx_buf_size <<=SXE_RX_PKT_BUF_SIZE_SHIFT ; +for (i =0 ; i < (num_pb /2 ); i++) +SXE_REG_WRITE (hw,SXE_RXPBSIZE (i), rx_buf_size); + + fallthrough; +case (PBA_STRATEGY_EQUAL ): + rx_buf_size = (total_buf_size / (num_pb - i)) + <<SXE_RX_PKT_BUF_SIZE_SHIFT ; +for (; i < num_pb; i++) +SXE_REG_WRITE (hw,SXE_RXPBSIZE (i), rx_buf_size); + +break ; + +default : +break ; + } + +for (; i <SXE_PKG_BUF_NUM_MAX ; i++) +SXE_REG_WRITE (hw,SXE_RXPBSIZE (i),0 ); +} + +u32 sxe_hw_rx_pkt_buf_size_get (struct sxe_hw *hw,u8 pb) +{ +return SXE_REG_READ (hw,SXE_RXPBSIZE (pb)); +} + +void sxe_hw_rx_multi_ring_configure (struct sxe_hw *hw, +u8 tcs,bool is_4q_per_pool, +bool sriov_enable) +{ +u32 mrqc =SXE_REG_READ (hw,SXE_MRQC ); + + mrqc &= ~SXE_MRQE_MASK ; + +if (sriov_enable) { +if (tcs >4 ) + mrqc |=SXE_MRQC_VMDQRT8TCEN ; +else if (tcs >1 ) + mrqc |=SXE_MRQC_VMDQRT4TCEN ; +else if (is_4q_per_pool) + mrqc |=SXE_MRQC_VMDQRSS32EN ; +else + mrqc |=SXE_MRQC_VMDQRSS64EN ; + + }else { +if (tcs >4 ) + mrqc |=SXE_MRQC_RTRSS8TCEN ; +else if (tcs >1 ) + mrqc |=SXE_MRQC_RTRSS4TCEN ; +else + mrqc |=SXE_MRQC_RSSEN ; + } + +SXE_REG_WRITE (hw,SXE_MRQC , mrqc); +} + +static void sxe_hw_rss_hash_pkt_type_set (struct sxe_hw *hw,u32 version) +{ +u32 mrqc =0 ; +u32 rss_field =0 ; + + rss_field |=SXE_MRQC_RSS_FIELD_IPV4 | +SXE_MRQC_RSS_FIELD_IPV4_TCP | +SXE_MRQC_RSS_FIELD_IPV6 | +SXE_MRQC_RSS_FIELD_IPV6_TCP ; + +if (version ==SXE_RSS_IP_VER_4 ) + rss_field |=SXE_MRQC_RSS_FIELD_IPV4_UDP ; + +if (version ==SXE_RSS_IP_VER_6 ) + rss_field |=SXE_MRQC_RSS_FIELD_IPV6_UDP ; + + mrqc |= rss_field; +SXE_REG_WRITE (hw,SXE_MRQC , mrqc); +} + +static void sxe_hw_rss_hash_pkt_type_update (struct sxe_hw *hw, +u32 version) +{ +u32 mrqc; + + mrqc =SXE_REG_READ (hw,SXE_MRQC ); + + mrqc |=SXE_MRQC_RSS_FIELD_IPV4 + |SXE_MRQC_RSS_FIELD_IPV4_TCP + |SXE_MRQC_RSS_FIELD_IPV6 + |SXE_MRQC_RSS_FIELD_IPV6_TCP ; + + mrqc &= ~(SXE_MRQC_RSS_FIELD_IPV4_UDP | +SXE_MRQC_RSS_FIELD_IPV6_UDP ); + +if (version ==SXE_RSS_IP_VER_4 ) + mrqc |=SXE_MRQC_RSS_FIELD_IPV4_UDP ; + +if (version ==SXE_RSS_IP_VER_6 ) + mrqc |=SXE_MRQC_RSS_FIELD_IPV6_UDP ; + +SXE_REG_WRITE (hw,SXE_MRQC , mrqc); +} + +static void sxe_hw_rss_rings_used_set (struct sxe_hw *hw,u32 rss_num, +u16 pool,u16 pf_offset) +{ +u32 psrtype =0 ; + +if (rss_num >3 ) + psrtype |=2u <<29 ; +else if (rss_num >1 ) + psrtype |=1u <<29 ; + +while (pool--) +SXE_REG_WRITE (hw,SXE_PSRTYPE (pf_offset + pool), psrtype); +} + +void sxe_hw_rss_key_set_all (struct sxe_hw *hw,u32 *rss_key) +{ +u32 i; + +for (i =0 ; i <SXE_MAX_RSS_KEY_ENTRIES ; i++) +SXE_REG_WRITE (hw,SXE_RSSRK (i), rss_key[i]); +} + +void sxe_hw_rss_redir_tbl_reg_write (struct sxe_hw *hw, +u16 reg_idx,u32 value) +{ +SXE_REG_WRITE (hw,SXE_RETA (reg_idx >>2 ), value); +} + +void sxe_hw_rss_redir_tbl_set_all (struct sxe_hw *hw,u8 *redir_tbl) +{ +u32 i; +u32 tbl =0 ; +u32 indices_multi =0x1 ; + + +for (i =0 ; i <SXE_MAX_RETA_ENTRIES ; i++) { + tbl |= indices_multi * redir_tbl[i] << (i &0x3 ) *8 ; +if ((i &3 ) ==3 ) { +sxe_hw_rss_redir_tbl_reg_write (hw, i, tbl); + tbl =0 ; + } + } +} + +void sxe_hw_rx_cap_switch_on (struct sxe_hw *hw) +{ +u32 rxctrl; + +if (hw->mac.set_lben) { +u32 pfdtxgswc =SXE_REG_READ (hw,SXE_PFDTXGSWC ); + pfdtxgswc |=SXE_PFDTXGSWC_VT_LBEN ; +SXE_REG_WRITE (hw,SXE_PFDTXGSWC , pfdtxgswc); + hw->mac.set_lben = false; + } + + rxctrl =SXE_REG_READ (hw,SXE_RXCTRL ); + rxctrl |=SXE_RXCTRL_RXEN ; +SXE_REG_WRITE (hw,SXE_RXCTRL , rxctrl); +} + +void sxe_hw_rx_cap_switch_off (struct sxe_hw *hw) +{ +u32 rxctrl; + + rxctrl =SXE_REG_READ (hw,SXE_RXCTRL ); +if (rxctrl &SXE_RXCTRL_RXEN ) { +u32 pfdtxgswc =SXE_REG_READ (hw,SXE_PFDTXGSWC ); +if (pfdtxgswc &SXE_PFDTXGSWC_VT_LBEN ) { + pfdtxgswc &= ~SXE_PFDTXGSWC_VT_LBEN ; +SXE_REG_WRITE (hw,SXE_PFDTXGSWC , pfdtxgswc); + hw->mac.set_lben = true; + }else { + hw->mac.set_lben = false; + } + rxctrl &= ~SXE_RXCTRL_RXEN ; +SXE_REG_WRITE (hw,SXE_RXCTRL , rxctrl); + } +} + +static void sxe_hw_rx_func_switch_on (struct sxe_hw *hw) +{ +u32 rxctrl; + + rxctrl =SXE_REG_READ (hw,SXE_COMCTRL ); + rxctrl |=SXE_COMCTRL_RXEN |SXE_COMCTRL_EDSEL ; +SXE_REG_WRITE (hw,SXE_COMCTRL , rxctrl); +} + +void sxe_hw_tx_pkt_buf_switch (struct sxe_hw *hw,bool is_on) +{ +u32 dbucfg; + + dbucfg =SXE_REG_READ (hw,SXE_DTXCFG ); + +if (is_on) { + dbucfg |=SXE_DTXCFG_DBUTX_START ; + dbucfg |=SXE_DTXCFG_DBUTX_BUF_ALFUL_CFG ; +SXE_REG_WRITE (hw,SXE_DTXCFG , dbucfg); + }else { + dbucfg &= ~SXE_DTXCFG_DBUTX_START ; +SXE_REG_WRITE (hw,SXE_DTXCFG , dbucfg); + } +} + +void sxe_hw_tx_pkt_buf_size_configure (struct sxe_hw *hw,u8 num_pb) +{ +u32 i, tx_pkt_size; + +if (!num_pb) + num_pb =1 ; + + tx_pkt_size =SXE_TX_PBSIZE_MAX / num_pb; +for (i =0 ; i < num_pb; i++) +SXE_REG_WRITE (hw,SXE_TXPBSIZE (i), tx_pkt_size); + +for (; i <SXE_PKG_BUF_NUM_MAX ; i++) +SXE_REG_WRITE (hw,SXE_TXPBSIZE (i),0 ); +} + +void sxe_hw_rx_lro_ack_switch (struct sxe_hw *hw,bool is_on) +{ +u32 lro_dbu =SXE_REG_READ (hw,SXE_LRODBU ); + +if (is_on) + lro_dbu &= ~SXE_LRODBU_LROACKDIS ; +else + lro_dbu |=SXE_LRODBU_LROACKDIS ; + +SXE_REG_WRITE (hw,SXE_LRODBU , lro_dbu); +} + +static void sxe_hw_vf_rx_switch (struct sxe_hw *hw, +u32 reg_offset,u32 vf_index,bool is_off) +{ +u32 vfre =SXE_REG_READ (hw,SXE_VFRE (reg_offset)); +if (is_off) + vfre &= ~BIT (vf_index); +else + vfre |=BIT (vf_index); + +SXE_REG_WRITE (hw,SXE_VFRE (reg_offset), vfre); +} + +static s32 sxe_hw_fnav_wait_init_done (struct sxe_hw *hw) +{ +u32 i; +s32 ret =0 ; +struct sxe_adapter *adapter = hw->adapter; +for (i =0 ; i <SXE_FNAV_INIT_DONE_POLL ; i++) { +if (SXE_REG_READ (hw,SXE_FNAVCTRL ) & +SXE_FNAVCTRL_INIT_DONE ) { +break ; + } + +usleep_range (1000 ,2000 ); + } + +if (i >=SXE_FNAV_INIT_DONE_POLL ) { +LOG_DEV_DEBUG ("flow navigator poll time exceeded!" ); + ret = -SXE_ERR_FNAV_REINIT_FAILED ; + } + +return ret; +} + +void sxe_hw_fnav_enable (struct sxe_hw *hw,u32 fnavctrl) +{ +u32 fnavctrl_ori; +bool is_clear_stat = false; + +SXE_REG_WRITE (hw,SXE_FNAVHKEY ,SXE_FNAV_BUCKET_HASH_KEY ); +SXE_REG_WRITE (hw,SXE_FNAVSKEY ,SXE_FNAV_SAMPLE_HASH_KEY ); + + fnavctrl_ori =SXE_REG_READ (hw,SXE_FNAVCTRL ); +if ((fnavctrl_ori &0x13 ) != (fnavctrl &0x13 )) + is_clear_stat = true; + +SXE_REG_WRITE (hw,SXE_FNAVCTRL , fnavctrl); +SXE_WRITE_FLUSH (hw); + +sxe_hw_fnav_wait_init_done (hw); + +if (is_clear_stat) { +SXE_REG_READ (hw,SXE_FNAVUSTAT ); +SXE_REG_READ (hw,SXE_FNAVFSTAT ); +SXE_REG_READ (hw,SXE_FNAVMATCH ); +SXE_REG_READ (hw,SXE_FNAVMISS ); +SXE_REG_READ (hw,SXE_FNAVLEN ); + } +} + +static s32 sxe_hw_fnav_mode_init (struct sxe_hw *hw, +u32 fnavctrl,u32 sxe_fnav_mode) +{ +struct sxe_adapter *adapter = hw->adapter; + +LOG_DEBUG_BDF ("fnavctrl=0x%x, sxe_fnav_mode=%u" , fnavctrl, sxe_fnav_mode); + +if (sxe_fnav_mode !=SXE_FNAV_SAMPLE_MODE && + sxe_fnav_mode !=SXE_FNAV_SPECIFIC_MODE ) { +LOG_ERROR_BDF ("mode[%u] a error fnav mode, fnav do not work. please" +" use SXE_FNAV_SAMPLE_MODE or SXE_FNAV_SPECIFIC_MODE" , + sxe_fnav_mode); + goto l_end; + } + +if (sxe_fnav_mode ==SXE_FNAV_SPECIFIC_MODE ) { + fnavctrl |=SXE_FNAVCTRL_SPECIFIC_MATCH | + (SXE_FNAV_DROP_QUEUE <<SXE_FNAVCTRL_DROP_Q_SHIFT ); + } + + fnavctrl |= (0x6 <<SXE_FNAVCTRL_FLEX_SHIFT ) | + (0xA <<SXE_FNAVCTRL_MAX_LENGTH_SHIFT ) | + (4 <<SXE_FNAVCTRL_FULL_THRESH_SHIFT ); + +sxe_hw_fnav_enable (hw, fnavctrl); + +l_end: +return 0 ; +} + +u32 sxe_hw_fnav_port_mask_get (__be16 src_port_mask,__be16 dst_port_mask) +{ +u32 mask =ntohs (dst_port_mask); + + mask <<=SXE_FNAVTCPM_DPORTM_SHIFT ; + mask |=ntohs (src_port_mask); + mask = ((mask &0x55555555 ) <<1 ) | ((mask &0xAAAAAAAA ) >>1 ); + mask = ((mask &0x33333333 ) <<2 ) | ((mask &0xCCCCCCCC ) >>2 ); + mask = ((mask &0x0F0F0F0F ) <<4 ) | ((mask &0xF0F0F0F0 ) >>4 ); +return ((mask &0x00FF00FF ) <<8 ) | ((mask &0xFF00FF00 ) >>8 ); +} + +static s32 sxe_hw_fnav_vm_pool_mask_get (struct sxe_hw *hw, +u8 vm_pool,u32 *fnavm) +{ +s32 ret =0 ; +struct sxe_adapter *adapter = hw->adapter; + +switch (vm_pool &SXE_SAMPLE_VM_POOL_MASK ) { +case 0x0 : + *fnavm |=SXE_FNAVM_POOL ; + fallthrough; +case 0x7F : +break ; +default : +LOG_DEV_ERR ("error on vm pool mask" ); + ret = -SXE_ERR_CONFIG ; + } + +return ret; +} + +static s32 sxe_hw_fnav_flow_type_mask_get (struct sxe_hw *hw, +union sxe_fnav_rule_info *input_mask, +u32 *fnavm) +{ +s32 ret =0 ; +struct sxe_adapter *adapter = hw->adapter; + +switch (input_mask->ntuple.flow_type &SXE_SAMPLE_L4TYPE_MASK ) { +case 0x0 : + *fnavm |=SXE_FNAVM_L4P ; +if (input_mask->ntuple.dst_port || + input_mask->ntuple.src_port) { +LOG_DEV_ERR ("error on src/dst port mask" ); + ret = -SXE_ERR_CONFIG ; + goto l_ret; + } +break ; +case SXE_SAMPLE_L4TYPE_MASK : +break ; +default : +LOG_DEV_ERR ("error on flow type mask" ); + ret = -SXE_ERR_CONFIG ; + } + +l_ret: +return ret; +} + +static s32 sxe_hw_fnav_vlan_mask_get (struct sxe_hw *hw, +__be16 vlan_id,u32 *fnavm) +{ +s32 ret =0 ; +struct sxe_adapter *adapter = hw->adapter; + +switch (ntohs (vlan_id) &SXE_SAMPLE_VLAN_MASK ) { +case 0x0000 : + *fnavm |=SXE_FNAVM_VLANID ; + fallthrough; +case 0x0FFF : + *fnavm |=SXE_FNAVM_VLANP ; +break ; +case 0xE000 : + *fnavm |=SXE_FNAVM_VLANID ; + fallthrough; +case 0xEFFF : +break ; +default : +LOG_DEV_ERR ("error on VLAN mask" ); + ret = -SXE_ERR_CONFIG ; + } + +return ret; +} + +static s32 sxe_hw_fnav_flex_bytes_mask_get (struct sxe_hw *hw, +__be16 flex_bytes,u32 *fnavm) +{ +s32 ret =0 ; +struct sxe_adapter *adapter = hw->adapter; + +switch ((__force u16 )flex_bytes &SXE_SAMPLE_FLEX_BYTES_MASK ) { +case 0x0000 : + *fnavm |=SXE_FNAVM_FLEX ; + fallthrough; +case 0xFFFF : +break ; +default : +LOG_DEV_ERR ("error on flexible byte mask" ); + ret = -SXE_ERR_CONFIG ; + } + +return ret; +} + +s32 sxe_hw_fnav_specific_rule_mask_set (struct sxe_hw *hw, +union sxe_fnav_rule_info *input_mask) +{ +s32 ret; +u32 fnavm =SXE_FNAVM_DIPV6 ; +u32 fnavtcpm; +struct sxe_adapter *adapter = hw->adapter; + + +if (input_mask->ntuple.bkt_hash) +LOG_DEV_ERR ("bucket hash should always be 0 in mask" ); + + ret =sxe_hw_fnav_vm_pool_mask_get (hw, input_mask->ntuple.vm_pool, &fnavm); +if (ret) + goto l_err_config; + + ret =sxe_hw_fnav_flow_type_mask_get (hw, input_mask, &fnavm); +if (ret) + goto l_err_config; + + ret =sxe_hw_fnav_vlan_mask_get (hw, input_mask->ntuple.vlan_id, &fnavm); +if (ret) + goto l_err_config; + + ret =sxe_hw_fnav_flex_bytes_mask_get (hw, input_mask->ntuple.flex_bytes, &fnavm); +if (ret) + goto l_err_config; + +LOG_DEBUG_BDF ("fnavm = 0x%x" , fnavm); +SXE_REG_WRITE (hw,SXE_FNAVM , fnavm); + + fnavtcpm =sxe_hw_fnav_port_mask_get (input_mask->ntuple.src_port, + input_mask->ntuple.dst_port); + +LOG_DEBUG_BDF ("fnavtcpm = 0x%x" , fnavtcpm); +SXE_REG_WRITE (hw,SXE_FNAVTCPM , ~fnavtcpm); +SXE_REG_WRITE (hw,SXE_FNAVUDPM , ~fnavtcpm); + +SXE_REG_WRITE_BE32 (hw,SXE_FNAVSIP4M , + ~input_mask->ntuple.src_ip[0 ]); +SXE_REG_WRITE_BE32 (hw,SXE_FNAVDIP4M , + ~input_mask->ntuple.dst_ip[0 ]); + +return 0 ; + +l_err_config: +return -SXE_ERR_CONFIG ; +} + +static s32 sxe_hw_fnav_cmd_complete_check (struct sxe_hw *hw, +u32 *fnavcmd) +{ +u32 i; + +for (i =0 ; i <SXE_FNAVCMD_CMD_POLL *10 ; i++) { + *fnavcmd =SXE_REG_READ (hw,SXE_FNAVCMD ); +if (!(*fnavcmd &SXE_FNAVCMD_CMD_MASK )) +return 0 ; + +sxe_udelay (10 ); + } + +return -SXE_ERR_FNAV_CMD_INCOMPLETE ; +} + +static void sxe_hw_fnav_filter_ip_set (struct sxe_hw *hw, +union sxe_fnav_rule_info *input) +{ +SXE_REG_WRITE_BE32 (hw,SXE_FNAVSIPV6 (0 ), + input->ntuple.src_ip[0 ]); +SXE_REG_WRITE_BE32 (hw,SXE_FNAVSIPV6 (1 ), + input->ntuple.src_ip[1 ]); +SXE_REG_WRITE_BE32 (hw,SXE_FNAVSIPV6 (2 ), + input->ntuple.src_ip[2 ]); + +SXE_REG_WRITE_BE32 (hw,SXE_FNAVIPSA , input->ntuple.src_ip[0 ]); + +SXE_REG_WRITE_BE32 (hw,SXE_FNAVIPDA , input->ntuple.dst_ip[0 ]); +} + +static void sxe_hw_fnav_filter_port_set (struct sxe_hw *hw, +union sxe_fnav_rule_info *input) +{ +u32 fnavport; + + fnavport =be16_to_cpu (input->ntuple.dst_port); + fnavport <<=SXE_FNAVPORT_DESTINATION_SHIFT ; + fnavport |=be16_to_cpu (input->ntuple.src_port); +SXE_REG_WRITE (hw,SXE_FNAVPORT , fnavport); +} + +static void sxe_hw_fnav_filter_vlan_set (struct sxe_hw *hw, +union sxe_fnav_rule_info *input) +{ +u32 fnavvlan; + + fnavvlan =ntohs (SXE_SWAP_16 (input->ntuple.flex_bytes)); + fnavvlan <<=SXE_FNAVVLAN_FLEX_SHIFT ; + fnavvlan |=ntohs (input->ntuple.vlan_id); +SXE_REG_WRITE (hw,SXE_FNAVVLAN , fnavvlan); +} + +static void sxe_hw_fnav_filter_bkt_hash_set (struct sxe_hw *hw, +union sxe_fnav_rule_info *input, +u16 soft_id) +{ +u32 fnavhash; + + fnavhash = (__force u32 )input->ntuple.bkt_hash; + fnavhash |= soft_id <<SXE_FNAVHASH_SIG_SW_INDEX_SHIFT ; +SXE_REG_WRITE (hw,SXE_FNAVHASH , fnavhash); +} + +static s32 sxe_hw_fnav_filter_cmd_set (struct sxe_hw *hw, +union sxe_fnav_rule_info *input, +u8 queue) +{ +u32 fnavcmd; +s32 ret; +struct sxe_adapter *adapter = hw->adapter; + + fnavcmd =SXE_FNAVCMD_CMD_ADD_FLOW |SXE_FNAVCMD_FILTER_UPDATE | +SXE_FNAVCMD_LAST |SXE_FNAVCMD_QUEUE_EN ; + +#ifndef SXE_DPDK +if (queue ==SXE_FNAV_DROP_QUEUE ) + fnavcmd |=SXE_FNAVCMD_DROP ; +#endif + + fnavcmd |= input->ntuple.flow_type <<SXE_FNAVCMD_FLOW_TYPE_SHIFT ; + fnavcmd |= (u32 )queue <<SXE_FNAVCMD_RX_QUEUE_SHIFT ; + fnavcmd |= (u32 )input->ntuple.vm_pool <<SXE_FNAVCMD_VT_POOL_SHIFT ; + +SXE_REG_WRITE (hw,SXE_FNAVCMD , fnavcmd); + ret =sxe_hw_fnav_cmd_complete_check (hw, &fnavcmd); +if (ret) +LOG_DEV_ERR ("flow navigator command did not complete!" ); + +return ret; +} + +s32 sxe_hw_fnav_specific_rule_add (struct sxe_hw *hw, +union sxe_fnav_rule_info *input, +u16 soft_id,u8 queue) +{ +s32 ret; +struct sxe_adapter *adapter = hw->adapter; + +sxe_hw_fnav_filter_ip_set (hw, input); + +sxe_hw_fnav_filter_port_set (hw, input); + +sxe_hw_fnav_filter_vlan_set (hw, input); + +sxe_hw_fnav_filter_bkt_hash_set (hw, input, soft_id); + +SXE_WRITE_FLUSH (hw); + + ret =sxe_hw_fnav_filter_cmd_set (hw, input, queue); +if (ret) +LOG_ERROR_BDF ("set fnav filter cmd error. ret=%d" , ret); + +return ret; +} + +s32 sxe_hw_fnav_specific_rule_del (struct sxe_hw *hw, +union sxe_fnav_rule_info *input, +u16 soft_id) +{ +u32 fnavhash; +u32 fnavcmd; +s32 ret; +struct sxe_adapter *adapter = hw->adapter; + + + fnavhash = (__force u32 )input->ntuple.bkt_hash; + fnavhash |= soft_id <<SXE_FNAVHASH_SIG_SW_INDEX_SHIFT ; +SXE_REG_WRITE (hw,SXE_FNAVHASH , fnavhash); + +SXE_WRITE_FLUSH (hw); + +SXE_REG_WRITE (hw,SXE_FNAVCMD ,SXE_FNAVCMD_CMD_QUERY_REM_FILT ); + + ret =sxe_hw_fnav_cmd_complete_check (hw, &fnavcmd); +if (ret) { +LOG_DEV_ERR ("flow navigator command did not complete!" ); +return ret; + } + +if (fnavcmd &SXE_FNAVCMD_FILTER_VALID ) { +SXE_REG_WRITE (hw,SXE_FNAVHASH , fnavhash); +SXE_WRITE_FLUSH (hw); +SXE_REG_WRITE (hw,SXE_FNAVCMD , +SXE_FNAVCMD_CMD_REMOVE_FLOW ); + } + +return 0 ; +} + +void sxe_hw_fnav_sample_rule_configure (struct sxe_hw *hw, +u8 flow_type,u32 hash_value,u8 queue) +{ +u32 fnavcmd; +u64 fnavhashcmd; +struct sxe_adapter *adapter = hw->adapter; + + fnavcmd =SXE_FNAVCMD_CMD_ADD_FLOW |SXE_FNAVCMD_FILTER_UPDATE | +SXE_FNAVCMD_LAST |SXE_FNAVCMD_QUEUE_EN ; + fnavcmd |= (u32 )flow_type <<SXE_FNAVCMD_FLOW_TYPE_SHIFT ; + fnavcmd |= (u32 )queue <<SXE_FNAVCMD_RX_QUEUE_SHIFT ; + + fnavhashcmd = (u64 )fnavcmd <<32 ; + fnavhashcmd |= hash_value; +SXE_REG64_WRITE (hw,SXE_FNAVHASH , fnavhashcmd); + +LOG_DEV_DEBUG ("tx queue=%x hash=%x" , queue, (u32 )fnavhashcmd); +} + +static u64 sxe_hw_fnav_sample_rule_hash_get (struct sxe_hw *hw, +u8 flow_type,u32 hash_value,u8 queue) +{ +u32 fnavcmd; +u64 fnavhashcmd; +struct sxe_adapter *adapter = hw->adapter; + + fnavcmd =SXE_FNAVCMD_CMD_ADD_FLOW |SXE_FNAVCMD_FILTER_UPDATE | +SXE_FNAVCMD_LAST |SXE_FNAVCMD_QUEUE_EN ; + fnavcmd |= (u32 )flow_type <<SXE_FNAVCMD_FLOW_TYPE_SHIFT ; + fnavcmd |= (u32 )queue <<SXE_FNAVCMD_RX_QUEUE_SHIFT ; + + fnavhashcmd = (u64 )fnavcmd <<32 ; + fnavhashcmd |= hash_value; + +LOG_DEV_DEBUG ("tx queue=%x hash=%x" , queue, (u32 )fnavhashcmd); + +return fnavhashcmd; +} + +static s32 sxe_hw_fnav_sample_hash_cmd_get (struct sxe_hw *hw, +u8 flow_type, +u32 hash_value, +u8 queue,u64 *hash_cmd) +{ +s32 ret =0 ; +u8 pkg_type; +struct sxe_adapter *adapter = hw->adapter; + + pkg_type = flow_type &SXE_SAMPLE_FLOW_TYPE_MASK ; +switch (pkg_type) { +case SXE_SAMPLE_FLOW_TYPE_TCPV4 : +case SXE_SAMPLE_FLOW_TYPE_UDPV4 : +case SXE_SAMPLE_FLOW_TYPE_SCTPV4 : +case SXE_SAMPLE_FLOW_TYPE_TCPV6 : +case SXE_SAMPLE_FLOW_TYPE_UDPV6 : +case SXE_SAMPLE_FLOW_TYPE_SCTPV6 : +break ; +default : +LOG_DEV_ERR ("error on flow type input" ); + ret = -SXE_ERR_CONFIG ; + goto l_end; + } + + *hash_cmd =sxe_hw_fnav_sample_rule_hash_get (hw, pkg_type, hash_value, queue); + +l_end: +return ret; +} + +static s32 sxe_hw_fnav_single_sample_rule_del (struct sxe_hw *hw, +u32 hash) +{ +u32 fdircmd; +s32 ret; +struct sxe_adapter *adapter = hw->adapter; + +SXE_REG_WRITE (hw,SXE_FNAVHASH , hash); +SXE_WRITE_FLUSH (hw); + +SXE_REG_WRITE (hw,SXE_FNAVCMD ,SXE_FNAVCMD_CMD_REMOVE_FLOW ); + ret =sxe_hw_fnav_cmd_complete_check (hw, &fdircmd); +if (ret) { +LOG_DEV_ERR ("flow navigator previous command did not complete," +"aborting table re-initialization." ); + } + +return ret; +} + +s32 sxe_hw_fnav_sample_rules_table_reinit (struct sxe_hw *hw) +{ +u32 fnavctrl =SXE_REG_READ (hw,SXE_FNAVCTRL ); +u32 fnavcmd; +s32 ret; +struct sxe_adapter *adapter = hw->adapter; + + fnavctrl &= ~SXE_FNAVCTRL_INIT_DONE ; + + ret =sxe_hw_fnav_cmd_complete_check (hw, &fnavcmd); +if (ret) { +LOG_DEV_ERR ("flow navigator previous command did not complete," +"aborting table re-initialization." ); + goto l_ret; + } + +SXE_REG_WRITE (hw,SXE_FNAVFREE ,0 ); +SXE_WRITE_FLUSH (hw); + +SXE_REG_WRITE (hw,SXE_FNAVCMD , + (SXE_REG_READ (hw,SXE_FNAVCMD ) | +SXE_FNAVCMD_CLEARHT )); +SXE_WRITE_FLUSH (hw); +SXE_REG_WRITE (hw,SXE_FNAVCMD , + (SXE_REG_READ (hw,SXE_FNAVCMD ) & + ~SXE_FNAVCMD_CLEARHT )); +SXE_WRITE_FLUSH (hw); + +SXE_REG_WRITE (hw,SXE_FNAVHASH ,0x00 ); +SXE_WRITE_FLUSH (hw); + +SXE_REG_WRITE (hw,SXE_FNAVCTRL , fnavctrl); +SXE_WRITE_FLUSH (hw); + + ret =sxe_hw_fnav_wait_init_done (hw); +if (ret) { +LOG_ERROR_BDF ("flow navigator simple poll time exceeded!" ); + goto l_ret; + } + +SXE_REG_READ (hw,SXE_FNAVUSTAT ); +SXE_REG_READ (hw,SXE_FNAVFSTAT ); +SXE_REG_READ (hw,SXE_FNAVMATCH ); +SXE_REG_READ (hw,SXE_FNAVMISS ); +SXE_REG_READ (hw,SXE_FNAVLEN ); + +l_ret: +return ret; +} + +static void sxe_hw_fnav_sample_stats_reinit (struct sxe_hw *hw) +{ +SXE_REG_READ (hw,SXE_FNAVUSTAT ); +SXE_REG_READ (hw,SXE_FNAVFSTAT ); +SXE_REG_READ (hw,SXE_FNAVMATCH ); +SXE_REG_READ (hw,SXE_FNAVMISS ); +SXE_REG_READ (hw,SXE_FNAVLEN ); +} + +static void sxe_hw_ptp_freq_adjust (struct sxe_hw *hw,u32 adj_freq) +{ +SXE_REG_WRITE (hw,SXE_TIMADJL ,0 ); +SXE_REG_WRITE (hw,SXE_TIMADJH , adj_freq); +SXE_WRITE_FLUSH (hw); +} + +u64 sxe_hw_ptp_systime_get (struct sxe_hw *hw) +{ +struct sxe_adapter *adapter = hw->adapter; +u32 systiml; +u32 systimm; +u64 ns; + + systiml =SXE_REG_READ (hw,SXE_SYSTIML ); + systimm =SXE_REG_READ (hw,SXE_SYSTIMM ); + ns =SXE_TIME_TO_NS (systiml, systimm); + +LOG_DEBUG_BDF ("get ptp hw systime systiml=%u, systimm=%u, ns=%" SXE_PRIU64 , + systiml, systimm, ns);Lines of this file are not shown. View the raw message.
drivers/net/sxe/base/sxe_hw.h new file +1541
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/base/sxe_logs.h new file +273
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/base/sxe_types.h new file +40
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/drv_msg.h new file +18
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe/sxe_hdc.h new file +42
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe/sxe_msg.h new file +135
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe/sxe_regs.h new file +1280
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/include/sxe_version.h new file +29
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe_irq.c new file +126
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe_main.c new file +251
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe_pmd_hdc.c new file +683
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/pf/sxe_pmd_hdc.h new file +44
-0Lines of this file are not shown. View the raw message.
drivers/net/sxe/sxe_drv_type.h new file +15
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
No ifdef like this, please use stdbool.h like other parts of DPDK
drivers/net/sxe/sxe_drv_type.h
Quoted 13 lines
drivers/net/sxe/sxe_drv_type.h new file +11
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
This is bad practice and will conflict with stdbool.h Why not just include stdbool.h
drivers/net/sxe/sxe_drv_type.h
Quoted 7 lines
drivers/net/sxe/sxe_drv_type.h new file +7
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Why not use rte_bswap32 and rte_bswap16 in rte_byteorder.h?
drivers/net/sxe/sxe_drv_type.h
Quoted 14 lines
drivers/net/sxe/sxe_drv_type.h new file +14
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
You probably don't want timezone shifts etc, better to use clock_gettime(CLOCK_MONOTONIC) or just use TSC and convert into ms.
+u64 sxe_trace_id_gen(void)
+{
+ u64 tid = getpid() + (pthread_self() << 20);
+ u64 index = 0;
+ u64 timestamp = sxe_time_get_real_ms();
+
+ sxe_trace_id = (SXE_TRACE_ID_FLAG)
+ | ((timestamp << SXE_TRACE_ID_TIME_SHIFT) & SXE_TRACE_ID_TIME_MASK) + | ((tid << SXE_TRACE_ID_TID_SHIFT) & SXE_TRACE_ID_TID_MASK) + | ((index << SXE_TRACE_ID_COUNT_SHIFT) & SXE_TRACE_ID_COUNT_MASK);
+ return sxe_trace_id;
+}
+
+void sxe_trace_id_clean(void)
+{
+ sxe_trace_id = 0;
+}
+
+u64 sxe_trace_id_get(void)
+{
+ return sxe_trace_id++;
+}
Please use DPDK trace facility instead of inventing your own.
Part of the diff is not shown here. View the raw message.
PATCH v4 3/14 net/sxe: add tx rx setup and data path
In reply to Jie LiuAdd setup, initialization, and logic for tx and rx queues.
--- drivers/net/meson.build | 1 + drivers/net/sxe/base/sxe_offload_common.c | 54 + drivers/net/sxe/base/sxe_offload_common.h | 14 + drivers/net/sxe/base/sxe_queue_common.c | 397 ++++++ drivers/net/sxe/base/sxe_queue_common.h | 240 ++++ drivers/net/sxe/base/sxe_rx_common.c | 243 ++++ drivers/net/sxe/base/sxe_rx_common.h | 19 + drivers/net/sxe/base/sxe_tx_common.c | 41 + drivers/net/sxe/base/sxe_tx_common.h | 12 + drivers/net/sxe/include/sxe_type.h | 795 +++++++++++ drivers/net/sxe/meson.build | 10 +- drivers/net/sxe/pf/rte_pmd_sxe.h | 14 + drivers/net/sxe/pf/sxe.h | 1 + drivers/net/sxe/pf/sxe_ethdev.c | 200 +++ drivers/net/sxe/pf/sxe_irq.c | 258 ++++ drivers/net/sxe/pf/sxe_irq.h | 11 + drivers/net/sxe/pf/sxe_main.c | 7 + drivers/net/sxe/pf/sxe_offload.c | 39 + drivers/net/sxe/pf/sxe_offload.h | 18 + drivers/net/sxe/pf/sxe_queue.c | 776 +++++++++++ drivers/net/sxe/pf/sxe_queue.h | 133 ++ drivers/net/sxe/pf/sxe_rx.c | 1491 +++++++++++++++++++++ drivers/net/sxe/pf/sxe_rx.h | 194 +++ drivers/net/sxe/pf/sxe_tx.c | 1072 +++++++++++++++ drivers/net/sxe/pf/sxe_tx.h | 50 + drivers/net/sxe/rte_pmd_sxe_version.map | 5 + drivers/net/sxe/version.map | 5 + 27 files changed, 6099 insertions(+), 1 deletion(-) create mode 100644 drivers/net/sxe/base/sxe_offload_common.c create mode 100644 drivers/net/sxe/base/sxe_offload_common.h create mode 100644 drivers/net/sxe/base/sxe_queue_common.c create mode 100644 drivers/net/sxe/base/sxe_queue_common.h create mode 100644 drivers/net/sxe/base/sxe_rx_common.c create mode 100644 drivers/net/sxe/base/sxe_rx_common.h create mode 100644 drivers/net/sxe/base/sxe_tx_common.c create mode 100644 drivers/net/sxe/base/sxe_tx_common.h create mode 100644 drivers/net/sxe/include/sxe_type.h create mode 100644 drivers/net/sxe/pf/rte_pmd_sxe.h create mode 100644 drivers/net/sxe/pf/sxe_offload.c create mode 100644 drivers/net/sxe/pf/sxe_offload.h create mode 100644 drivers/net/sxe/pf/sxe_queue.c create mode 100644 drivers/net/sxe/pf/sxe_queue.h create mode 100644 drivers/net/sxe/pf/sxe_rx.c create mode 100644 drivers/net/sxe/pf/sxe_rx.h create mode 100644 drivers/net/sxe/pf/sxe_tx.c create mode 100644 drivers/net/sxe/pf/sxe_tx.h create mode 100644 drivers/net/sxe/rte_pmd_sxe_version.map create mode 100644 drivers/net/sxe/version.map
drivers/net/meson.build +1 -0
@@ -64,6 +64,7 @@ drivers = [ 'vmxnet3', 'xsc', 'zxdh', + 'sxe', ] std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc std_deps += ['bus_pci'] # very many PMDs depend on PCI, so make std
drivers/net/sxe/base/sxe_offload_common.c new file +54 -0
54 lines not on this page · raw message
drivers/net/sxe/base/sxe_offload_common.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_OFFLOAD_COMMON_H__ +#define __SXE_OFFLOAD_COMMON_H__ + +u64 __sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 __sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev); + +u64 __sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); + +#endif
drivers/net/sxe/base/sxe_queue_common.c new file +397 -0
397 lines not on this page · raw message
drivers/net/sxe/base/sxe_queue_common.h new file +240 -0
240 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.c new file +243 -0
243 lines not on this page · raw message
drivers/net/sxe/base/sxe_rx_common.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_RX_COMMON_H__ +#define __SXE_RX_COMMON_H__ + +#include "sxe_dpdk_version.h" + +void __rte_cold __sxe_rx_function_set(struct rte_eth_dev *dev, +bool rx_batch_alloc_allowed,bool *rx_vec_allowed); + +s32 __sxe_rx_descriptor_status (void *rx_queue,u16 offset); + +u16 __sxe_pkts_recv (void *rx_queue,struct rte_mbuf **rx_pkts, +u16 pkts_num); + +const u32 *__sxe_dev_supported_ptypes_get (struct rte_eth_dev *dev,size_t *no_of_elements); +#endif
drivers/net/sxe/base/sxe_tx_common.c new file +41 -0
41 lines not on this page · raw message
drivers/net/sxe/base/sxe_tx_common.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_TX_COMMON_H__ +#define __SXE_TX_COMMON_H__ + +int __sxe_tx_descriptor_status (void *tx_queue,u16 offset); + +u16 __sxe_pkts_xmit_with_offload (void *tx_queue,struct rte_mbuf **tx_pkts,u16 pkts_num); + +#endif
drivers/net/sxe/include/sxe_type.h new file +795 -0
795 lines not on this page · raw message
drivers/net/sxe/meson.build +9 -1
@@ -11,7 +11,15 @@ sources = files( 'pf/sxe_main.c', 'pf/sxe_irq.c', 'pf/sxe_ethdev.c', + 'pf/sxe_offload.c', + 'pf/sxe_queue.c', + 'pf/sxe_rx.c', + 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', + 'base/sxe_queue_common.c', + 'base/sxe_rx_common.c', + 'base/sxe_tx_common.c', + 'base/sxe_offload_common.c', 'base/sxe_common.c', 'base/sxe_hw.c', )
@@ -19,4 +27,4 @@ sources = files( includes += include_directories('base') includes += include_directories('pf') includes += include_directories('include/sxe/') -includes += include_directories('include/') +includes += include_directories('include/')
drivers/net/sxe/pf/rte_pmd_sxe.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __PMD_SXE_H__ +#define __PMD_SXE_H__ + +typedef uint8_t u8 ; +typedef uint16_t u16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; + +s32 rte_pmd_sxe_tx_loopback_set (u16 port,u8 on); +#endif
drivers/net/sxe/pf/sxe.h +1 -0
@@ -44,6 +44,7 @@ struct sxe_adapter {struct sxe_irq_context irq_ctxt; +bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ]; };
drivers/net/sxe/pf/sxe_ethdev.c +200 -0
274 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.c +258 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_irq.h +11 -0
@@ -35,7 +35,18 @@ void sxe_event_irq_delayed_handler(void *param);void sxe_irq_init (struct rte_eth_dev *eth_dev); +s32 sxe_irq_configure (struct rte_eth_dev *dev); + +void sxe_irq_enable (struct rte_eth_dev *eth_dev); + +void sxe_irq_disable (struct rte_eth_dev *eth_dev); +void sxe_irq_uninit (struct rte_eth_dev *eth_dev); +s32 sxe_rx_queue_intr_enable (struct rte_eth_dev *eth_dev,u16 queue_id); + +s32 sxe_rx_queue_intr_disable (struct rte_eth_dev *eth_dev,u16 queue_id); + +void sxe_irq_vec_free (struct rte_intr_handle *handle);#endif
drivers/net/sxe/pf/sxe_main.c +7 -0
@@ -20,9 +20,11 @@#include "sxe_ethdev.h" #include "sxe.h" #include "drv_msg.h" +#include "sxe_queue.h" #include "sxe_errno.h" #include "sxe_compat_platform.h" #include "sxe_pmd_hdc.h" +#include "sxe_queue.h" static const struct rte_pci_id sxe_pci_tbl[] = { {RTE_PCI_DEVICE (PCI_VENDOR_ID_STARS ,SXE_DEV_ID_ASIC ) },
@@ -164,10 +166,15 @@ s32 sxe_hw_reset(struct sxe_hw *hw) {s32 ret; +/* Rx DBU off */ +sxe_hw_rx_cap_switch_off (hw); +sxe_hw_all_irq_disable (hw);sxe_hw_pending_irq_read_clear (hw); +sxe_hw_all_ring_disable (hw,SXE_HW_TXRX_RING_NUM_MAX ); + ret =sxe_mng_reset (hw, false);if (ret) {PMD_LOG_ERR (INIT ,"mng reset disable failed, ret=%d" , ret);
drivers/net/sxe/pf/sxe_offload.c new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ +#include "sxe_dpdk_version.h" +#include <ethdev_driver.h> + +#include "sxe.h" +#include "sxe_offload.h" +#include "sxe_logs.h" +#include "sxe_compat_version.h" +#include "sxe_queue_common.h" +#include "sxe_offload_common.h" + +#define SXE_4_BIT_WIDTH (CHAR_BIT / 2) +#define SXE_4_BIT_MASK RTE_LEN2MASK(SXE_4_BIT_WIDTH, u8) +#define SXE_8_BIT_WIDTH CHAR_BIT +#define SXE_8_BIT_MASK UINT8_MAX + +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev) +{ +return __sxe_rx_queue_offload_capa_get (dev); +} + +u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev) +{ +return __sxe_rx_port_offload_capa_get (dev); +} + +u64 sxe_tx_queue_offload_capa_get (struct rte_eth_dev *dev) +{ +RTE_SET_USED (dev); + +return 0 ; +} + +u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev) +{ +return __sxe_tx_port_offload_capa_get (dev); +}
drivers/net/sxe/pf/sxe_offload.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_OFFLOAD_H__ +#define __SXE_OFFLOAD_H__ + +#include "sxe_hw.h" + +u64 sxe_rx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_rx_port_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_tx_queue_offload_capa_get (struct rte_eth_dev *dev); + +u64 sxe_tx_port_offload_capa_get (struct rte_eth_dev *dev); + +#endif
drivers/net/sxe/pf/sxe_queue.c new file +776 -0
481 lines not on this page · raw message
drivers/net/sxe/pf/sxe_queue.h new file +133 -0
133 lines not on this page · raw message
drivers/net/sxe/pf/sxe_rx.c new file +1491 -0
1,491 lines not on this page · raw message
drivers/net/sxe/pf/sxe_rx.h new file +194 -0
194 lines not on this page · raw message
drivers/net/sxe/pf/sxe_tx.c new file +1072 -0
1,072 lines not on this page · raw message
drivers/net/sxe/pf/sxe_tx.h new file +50 -0
50 lines not on this page · raw message
drivers/net/sxe/rte_pmd_sxe_version.map new file +5 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v4 03/14] net/sxe: add tx rx setup and data path
drivers/net/sxe/version.map line 5
Quoted 12 lines · On Wed, 9 Jul 2025 04:43:03 -0400 Jie Liu <[email protected]>…
drivers/net/sxe/version.map new file +5
-0@@ -0,0 +1,5 @@ +EXPERIMENTAL { + global: + rte_pmd_sxe_tx_loopback_set; + local: *; +};
DPDK has changed to not use version map. See new RTE_EXPORT_SYMBOL macros.
But drivers should not have their own API's if a similar API exists already.
PATCH v4 4/14 net/sxe: add link, flow ctrl, mac ops, mtu ops function
In reply to Jie LiuAdd link, flow ctrl, mac ops, mtu ops function.
--- drivers/net/sxe/meson.build | 3 + drivers/net/sxe/pf/sxe.h | 11 + drivers/net/sxe/pf/sxe_ethdev.c | 443 +++++++++++++- drivers/net/sxe/pf/sxe_filter.c | 279 +++++++++ drivers/net/sxe/pf/sxe_filter.h | 55 ++ drivers/net/sxe/pf/sxe_flow_ctrl.c | 98 +++ drivers/net/sxe/pf/sxe_flow_ctrl.h | 16 + drivers/net/sxe/pf/sxe_irq.c | 146 ++++- drivers/net/sxe/pf/sxe_main.c | 2 + drivers/net/sxe/pf/sxe_phy.c | 932 +++++++++++++++++++++++++++++ drivers/net/sxe/pf/sxe_phy.h | 77 +++ 11 files changed, 2052 insertions(+), 10 deletions(-) create mode 100644 drivers/net/sxe/pf/sxe_filter.c create mode 100644 drivers/net/sxe/pf/sxe_filter.h create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.c create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.h create mode 100644 drivers/net/sxe/pf/sxe_phy.c
drivers/net/sxe/meson.build +3 -0
@@ -9,6 +9,8 @@ cflags += ['-DSXE_HOST_DRIVER'] deps += ['hash'] sources = files( 'pf/sxe_main.c', + 'pf/sxe_filter.c', + 'pf/sxe_flow_ctrl.c', 'pf/sxe_irq.c', 'pf/sxe_ethdev.c', 'pf/sxe_offload.c',
@@ -16,6 +18,7 @@ sources = files( 'pf/sxe_rx.c', 'pf/sxe_tx.c', 'pf/sxe_pmd_hdc.c', + 'pf/sxe_phy.c', 'base/sxe_queue_common.c', 'base/sxe_rx_common.c', 'base/sxe_tx_common.c',
drivers/net/sxe/pf/sxe.h +11 -0
@@ -43,9 +43,20 @@ struct sxe_adapter {struct sxe_hw hw;struct sxe_irq_context irq_ctxt; +struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;s8 name[PCI_PRI_STR_SIZE +1 ]; + +u32 mtu; + +RTE_ATOMIC (bool )link_thread_running; +RTE_ATOMIC (bool )is_stopping; +rte_thread_t link_thread_tid; +rte_atomic32_t link_thread_running; +rte_atomic32_t is_stopping; +pthread_t link_thread_tid; +bool is_stopped; };s32 sxe_hw_reset (struct sxe_hw *hw);
drivers/net/sxe/pf/sxe_ethdev.c +437 -6
606 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.c new file +279 -0
279 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h new file +55 -0
55 lines not on this page · raw message
drivers/net/sxe/pf/sxe_flow_ctrl.c new file +98 -0
98 lines not on this page · raw message
drivers/net/sxe/pf/sxe_flow_ctrl.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_FLOW_CTRL_H__ +#define __SXE_FLOW_CTRL_H__ + +s32 sxe_flow_ctrl_enable (struct rte_eth_dev *dev); + +s32 sxe_flow_ctrl_get (struct rte_eth_dev *dev, +struct rte_eth_fc_conf *fc_conf); + +s32 sxe_flow_ctrl_set (struct rte_eth_dev *dev, +struct rte_eth_fc_conf *fc_conf); + +#endif
drivers/net/sxe/pf/sxe_irq.c +142 -4
181 lines not on this page · raw message
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -201,6 +201,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) { +sxe_fc_autoneg_localcap_set (hw); + hw->mac.auto_restart = true;PMD_LOG_INFO (INIT ,"auto_restart:%u." , hw->mac.auto_restart); }
drivers/net/sxe/pf/sxe_phy.c new file +932 -0
932 lines not on this page · raw message
drivers/net/sxe/pf/sxe_phy.h +77 -0
82 lines not on this page · raw message
Signature · 1 line
2.18.4
Re: [PATCH v4 04/14] net/sxe: add link, flow ctrl, mac ops, mtu ops function
Quoted 8 lines · On Wed, 9 Jul 2025 04:43:04 -0400 Jie Liu <[email protected]>…
+++
b/drivers/net/sxe/pf/sxe_filter.hdrivers/net/sxe/pf/sxe_filter.h new file +6
-0@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright (C), 2022, Linkdata Technology Co., Ltd. +*/ + +#ifndef __SXE_FILTER_H__ +#define __SXE_FILTER_H__
drivers/net/sxe/pf/sxe_filter.h line 16
Quoted 10 lines
drivers/net/sxe/pf/sxe_filter.h new file +10
-0+ +#include <rte_ether.h> +#include "sxe_dpdk_version.h" +#include <ethdev_driver.h> +#include "sxe_types.h" +#include "sxe_hw.h" + +struct sxe_adapter ; + +#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
Use RTE_ETHER_ADDR_PRT_FMT or rte_ether_format_addr
Re: [PATCH v4 04/14] net/sxe: add link, flow ctrl, mac ops, mtu ops function
In reply to Jie Liudrivers/net/sxe/pf/sxe.h struct sxe_adapter { · line 54
Quoted 2 lines · On Wed, 9 Jul 2025 04:43:04 -0400 Jie Liu <[email protected]>…
drivers/net/sxe/pf/sxe.h +2
-0+RTE_ATOMIC (bool )link_thread_running; +RTE_ATOMIC (bool )is_stopping;
Despite what checkpatch says, need space here:
RTE_ATOMIC(bool) is_stopping;
drivers/net/sxe/pf/sxe.h struct sxe_adapter { · line 56
Quoted 2 lines
drivers/net/sxe/pf/sxe.h +2
-0+rte_thread_t link_thread_tid; +rte_atomic32_t link_thread_running;
Don't use old rte atomics, instead use RTE_ATOMIC() consistently
drivers/net/sxe/pf/sxe.h struct sxe_adapter { · line 58
Quoted 2 lines
drivers/net/sxe/pf/sxe.h +2
-0+rte_atomic32_t is_stopping; +pthread_t link_thread_tid;
Two struct elements with same name, how does that work?
Quoted 1 line
drivers/net/sxe/pf/sxe.h +1
-0+bool is_stopped;
Re: Re: [PATCH v4 04/14] net/sxe: add link, flow ctrl, mac ops, mtu ops function
> -----原始邮件-----
> 发件人: "Stephen Hemminger" <[email protected]>
> 发送时间: 2025-07-10 00:09:30 (星期四)
> 收件人: "Jie Liu" <[email protected]>
> 抄送: [email protected]
> 主题: Re: [PATCH v4 04/14] net/sxe: add link, flow ctrl, mac ops, mtu ops function >
> On Wed, 9 Jul 2025 04:43:04 -0400
> Jie Liu <[email protected]> wrote:
>
> > + RTE_ATOMIC(bool)link_thread_running;
> > + RTE_ATOMIC(bool)is_stopping;
>
> Despite what checkpatch says, need space here:
> RTE_ATOMIC(bool) is_stopping;
>
> > + rte_thread_t link_thread_tid;
> > + rte_atomic32_t link_thread_running;
>
> Don't use old rte atomics, instead use RTE_ATOMIC() consistently >
> > + rte_atomic32_t is_stopping;
> > + pthread_t link_thread_tid;
>
> Two struct elements with same name, how does that work?
>
> > + bool is_stopped;
This will be fully revised in the 14th patch, so please don't worry.</[email protected]></[email protected]></[email protected]>
PATCH v4 5/14 net/sxe: support vlan filter
In reply to Jie LiuSupport vlan filter.
--- drivers/net/sxe/base/sxe_offload_common.c | 4 + drivers/net/sxe/pf/sxe.h | 5 +- drivers/net/sxe/pf/sxe_filter.c | 277 ++++++++++++++++++++++ drivers/net/sxe/pf/sxe_filter.h | 13 + drivers/net/sxe/pf/sxe_main.c | 2 + 5 files changed, 300 insertions(+), 1 deletion(-)
drivers/net/sxe/base/sxe_offload_common.c +4 -0
@@ -14,6 +14,8 @@ u64 __sxe_rx_queue_offload_capa_get(struct rte_eth_dev *dev)u64 offloads =0 ; + offloads |=RTE_ETH_RX_OFFLOAD_VLAN_STRIP ; +return offloads; }
@@ -28,6 +30,8 @@ u64 __sxe_rx_port_offload_capa_get(struct rte_eth_dev *dev)#ifdef DEV_RX_JUMBO_FRAME DEV_RX_OFFLOAD_JUMBO_FRAME | #endif +RTE_ETH_RX_OFFLOAD_VLAN_FILTER | +RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |RTE_ETH_RX_OFFLOAD_SCATTER ;if (!RTE_ETH_DEV_SRIOV (dev).active)
drivers/net/sxe/pf/sxe.h +4 -1
@@ -6,7 +6,7 @@#include <rte_pci.h> #include <rte_time.h> - +#include "sxe_filter.h" #include <stdbool.h> #include "sxe_types.h" #include "sxe_irq.h"
@@ -14,6 +14,7 @@#include "sxe_hw.h" struct sxe_hw ; +struct sxe_vlan_context ;#define SXE_LPBK_DISABLED 0x0#define SXE_LPBK_ENABLED 0x1
@@ -43,6 +44,8 @@ struct sxe_adapter {struct sxe_hw hw;struct sxe_irq_context irq_ctxt; + +struct sxe_vlan_context vlan_ctxt;struct sxe_phy_context phy_ctxt;bool rx_batch_alloc_allowed;
drivers/net/sxe/pf/sxe_filter.c +277 -0
280 lines not on this page · raw message
drivers/net/sxe/pf/sxe_filter.h +13 -0
@@ -46,10 +46,23 @@ void sxe_mac_addr_remove(struct rte_eth_dev *dev, u32 rar_idx);s32 sxe_mac_addr_set (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +s32 sxe_vlan_filter_set (struct rte_eth_dev *eth_dev,u16 vlan_id,s32 on); + +s32 sxe_vlan_tpid_set (struct rte_eth_dev *eth_dev, +enum rte_vlan_type vlan_type,u16 tpid); + +s32 sxe_vlan_offload_set (struct rte_eth_dev *dev,s32 vlan_mask); + +void sxe_vlan_strip_queue_set (struct rte_eth_dev *dev,u16 queue,s32 on); + +void sxe_vlan_filter_configure (struct rte_eth_dev *dev); +s32 sxe_set_mc_addr_list (struct rte_eth_dev *dev,struct rte_ether_addr *mc_addr_list,u32 nb_mc_addr); +void sxe_vlan_strip_switch_set (struct rte_eth_dev *dev); +void sxe_fc_mac_addr_set (struct sxe_adapter *adapter);#endif
drivers/net/sxe/pf/sxe_main.c +2 -0
@@ -201,6 +201,8 @@ s32 sxe_hw_reset(struct sxe_hw *hw)void sxe_hw_start (struct sxe_hw *hw) { +sxe_hw_vlan_filter_array_clear (hw); +sxe_fc_autoneg_localcap_set (hw); hw->mac.auto_restart = true;
Signature · 1 line
2.18.4