introduces the ENETC PMD
Subsystems (2)
cover introduces the ENETC PMD
This patch set introduces the PMD which integrates with the existing PCI bus. Document is also part of the set
Gagandeep Singh (3):
doc: add usage doc for ENETC PMD
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
MAINTAINERS | 7 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 165 ++++++++ doc/guides/nics/features/enetc.ini | 10 + doc/guides/nics/index.rst | 1 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 25 ++ drivers/net/enetc/base/enetc_hw.h | 220 ++++++++++ drivers/net/enetc/enetc.h | 111 +++++ drivers/net/enetc/enetc_ethdev.c | 271 ++++++++++++ drivers/net/enetc/enetc_logs.h | 40 ++ drivers/net/enetc/enetc_rxtx.c | 447 ++++++++++++++++++++ drivers/net/enetc/meson.build | 11 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 17 files changed, 1325 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/enetc_rxtx.c create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
Signature · 1 line
2.17.1
PATCH 1/3 doc: add usage doc for ENETC PMD
Add enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
--- MAINTAINERS | 5 + doc/guides/nics/enetc.rst | 164 +++++++++++++++++++++++++++++ doc/guides/nics/features/enetc.ini | 8 ++ doc/guides/nics/index.rst | 1 + 4 files changed, 178 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini
MAINTAINERS +5 -0
@@ -627,6 +627,11 @@ F: drivers/net/nfp/ F: doc/guides/nics/nfp.rst F: doc/guides/nics/features/nfp*.ini +NXP enetc +M: Gagandeep Singh <[email protected]> +F: doc/guides/nics/enetc.rst +F: doc/guides/nics/features/enetc.ini + NXP dpaa M: Hemant Agrawal <[email protected]> M: Shreyansh Jain <[email protected]>
doc/guides/nics/enetc.rst new file +164 -0
164 lines not on this page · raw message
doc/guides/nics/features/enetc.ini new file +8 -0
@@ -0,0 +1,8 @@ +; +; Supported features of the 'enetc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +ARMv8 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -21,6 +21,7 @@ Network Interface Controller Drivers dpaa2 e1000em ena + enetc enic fm10k i40e
Signature · 1 line
2.17.1
PATCH 2/3 net/enetc: add ENETC PMD with basic operations
In reply to Gagandeep SinghThis patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware intialisation
--- MAINTAINERS | 1 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 1 + doc/guides/nics/features/enetc.ini | 2 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 24 ++ drivers/net/enetc/base/enetc_hw.h | 220 ++++++++++++++++ drivers/net/enetc/enetc.h | 111 ++++++++ drivers/net/enetc/enetc_ethdev.c | 269 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 40 +++ drivers/net/enetc/meson.build | 10 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 15 files changed, 695 insertions(+) create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
MAINTAINERS +1 -0
@@ -629,6 +629,7 @@ F: doc/guides/nics/features/nfp*.ini NXP enetc M: Gagandeep Singh <[email protected]> +F: drivers/net/enetc/ F: doc/guides/nics/enetc.rst F: doc/guides/nics/features/enetc.ini
config/common_base +5 -0
@@ -910,3 +910,8 @@ CONFIG_RTE_APP_CRYPTO_PERF=y # Compile the eventdev application # CONFIG_RTE_APP_EVENTDEV=y + +# +# Compile NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=n
config/common_linuxapp +5 -0
@@ -44,3 +44,8 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y + +# +# NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=y
doc/guides/nics/enetc.rst +1 -0
@@ -49,6 +49,7 @@ This infrastructure simplifies adding support for IEP and facilitates in followi ENETC Features ~~~~~~~~~~~~~~ +- Link Status NIC Driver (PMD) ~~~~~~~~~~~~~~~~
doc/guides/nics/features/enetc.ini +2 -0
@@ -4,5 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y +Linux VFIO = Y ARMv8 = Y Usage doc = Y
drivers/net/Makefile +1 -0
@@ -24,6 +24,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 endif DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000 DIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena +DIRS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic DIRS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += failsafe DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
drivers/net/enetc/Makefile new file +24 -0
@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_enetc.a + +CFLAGS += -O3 +EXPORT_MAP := rte_pmd_enetc_version.map +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c + +LDLIBS += -lrte_eal +LDLIBS += -lrte_ethdev +LDLIBS += -lrte_bus_pci + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/enetc/base/enetc_hw.h new file +220 -0
220 lines not on this page · raw message
drivers/net/enetc/enetc.h new file +111 -0
111 lines not on this page · raw message
drivers/net/enetc/enetc_ethdev.c new file +269 -0
269 lines not on this page · raw message
drivers/net/enetc/enetc_logs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ + +#ifndef _ENETC_LOGS_H_ +#define _ENETC_LOGS_H_ + +extern int enetc_logtype_pmd; + +#define ENETC_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, enetc_logtype_pmd, "enetc_net: " \ + fmt "\n", ##args) + +#define ENETC_PMD_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, enetc_logtype_pmd, "enetc_net: %s(): "\ + fmt "\n", __func__, ##args) + +#define PMD_INIT_FUNC_TRACE () ENETC_PMD_DEBUG(">>") + +#define ENETC_PMD_CRIT(fmt, args...) \ + ENETC_PMD_LOG(CRIT, fmt, ## args) +#define ENETC_PMD_INFO(fmt, args...) \ + ENETC_PMD_LOG(INFO, fmt, ## args) +#define ENETC_PMD_ERR(fmt, args...) \ + ENETC_PMD_LOG(ERR, fmt, ## args) +#define ENETC_PMD_WARN(fmt, args...) \ + ENETC_PMD_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) +#define ENETC_PMD_DP_INFO(fmt, args...) \ + ENETC_PMD_DP_LOG(INFO, fmt, ## args) +#define ENETC_PMD_DP_WARN(fmt, args...) \ + ENETC_PMD_DP_LOG(WARNING, fmt, ## args) + +#endif /* _ENETC_LOGS_H_*/
drivers/net/enetc/meson.build new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +if host_machine.system() != 'linux' + build = false +endif + +sources = files('enetc_ethdev.c') + +includes += include_directories('base')
drivers/net/enetc/rte_pmd_enetc_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_18.11 { + + local: *; +};
drivers/net/meson.build +1 -0
@@ -11,6 +11,7 @@ drivers = ['af_packet', 'dpaa', 'dpaa2', 'e1000', 'ena', + 'enetc', 'enic', 'failsafe', 'fm10k', 'i40e',
mk/rte.app.mk +1 -0
@@ -135,6 +135,7 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += -lrte_pmd_enetc _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
Signature · 1 line
2.17.1
PATCH 3/3 net/enetc: enable Rx and Tx
In reply to Gagandeep SinghAdd RX and TX queue setup, datapath functions
and enable the packet parsing
--- MAINTAINERS | 1 + drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/enetc_ethdev.c | 6 +- drivers/net/enetc/enetc_rxtx.c | 447 +++++++++++++++++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 5 files changed, 456 insertions(+), 4 deletions(-) create mode 100644 drivers/net/enetc/enetc_rxtx.c
MAINTAINERS +1 -0
@@ -629,6 +629,7 @@ F: doc/guides/nics/features/nfp*.ini NXP enetc M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> F: drivers/net/enetc/ F: doc/guides/nics/enetc.rst F: doc/guides/nics/features/enetc.ini
drivers/net/enetc/Makefile +2 -1
@@ -16,8 +16,9 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c -LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pci
drivers/net/enetc/enetc_ethdev.c +4 -2
@@ -37,6 +37,8 @@ static const struct eth_dev_ops enetc_ops = { .dev_close = enetc_dev_close, .link_update = enetc_link_update, .dev_infos_get = enetc_dev_infos_get, + .rx_queue_setup = enetc_rx_queue_setup, + .tx_queue_setup = enetc_tx_queue_setup, };/**
@@ -61,8 +63,8 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)PMD_INIT_FUNC_TRACE (); eth_dev->dev_ops = &enetc_ops; - eth_dev->rx_pkt_burst =NULL ; - eth_dev->tx_pkt_burst =NULL ; + eth_dev->rx_pkt_burst = &enetc_recv_pkts; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts;rte_eth_copy_pci_info (eth_dev, pci_dev);
drivers/net/enetc/enetc_rxtx.c new file +447 -0
447 lines not on this page · raw message
drivers/net/enetc/meson.build +2 -1
@@ -5,6 +5,7 @@ if host_machine.system() != 'linux' build = false endif -sources = files('enetc_ethdev.c') +sources = files('enetc_ethdev.c', + 'enetc_rxtx.c') includes += include_directories('base')
Signature · 1 line
2.17.1
v2 cover introduces the enetc PMD driver
In reply to Gagandeep Singh*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
Change-log:
document improvement
checkpatch warnings removed
Gagandeep Singh (3):
doc: add usage doc for ENETC PMD
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
MAINTAINERS | 7 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 154 +++++++ doc/guides/nics/features/enetc.ini | 10 + doc/guides/nics/index.rst | 1 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 25 ++ drivers/net/enetc/base/enetc_hw.h | 220 ++++++++++ drivers/net/enetc/enetc.h | 111 +++++ drivers/net/enetc/enetc_ethdev.c | 271 ++++++++++++ drivers/net/enetc/enetc_logs.h | 40 ++ drivers/net/enetc/enetc_rxtx.c | 447 ++++++++++++++++++++ drivers/net/enetc/meson.build | 11 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 17 files changed, 1314 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/enetc_rxtx.c create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
Signature · 1 line
2.17.1
PATCH v2 1/3 doc: add usage doc for ENETC PMD
Add enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
--- MAINTAINERS | 5 + doc/guides/nics/enetc.rst | 153 +++++++++++++++++++++++++++++ doc/guides/nics/features/enetc.ini | 8 ++ doc/guides/nics/index.rst | 1 + 4 files changed, 167 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini
MAINTAINERS +5 -0
@@ -643,6 +643,11 @@ F: drivers/net/dpaa2/ F: doc/guides/nics/dpaa2.rst F: doc/guides/nics/features/dpaa2.ini +NXP enetc +M: Gagandeep Singh <[email protected]> +F: doc/guides/nics/enetc.rst +F: doc/guides/nics/features/enetc.ini + QLogic bnx2x M: Harish Patil <[email protected]> M: Rasesh Mody <[email protected]>
doc/guides/nics/enetc.rst new file +153 -0
153 lines not on this page · raw message
doc/guides/nics/features/enetc.ini new file +8 -0
@@ -0,0 +1,8 @@ +; +; Supported features of the 'enetc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +ARMv8 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -21,6 +21,7 @@ Network Interface Controller Drivers dpaa2 e1000em ena + enetc enic fm10k i40e
Signature · 1 line
2.17.1
PATCH v2 2/3 net/enetc: add ENETC PMD with basic operations
In reply to Gagandeep SinghThis patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware initialisation
--- MAINTAINERS | 1 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 1 + doc/guides/nics/features/enetc.ini | 2 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 24 ++ drivers/net/enetc/base/enetc_hw.h | 220 ++++++++++++++++ drivers/net/enetc/enetc.h | 111 ++++++++ drivers/net/enetc/enetc_ethdev.c | 269 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 40 +++ drivers/net/enetc/meson.build | 10 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 15 files changed, 695 insertions(+) create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
MAINTAINERS +1 -0
@@ -645,6 +645,7 @@ F: doc/guides/nics/features/dpaa2.ini NXP enetc M: Gagandeep Singh <[email protected]> +F: drivers/net/enetc/ F: doc/guides/nics/enetc.rst F: doc/guides/nics/features/enetc.ini
config/common_base +5 -0
@@ -217,6 +217,11 @@ CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=y CONFIG_RTE_LIBRTE_DPAA2_PMD=n CONFIG_RTE_LIBRTE_DPAA2_DEBUG_DRIVER=n +# +# Compile NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=n + # # Compile burst-oriented Amazon ENA PMD driver #
config/common_linuxapp +5 -0
@@ -44,3 +44,8 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y + +# +# NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=y
doc/guides/nics/enetc.rst +1 -0
@@ -44,6 +44,7 @@ This infrastructure simplifies adding support for IEP and facilitates in followi ENETC Features ~~~~~~~~~~~~~~ +- Link Status NIC Driver (PMD) ~~~~~~~~~~~~~~~~
doc/guides/nics/features/enetc.ini +2 -0
@@ -4,5 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y +Linux VFIO = Y ARMv8 = Y Usage doc = Y
drivers/net/Makefile +1 -0
@@ -24,6 +24,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 endif DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000 DIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena +DIRS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic DIRS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += failsafe DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
drivers/net/enetc/Makefile new file +24 -0
@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_enetc.a + +CFLAGS += -O3 +EXPORT_MAP := rte_pmd_enetc_version.map +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c + +LDLIBS += -lrte_eal +LDLIBS += -lrte_ethdev +LDLIBS += -lrte_bus_pci + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/enetc/base/enetc_hw.h new file +220 -0
220 lines not on this page · raw message
drivers/net/enetc/enetc.h new file +111 -0
111 lines not on this page · raw message
drivers/net/enetc/enetc_ethdev.c new file +269 -0
269 lines not on this page · raw message
drivers/net/enetc/enetc_logs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ + +#ifndef _ENETC_LOGS_H_ +#define _ENETC_LOGS_H_ + +extern int enetc_logtype_pmd; + +#define ENETC_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, enetc_logtype_pmd, "enetc_net: " \ + fmt "\n", ##args) + +#define ENETC_PMD_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, enetc_logtype_pmd, "enetc_net: %s(): "\ + fmt "\n", __func__, ##args) + +#define PMD_INIT_FUNC_TRACE () ENETC_PMD_DEBUG(">>") + +#define ENETC_PMD_CRIT(fmt, args...) \ + ENETC_PMD_LOG(CRIT, fmt, ## args) +#define ENETC_PMD_INFO(fmt, args...) \ + ENETC_PMD_LOG(INFO, fmt, ## args) +#define ENETC_PMD_ERR(fmt, args...) \ + ENETC_PMD_LOG(ERR, fmt, ## args) +#define ENETC_PMD_WARN(fmt, args...) \ + ENETC_PMD_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) +#define ENETC_PMD_DP_INFO(fmt, args...) \ + ENETC_PMD_DP_LOG(INFO, fmt, ## args) +#define ENETC_PMD_DP_WARN(fmt, args...) \ + ENETC_PMD_DP_LOG(WARNING, fmt, ## args) + +#endif /* _ENETC_LOGS_H_*/
drivers/net/enetc/meson.build new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +if host_machine.system() != 'linux' + build = false +endif + +sources = files('enetc_ethdev.c') + +includes += include_directories('base')
drivers/net/enetc/rte_pmd_enetc_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_18.11 { + + local: *; +};
drivers/net/meson.build +1 -0
@@ -11,6 +11,7 @@ drivers = ['af_packet', 'dpaa', 'dpaa2', 'e1000', 'ena', + 'enetc', 'enic', 'failsafe', 'fm10k', 'i40e',
mk/rte.app.mk +1 -0
@@ -135,6 +135,7 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += -lrte_pmd_enetc _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
Signature · 1 line
2.17.1
PATCH v2 3/3 net/enetc: enable Rx and Tx
In reply to Gagandeep SinghAdd RX and TX queue setup, datapath functions
and enable the packet parsing
--- MAINTAINERS | 1 + drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/enetc_ethdev.c | 6 +- drivers/net/enetc/enetc_rxtx.c | 447 +++++++++++++++++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 5 files changed, 456 insertions(+), 4 deletions(-) create mode 100644 drivers/net/enetc/enetc_rxtx.c
MAINTAINERS +1 -0
@@ -645,6 +645,7 @@ F: doc/guides/nics/features/dpaa2.ini NXP enetc M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> F: drivers/net/enetc/ F: doc/guides/nics/enetc.rst F: doc/guides/nics/features/enetc.ini
drivers/net/enetc/Makefile +2 -1
@@ -16,8 +16,9 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c -LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pci
drivers/net/enetc/enetc_ethdev.c +4 -2
@@ -37,6 +37,8 @@ static const struct eth_dev_ops enetc_ops = { .dev_close = enetc_dev_close, .link_update = enetc_link_update, .dev_infos_get = enetc_dev_infos_get, + .rx_queue_setup = enetc_rx_queue_setup, + .tx_queue_setup = enetc_tx_queue_setup, };/**
@@ -61,8 +63,8 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)PMD_INIT_FUNC_TRACE (); eth_dev->dev_ops = &enetc_ops; - eth_dev->rx_pkt_burst =NULL ; - eth_dev->tx_pkt_burst =NULL ; + eth_dev->rx_pkt_burst = &enetc_recv_pkts; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts;rte_eth_copy_pci_info (eth_dev, pci_dev);
drivers/net/enetc/enetc_rxtx.c new file +447 -0
447 lines not on this page · raw message
drivers/net/enetc/meson.build +2 -1
@@ -5,6 +5,7 @@ if host_machine.system() != 'linux' build = false endif -sources = files('enetc_ethdev.c') +sources = files('enetc_ethdev.c', + 'enetc_rxtx.c') includes += include_directories('base')
Signature · 1 line
2.17.1
Re: [PATCH 2/3] net/enetc: add ENETC PMD with basic operations
In reply to Gagandeep SinghQuoted 30 lines · Gagandeep Singh
This patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware intialisation
Signed-off-by Gagandeep Singh <[email protected]>--- MAINTAINERS | 1 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 1 + doc/guides/nics/features/enetc.ini | 2 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 24 ++ drivers/net/enetc/base/enetc_hw.h | 220 ++++++++++++++++ drivers/net/enetc/enetc.h | 111 ++++++++ drivers/net/enetc/enetc_ethdev.c | 269 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 40 +++ drivers/net/enetc/meson.build | 10 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 15 files changed, 695 insertions(+)create mode 100644
drivers/net/enetc/Makefile
create mode 100644drivers/net/enetc/base/enetc_hw.hcreate mode 100644drivers/net/enetc/enetc.h
create mode 100644drivers/net/enetc/enetc_ethdev.ccreate mode 100644drivers/net/enetc/enetc_logs.hcreate mode 100644drivers/net/enetc/meson.buildcreate mode 100644drivers/net/enetc/rte_pmd_enetc_version.map
[...]
Quoted 10 lines
drivers/net/enetc/base/enetc_hw.h new file +4
-0@@ -0,0 +1,220 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ +
[...]
drivers/net/enetc/base/enetc_hw.h line 164
Quoted 10 lines
drivers/net/enetc/base/enetc_hw.h new file +10
-0+ +/* PCI device info */ +struct enetc_hw { +/* SI registers, used by all PCI functions */ +void *reg; +/* Port registers, PF only */ +void *port; +/* IP global registers, PF only */ +void *global; +};
A trivial one: Some structures have comments, but some don't.
Even the one above has comments *before* the variable. There is a no fixed standard, but it is expected that comments would be uniform across the file. If you see in file enetc/enetc.h, you would observe some comments *after* the variable.
Can you make them uniform?
Quoted 54 lines
drivers/net/enetc/base/enetc_hw.h new file +54
-0+ +struct enetc_eth_mac_info { +uint8_t addr[ETH_ADDR_LEN ]; +uint8_t perm_addr[ETH_ADDR_LEN ]; +bool get_link_status; +}; + +struct enetc_eth_hw { +struct net_device *ndev; +struct enetc_hw hw; +uint16_t device_id; +uint16_t vendor_id; +uint8_t revision_id; +struct enetc_eth_mac_info mac; +}; + +/* Transmit Descriptor */ +struct enetc_tx_desc { +uint64_t addr; +uint16_t frm_len; +uint16_t buf_len; +uint32_t flags_errors; +}; + +/* TX Buffer Descriptors (BD) */ +struct enetc_tx_bd { +uint64_t addr; +uint16_t buf_len; +uint16_t frm_len; +uint16_t err_csum; +uint16_t flags; +}; + +/* RX buffer descriptor */ +union enetc_rx_bd { +struct { +uint64_t addr; +uint8_t reserved[8 ]; + } w; +struct { +uint16_t inet_csum; +uint16_t parse_summary; +uint32_t rss_hash; +uint16_t buf_len; +uint16_t vlan_opt; +union { +struct { +uint16_t flags; +uint16_t error; + }; +uint32_t lstatus; + }; + } r; +};
[...]
Quoted 113 lines
drivers/net/enetc/base/enetc_hw.h new file +1
-0+#endif /* _ENETC_H_ */ drivers/net/enetc/enetc_ethdev.c new file +106
-0@@ -0,0 +1,269 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ + +#include <stdbool.h> +#include <rte_ethdev_pci.h> + +#include "enetc_logs.h" +#include "enetc.h" + +int enetc_logtype_pmd; + +/* Functions Prototypes */ +static int enetc_dev_configure (struct rte_eth_dev *dev); +static int enetc_dev_start (struct rte_eth_dev *dev); +static void enetc_dev_stop (struct rte_eth_dev *dev); +static void enetc_dev_close (struct rte_eth_dev *dev); +static void enetc_dev_infos_get (struct rte_eth_dev *dev, +struct rte_eth_dev_info *dev_info); +static int enetc_link_update (struct rte_eth_dev *dev,int wait_to_complete); +static int enetc_hardware_init (struct enetc_eth_hw *hw); + +/* +* The set of PCI devices this driver supports +*/ +static const struct rte_pci_id pci_id_enetc_map[] = { + {RTE_PCI_DEVICE (PCI_VENDOR_ID_FREESCALE ,ENETC_DEV_ID ) }, + {RTE_PCI_DEVICE (PCI_VENDOR_ID_FREESCALE ,ENETC_DEV_ID_VF ) }, + { .vendor_id =0 ,/* sentinel */ }, +}; + +/* Features supported by this driver */ +static const struct eth_dev_ops enetc_ops = { + .dev_configure = enetc_dev_configure, + .dev_start = enetc_dev_start, + .dev_stop = enetc_dev_stop, + .dev_close = enetc_dev_close, + .link_update = enetc_link_update, + .dev_infos_get = enetc_dev_infos_get, +}; + +/** +* Initialisation of the enetc device +* +* @param eth_dev +* - Pointer to the structure rte_eth_dev +* +* @return +* - On success, zero. +* - On failure, negative value. +*/ +static int +enetc_dev_init (struct rte_eth_dev *eth_dev) +{ +int error =0 , i; +struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); +struct enetc_eth_adapter *adapter = +ENETC_DEV_PRIVATE (eth_dev->data->dev_private); + +PMD_INIT_FUNC_TRACE (); + eth_dev->dev_ops = &enetc_ops; + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; + +rte_eth_copy_pci_info (eth_dev, pci_dev); + +/* Retrieving and storing the HW base address of device */ + hw->hw.reg = (void *)pci_dev->mem_resource[0 ].addr; + + adapter->tx_bd_count =MAX_BD_COUNT ; + adapter->rx_bd_count =MAX_BD_COUNT ; + + adapter->num_rx_rings =MAX_RX_RINGS ; + adapter->num_tx_rings =MAX_TX_RINGS ; + +for (i =0 ; i < adapter->num_rx_rings; i++) { + adapter->rx_ring[i] =rte_zmalloc (NULL , +sizeof (struct enetc_bdr ),0 ); +if (!adapter->rx_ring[i]) { +ENETC_PMD_ERR ("Failed to allocate RX ring memory" ); +while (--i >=0 ) +rte_free (adapter->rx_ring[i]); + error = -ENOMEM ; + goto err_late; + } + adapter->rx_ring[i]->bd_count = adapter->rx_bd_count; + } + +for (i =0 ; i < adapter->num_tx_rings; i++) { + adapter->tx_ring[i] =rte_zmalloc (NULL , +sizeof (struct enetc_bdr ),0 ); +if (!adapter->tx_ring[i]) { +ENETC_PMD_ERR ("Failed to allocate TX ring memory" ); +while (--i >=0 ) +rte_free (adapter->tx_ring[i]); + error = -ENOMEM ; + goto err_second; + } + adapter->tx_ring[i]->bd_count = adapter->tx_bd_count; + } + + error =enetc_hardware_init (hw); +if (error !=0 ) { +ENETC_PMD_ERR ("Hardware initialization failed" );
drivers/net/enetc/enetc_ethdev.c line 116
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+ goto err_first; + } + +/* Allocate memory for storing MAC addresses */ + eth_dev->data->mac_addrs =rte_zmalloc ("enetc_eth" , +ETHER_ADDR_LEN ,0 ); +if (!eth_dev->data->mac_addrs) { +ENETC_PMD_ERR ("Failed to allocate %d bytes needed to " +"store MAC addresses" , +ETHER_ADDR_LEN *1 );
Formatting of the above log is not correct. It should be in format:
FUNCTION_NAME(Some argument,
argument on new line after just below the first, ...);
drivers/net/enetc/enetc_ethdev.c line 123
Quoted 7 lines
drivers/net/enetc/enetc_ethdev.c new file +7
-0+ error = -ENOMEM ; + goto err_first; + } + +/* Copy the permanent MAC address */ +ether_addr_copy ((struct ether_addr *)hw->mac.addr, + ð_dev->data->mac_addrs[0 ]);
Alignment of the second argument should be below the first one.
Quoted 9 lines
drivers/net/enetc/enetc_ethdev.c new file +9
-0+ +ENETC_PMD_DEBUG ("port_id %d vendorID=0x%x deviceID=0x%x" , + eth_dev->data->port_id, pci_dev->id.vendor_id, + pci_dev->id.device_id); +return 0 ; + +err_first: +for (i =0 ; i < adapter->num_tx_rings; i++) +rte_free (adapter->tx_ring[i]);
drivers/net/enetc/enetc_ethdev.c line 142
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+err_second: +for (i =0 ; i < adapter->num_rx_rings; i++) +rte_free (adapter->rx_ring[i]); +err_late: +return error; +} + +static int +enetc_dev_uninit (struct rte_eth_dev *eth_dev) +{
Some functions have FUNC_TRACE, some don't. Maybe you should make it uniform.
Quoted 49 lines
drivers/net/enetc/enetc_ethdev.c new file +49
-0+return 0 ; +} + +static int +enetc_dev_configure (struct rte_eth_dev *dev) +{ +PMD_INIT_FUNC_TRACE (); +return 0 ; +} + +static int +enetc_dev_start (struct rte_eth_dev *dev) +{ +PMD_INIT_FUNC_TRACE (); +return 0 ; +} + +static void +enetc_dev_stop (struct rte_eth_dev *dev) +{ +} + +static void +enetc_dev_close (struct rte_eth_dev *dev) +{ +} + +/* return 0 means link status changed, -1 means not changed */ +static int +enetc_link_update (struct rte_eth_dev *dev,int wait_to_complete) +{ +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_eth_link link; + + hw->mac.get_link_status =1 ; + +memset (&link,0 ,sizeof (link)); +rte_eth_linkstatus_get (dev, &link); + + link.link_duplex =ETH_LINK_FULL_DUPLEX ; + link.link_status =ETH_LINK_UP ; +rte_eth_linkstatus_set (dev, &link); + +return 0 ; +} + +static int +enetc_hardware_init (struct enetc_eth_hw *hw)
drivers/net/enetc/enetc_ethdev.c line 201
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+{ +uint32_t psipmr =0 ; + +/* Calculating and storing the base HW addresses */ + hw->hw.port = hw->hw.reg +ENETC_PORT_BASE ; + hw->hw.global = hw->hw.reg +ENETC_GLOBAL_BASE ; + +/* Enabling Station Interface */ +ENETC_REG_WRITE (ENETC_GET_HW_ADDR (hw->hw.reg,ENETC_SIMR ), +ENETC_SIMR_EN );
Second argument on new line should start below first.
Quoted 27 lines
drivers/net/enetc/enetc_ethdev.c new file +27
-0+ +/* Setting to accept broadcast packets for each inetrface */ + psipmr |=ENETC_PSIPMR_SET_UP (0 ) |ENETC_PSIPMR_SET_MP (0 ) | +ENETC_PSIPMR_SET_VLAN_MP (0 ); + psipmr |=ENETC_PSIPMR_SET_UP (1 ) |ENETC_PSIPMR_SET_MP (1 ) | +ENETC_PSIPMR_SET_VLAN_MP (1 ); + psipmr |=ENETC_PSIPMR_SET_UP (2 ) |ENETC_PSIPMR_SET_MP (2 ) | +ENETC_PSIPMR_SET_VLAN_MP (2 ); + +ENETC_REG_WRITE (ENETC_GET_HW_ADDR (hw->hw.port,ENETC_PSIPMR ), + psipmr); + +ENETC_REG_WRITE (ENETC_GET_HW_ADDR (hw->hw.port,ENETC_PM0_CMD_CFG ), +ENETC_PM0_TX_EN |ENETC_PM0_RX_EN ); + +/* Enable port */ +ENETC_REG_WRITE (ENETC_GET_HW_ADDR (hw->hw.port,ENETC_PMR ), +ENETC_PMR_EN ); + +/* Enabling broadcast address */ +ENETC_REG_WRITE (ENETC_GET_HW_ADDR (hw->hw.port,ENETC_PSIPMAR0 (0 )), +0xFFFFFFFF ); +ENETC_REG_WRITE (ENETC_GET_HW_ADDR (hw->hw.port,ENETC_PSIPMAR1 (0 )), +0xFFFF <<16 ); + +return 0 ; +}
[...]
mk/rte.app.mk endif · line 141
Quoted 13 lines
mk/rte.app.mk +1
-0@@ -135,6 +135,7 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += -lrte_pmd_enetc _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
32 bit compilation for this is failing with errors like this:
/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c: In function ‘enetc_xmit_pkts’:/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c:73:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(uint64_t)rte_cpu_to_le_64(tx_swbd->buffer_addr->buf_addr +
^/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c: In function ‘enetc_refill_rx_ring’:/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c:98:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
rxbd->w.addr = (uint64_t)rx_swbd->buffer_addr->buf_addr +
^
In file included from /home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c:13:0:
/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c: In function ‘enetc_setup_txbdr’:
/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c:293:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
lower_32_bits((uint64_t)tx_ring->bd_base));
^
/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/base/enetc_hw.h:108:45: note: in definition of macro ‘enetc_wr_reg’
#define enetc_wr_reg(reg, val) rte_write32((val), (reg))
^~~
/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/base/enetc_hw.h:121:5: note: in expansion of macro ‘enetc_wr’
enetc_wr(hw, ENETC_BDR(t, n, off), val)
^~~~~~~~/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/base/enetc_hw.h:126:5: note: in expansion of macro ‘enetc_bdr_wr’
enetc_bdr_wr(hw, TX, n, off, val)
^~~~~~~~~~~~/home/shreyansh/build/DPDK/05_dpdk/drivers/net/enetc/enetc_rxtx.c:292:2: note: in expansion of macro ‘enetc_txbdr_wr’
Re: [PATCH v2 3/3] net/enetc: enable Rx and Tx
In reply to Gagandeep SinghQuoted 79 lines · Gagandeep Singh
Add RX and TX queue setup, datapath functions
and enable the packet parsingSigned-off-by Gagandeep Singh <[email protected]>--- MAINTAINERS | 1 + drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/enetc_ethdev.c | 6 +- drivers/net/enetc/enetc_rxtx.c | 447 +++++++++++++++++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 5 files changed, 456 insertions(+), 4 deletions(-)create mode 100644
drivers/net/enetc/enetc_rxtx.cMAINTAINERS +1
-0@@ -645,6 +645,7 @@ F: doc/guides/nics/features/dpaa2.ini NXP enetc M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> F: drivers/net/enetc/ F: doc/guides/nics/enetc.rst F: doc/guides/nics/features/enetc.inidrivers/net/enetc/Makefile +2
-1@@ -16,8 +16,9 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c -LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pcidrivers/net/enetc/enetc_ethdev.c +4
-2@@ -37,6 +37,8 @@ static const struct eth_dev_ops enetc_ops = { .dev_close = enetc_dev_close, .link_update = enetc_link_update, .dev_infos_get = enetc_dev_infos_get, + .rx_queue_setup = enetc_rx_queue_setup, + .tx_queue_setup = enetc_tx_queue_setup, };/** @@ -61,8 +63,8 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)PMD_INIT_FUNC_TRACE (); eth_dev->dev_ops = &enetc_ops; - eth_dev->rx_pkt_burst =NULL ; - eth_dev->tx_pkt_burst =NULL ; + eth_dev->rx_pkt_burst = &enetc_recv_pkts; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts;rte_eth_copy_pci_info (eth_dev, pci_dev);drivers/net/enetc/enetc_rxtx.c new file +9
-0@@ -0,0 +1,447 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ + +#include <stdbool.h> +#include <stdint.h> +#include <unistd.h> + +#include "rte_ethdev.h"
drivers/net/enetc/enetc_rxtx.c line 19
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+#include "rte_malloc.h" +#include "rte_memzone.h" + +#include "base/enetc_hw.h" +#include "enetc.h" +#include "enetc_logs.h" + +#define ENETC_RXBD_BUNDLE 8/* Number of BDs to update at once */ + +static inline int enetc_bd_unused (struct enetc_bdr *bdr)
Ideally, the function definition should be like:
<static/inline etc> <return type>
<Function name>(<Arguments>,
<Arguments on new line>,
<More arguments>);
This helps in searching for the tags against function names. Declarations are on a single line.
This is valid across other patches as well in this series.
Quoted 24 lines
drivers/net/enetc/enetc_rxtx.c new file +24
-0+{ +if (bdr->next_to_clean > bdr->next_to_use) +return bdr->next_to_clean - bdr->next_to_use -1 ; + +return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use -1 ; +} + +static bool enetc_clean_tx_ring (struct enetc_bdr *tx_ring) +{ +int tx_frm_cnt =0 ; +struct enetc_swbd *tx_swbd; +int i; + + i = tx_ring->next_to_clean; + tx_swbd = &tx_ring->q_swbd[i]; +while ((int )(enetc_rd_reg (tx_ring->tcisr) &ENETC_TBCISR_IDX_MASK ) != i) { +rte_pktmbuf_free (tx_swbd->buffer_addr); + tx_swbd->buffer_addr =NULL ; + tx_swbd++; + i++; +if (unlikely (i == tx_ring->bd_count)) { + i =0 ; + tx_swbd = &tx_ring->q_swbd[0 ]; + }
drivers/net/enetc/enetc_rxtx.c line 53
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+ + tx_frm_cnt++; + } + tx_ring->next_to_clean = i; +return tx_frm_cnt++; +} + +uint16_t enetc_xmit_pkts (void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts)
Formatting of second line arguments is wrong.
Also, maintain uniformity of the declaration syntax. Either all on single line with their returns or all with returns on one line and names on another.
Quoted 53 lines
drivers/net/enetc/enetc_rxtx.c new file +53
-0+{ +struct enetc_swbd *tx_swbd; +int i, start; +struct enetc_tx_bd *txbd; +struct enetc_bdr *tx_ring = (struct enetc_bdr *)tx_queue; + + i = tx_ring->next_to_use; + start =0 ; +while (nb_pkts--) { +enetc_clean_tx_ring (tx_ring); + + tx_ring->q_swbd[i].buffer_addr = tx_pkts[start]; + + txbd =ENETC_TXBD (*tx_ring, i); + tx_swbd = &tx_ring->q_swbd[i]; + txbd->frm_len = tx_pkts[start]->pkt_len; + txbd->buf_len = txbd->frm_len; + txbd->flags =rte_cpu_to_le_16 (ENETC_TXBD_FLAGS_F ); + txbd->addr = + (uint64_t )rte_cpu_to_le_64 (tx_swbd->buffer_addr->buf_addr + + tx_swbd->buffer_addr->data_off); + i++; + start++; +if (unlikely (i == tx_ring->bd_count)) + i =0 ; + } + tx_ring->next_to_use = i; +enetc_wr_reg (tx_ring->tcir, i); +return start; +} + +static int enetc_refill_rx_ring (struct enetc_bdr *rx_ring,const int buff_cnt) +{ +struct enetc_swbd *rx_swbd; +union enetc_rx_bd *rxbd; +int i, j; + + i = rx_ring->next_to_use; + rx_swbd = &rx_ring->q_swbd[i]; + rxbd =ENETC_RXBD (*rx_ring, i); + +for (j =0 ; j < buff_cnt; j++) { + rx_swbd->buffer_addr = +rte_cpu_to_le_64 (rte_mbuf_raw_alloc (rx_ring->mb_pool)); + rxbd->w.addr = (uint64_t )rx_swbd->buffer_addr->buf_addr + + rx_swbd->buffer_addr->data_off; +/* clear 'R" as well */ + rxbd->r.lstatus =0 ; + rx_swbd++; + rxbd++; + i++; + +if (unlikely (i == rx_ring->bd_count)) {
drivers/net/enetc/enetc_rxtx.c line 116
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+ i =0 ; + rxbd =ENETC_RXBD (*rx_ring,0 ); + rx_swbd = &rx_ring->q_swbd[i]; + } + } +if (likely (j)) { + rx_ring->next_to_alloc = i; + rx_ring->next_to_use = i; +enetc_wr_reg (rx_ring->rcir, i); + }
It is nice to have a new line after a logical block (like the for and if above). It helps in reading. But, no formal rule exists to enforce this.
Quoted 43 lines
drivers/net/enetc/enetc_rxtx.c new file +43
-0+return j; +} + + +static inline void __attribute__((hot)) +enetc_dev_rx_parse (struct rte_mbuf *m,uint16_t parse_results) +{ +ENETC_PMD_DP_DEBUG ("parse summary = 0x%x " , parse_results); + + m->packet_type =RTE_PTYPE_UNKNOWN ; +switch (parse_results) { +case ENETC_PKT_TYPE_ETHER : + m->packet_type =RTE_PTYPE_L2_ETHER ; +break ; +case ENETC_PKT_TYPE_IPV4 : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 ; +break ; +case ENETC_PKT_TYPE_IPV6 : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 ; +break ; +case ENETC_PKT_TYPE_IPV4_TCP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_TCP ; +break ; +case ENETC_PKT_TYPE_IPV6_TCP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_TCP ; +break ; +case ENETC_PKT_TYPE_IPV4_UDP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_UDP ; +break ; +case ENETC_PKT_TYPE_IPV6_UDP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ; +break ; +case ENETC_PKT_TYPE_IPV4_SCTP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_SCTP ; +break ; +case ENETC_PKT_TYPE_IPV6_SCTP :
drivers/net/enetc/enetc_rxtx.c line 169
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+ m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_SCTP ; +break ; +case ENETC_PKT_TYPE_IPV4_ICMP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_ICMP ; +break ; +case ENETC_PKT_TYPE_IPV6_ICMP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_ICMP ;
If you order your packet_type values, they would be easier to read:
m->packet_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_ICMP;
Again, just like above, no strict formatting rule exists. You can choose to ignore.
drivers/net/enetc/enetc_rxtx.c line 179
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+break ; +/* More switch cases can be added */ +default : + m->packet_type =RTE_PTYPE_UNKNOWN ; + } +} + +static int +enetc_clean_rx_ring (struct enetc_bdr *rx_ring,struct rte_mbuf **rx_pkts, +int work_limit)
I think the above line would exceed 79 char - even if not, formatting is incorrect.
Quoted 47 lines
drivers/net/enetc/enetc_rxtx.c new file +47
-0+{ +int rx_frm_cnt =0 ; +int cleaned_cnt, i; +struct enetc_swbd *rx_swbd; + + cleaned_cnt =enetc_bd_unused (rx_ring); + +/* next descriptor to process */ + i = rx_ring->next_to_clean; + rx_swbd = &rx_ring->q_swbd[i]; + +while (likely (rx_frm_cnt < work_limit)) { +union enetc_rx_bd *rxbd; +uint32_t bd_status; + +if (cleaned_cnt >=ENETC_RXBD_BUNDLE ) { +int count =enetc_refill_rx_ring (rx_ring, cleaned_cnt); + + cleaned_cnt -= count; + } + rxbd =ENETC_RXBD (*rx_ring, i); + bd_status =rte_le_to_cpu_32 (rxbd->r.lstatus); +if (!bd_status) +break ; + + rx_swbd->buffer_addr->pkt_len = rxbd->r.buf_len; + rx_swbd->buffer_addr->data_len = rxbd->r.buf_len; + rx_swbd->buffer_addr->hash.rss = rxbd->r.rss_hash; + rx_swbd->buffer_addr->ol_flags =0 ; +enetc_dev_rx_parse (rx_swbd->buffer_addr, rxbd->r.parse_summary); + + rx_pkts[rx_frm_cnt] = rx_swbd->buffer_addr; + + cleaned_cnt++; + rx_swbd++; + i++; +if (unlikely (i == rx_ring->bd_count)) { + i =0 ; + rx_swbd = &rx_ring->q_swbd[i]; + } + rx_ring->next_to_clean = i; + rx_frm_cnt++; + } + +return rx_frm_cnt; +} +
[...]
Quoted 7 lines
drivers/net/enetc/enetc_rxtx.c new file +7
-0+static void enetc_setup_tx_bdrs (struct rte_eth_dev *dev) +{ +int i; +struct enetc_eth_adapter *priv = +ENETC_DEV_PRIVATE (dev->data->dev_private); + +for (i =0 ; i < priv->num_tx_rings; i++) {
drivers/net/enetc/enetc_rxtx.c line 326
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+enetc_setup_txbdr (&priv->hw.hw, priv->tx_ring[i]); + dev->data->tx_queues[i] = priv->tx_ring[i]; + } +} + +int enetc_tx_queue_setup (struct rte_eth_dev *dev, +uint16_t queue_idx, +uint16_t nb_desc, +unsigned int socket_id, +const struct rte_eth_txconf *tx_conf)
Can you please fix the format of the arguments on new line.
Quoted 17 lines
drivers/net/enetc/enetc_rxtx.c new file +17
-0+{ +struct enetc_eth_adapter *adapter = +ENETC_DEV_PRIVATE (dev->data->dev_private); +int err =0 ; + + err =enetc_alloc_tx_resources (adapter); +if (err) + goto err_alloc_tx; + +enetc_setup_tx_bdrs (dev); + +err_alloc_tx: +return err; +} + +static int enetc_alloc_rxbdr (struct enetc_bdr *rxr) +{
drivers/net/enetc/enetc_rxtx.c line 353
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+int size; + + size = rxr->bd_count *sizeof (struct enetc_swbd ); + rxr->q_swbd =rte_malloc (NULL , size,RTE_CACHE_LINE_SIZE ); +if (rxr->q_swbd ==NULL ) +return -ENOMEM ; + + size = rxr->bd_count *sizeof (union enetc_rx_bd ); + rxr->bd_base =rte_malloc (NULL , size,RTE_CACHE_LINE_SIZE ); +
New line is not required here - rxr->bd_base allocation is being checked, so essentially a single logical block.
Quoted 13 lines
drivers/net/enetc/enetc_rxtx.c new file +13
-0+if (rxr->bd_base ==NULL ) { +rte_free (rxr->q_swbd); + rxr->q_swbd =NULL ; +return -ENOMEM ; + } + + rxr->next_to_clean =0 ; + rxr->next_to_use =0 ; + rxr->next_to_alloc =0 ; + +return 0 ; +} +
[...]
Re: [PATCH v2 1/3] doc: add usage doc for ENETC PMD
In reply to Gagandeep SinghQuoted 11 lines · Gagandeep Singh
Add enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
Signed-off-by Gagandeep Singh <[email protected]>--- MAINTAINERS | 5 + doc/guides/nics/enetc.rst | 153 +++++++++++++++++++++++++++++ doc/guides/nics/features/enetc.ini | 8 ++ doc/guides/nics/index.rst | 1 +
Please also add a release note update.
And a web page patch to supported device list: https://core.dpdk.org/supported/
<...>
Quoted 22 lines
doc/guides/nics/enetc.rst new file +22
-0+Driver compilation and testing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#. Please refer the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` + to compile the driver. Use target "arm64-armv8a-linuxapp-gcc" in make command + +#. Refer to the document :ref:`cross build dpdk for arm64 <configure_and_cross_compile_dpdk_build>` to + disable flags and for cross compilation + +#. To compile in performance mode, please set ``CONFIG_RTE_CACHE_LINE_SIZE=64`` + +#. Running l2fwd: + + Follow instructions available in the document + :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` + to run l2fwd. + + - First unbind the ports from kernel + + - echo vfio-pci > /sys/bus/pci/devices/0000\:00\:00.1/driver_override + - echo 0000:00:00.1 > /sys/bus/pci/drivers/fsl_enetc/unbind + - echo vfio-pci > /sys/bus/pci/devices/0000\:00\:00.0/driver_override
doc/guides/nics/enetc.rst line 132
Quoted 10 lines
doc/guides/nics/enetc.rst new file +10
-0+ - echo 0000:00:00.0 > /sys/bus/pci/drivers/fsl_enetc/unbind + - Then bind them to VFIO, so that DPDK application can use them + + - echo 0000:00:00.1 > /sys/bus/pci/drivers/vfio-pci/bind + - echo 0000:00:00.0 > /sys/bus/pci/drivers/vfio-pci/bind + - Mount Hugepages + + - mkdir /mnt/hugepages + - mount -t hugetlbfs none /mnt/hugepages + - Run l2fwd application
We moved common part of documentation into " compiling and testing a PMD for a NIC" section, check other PMD docs for usage, for example ena PMD, "Usage example" section.
It is good to keep example output if it has PMD specific logs, but not required to have generic output.
Re: [PATCH v2 2/3] net/enetc: add ENETC PMD with basic operations
In reply to Gagandeep SinghQuoted 5 lines · Gagandeep Singh
This patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware initialisation
Signed-off-by Gagandeep Singh <[email protected]>
<...>
drivers/net/enetc/Makefile line 11
Quoted 12 lines
drivers/net/enetc/Makefile new file +11
-0@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_enetc.a + +CFLAGS += -O3
Can you please add following to catch errors.
+CFLAGS += $(WERROR_FLAGS)
<...>
drivers/net/enetc/base/enetc_hw.h line 169
Quoted 4 lines
drivers/net/enetc/base/enetc_hw.h new file +4
-0+struct enetc_eth_mac_info { +uint8_t addr[ETH_ADDR_LEN ]; +uint8_t perm_addr[ETH_ADDR_LEN ]; +bool get_link_status;
Don't use bool in structures, this is slightly new, please check:
https://patches.dpdk.org/patch/44817/
<...>
Quoted 6 lines
drivers/net/enetc/enetc.h new file +6
-0+/* +* RX/TX ENETC function prototypes +*/ +int enetc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, + uint16_t nb_rx_desc, unsigned int socket_id, + const struct rte_eth_rxconf *rx_conf,
drivers/net/enetc/enetc.h line 109
Quoted 10 lines
drivers/net/enetc/enetc.h new file +10
-0+ struct rte_mempool *mb_pool); + +int enetc_tx_queue_setup (struct rte_eth_dev *dev,uint16_t tx_queue_id, +uint16_t nb_tx_desc,unsigned int socket_id, +const struct rte_eth_txconf *tx_conf); + +uint16_t enetc_xmit_pkts (void *txq,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +uint16_t enetc_recv_pkts (void *rxq,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);
Should these function declerations be in next patch?
<...>
Quoted 6 lines
drivers/net/enetc/enetc_ethdev.c new file +6
-0+static int +enetc_dev_init (struct rte_eth_dev *eth_dev) +{ +int error =0 , i; +struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); + struct enetc_eth_hw *hw =
drivers/net/enetc/enetc_ethdev.c line 67
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+ENETC_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); +struct enetc_eth_adapter *adapter = +ENETC_DEV_PRIVATE (eth_dev->data->dev_private); + +PMD_INIT_FUNC_TRACE (); + eth_dev->dev_ops = &enetc_ops; + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; + +rte_eth_copy_pci_info (eth_dev, pci_dev);
Isn't this alredy done by rte_eth_dev_pci_generic_probe() ?
Quoted 12 lines
drivers/net/enetc/enetc_ethdev.c new file +12
-0+ +/* Retrieving and storing the HW base address of device */ + hw->hw.reg = (void *)pci_dev->mem_resource[0 ].addr; + + adapter->tx_bd_count =MAX_BD_COUNT ; + adapter->rx_bd_count =MAX_BD_COUNT ; + + adapter->num_rx_rings =MAX_RX_RINGS ; + adapter->num_tx_rings =MAX_TX_RINGS ; + +for (i =0 ; i < adapter->num_rx_rings; i++) { + adapter->rx_ring[i] = rte_zmalloc(NULL,
drivers/net/enetc/enetc_ethdev.c line 89
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+ sizeof(struct enetc_bdr), 0); +if (!adapter->rx_ring[i]) { +ENETC_PMD_ERR ("Failed to allocate RX ring memory" ); +while (--i >=0 ) +rte_free (adapter->rx_ring[i]); + error = -ENOMEM ; + goto err_late; + } + adapter->rx_ring[i]->bd_count = adapter->rx_bd_count; + }
There are dev->data->nb_rx_queues & dev->data->nb_tx_queues variables set with user provided values,
Also there are dev->data->rx_queues & dev->data->tx_queues already allocated by ethdev according queue numbers.
Why you are not using them but having a private version of them and use them? <...>
drivers/net/enetc/enetc_ethdev.c line 141
Quoted 2 lines
drivers/net/enetc/enetc_ethdev.c new file +2
-0+static int +enetc_dev_uninit (struct rte_eth_dev *eth_dev)
error: unused parameter ‘eth_dev’ [-Werror=unused-parameter] same is valid for below a few more functions.
<...>
drivers/net/enetc/enetc_ethdev.c line 197
Quoted 8 lines
drivers/net/enetc/enetc_ethdev.c new file +8
-0+static int +enetc_hardware_init (struct enetc_eth_hw *hw) +{ +uint32_t psipmr =0 ; + +/* Calculating and storing the base HW addresses */ + hw->hw.port = hw->hw.reg +ENETC_PORT_BASE ; + hw->hw.global = hw->hw.reg +ENETC_GLOBAL_BASE ;
error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]
You will get more of this when warnings enabled (please check above suggested change on Makefile)
<...>
drivers/net/enetc/enetc_ethdev.c
Quoted 9 lines
drivers/net/enetc/enetc_ethdev.c new file +9
-0+static void +enetc_dev_infos_get (struct rte_eth_dev *dev,struct rte_eth_dev_info *dev_info) +{ +struct enetc_eth_adapter *adapter = +ENETC_DEV_PRIVATE (dev->data->dev_private); + + dev_info->max_rx_queues = adapter->num_rx_rings; + dev_info->max_tx_queues = adapter->num_tx_rings; + dev_info->max_rx_pktlen =1500
rte_eth_dev_info_get() also returns dev_info->nb_rx_queues & dev_info->nb_tx_queues based on dev->data->nb_[r/t]x_queues but that is wrong for this driver becase it uses different values as number of [r/t]x queues.
This is related to the above comment. Using dev->data->nb_[r/t]x_queues instead of adapter->num_[r/t]x_rings will fix this.
Re: [PATCH v2 3/3] net/enetc: enable Rx and Tx
In reply to Gagandeep SinghQuoted 4 lines · Gagandeep Singh
Add RX and TX queue setup, datapath functions
and enable the packet parsingSigned-off-by Gagandeep Singh <[email protected]>
<...>
drivers/net/enetc/Makefile LIBABIVER := 1 · line 23
Quoted 4 lines
drivers/net/enetc/Makefile +1
-1-LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pci
Isn't mbuf and ring are dependency?
<...>
Quoted 45 lines
drivers/net/enetc/enetc_rxtx.c new file +45
-0+static inline void __attribute__((hot)) +enetc_dev_rx_parse (struct rte_mbuf *m,uint16_t parse_results) +{ +ENETC_PMD_DP_DEBUG ("parse summary = 0x%x " , parse_results); + + m->packet_type =RTE_PTYPE_UNKNOWN ; +switch (parse_results) { +case ENETC_PKT_TYPE_ETHER : + m->packet_type =RTE_PTYPE_L2_ETHER ; +break ; +case ENETC_PKT_TYPE_IPV4 : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 ; +break ; +case ENETC_PKT_TYPE_IPV6 : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 ; +break ; +case ENETC_PKT_TYPE_IPV4_TCP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_TCP ; +break ; +case ENETC_PKT_TYPE_IPV6_TCP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_TCP ; +break ; +case ENETC_PKT_TYPE_IPV4_UDP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_UDP ; +break ; +case ENETC_PKT_TYPE_IPV6_UDP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ; +break ; +case ENETC_PKT_TYPE_IPV4_SCTP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_SCTP ; +break ; +case ENETC_PKT_TYPE_IPV6_SCTP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_SCTP ; +break ; +case ENETC_PKT_TYPE_IPV4_ICMP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 |RTE_PTYPE_L4_ICMP ;
drivers/net/enetc/enetc_rxtx.c line 175
Quoted 10 lines
drivers/net/enetc/enetc_rxtx.c new file +10
-0+break ; +case ENETC_PKT_TYPE_IPV6_ICMP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_ICMP ; +break ; +/* More switch cases can be added */ +default : + m->packet_type =RTE_PTYPE_UNKNOWN ; + } +}
You are already getting packet type info from device and set mbuf, by implementing (relatively easy) rte_eth_dev_get_supported_ptypes() API you can make applications use these values better,
And enable "Packet type parsing" feature in .ini file
v3 cover introduces the enetc PMD driver
In reply to Gagandeep Singh*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v2->v3 Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added in Makefile
* private list of RX/TX queues removed
* added the dev_start and dev_stop APIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2 Change-log:
* document improvement
* checkpatch warnings removed
Gagandeep Singh (3):
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
MAINTAINERS | 7 + doc/guides/nics/enetc.rst | 110 ++++++++ doc/guides/nics/features/enetc.ini | 11 + doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_18_11.rst | 6 + drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/base/enetc_hw.h | 19 +- drivers/net/enetc/enetc.h | 25 +- drivers/net/enetc/enetc_ethdev.c | 345 ++++++++++++++++++++++++- drivers/net/enetc/enetc_rxtx.c | 239 +++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 11 files changed, 756 insertions(+), 13 deletions(-) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini create mode 100644 drivers/net/enetc/enetc_rxtx.c
Signature · 1 line
2.17.1
PATCH v3 1/3 net/enetc: enable Rx and Tx
Add RX and TX queue setup, datapath functions
--- drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/base/enetc_hw.h | 19 +- drivers/net/enetc/enetc.h | 25 ++- drivers/net/enetc/enetc_ethdev.c | 326 +++++++++++++++++++++++++++++- drivers/net/enetc/enetc_rxtx.c | 239 ++++++++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 6 files changed, 602 insertions(+), 13 deletions(-) create mode 100644 drivers/net/enetc/enetc_rxtx.c
drivers/net/enetc/Makefile +2 -1
@@ -14,8 +14,9 @@ EXPORT_MAP := rte_pmd_enetc_version.map LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c -LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pci
drivers/net/enetc/base/enetc_hw.h +11 -8
@@ -104,16 +104,19 @@ enum enetc_bdr_type {TX, RX};#define ETH_ADDR_LEN 6/* general register accessors */ -#define enetc_rd_reg (reg) rte_read32((reg)) -#define enetc_wr_reg (reg, val) rte_write32((val), (reg)) -#define enetc_rd (hw, off) enetc_rd_reg((hw)->reg + (off)) -#define enetc_wr (hw, off, val) enetc_wr_reg((hw)->reg + (off), val) +#define enetc_rd_reg (reg) rte_read32((void *)(reg)) +#define enetc_wr_reg (reg, val) rte_write32((val), (void *)(reg)) +#define enetc_rd (hw, off) enetc_rd_reg((size_t)(hw)->reg + (off)) +#define enetc_wr (hw, off, val) enetc_wr_reg((size_t)(hw)->reg + (off), val)/* port register accessors - PF only */ -#define enetc_port_rd (hw, off) enetc_rd_reg((hw)->port + (off)) -#define enetc_port_wr (hw, off, val) enetc_wr_reg((hw)->port + (off), val) +#define enetc_port_rd (hw, off) enetc_rd_reg((size_t)(hw)->port + (off)) +#define enetc_port_wr (hw, off, val) \ + enetc_wr_reg((size_t)(hw)->port + (off), val)/* global register accessors - PF only */ -#define enetc_global_rd (hw, off) enetc_rd_reg((hw)->global + (off)) -#define enetc_global_wr (hw, off, val) enetc_wr_reg((hw)->global + (off), val) +#define enetc_global_rd (hw, off) \ + enetc_rd_reg((size_t)(hw)->global + (off)) +#define enetc_global_wr (hw, off, val) \ + enetc_wr_reg((size_t)(hw)->global + (off), val)/* BDR register accessors, see ENETC_BDR() */ #define enetc_bdr_rd (hw, t, n, off) \ enetc_rd(hw, ENETC_BDR(t, n, off))
drivers/net/enetc/enetc.h +24 -1
@@ -18,7 +18,11 @@#define MAX_RX_RINGS 1/* Max BD counts per Ring. */ -#define MAX_BD_COUNT 256 +#define MAX_BD_COUNT 64000 +/* Min BD counts per Ring. */ +#define MIN_BD_COUNT 32 +/* BD ALIGN */ +#define BD_ALIGN 8/* * upper_32_bits - return bits 32-63 of a number
@@ -87,4 +91,23 @@ struct enetc_eth_adapter {#define ENETC_REG_WRITE (addr, val) (*(uint32_t *)addr = val)#define ENETC_REG_WRITE_RELAXED (addr, val) (*(uint32_t *)addr = val) +/* +* RX/TX ENETC function prototypes +*/ +uint16_t enetc_xmit_pkts (void *txq,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +uint16_t enetc_recv_pkts (void *rxq,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); + + +int enetc_refill_rx_ring (struct enetc_bdr *rx_ring,const int buff_cnt); + +static inline int +enetc_bd_unused (struct enetc_bdr *bdr) +{ +if (bdr->next_to_clean > bdr->next_to_use) +return bdr->next_to_clean - bdr->next_to_use -1 ; + +return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use -1 ; +}#endif /* _ENETC_H_ */
drivers/net/enetc/enetc_ethdev.c +324 -2
355 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c new file +239 -0
239 lines not on this page · raw message
drivers/net/enetc/meson.build +2 -1
@@ -5,6 +5,7 @@ if host_machine.system() != 'linux' build = false endif -sources = files('enetc_ethdev.c') +sources = files('enetc_ethdev.c', + 'enetc_rxtx.c') includes += include_directories('base')
Signature · 1 line
2.17.1
PATCH v3 2/3 net/enetc: support packet parse type
In reply to Gagandeep Singh--- drivers/net/enetc/enetc_ethdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/enetc/enetc_ethdev.c +19 -0
@@ -28,6 +28,7 @@ static int enetc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf);static void enetc_tx_queue_release (void *txq); +static const uint32_t *enetc_supported_ptypes_get (struct rte_eth_dev *dev);/* * The set of PCI devices this driver supports
@@ -50,6 +51,7 @@ static const struct eth_dev_ops enetc_ops = { .rx_queue_release = enetc_rx_queue_release, .tx_queue_setup = enetc_tx_queue_setup, .tx_queue_release = enetc_tx_queue_release, + .dev_supported_ptypes_get = enetc_supported_ptypes_get, };/**
@@ -165,6 +167,23 @@ enetc_dev_close(struct rte_eth_dev *dev __rte_unused)PMD_INIT_FUNC_TRACE (); } +static const uint32_t * +enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) +{ +static const uint32_t ptypes[] = { +RTE_PTYPE_L2_ETHER , +RTE_PTYPE_L3_IPV4 , +RTE_PTYPE_L3_IPV6 , +RTE_PTYPE_L4_TCP , +RTE_PTYPE_L4_UDP , +RTE_PTYPE_L4_SCTP , +RTE_PTYPE_L4_ICMP , +RTE_PTYPE_UNKNOWN + }; + +return ptypes; +} +/* return 0 means link status changed, -1 means not changed */ static int enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
Signature · 1 line
2.17.1
PATCH v3 3/3 doc: add usage doc for ENETC PMD
In reply to Gagandeep SinghAdd enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
--- MAINTAINERS | 7 ++ doc/guides/nics/enetc.rst | 110 +++++++++++++++++++++++++ doc/guides/nics/features/enetc.ini | 11 +++ doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_18_11.rst | 6 ++ 5 files changed, 135 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini
MAINTAINERS +7 -0
@@ -643,6 +643,13 @@ F: drivers/net/dpaa2/ F: doc/guides/nics/dpaa2.rst F: doc/guides/nics/features/dpaa2.ini +NXP enetc +M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> +F: drivers/net/enetc/ +F: doc/guides/nics/enetc.rst +F: doc/guides/nics/features/enetc.ini + QLogic bnx2x M: Harish Patil <[email protected]> M: Rasesh Mody <[email protected]>
doc/guides/nics/enetc.rst new file +110 -0
110 lines not on this page · raw message
doc/guides/nics/features/enetc.ini new file +11 -0
@@ -0,0 +1,11 @@ +; +; Supported features of the 'enetc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Packet type parsing = Y +Link status = Y +Linux VFIO = Y +ARMv8 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -21,6 +21,7 @@ Network Interface Controller Drivers dpaa2 e1000em ena + enetc enic fm10k i40e
doc/guides/rel_notes/release_18_11.rst +6 -0
@@ -50,6 +50,11 @@ New Features * Other libs * Apps, Examples, Tools (if significative) + * **Added NXP ENETC PMD.** + + Added the new enetc driver for NXP enetc platform. See the + "ENETC Poll Mode Driver" document for more details on this new driver. + This section is a comment. Do not overwrite or remove it. Also, make sure to start the actual text at the margin. =========================================================
@@ -156,6 +161,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_pmd_ixgbe.so.2 librte_pmd_dpaa2_cmdif.so.1 librte_pmd_dpaa2_qdma.so.1 + + librte_pmd_enetc.so.1 librte_pmd_ring.so.2 librte_pmd_softnic.so.1 librte_pmd_vhost.so.2
Signature · 1 line
2.17.1
Re: [PATCH v3 0/3] introduces the enetc PMD driver
In reply to Gagandeep SinghQuoted 27 lines
-----Original Message-----
From: Gagandeep Singh
Sent: Friday, September 28, 2018 10:47 AM
To: [email protected]; [email protected]
Cc: Pankaj Chauhan <[email protected]>; Gagandeep Singh <[email protected]>
Subject: [PATCH v3 0/3] introduces the enetc PMD driver*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v2->v3Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added inMakefile
* private list of RX/TX queues removed
* added thedev_startanddev_stopAPIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2Change-log:
* document improvement
* checkpatch warnings removed
Quoted 5 lines
Gagandeep Singh (3):
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
Self NACK
One patch is missing. I will send a V4
v4 cover introduces the enetc PMD driver
In reply to Gagandeep Singh*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v3->v4 Change-log:
* fixed patch set
v2->v3 Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added in Makefile
* private list of RX/TX queues removed
* added the dev_start and dev_stop APIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2 Change-log:
* document improvement
* checkpatch warnings removed
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
MAINTAINERS | 7 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 110 ++++ doc/guides/nics/features/enetc.ini | 11 + doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_18_11.rst | 6 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 23 + drivers/net/enetc/base/enetc_hw.h | 220 ++++++++ drivers/net/enetc/enetc.h | 113 ++++ drivers/net/enetc/enetc_ethdev.c | 592 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 40 ++ drivers/net/enetc/enetc_rxtx.c | 239 ++++++++ drivers/net/enetc/meson.build | 11 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 18 files changed, 1390 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/enetc_rxtx.c create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
Signature · 1 line
2.17.1
PATCH v4 1/4 net/enetc: add ENETC PMD with basic operations
This patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware initialisation
--- config/common_base | 5 + config/common_linuxapp | 5 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 22 ++ drivers/net/enetc/base/enetc_hw.h | 217 +++++++++++++++++ drivers/net/enetc/enetc.h | 90 +++++++ drivers/net/enetc/enetc_ethdev.c | 251 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 40 ++++ drivers/net/enetc/meson.build | 10 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 12 files changed, 647 insertions(+) create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
config/common_base +5 -0
@@ -217,6 +217,11 @@ CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=y CONFIG_RTE_LIBRTE_DPAA2_PMD=n CONFIG_RTE_LIBRTE_DPAA2_DEBUG_DRIVER=n +# +# Compile NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=n + # # Compile burst-oriented Amazon ENA PMD driver #
config/common_linuxapp +5 -0
@@ -44,3 +44,8 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y + +# +# NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=y
drivers/net/Makefile +1 -0
@@ -24,6 +24,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 endif DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000 DIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena +DIRS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic DIRS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += failsafe DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
drivers/net/enetc/Makefile new file +22 -0
@@ -0,0 +1,22 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_enetc.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_pmd_enetc_version.map +LIBABIVER := 1 + +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c + +LDLIBS += -lrte_eal +LDLIBS += -lrte_ethdev +LDLIBS += -lrte_bus_pci + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/enetc/base/enetc_hw.h new file +217 -0
217 lines not on this page · raw message
drivers/net/enetc/enetc.h new file +90 -0
90 lines not on this page · raw message
drivers/net/enetc/enetc_ethdev.c new file +251 -0
251 lines not on this page · raw message
drivers/net/enetc/enetc_logs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ + +#ifndef _ENETC_LOGS_H_ +#define _ENETC_LOGS_H_ + +extern int enetc_logtype_pmd; + +#define ENETC_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, enetc_logtype_pmd, "enetc_net: " \ + fmt "\n", ##args) + +#define ENETC_PMD_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, enetc_logtype_pmd, "enetc_net: %s(): "\ + fmt "\n", __func__, ##args) + +#define PMD_INIT_FUNC_TRACE () ENETC_PMD_DEBUG(">>") + +#define ENETC_PMD_CRIT(fmt, args...) \ + ENETC_PMD_LOG(CRIT, fmt, ## args) +#define ENETC_PMD_INFO(fmt, args...) \ + ENETC_PMD_LOG(INFO, fmt, ## args) +#define ENETC_PMD_ERR(fmt, args...) \ + ENETC_PMD_LOG(ERR, fmt, ## args) +#define ENETC_PMD_WARN(fmt, args...) \ + ENETC_PMD_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) +#define ENETC_PMD_DP_INFO(fmt, args...) \ + ENETC_PMD_DP_LOG(INFO, fmt, ## args) +#define ENETC_PMD_DP_WARN(fmt, args...) \ + ENETC_PMD_DP_LOG(WARNING, fmt, ## args) + +#endif /* _ENETC_LOGS_H_*/
drivers/net/enetc/meson.build new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +if host_machine.system() != 'linux' + build = false +endif + +sources = files('enetc_ethdev.c') + +includes += include_directories('base')
drivers/net/enetc/rte_pmd_enetc_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_18.11 { + + local: *; +};
drivers/net/meson.build +1 -0
@@ -11,6 +11,7 @@ drivers = ['af_packet', 'dpaa', 'dpaa2', 'e1000', 'ena', + 'enetc', 'enic', 'failsafe', 'fm10k', 'i40e',
mk/rte.app.mk +1 -0
@@ -135,6 +135,7 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += -lrte_pmd_enetc _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
Signature · 1 line
2.17.1
PATCH v4 2/4 net/enetc: enable Rx and Tx
In reply to Gagandeep SinghAdd RX and TX queue setup, datapath functions
--- drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/base/enetc_hw.h | 19 +- drivers/net/enetc/enetc.h | 25 ++- drivers/net/enetc/enetc_ethdev.c | 326 +++++++++++++++++++++++++++++- drivers/net/enetc/enetc_rxtx.c | 239 ++++++++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 6 files changed, 602 insertions(+), 13 deletions(-) create mode 100644 drivers/net/enetc/enetc_rxtx.c
drivers/net/enetc/Makefile +2 -1
@@ -14,8 +14,9 @@ EXPORT_MAP := rte_pmd_enetc_version.map LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c -LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pci
drivers/net/enetc/base/enetc_hw.h +11 -8
@@ -104,16 +104,19 @@ enum enetc_bdr_type {TX, RX};#define ETH_ADDR_LEN 6/* general register accessors */ -#define enetc_rd_reg (reg) rte_read32((reg)) -#define enetc_wr_reg (reg, val) rte_write32((val), (reg)) -#define enetc_rd (hw, off) enetc_rd_reg((hw)->reg + (off)) -#define enetc_wr (hw, off, val) enetc_wr_reg((hw)->reg + (off), val) +#define enetc_rd_reg (reg) rte_read32((void *)(reg)) +#define enetc_wr_reg (reg, val) rte_write32((val), (void *)(reg)) +#define enetc_rd (hw, off) enetc_rd_reg((size_t)(hw)->reg + (off)) +#define enetc_wr (hw, off, val) enetc_wr_reg((size_t)(hw)->reg + (off), val)/* port register accessors - PF only */ -#define enetc_port_rd (hw, off) enetc_rd_reg((hw)->port + (off)) -#define enetc_port_wr (hw, off, val) enetc_wr_reg((hw)->port + (off), val) +#define enetc_port_rd (hw, off) enetc_rd_reg((size_t)(hw)->port + (off)) +#define enetc_port_wr (hw, off, val) \ + enetc_wr_reg((size_t)(hw)->port + (off), val)/* global register accessors - PF only */ -#define enetc_global_rd (hw, off) enetc_rd_reg((hw)->global + (off)) -#define enetc_global_wr (hw, off, val) enetc_wr_reg((hw)->global + (off), val) +#define enetc_global_rd (hw, off) \ + enetc_rd_reg((size_t)(hw)->global + (off)) +#define enetc_global_wr (hw, off, val) \ + enetc_wr_reg((size_t)(hw)->global + (off), val)/* BDR register accessors, see ENETC_BDR() */ #define enetc_bdr_rd (hw, t, n, off) \ enetc_rd(hw, ENETC_BDR(t, n, off))
drivers/net/enetc/enetc.h +24 -1
@@ -18,7 +18,11 @@#define MAX_RX_RINGS 1/* Max BD counts per Ring. */ -#define MAX_BD_COUNT 256 +#define MAX_BD_COUNT 64000 +/* Min BD counts per Ring. */ +#define MIN_BD_COUNT 32 +/* BD ALIGN */ +#define BD_ALIGN 8/* * upper_32_bits - return bits 32-63 of a number
@@ -87,4 +91,23 @@ struct enetc_eth_adapter {#define ENETC_REG_WRITE (addr, val) (*(uint32_t *)addr = val)#define ENETC_REG_WRITE_RELAXED (addr, val) (*(uint32_t *)addr = val) +/* +* RX/TX ENETC function prototypes +*/ +uint16_t enetc_xmit_pkts (void *txq,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +uint16_t enetc_recv_pkts (void *rxq,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); + + +int enetc_refill_rx_ring (struct enetc_bdr *rx_ring,const int buff_cnt); + +static inline int +enetc_bd_unused (struct enetc_bdr *bdr) +{ +if (bdr->next_to_clean > bdr->next_to_use) +return bdr->next_to_clean - bdr->next_to_use -1 ; + +return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use -1 ; +}#endif /* _ENETC_H_ */
drivers/net/enetc/enetc_ethdev.c +324 -2
355 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c new file +239 -0
239 lines not on this page · raw message
drivers/net/enetc/meson.build +2 -1
@@ -5,6 +5,7 @@ if host_machine.system() != 'linux' build = false endif -sources = files('enetc_ethdev.c') +sources = files('enetc_ethdev.c', + 'enetc_rxtx.c') includes += include_directories('base')
Signature · 1 line
2.17.1
PATCH v4 3/4 net/enetc: support packet parse type
In reply to Gagandeep Singh--- drivers/net/enetc/enetc_ethdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/enetc/enetc_ethdev.c +19 -0
@@ -28,6 +28,7 @@ static int enetc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf);static void enetc_tx_queue_release (void *txq); +static const uint32_t *enetc_supported_ptypes_get (struct rte_eth_dev *dev);/* * The set of PCI devices this driver supports
@@ -50,6 +51,7 @@ static const struct eth_dev_ops enetc_ops = { .rx_queue_release = enetc_rx_queue_release, .tx_queue_setup = enetc_tx_queue_setup, .tx_queue_release = enetc_tx_queue_release, + .dev_supported_ptypes_get = enetc_supported_ptypes_get, };/**
@@ -165,6 +167,23 @@ enetc_dev_close(struct rte_eth_dev *dev __rte_unused)PMD_INIT_FUNC_TRACE (); } +static const uint32_t * +enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) +{ +static const uint32_t ptypes[] = { +RTE_PTYPE_L2_ETHER , +RTE_PTYPE_L3_IPV4 , +RTE_PTYPE_L3_IPV6 , +RTE_PTYPE_L4_TCP , +RTE_PTYPE_L4_UDP , +RTE_PTYPE_L4_SCTP , +RTE_PTYPE_L4_ICMP , +RTE_PTYPE_UNKNOWN + }; + +return ptypes; +} +/* return 0 means link status changed, -1 means not changed */ static int enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
Signature · 1 line
2.17.1
PATCH v4 4/4 doc: add usage doc for ENETC PMD
In reply to Gagandeep SinghAdd enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
--- MAINTAINERS | 7 ++ doc/guides/nics/enetc.rst | 110 +++++++++++++++++++++++++ doc/guides/nics/features/enetc.ini | 11 +++ doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_18_11.rst | 6 ++ 5 files changed, 135 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini
MAINTAINERS +7 -0
@@ -643,6 +643,13 @@ F: drivers/net/dpaa2/ F: doc/guides/nics/dpaa2.rst F: doc/guides/nics/features/dpaa2.ini +NXP enetc +M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> +F: drivers/net/enetc/ +F: doc/guides/nics/enetc.rst +F: doc/guides/nics/features/enetc.ini + QLogic bnx2x M: Harish Patil <[email protected]> M: Rasesh Mody <[email protected]>
doc/guides/nics/enetc.rst new file +110 -0
110 lines not on this page · raw message
doc/guides/nics/features/enetc.ini new file +11 -0
@@ -0,0 +1,11 @@ +; +; Supported features of the 'enetc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Packet type parsing = Y +Link status = Y +Linux VFIO = Y +ARMv8 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -21,6 +21,7 @@ Network Interface Controller Drivers dpaa2 e1000em ena + enetc enic fm10k i40e
doc/guides/rel_notes/release_18_11.rst +6 -0
@@ -50,6 +50,11 @@ New Features * Other libs * Apps, Examples, Tools (if significative) + * **Added NXP ENETC PMD.** + + Added the new enetc driver for NXP enetc platform. See the + "ENETC Poll Mode Driver" document for more details on this new driver. + This section is a comment. Do not overwrite or remove it. Also, make sure to start the actual text at the margin. =========================================================
@@ -156,6 +161,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_pmd_ixgbe.so.2 librte_pmd_dpaa2_cmdif.so.1 librte_pmd_dpaa2_qdma.so.1 + + librte_pmd_enetc.so.1 librte_pmd_ring.so.2 librte_pmd_softnic.so.1 librte_pmd_vhost.so.2
Signature · 1 line
2.17.1
Re: [PATCH v4 3/4] net/enetc: support packet parse type
In reply to Gagandeep SinghQuoted 5 lines · Gagandeep Singh
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/enetc/enetc_ethdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Commit message is missing in this patch.
Re: [PATCH v4 0/4] introduces the enetc PMD driver
In reply to Gagandeep SinghQuoted 19 lines · Gagandeep Singh
*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v3->v4Change-log:
* fixed patch set
v2->v3Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added inMakefile
* private list of RX/TX queues removed
* added thedev_startanddev_stopAPIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2Change-log:
* document improvement
* checkpatch warnings removed
Quoted 6 lines
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
Please feel free to use my ACK in the next version of this series (which you would have to send for 3rd/4 patch which doesn't have a commit message).
Re: [PATCH v4 1/4] net/enetc: add ENETC PMD with basic operations
In reply to Gagandeep SinghQuoted 5 lines · Gagandeep Singh
This patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware initialisation
Signed-off-by Gagandeep Singh <[email protected]>
<...>
drivers/net/enetc/base/enetc_hw.h line 165
Quoted 3 lines
drivers/net/enetc/base/enetc_hw.h new file +3
-0+struct enetc_eth_mac_info { +uint8_t addr[ETH_ADDR_LEN ]; +uint8_t perm_addr[ETH_ADDR_LEN ];
Can reuse DPDK ETHER_ADDR_LEN for this instead of re-defining? (You can skip if this is coming from a common code and you need to maintain the difference yourself for this change.)
<...>
Quoted 22 lines
drivers/net/enetc/enetc_ethdev.c new file +22
-0+static int +enetc_dev_init (struct rte_eth_dev *eth_dev) +{ +int error =0 ; +struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); + +PMD_INIT_FUNC_TRACE (); + eth_dev->dev_ops = &enetc_ops; + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; + +/* Retrieving and storing the HW base address of device */ + hw->hw.reg = (void *)pci_dev->mem_resource[0 ].addr; + hw->device_id = pci_dev->id.device_id; + + error =enetc_hardware_init (hw); +if (error !=0 ) { +ENETC_PMD_ERR ("Hardware initialization failed" ); +return -1 ; + }
drivers/net/enetc/enetc_ethdev.c line 83
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+ +/* Allocate memory for storing MAC addresses */ + eth_dev->data->mac_addrs =rte_zmalloc ("enetc_eth" ,ETHER_ADDR_LEN ,0 ); +if (!eth_dev->data->mac_addrs) { +ENETC_PMD_ERR ("Failed to allocate %d bytes needed to " +"store MAC addresses" , +ETHER_ADDR_LEN *1 ); + error = -ENOMEM ; +return -1 ; + }
Need to free eth_dev->data->mac_addrs on uninit()
<...>
Quoted 6 lines
drivers/net/enetc/enetc_ethdev.c new file +6
-0+static int +enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) +{ +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_eth_link link;
drivers/net/enetc/enetc_ethdev.c line 171
Quoted 10 lines
drivers/net/enetc/enetc_ethdev.c new file +10
-0+ +PMD_INIT_FUNC_TRACE (); + hw->mac.get_link_status =1 ; + +memset (&link,0 ,sizeof (link)); +rte_eth_linkstatus_get (dev, &link); + + link.link_duplex =ETH_LINK_FULL_DUPLEX ; + link.link_status =ETH_LINK_UP ; +rte_eth_linkstatus_set (dev, &link);
rte_eth_linkstatus_get() / rte_eth_linkstatus_set() updates variables that holds the status of the link, but this PMD function should update the HW link status not just the state.
<...>
drivers/net/enetc/enetc_logs.h line 38
Quoted 10 lines
drivers/net/enetc/enetc_logs.h new file +10
-0+/* DP Logs, toggled out at compile time if level lower than current level */ +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) +#define ENETC_PMD_DP_INFO(fmt, args...) \ + ENETC_PMD_DP_LOG(INFO, fmt, ## args) +#define ENETC_PMD_DP_WARN(fmt, args...) \ + ENETC_PMD_DP_LOG(WARNING, fmt, ## args)
What about adding DP logs when you need them?
Re: [PATCH v4 2/4] net/enetc: enable Rx and Tx
In reply to Gagandeep SinghQuoted 3 lines · Gagandeep Singh
Add RX and TX queue setup, datapath functions
Signed-off-by Gagandeep Singh <[email protected]>
<...>
Quoted 15 lines
drivers/net/enetc/base/enetc_hw.h +4
-6@@ -104,16 +104,19 @@ enum enetc_bdr_type {TX, RX};#define ETH_ADDR_LEN 6/* general register accessors */ -#define enetc_rd_reg (reg) rte_read32((reg)) -#define enetc_wr_reg (reg, val) rte_write32((val), (reg)) -#define enetc_rd (hw, off) enetc_rd_reg((hw)->reg + (off)) -#define enetc_wr (hw, off, val) enetc_wr_reg((hw)->reg + (off), val) +#define enetc_rd_reg (reg) rte_read32((void *)(reg)) +#define enetc_wr_reg (reg, val) rte_write32((val), (void *)(reg)) +#define enetc_rd (hw, off) enetc_rd_reg((size_t)(hw)->reg + (off)) +#define enetc_wr (hw, off, val) enetc_wr_reg((size_t)(hw)->reg + (off), val)/* port register accessors - PF only */ -#define enetc_port_rd (hw, off) enetc_rd_reg((hw)->port + (off)) -#define enetc_port_wr (hw, off, val) enetc_wr_reg((hw)->port + (off), val)
drivers/net/enetc/base/enetc_hw.h enum enetc_bdr_type {TX, RX}; · line 119
Quoted 10 lines
drivers/net/enetc/base/enetc_hw.h +7
-2+#define enetc_port_rd (hw, off) enetc_rd_reg((size_t)(hw)->port + (off)) +#define enetc_port_wr (hw, off, val) \ + enetc_wr_reg((size_t)(hw)->port + (off), val)/* global register accessors - PF only */ -#define enetc_global_rd (hw, off) enetc_rd_reg((hw)->global + (off)) -#define enetc_global_wr (hw, off, val) enetc_wr_reg((hw)->global + (off), val) +#define enetc_global_rd (hw, off) \ + enetc_rd_reg((size_t)(hw)->global + (off)) +#define enetc_global_wr (hw, off, val) \ + enetc_wr_reg((size_t)(hw)->global + (off), val)
Is there any reason to not add these functions as updated version at first plane at previous patch?
drivers/net/enetc/enetc.h line 21
Quoted 13 lines
drivers/net/enetc/base/enetc_hw.h +0
-0/* BDR register accessors, see ENETC_BDR() */ #define enetc_bdr_rd (hw, t, n, off) \ enetc_rd(hw, ENETC_BDR(t, n, off))drivers/net/enetc/enetc.h +1
-1@@ -18,7 +18,11 @@#define MAX_RX_RINGS 1/* Max BD counts per Ring. */ -#define MAX_BD_COUNT 256 +#define MAX_BD_COUNT 64000
Same here, is there a reason this has not been defined as 64000 in prev patch at first place.
Or if this variable not used in prev patch at all, why not introduce here.
<...>
drivers/net/enetc/enetc.h static const struct eth_dev_ops enetc_ops = { · line 52
Quoted 8 lines
drivers/net/enetc/enetc.h +4
-0@@ -37,6 +46,10 @@ static const struct eth_dev_ops enetc_ops = { .dev_close = enetc_dev_close, .link_update = enetc_link_update, .dev_infos_get = enetc_dev_infos_get, + .rx_queue_setup = enetc_rx_queue_setup, + .rx_queue_release = enetc_rx_queue_release, + .tx_queue_setup = enetc_tx_queue_setup, + .tx_queue_release = enetc_tx_queue_release,
It is not very explicit in API doc but generally PMDs clean all queue related resources in dev_close() too, can you please implement it.
Re: [PATCH v4 3/4] net/enetc: support packet parse type
In reply to Shreyansh JainQuoted 8 lines · Shreyansh Jain
Quoted 5 lines · Gagandeep Singh
Signed-off-by Gagandeep Singh <[email protected]>--- drivers/net/enetc/enetc_ethdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Commit message is missing in this patch.
+1 to provide some details.
Re: [PATCH v4 4/4] doc: add usage doc for ENETC PMD
In reply to Gagandeep SinghQuoted 6 lines · Gagandeep Singh
Add enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
Signed-off-by Gagandeep Singh <[email protected]>
<...>
MAINTAINERS F: drivers/net/dpaa2/ · line 649
Quoted 8 lines
MAINTAINERS +4
-0@@ -643,6 +643,13 @@ F: drivers/net/dpaa2/ F: doc/guides/nics/dpaa2.rst F: doc/guides/nics/features/dpaa2.ini +NXP enetc +M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> +F: drivers/net/enetc/
Can you please add above part with patch 1/4, and append rest with this patch.
<...>
doc/guides/nics/features/enetc.ini line 11
Quoted 12 lines
doc/guides/nics/features/enetc.ini new file +11
-0@@ -0,0 +1,11 @@ +; +; Supported features of the 'enetc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Packet type parsing = Y +Link status = Y +Linux VFIO = Y +ARMv8 = Y +Usage doc = Y
Can you please add .ini file with patch 1/4, so you will need to above MAINTAINERS part to add .ini file too
And add "Packet type parsing = Y" part with patch 3/4
<...>
doc/guides/rel_notes/release_18_11.rst The libraries prepended with a plus sign were incremented in this version. · line 164
Quoted 5 lines
doc/guides/rel_notes/release_18_11.rst +1
-0@@ -156,6 +161,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_pmd_ixgbe.so.2 librte_pmd_dpaa2_cmdif.so.1 librte_pmd_dpaa2_qdma.so.1 + + librte_pmd_enetc.so.1
No need to add this one, there is no API that this PMD provides.
v5 cover introduces the enetc PMD driver
In reply to Gagandeep Singh*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v4->v5 Change-log:
* missing commit info added in patch [3/4]
* dev_close API implemented
* link_update API updated
* all comments handled
v3->v4 Change-log:
* fixed patch set
v2->v3 Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added in Makefile
* private list of RX/TX queues removed
* added the dev_start and dev_stop APIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2 Change-log:
* document improvement
* checkpatch warnings removed
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
MAINTAINERS | 7 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/enetc.rst | 110 ++++ doc/guides/nics/features/enetc.ini | 11 + doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_18_11.rst | 5 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 23 + drivers/net/enetc/base/enetc_hw.h | 226 +++++++ drivers/net/enetc/enetc.h | 113 ++++ drivers/net/enetc/enetc_ethdev.c | 631 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 40 ++ drivers/net/enetc/enetc_rxtx.c | 239 ++++++++ drivers/net/enetc/meson.build | 11 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 18 files changed, 1434 insertions(+) create mode 100644 doc/guides/nics/enetc.rst create mode 100644 doc/guides/nics/features/enetc.ini create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/enetc_rxtx.c create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
Signature · 1 line
2.17.1
PATCH v5 1/4 net/enetc: add ENETC PMD with basic operations
This patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware initialisation
--- MAINTAINERS | 6 + config/common_base | 5 + config/common_linuxapp | 5 + doc/guides/nics/features/enetc.ini | 9 + drivers/net/Makefile | 1 + drivers/net/enetc/Makefile | 22 ++ drivers/net/enetc/base/enetc_hw.h | 226 ++++++++++++++++ drivers/net/enetc/enetc.h | 87 +++++++ drivers/net/enetc/enetc_ethdev.c | 275 ++++++++++++++++++++ drivers/net/enetc/enetc_logs.h | 29 +++ drivers/net/enetc/meson.build | 10 + drivers/net/enetc/rte_pmd_enetc_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 14 files changed, 681 insertions(+) create mode 100644 doc/guides/nics/features/enetc.ini create mode 100644 drivers/net/enetc/Makefile create mode 100644 drivers/net/enetc/base/enetc_hw.h create mode 100644 drivers/net/enetc/enetc.h create mode 100644 drivers/net/enetc/enetc_ethdev.c create mode 100644 drivers/net/enetc/enetc_logs.h create mode 100644 drivers/net/enetc/meson.build create mode 100644 drivers/net/enetc/rte_pmd_enetc_version.map
MAINTAINERS +6 -0
@@ -643,6 +643,12 @@ F: drivers/net/dpaa2/ F: doc/guides/nics/dpaa2.rst F: doc/guides/nics/features/dpaa2.ini +NXP enetc +M: Gagandeep Singh <[email protected]> +M: Pankaj Chauhan <[email protected]> +F: drivers/net/enetc/ +F: doc/guides/nics/features/enetc.ini + QLogic bnx2x M: Harish Patil <[email protected]> M: Rasesh Mody <[email protected]>
config/common_base +5 -0
@@ -217,6 +217,11 @@ CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=y CONFIG_RTE_LIBRTE_DPAA2_PMD=n CONFIG_RTE_LIBRTE_DPAA2_DEBUG_DRIVER=n +# +# Compile NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=n + # # Compile burst-oriented Amazon ENA PMD driver #
config/common_linuxapp +5 -0
@@ -44,3 +44,8 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y + +# +# NXP ENETC PMD Driver +# +CONFIG_RTE_LIBRTE_ENETC_PMD=y
doc/guides/nics/features/enetc.ini new file +9 -0
@@ -0,0 +1,9 @@ +; +; Supported features of the 'enetc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Link status = Y +Linux VFIO = Y +ARMv8 = Y
drivers/net/Makefile +1 -0
@@ -24,6 +24,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 endif DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000 DIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena +DIRS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic DIRS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += failsafe DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
drivers/net/enetc/Makefile new file +22 -0
@@ -0,0 +1,22 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_enetc.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_pmd_enetc_version.map +LIBABIVER := 1 + +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c + +LDLIBS += -lrte_eal +LDLIBS += -lrte_ethdev +LDLIBS += -lrte_bus_pci + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/enetc/base/enetc_hw.h new file +226 -0
226 lines not on this page · raw message
drivers/net/enetc/enetc.h new file +87 -0
87 lines not on this page · raw message
drivers/net/enetc/enetc_ethdev.c new file +275 -0
275 lines not on this page · raw message
drivers/net/enetc/enetc_logs.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright 2018 NXP +*/ + +#ifndef _ENETC_LOGS_H_ +#define _ENETC_LOGS_H_ + +extern int enetc_logtype_pmd; + +#define ENETC_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, enetc_logtype_pmd, "enetc_net: " \ + fmt "\n", ##args) + +#define ENETC_PMD_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, enetc_logtype_pmd, "enetc_net: %s(): "\ + fmt "\n", __func__, ##args) + +#define PMD_INIT_FUNC_TRACE () ENETC_PMD_DEBUG(">>") + +#define ENETC_PMD_CRIT(fmt, args...) \ + ENETC_PMD_LOG(CRIT, fmt, ## args) +#define ENETC_PMD_INFO(fmt, args...) \ + ENETC_PMD_LOG(INFO, fmt, ## args) +#define ENETC_PMD_ERR(fmt, args...) \ + ENETC_PMD_LOG(ERR, fmt, ## args) +#define ENETC_PMD_WARN(fmt, args...) \ + ENETC_PMD_LOG(WARNING, fmt, ## args) + +#endif /* _ENETC_LOGS_H_*/
drivers/net/enetc/meson.build new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +if host_machine.system() != 'linux' + build = false +endif + +sources = files('enetc_ethdev.c') + +includes += include_directories('base')
drivers/net/enetc/rte_pmd_enetc_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_18.11 { + + local: *; +};
drivers/net/meson.build +1 -0
@@ -11,6 +11,7 @@ drivers = ['af_packet', 'dpaa', 'dpaa2', 'e1000', 'ena', + 'enetc', 'enic', 'failsafe', 'fm10k', 'i40e',
mk/rte.app.mk +1 -0
@@ -135,6 +135,7 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += -lrte_pmd_enetc _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
Signature · 1 line
2.17.1
PATCH v5 3/4 net/enetc: support packet parse type
In reply to Gagandeep Singhenable supported packet parse types feature
--- doc/guides/nics/features/enetc.ini | 1 + drivers/net/enetc/enetc_ethdev.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
doc/guides/nics/features/enetc.ini +1 -0
@@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Packet type parsing = Y Link status = Y Linux VFIO = Y ARMv8 = Y
drivers/net/enetc/enetc_ethdev.c +19 -0
@@ -28,6 +28,7 @@ static int enetc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf);static void enetc_tx_queue_release (void *txq); +static const uint32_t *enetc_supported_ptypes_get (struct rte_eth_dev *dev);/* * The set of PCI devices this driver supports
@@ -50,6 +51,7 @@ static const struct eth_dev_ops enetc_ops = { .rx_queue_release = enetc_rx_queue_release, .tx_queue_setup = enetc_tx_queue_setup, .tx_queue_release = enetc_tx_queue_release, + .dev_supported_ptypes_get = enetc_supported_ptypes_get, };/**
@@ -182,6 +184,23 @@ enetc_dev_close(struct rte_eth_dev *dev) dev->data->nb_tx_queues =0 ; } +static const uint32_t * +enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) +{ +static const uint32_t ptypes[] = { +RTE_PTYPE_L2_ETHER , +RTE_PTYPE_L3_IPV4 , +RTE_PTYPE_L3_IPV6 , +RTE_PTYPE_L4_TCP , +RTE_PTYPE_L4_UDP , +RTE_PTYPE_L4_SCTP , +RTE_PTYPE_L4_ICMP , +RTE_PTYPE_UNKNOWN + }; + +return ptypes; +} +/* return 0 means link status changed, -1 means not changed */ static int enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
Signature · 1 line
2.17.1
PATCH v5 2/4 net/enetc: enable Rx and Tx
In reply to Gagandeep SinghAdd RX and TX queue setup, datapath functions
--- drivers/net/enetc/Makefile | 3 +- drivers/net/enetc/enetc.h | 26 +++ drivers/net/enetc/enetc_ethdev.c | 343 ++++++++++++++++++++++++++++++- drivers/net/enetc/enetc_logs.h | 11 + drivers/net/enetc/enetc_rxtx.c | 239 +++++++++++++++++++++ drivers/net/enetc/meson.build | 3 +- 6 files changed, 620 insertions(+), 5 deletions(-) create mode 100644 drivers/net/enetc/enetc_rxtx.c
drivers/net/enetc/Makefile +2 -1
@@ -14,8 +14,9 @@ EXPORT_MAP := rte_pmd_enetc_version.map LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c -LDLIBS += -lrte_eal +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool LDLIBS += -lrte_ethdev LDLIBS += -lrte_bus_pci
drivers/net/enetc/enetc.h +26 -0
@@ -17,6 +17,13 @@/* Max RX rings per ENTEC. */ #define MAX_RX_RINGS 1 +/* Max BD counts per Ring. */ +#define MAX_BD_COUNT 64000 +/* Min BD counts per Ring. */ +#define MIN_BD_COUNT 32 +/* BD ALIGN */ +#define BD_ALIGN 8 +/* * upper_32_bits - return bits 32-63 of a number * @n: the number we're accessing
@@ -84,4 +91,23 @@ struct enetc_eth_adapter {#define ENETC_REG_WRITE (addr, val) (*(uint32_t *)addr = val)#define ENETC_REG_WRITE_RELAXED (addr, val) (*(uint32_t *)addr = val) +/* +* RX/TX ENETC function prototypes +*/ +uint16_t enetc_xmit_pkts (void *txq,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +uint16_t enetc_recv_pkts (void *rxq,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); + + +int enetc_refill_rx_ring (struct enetc_bdr *rx_ring,const int buff_cnt); + +static inline int +enetc_bd_unused (struct enetc_bdr *bdr) +{ +if (bdr->next_to_clean > bdr->next_to_use) +return bdr->next_to_clean - bdr->next_to_use -1 ; + +return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use -1 ; +}#endif /* _ENETC_H_ */
drivers/net/enetc/enetc_ethdev.c +340 -3
380 lines not on this page · raw message
drivers/net/enetc/enetc_logs.h +11 -0
@@ -26,4 +26,15 @@ extern int enetc_logtype_pmd; #define ENETC_PMD_WARN(fmt, args...) \ ENETC_PMD_LOG(WARNING, fmt, ## args) +/* DP Logs, toggled out at compile time if level lower than current level */ +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) +#define ENETC_PMD_DP_INFO(fmt, args...) \ + ENETC_PMD_DP_LOG(INFO, fmt, ## args) +#define ENETC_PMD_DP_WARN(fmt, args...) \ + ENETC_PMD_DP_LOG(WARNING, fmt, ## args) +#endif /* _ENETC_LOGS_H_*/
drivers/net/enetc/enetc_rxtx.c new file +239 -0
239 lines not on this page · raw message
drivers/net/enetc/meson.build +2 -1
@@ -5,6 +5,7 @@ if host_machine.system() != 'linux' build = false endif -sources = files('enetc_ethdev.c') +sources = files('enetc_ethdev.c', + 'enetc_rxtx.c') includes += include_directories('base')
Signature · 1 line
2.17.1
PATCH v5 4/4 doc: add usage doc for ENETC PMD
In reply to Gagandeep SinghAdd enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
--- MAINTAINERS | 1 + doc/guides/nics/enetc.rst | 110 +++++++++++++++++++++++++ doc/guides/nics/features/enetc.ini | 1 + doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_18_11.rst | 5 ++ 5 files changed, 118 insertions(+) create mode 100644 doc/guides/nics/enetc.rst
MAINTAINERS +1 -0
@@ -647,6 +647,7 @@ NXP enetc M: Gagandeep Singh <[email protected]> M: Pankaj Chauhan <[email protected]> F: drivers/net/enetc/ +F: doc/guides/nics/enetc.rst F: doc/guides/nics/features/enetc.ini QLogic bnx2x
doc/guides/nics/enetc.rst new file +110 -0
110 lines not on this page · raw message
doc/guides/nics/features/enetc.ini +1 -0
@@ -8,3 +8,4 @@ Packet type parsing = Y Link status = Y Linux VFIO = Y ARMv8 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -21,6 +21,7 @@ Network Interface Controller Drivers dpaa2 e1000em ena + enetc enic fm10k i40e
doc/guides/rel_notes/release_18_11.rst +5 -0
@@ -50,6 +50,11 @@ New Features * Other libs * Apps, Examples, Tools (if significative) + * **Added NXP ENETC PMD.** + + Added the new enetc driver for NXP enetc platform. See the + "ENETC Poll Mode Driver" document for more details on this new driver. + This section is a comment. Do not overwrite or remove it. Also, make sure to start the actual text at the margin. =========================================================
Signature · 1 line
2.17.1
Re: [PATCH v5 1/4] net/enetc: add ENETC PMD with basic operations
In reply to Gagandeep SinghQuoted 5 lines · Gagandeep Singh
This patch introduces the enetc PMD with basic initialisation functions includes probe, teardown, hardware initialisation
Signed-off-by Gagandeep Singh <[email protected]>
<...>
mk/rte.app.mk endif · line 141
Quoted 8 lines
mk/rte.app.mk +1
-0@@ -135,6 +135,7 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += -lrte_pmd_enetc _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
Alphabetical order please, I can fix while merging.
Re: [PATCH v5 4/4] doc: add usage doc for ENETC PMD
In reply to Gagandeep SinghQuoted 6 lines · Gagandeep Singh
Add enetc usage document to compile and run the DPDK application on enetc supported platform. This document introduces the enetc driver, supported platforms and supported features.
Signed-off-by Gagandeep Singh <[email protected]>
<...>
doc/guides/rel_notes/release_18_11.rst New Features · line 60
Quoted 12 lines
doc/guides/rel_notes/release_18_11.rst +5
-0@@ -50,6 +50,11 @@ New Features * Other libs * Apps, Examples, Tools (if significative) + * **Added NXP ENETC PMD.** + + Added the new enetc driver for NXP enetc platform. See the + "ENETC Poll Mode Driver" document for more details on this new driver. + This section is a comment. Do not overwrite or remove it. Also, make sure to start the actual text at the margin. =========================================================
This seems put into comment part of the section, I can fix while merging.
Re: [PATCH v5 0/4] introduces the enetc PMD driver
In reply to Gagandeep SinghQuoted 25 lines · Gagandeep Singh
*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v4->v5Change-log:
* missing commit info added in patch [3/4]
*dev_closeAPI implemented
*link_updateAPI updated
* all comments handled
v3->v4Change-log:
* fixed patch set
v2->v3Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added inMakefile
* private list of RX/TX queues removed
* added thedev_startanddev_stopAPIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2Change-log:
* document improvement
* checkpatch warnings removed
Quoted 5 lines
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
For series,
Series applied to dpdk-next-net/master, thanks.
Re: [PATCH v5 0/4] introduces the enetc PMD driver
Quoted 32 lines · Ferruh Yigit
Quoted 25 lines · Gagandeep Singh
*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
v4->v5Change-log:
* missing commit info added in patch [3/4]
*dev_closeAPI implemented
*link_updateAPI updated
* all comments handled
v3->v4Change-log:
* fixed patch set
v2->v3Change-log:
* Added a release note
* commom part of documentation is removed
* cflag Werror added inMakefile
* private list of RX/TX queues removed
* added thedev_startanddev_stopAPIs
* added rx/tx queue release APIs
* packet parse type feature enabled
v1->v2Change-log:
* document improvement
* checkpatch warnings removedQuoted 5 lines
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMD
Quoted 7 lines
For series,
Reviewed-by Ferruh Yigit <[email protected]>Acked-by Shreyansh Jain <[email protected]>Series applied to dpdk-next-net/master, thanks.
Can you please send a web page patch [1], to announce NIC support [2]?
You can benefit from recent samples like 'Marvell NETA' [3] or 'Aquantia Atlantic' [4].
Thanks,
ferruh
[1]
https://git.dpdk.org/tools/dpdk-web/
[2]
https://core.dpdk.org/supported/
[3]
https://mails.dpdk.org/archives/web/2018-October/000908.html
[4]
https://mails.dpdk.org/archives/web/2018-November/000922.html
Re: [PATCH v5 0/4] introduces the enetc PMD driver
Hello Ferruh,
Quoted 5 lines · Ferruh Yigit
Quoted 4 lines · Ferruh Yigit
Quoted 3 lines · Gagandeep Singh
*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
...
...
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMDFor series,
Reviewed-by Ferruh Yigit <[email protected]>Acked-by Shreyansh Jain <[email protected]>
Quoted 7 lines
Quoted 2 lines
Series applied to dpdk-next-net/master, thanks.
Can you please send a web page patch [1], to announce NIC support [2]?
You can benefit from recent samples like 'Marvell NETA' [3] or 'Aquantia Atlantic' [4].
I have sent a patch for this here [5] - which also fixes/elaborates existing device names.
[5] https://mails.dpdk.org/archives/web/2018-November/000948.html
Re: [PATCH v5 0/4] introduces the enetc PMD driver
Quoted 24 lines · Shreyansh Jain
Hello Ferruh,
Quoted 5 lines · Ferruh Yigit
Quoted 4 lines · Ferruh Yigit
Quoted 3 lines · Gagandeep Singh
*ENETC* PMD driver which integrates with the existing PCI bus. Document is also part of the set
...
...Quoted 14 lines
Quoted 13 lines
Quoted 5 lines
Gagandeep Singh (4):
net/enetc: add ENETC PMD with basic operations
net/enetc: enable Rx and Tx
net/enetc: support packet parse type
doc: add usage doc for ENETC PMDFor series,
Reviewed-by Ferruh Yigit <[email protected]>Acked-by Shreyansh Jain <[email protected]>Series applied to dpdk-next-net/master, thanks.
Quoted 7 lines
Quoted 4 lines
Can you please send a web page patch [1], to announce NIC support [2]?
You can benefit from recent samples like 'Marvell NETA' [3] or 'Aquantia Atlantic' [4].
I have sent a patch for this here [5] - which also fixes/elaborates existing device names.
Great, thanks.
Quoted 21 lines
[5] https://mails.dpdk.org/archives/web/2018-November/000948.html