OCTEON TX2 Ethdev driver
Subsystems (2)
cover OCTEON TX2 Ethdev driver
From: Jerin Jacob <[email protected]>
This patchset adds support for OCTEON TX2 ethdev driver.
This patch set is depended on "OCTEON TX2 common and mempool driver" series.
http://mails.dpdk.org/archives/dev/2019-June/133329.html
This patches series also available at https://github.com/jerinjacobk/dpdk-octeontx2-nix
including the dependency patches for quick download and review.
Harman Kalra (2):
net/octeontx2: add PTP base support
net/octeontx2: add remaining PTP operations
Jerin Jacob (17):
net/octeontx2: add build infrastructure net/octeontx2: add ethdev probe and remove net/octeontx2: add device init and uninit net/octeontx2: add devargs parsing functions net/octeontx2: handle device error interrupts net/octeontx2: add info get operation net/octeontx2: add device configure operation net/octeontx2: handle queue specific error interrupts net/octeontx2: add context debug utils net/octeontx2: add Rx queue setup and release net/octeontx2: add Tx queue setup and release net/octeontx2: add ptype support net/octeontx2: add Rx and Tx descriptor operations net/octeontx2: add Rx burst support net/octeontx2: add Rx vector version net/octeontx2: add Tx burst support
doc: add Marvell OCTEON TX2 ethdev documentation
Kiran Kumar K (13):
net/octeontx2: add register dump support net/octeontx2: add basic stats operation net/octeontx2: add extended stats operations net/octeontx2: introducing flow driver net/octeontx2: flow utility functions net/octeontx2: flow mailbox utility net/octeontx2: add flow MCAM utility functions net/octeontx2: add flow parsing for outer layers net/octeontx2: adding flow parsing for inner layers net/octeontx2: add flow actions support net/octeontx2: add flow operations net/octeontx2: add additional flow operations net/octeontx2: add flow init and fini
Krzysztof Kanas (2):
net/octeontx2: alloc and free TM HW resources net/octeontx2: enable Tx through traffic manager
Nithin Dabilpuram (9):
net/octeontx2: add queue start and stop operations net/octeontx2: introduce traffic manager net/octeontx2: configure TM HW resources net/octeontx2: add queue info and pool supported operations net/octeontx2: add Rx multi segment version net/octeontx2: add Tx multi segment version net/octeontx2: add Tx vector version net/octeontx2: add device start operation net/octeontx2: add device stop and close operations
Sunil Kumar Kori (1):
net/octeontx2: add unicast MAC filter
Vamsi Attunuru (9):
net/octeontx2: add link stats operations net/octeontx2: add promiscuous and allmulticast mode net/octeontx2: add RSS support net/octeontx2: handle port reconfigure net/octeontx2: add link status set operations net/octeontx2: add module EEPROM dump net/octeontx2: add flow control support net/octeontx2: add FW version get operation net/octeontx2: add MTU set operation
Vivek Sharma (5):
net/octeontx2: connect flow API to ethdev ops net/octeontx2: implement VLAN utility functions net/octeontx2: support VLAN offloads net/octeontx2: support VLAN filters net/octeontx2: support VLAN TPID and PVID for Tx
MAINTAINERS | 8 + config/common_base | 5 + doc/guides/nics/features/octeontx2.ini | 47 + doc/guides/nics/features/octeontx2_vec.ini | 44 + doc/guides/nics/features/octeontx2_vf.ini | 39 + doc/guides/nics/index.rst | 1 + doc/guides/nics/octeontx2.rst | 289 +++ doc/guides/platform/octeontx2.rst | 3 + doc/guides/rel_notes/release_19_05.rst | 1 + drivers/net/Makefile | 1 + drivers/net/meson.build | 2 +- drivers/net/octeontx2/Makefile | 56 + drivers/net/octeontx2/meson.build | 41 + drivers/net/octeontx2/otx2_ethdev.c | 1959 +++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 496 +++++ drivers/net/octeontx2/otx2_ethdev_debug.c | 500 +++++ drivers/net/octeontx2/otx2_ethdev_devargs.c | 143 ++ drivers/net/octeontx2/otx2_ethdev_irq.c | 346 +++ drivers/net/octeontx2/otx2_ethdev_ops.c | 454 ++++ drivers/net/octeontx2/otx2_flow.c | 951 ++++++++ drivers/net/octeontx2/otx2_flow.h | 384 ++++ drivers/net/octeontx2/otx2_flow_ctrl.c | 230 ++ drivers/net/octeontx2/otx2_flow_parse.c | 944 ++++++++ drivers/net/octeontx2/otx2_flow_utils.c | 884 ++++++++ drivers/net/octeontx2/otx2_link.c | 157 ++ drivers/net/octeontx2/otx2_lookup.c | 279 +++ drivers/net/octeontx2/otx2_mac.c | 149 ++ drivers/net/octeontx2/otx2_ptp.c | 273 +++ drivers/net/octeontx2/otx2_rss.c | 378 ++++ drivers/net/octeontx2/otx2_rx.c | 410 ++++ drivers/net/octeontx2/otx2_rx.h | 333 +++ drivers/net/octeontx2/otx2_stats.c | 387 ++++ drivers/net/octeontx2/otx2_tm.c | 1396 ++++++++++++ drivers/net/octeontx2/otx2_tm.h | 153 ++ drivers/net/octeontx2/otx2_tx.c | 1033 +++++++++ drivers/net/octeontx2/otx2_tx.h | 370 ++++ drivers/net/octeontx2/otx2_vlan.c | 933 ++++++++ .../octeontx2/rte_pmd_octeontx2_version.map | 7 + mk/rte.app.mk | 2 + 39 files changed, 14087 insertions(+), 1 deletion(-) create mode 100644 doc/guides/nics/features/octeontx2.ini create mode 100644 doc/guides/nics/features/octeontx2_vec.ini create mode 100644 doc/guides/nics/features/octeontx2_vf.ini create mode 100644 doc/guides/nics/octeontx2.rst create mode 100644 drivers/net/octeontx2/Makefile create mode 100644 drivers/net/octeontx2/meson.build create mode 100644 drivers/net/octeontx2/otx2_ethdev.c create mode 100644 drivers/net/octeontx2/otx2_ethdev.h create mode 100644 drivers/net/octeontx2/otx2_ethdev_debug.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_devargs.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_irq.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_ops.c create mode 100644 drivers/net/octeontx2/otx2_flow.c create mode 100644 drivers/net/octeontx2/otx2_flow.h create mode 100644 drivers/net/octeontx2/otx2_flow_ctrl.c create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c create mode 100644 drivers/net/octeontx2/otx2_flow_utils.c create mode 100644 drivers/net/octeontx2/otx2_link.c create mode 100644 drivers/net/octeontx2/otx2_lookup.c create mode 100644 drivers/net/octeontx2/otx2_mac.c create mode 100644 drivers/net/octeontx2/otx2_ptp.c create mode 100644 drivers/net/octeontx2/otx2_rss.c create mode 100644 drivers/net/octeontx2/otx2_rx.c create mode 100644 drivers/net/octeontx2/otx2_rx.h create mode 100644 drivers/net/octeontx2/otx2_stats.c create mode 100644 drivers/net/octeontx2/otx2_tm.c create mode 100644 drivers/net/octeontx2/otx2_tm.h create mode 100644 drivers/net/octeontx2/otx2_tx.c create mode 100644 drivers/net/octeontx2/otx2_tx.h create mode 100644 drivers/net/octeontx2/otx2_vlan.c create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.map
Signature · 1 line
2.21.0
PATCH 1/58 net/octeontx2: add build infrastructure
From: Jerin Jacob <[email protected]>
Adding bare minimum PMD library and doc build infrastructure.
--- config/common_base | 5 +++ doc/guides/nics/features/octeontx2.ini | 8 ++++ doc/guides/nics/features/octeontx2_vec.ini | 8 ++++ doc/guides/nics/features/octeontx2_vf.ini | 8 ++++ drivers/net/Makefile | 1 + drivers/net/meson.build | 2 +- drivers/net/octeontx2/Makefile | 38 +++++++++++++++++++ drivers/net/octeontx2/meson.build | 24 ++++++++++++ drivers/net/octeontx2/otx2_ethdev.c | 3 ++ .../octeontx2/rte_pmd_octeontx2_version.map | 4 ++ mk/rte.app.mk | 2 + 11 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 doc/guides/nics/features/octeontx2.ini create mode 100644 doc/guides/nics/features/octeontx2_vec.ini create mode 100644 doc/guides/nics/features/octeontx2_vf.ini create mode 100644 drivers/net/octeontx2/Makefile create mode 100644 drivers/net/octeontx2/meson.build create mode 100644 drivers/net/octeontx2/otx2_ethdev.c create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.map
config/common_base +5 -0
@@ -405,6 +405,11 @@ CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n # CONFIG_RTE_LIBRTE_OCTEONTX_PMD=y +# +# Compile burst-oriented Cavium OCTEONTX2 network PMD driver +# +CONFIG_RTE_LIBRTE_OCTEONTX2_PMD=y + # # Compile WRS accelerated virtual port (AVP) guest PMD driver #
doc/guides/nics/features/octeontx2.ini new file +8 -0
@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y
doc/guides/nics/features/octeontx2_vec.ini new file +8 -0
@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2_vec' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y
doc/guides/nics/features/octeontx2_vf.ini new file +8 -0
@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y
drivers/net/Makefile +1 -0
@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx +DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += octeontx2 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
drivers/net/meson.build +1 -1
@@ -31,7 +31,7 @@ drivers = ['af_packet', 'netvsc', 'nfb', 'nfp', - 'null', 'octeontx', 'pcap', 'qede', 'ring', + 'null', 'octeontx', 'octeontx2', 'pcap', 'ring', 'sfc', 'softnic', 'szedata2',
drivers/net/octeontx2/Makefile new file +38 -0
@@ -0,0 +1,38 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_octeontx2.a + +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 +CFLAGS += -O3 +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -flax-vector-conversions + +ifneq ($(CONFIG_RTE_ARCH_64),y) +CFLAGS += -Wno-int-to-pointer-cast +CFLAGS += -Wno-pointer-to-int-cast +endif + +EXPORT_MAP := rte_pmd_octeontx2_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_ethdev.c + +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_bus_pci -lrte_mempool_octeontx2 + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build new file +24 -0
@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +sources = files( + 'otx2_ethdev.c', + ) + +allow_experimental_apis = true +deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] + +cflags += ['-flax-vector-conversions','-DALLOW_EXPERIMENTAL_API'] + +extra_flags = [] +# This integrated controller runs only on a arm64 machine, remove 32bit warnings +if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] +endif + +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeach
drivers/net/octeontx2/otx2_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/
drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_19.05 { + + local: *; +};
mk/rte.app.mk +2 -0
@@ -127,6 +127,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX) += -lrte_common_dpaax endif OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) +OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) ifeq ($(findstring y,$(OCTEONTX2-y)),y) _LDLIBS-y += -lrte_common_octeontx2 endif
@@ -197,6 +198,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += -lrte_pmd_mvneta _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += -lrte_pmd_octeontx2 -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH v1 01/58] net/octeontx2: add build infrastructure
Quoted 7 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Adding bare minimum PMD library and doc build infrastructure.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Pavan Nikhilesh <[email protected]>
Quoted 12 lines
--- config/common_base | 5 +++ doc/guides/nics/features/octeontx2.ini | 8 ++++ doc/guides/nics/features/octeontx2_vec.ini | 8 ++++ doc/guides/nics/features/octeontx2_vf.ini | 8 ++++ drivers/net/Makefile | 1 + drivers/net/meson.build | 2 +- drivers/net/octeontx2/Makefile | 38 +++++++++++++++++++ drivers/net/octeontx2/meson.build | 24 ++++++++++++ drivers/net/octeontx2/otx2_ethdev.c | 3 ++ .../octeontx2/rte_pmd_octeontx2_version.map | 4 ++ mk/rte.app.mk | 2 +
It can be good to include MAINTAINERS file in this patch, of course with the content that introduced in this patch.
Quoted 14 lines
11 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 doc/guides/nics/features/octeontx2.ini create mode 100644 doc/guides/nics/features/octeontx2_vec.ini create mode 100644 doc/guides/nics/features/octeontx2_vf.ini create mode 100644 drivers/net/octeontx2/Makefile create mode 100644 drivers/net/octeontx2/meson.build create mode 100644 drivers/net/octeontx2/otx2_ethdev.c create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.mapconfig/common_base +0
-0
config/common_base CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n · line 412
Quoted 8 lines
config/common_base +5
-0@@ -405,6 +405,11 @@ CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n # CONFIG_RTE_LIBRTE_OCTEONTX_PMD=y +# +# Compile burst-oriented Cavium OCTEONTX2 network PMD driver +# +CONFIG_RTE_LIBRTE_OCTEONTX2_PMD=y +
Since .ini files only has "ARMv8", should the PMD disabled in other config files? Or is the support coming for those architectures in next patches?
If this is only for Armv8 & Linux, better to keep disabled it in the base config and enable only in that specific config file.
Quoted 23 lines
config/common_base +0
-0# # Compile WRS accelerated virtual port (AVP) guest PMD driver #doc/guides/nics/features/octeontx2.ini new file +8
-0@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Ydoc/guides/nics/features/octeontx2_vec.ini new file +0
-0
doc/guides/nics/features/octeontx2_vec.ini line 8
Quoted 8 lines
doc/guides/nics/features/octeontx2_vec.ini new file +8
-0@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2_vec' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y
I think it is good to introduce vector .ini file with the patch that enables vector path, same with below vf one.
Quoted 31 lines
doc/guides/nics/features/octeontx2_vf.ini new file +8
-0@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Ydrivers/net/Makefile +1
-0@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx +DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += octeontx2 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ringdrivers/net/meson.build +0
-0
drivers/net/meson.build drivers = ['af_packet', · line 34
Quoted 5 lines
drivers/net/meson.build +1
-1@@ -31,7 +31,7 @@ drivers = ['af_packet', 'netvsc', 'nfb', 'nfp', - 'null', 'octeontx', 'pcap', 'qede', 'ring', + 'null', 'octeontx', 'octeontx2', 'pcap', 'ring',
Multiline is causing conflicts, can you please break the line while adding new one, like:
'null', 'octeontx',
'octeontx2',
'qede', 'ring',
Quoted 16 lines
drivers/net/meson.build +0
-0'sfc', 'softnic', 'szedata2',drivers/net/octeontx2/Makefile new file +7
-0@@ -0,0 +1,38 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +#
drivers/net/octeontx2/Makefile line 17
Quoted 10 lines
drivers/net/octeontx2/Makefile new file +10
-0+# library name +# +LIB = librte_pmd_octeontx2.a + +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 +CFLAGS += -O3 +CFLAGS += -DALLOW_EXPERIMENTAL_API
Can you please add this flag when really an experimental API is called? And for that case add a comment here the name of that experimental function, this will help us to remove unnecessary flags when APIs become non experimental.
drivers/net/octeontx2/Makefile line 18
Quoted 1 line
drivers/net/octeontx2/Makefile new file +1
-0+CFLAGS += -flax-vector-conversions
Same for this one, please add when needed.
drivers/net/octeontx2/Makefile line 22
Quoted 4 lines
drivers/net/octeontx2/Makefile new file +4
-0+ +ifneq ($(CONFIG_RTE_ARCH_64),y) +CFLAGS += -Wno-int-to-pointer-cast +CFLAGS += -Wno-pointer-to-int-cast
Is there a way to get rid of these? Why need to ignore these warnings?
Quoted 4 lines
drivers/net/octeontx2/Makefile new file +4
-0+endif + +EXPORT_MAP := rte_pmd_octeontx2_version.map +
drivers/net/octeontx2/Makefile line 36
Quoted 10 lines
drivers/net/octeontx2/Makefile new file +10
-0+LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_ethdev.c + +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_bus_pci -lrte_mempool_octeontx2
Can you please just keep minimum required dependencies?
Quoted 8 lines
drivers/net/octeontx2/Makefile new file +2
-0+ +include $(RTE_SDK)/mk/rte.lib.mkdrivers/net/octeontx2/meson.build new file +0
-0
drivers/net/octeontx2/meson.build line 9
Quoted 9 lines
drivers/net/octeontx2/meson.build new file +9
-0@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +sources = files( + 'otx2_ethdev.c', + ) + +allow_experimental_apis = true
All comments for makefile valid for meson too, can you please check?
Quoted 30 lines
drivers/net/octeontx2/meson.build new file +15
-0+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] + +cflags += ['-flax-vector-conversions','-DALLOW_EXPERIMENTAL_API'] + +extra_flags = [] +# This integrated controller runs only on a arm64 machine, remove 32bit warnings +if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] +endif + +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeachdrivers/net/octeontx2/otx2_ethdev.c new file +3
-0@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +0
-0
drivers/net/octeontx2/rte_pmd_octeontx2_version.map line 1
Quoted 1 line
drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +1
-0@@ -0,0 +1,4 @@ +DPDK_19.05 {
DPDK_19.08 now.
Quoted 24 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +3
-0+ + local: *; +};mk/rte.app.mk +2
-0@@ -127,6 +127,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX) += -lrte_common_dpaax endif OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) +OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) ifeq ($(findstring y,$(OCTEONTX2-y)),y) _LDLIBS-y += -lrte_common_octeontx2 endif@@ -197,6 +198,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += -lrte_pmd_mvneta _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += -lrte_pmd_octeontx2 -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring
Re: [dpdk-dev] [EXT] Re: [PATCH v1 01/58] net/octeontx2: add build infrastructure
Quoted 33 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:03 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Pavan Nikhilesh Bhagavatula <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v1 01/58] net/octeontx2: add build infrastructureQuoted 7 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Adding bare minimum PMD library and doc build infrastructure.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Pavan Nikhilesh <[email protected]>Quoted 12 lines
--- config/common_base | 5 +++ doc/guides/nics/features/octeontx2.ini | 8 ++++ doc/guides/nics/features/octeontx2_vec.ini | 8 ++++ doc/guides/nics/features/octeontx2_vf.ini | 8 ++++ drivers/net/Makefile | 1 + drivers/net/meson.build | 2 +- drivers/net/octeontx2/Makefile | 38 +++++++++++++++++++ drivers/net/octeontx2/meson.build | 24 ++++++++++++ drivers/net/octeontx2/otx2_ethdev.c | 3 ++ .../octeontx2/rte_pmd_octeontx2_version.map | 4 ++ mk/rte.app.mk | 2 +
Quoted 2 lines
It can be good to include
MAINTAINERSfile in this patch, of course with the content that introduced in this patch.
OK
Quoted 19 lines
Quoted 19 lines
11 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 doc/guides/nics/features/octeontx2.ini create mode 100644 doc/guides/nics/features/octeontx2_vec.ini create mode 100644 doc/guides/nics/features/octeontx2_vf.ini create mode 100644 drivers/net/octeontx2/Makefile create mode 100644 drivers/net/octeontx2/meson.build create mode 100644 drivers/net/octeontx2/otx2_ethdev.c create mode 100644
drivers/net/octeontx2/rte_pmd_octeontx2_version.mapconfig/common_base index renamed from config/common_base +0
-0
4a3de0360..38edad355100644config/common_base +0
-0@@ -405,6 +405,11 @@ CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n # CONFIG_RTE_LIBRTE_OCTEONTX_PMD=y
Quoted 10 lines
config/common_base CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n · line 412
Quoted 4 lines
config/common_base +4
-0+# +# Compile burst-oriented Cavium OCTEONTX2 network PMD driver # +CONFIG_RTE_LIBRTE_OCTEONTX2_PMD=y +Since .ini files only has "ARMv8", should the PMD disabled in other config files?
Or is the support coming for those architectures in next patches? If this is only for Armv8 & Linux, better to keep disabled it in the base config and enable only in that specific config file.
It does build for x86. I have added in the default config so that It will build for x86 as well so that ethdev changes will not be opted Out for this driver as not everyone have arm64 platform to compile this driver.
Quoted 28 lines
Quoted 28 lines
config/common_base +0
-1# # Compile WRS accelerated virtual port (AVP) guest PMD driver # diff --git a/doc/guides/nics/features/octeontx2.inib/doc/guides/nics/features/octeontx2.ini
new file mode 100644
index 000000000..0ec3b6983doc/guides/nics/features/octeontx2.ini new file +8
-0@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Ydoc/guides/nics/features/octeontx2_vec.ini new file +3
-0@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2_vec' network poll mode driver. +;
Quoted 8 lines
doc/guides/nics/features/octeontx2_vec.ini line 8
Quoted 5 lines
doc/guides/nics/features/octeontx2_vec.ini new file +5
-0+; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = YI think it is good to introduce vector .ini file with the patch that enables vector path, same with below vf one.
I have added only slowpath stuff that’s common for vector and scalar.
Quoted 36 lines
Quoted 36 lines
doc/guides/nics/features/octeontx2_vf.ini new file +8
-0@@ -0,0 +1,8 @@ +; +; Supported features of the 'octeontx2_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Ydrivers/net/Makefile index renamed from drivers/net/Makefile +0
-0
3a72cf38c..5bb618b21100644drivers/net/Makefile +1
-0@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx +DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += octeontx2 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring diff --gita/drivers/net/meson.build b/drivers/net/meson.build index
ed99896c3..086a2f4cd100644drivers/net/meson.build +0
-0@@ -31,7 +31,7 @@ drivers = ['af_packet', 'netvsc', 'nfb', 'nfp',
Quoted 8 lines
drivers/net/meson.build drivers = ['af_packet', · line 34
Quoted 2 lines
drivers/net/meson.build +1
-1- 'null', 'octeontx', 'pcap', 'qede', 'ring', + 'null', 'octeontx', 'octeontx2', 'pcap', 'ring',Multiline is causing conflicts, can you please break the line while adding new one, like:
'null', 'octeontx',
'octeontx2',
'qede', 'ring',
Makes sense. I will fix it.
Quoted 24 lines
Quoted 24 lines
drivers/net/meson.build +0
-0'sfc', 'softnic', 'szedata2',(quoted diff) +0
-0b/drivers/net/octeontx2/Makefile new file mode 100644 index 000000000..0a606d27b
drivers/net/octeontx2/Makefile new file +14
-0@@ -0,0 +1,38 @@ +# SPDX-License-Identifier: BSD-3-Clause # Copyright(C) 2019 Marvell +International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_octeontx2.a + +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
Quoted 8 lines
drivers/net/octeontx2/Makefile line 17
Quoted 3 lines
drivers/net/octeontx2/Makefile new file +3
-0+CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 +CFLAGS += -O3 +CFLAGS += -DALLOW_EXPERIMENTAL_APICan you please add this flag when really an experimental API is called? And for that case add a comment here the name of that experimental function, this will help us to remove unnecessary flags when APIs become non experimental.
I will fix it.
Quoted 4 lines
drivers/net/octeontx2/Makefile line 18
Quoted 2 lines
drivers/net/octeontx2/Makefile new file +1
-0+CFLAGS += -flax-vector-conversionsSame for this one, please add when needed.
I will fix it.
Quoted 7 lines
drivers/net/octeontx2/Makefile line 22
Quoted 5 lines
drivers/net/octeontx2/Makefile new file +4
-0+ +ifneq ($(CONFIG_RTE_ARCH_64),y) +CFLAGS += -Wno-int-to-pointer-cast +CFLAGS += -Wno-pointer-to-int-castIs there a way to get rid of these? Why need to ignore these warnings?
Those things are from base code. I would keep as it is.
Quoted 10 lines
Quoted 10 lines
drivers/net/octeontx2/Makefile new file +9
-0+endif + +EXPORT_MAP := rte_pmd_octeontx2_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +#
Quoted 8 lines
drivers/net/octeontx2/Makefile
Quoted 6 lines
drivers/net/octeontx2/Makefile new file +6
-0+SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_ethdev.c + +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 +-lm LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_bus_pci +-lrte_mempool_octeontx2Can you please just keep minimum required dependencies?
Sure.
Quoted 13 lines
Quoted 13 lines
drivers/net/octeontx2/Makefile new file +2
-0+ +include $(RTE_SDK)/mk/rte.lib.mkdrivers/net/octeontx2/meson.build new file +3
-0@@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause # Copyright(C) 2019 Marvell +International Ltd. +#
Quoted 8 lines
drivers/net/octeontx2/meson.build line 9
Quoted 6 lines
drivers/net/octeontx2/meson.build new file +6
-0+ +sources = files( + 'otx2_ethdev.c', + ) + +allow_experimental_apis = trueAll comments for makefile valid for meson too, can you please check?
Sure.
Quoted 28 lines
Quoted 28 lines
drivers/net/octeontx2/meson.build new file +15
-0+deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] + +cflags += ['-flax-vector-conversions','-DALLOW_EXPERIMENTAL_API'] + +extra_flags = [] +# This integrated controller runs only on a arm64 machine, remove +32bit warnings if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', +'-Wno-pointer-to-int-cast'] endif + +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeachdrivers/net/octeontx2/otx2_ethdev.c new file +3
-0@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ drivers/net/octeontx2/rte_pmd_octeontx2_version.map +0
-0
Quoted 8 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map line 1
Quoted 6 lines
new file mode 100644
index 000000000..fc8c95e91drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +1
-0@@ -0,0 +1,4 @@ +DPDK_19.05 {DPDK_19.08 now.
Good catch. I will fix it.
PATCH 2/58 net/octeontx2: add ethdev probe and remove
In reply to [email protected]From: Jerin Jacob <[email protected]>
add basic PCIe ethdev probe and remove.
--- drivers/net/octeontx2/otx2_ethdev.c | 93 +++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 27 +++++++++ 2 files changed, 120 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_ethdev.h
drivers/net/octeontx2/otx2_ethdev.c +93 -0
@@ -1,3 +1,96 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(C) 2019 Marvell International Ltd. */ + +#include <rte_ethdev_pci.h> +#include <rte_io.h> +#include <rte_malloc.h> + +#include "otx2_ethdev.h" + +static int +otx2_eth_dev_init (struct rte_eth_dev *eth_dev) +{ +RTE_SET_USED (eth_dev); + +return -ENODEV ; +} + +static int +otx2_eth_dev_uninit (struct rte_eth_dev *eth_dev,bool mbox_close) +{ +RTE_SET_USED (eth_dev); +RTE_SET_USED (mbox_close); + +return -ENODEV ; +} + +static int +nix_remove (struct rte_pci_device *pci_dev) +{ +struct rte_eth_dev *eth_dev; +int rc; + + eth_dev =rte_eth_dev_allocated (pci_dev->device.name); +if (eth_dev) { +/* Cleanup eth dev */ + rc =otx2_eth_dev_uninit (eth_dev, true); +if (rc) +return rc; + +rte_eth_dev_pci_release (eth_dev); + } + +/* Nothing to be done for secondary processes */ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +return 0 ; + +return 0 ; +} + +static int +nix_probe (struct rte_pci_driver *pci_drv,struct rte_pci_device *pci_dev) +{ +int rc; + +RTE_SET_USED (pci_drv); + + rc =rte_eth_dev_pci_generic_probe (pci_dev,sizeof (struct otx2_eth_dev ), + otx2_eth_dev_init); + +/* On error on secondary, recheck if port exists in primary or +* in mid of detach state. +*/ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY && rc) +if (!rte_eth_dev_allocated (pci_dev->device.name)) +return 0 ; +return rc; +} + +static const struct rte_pci_id pci_nix_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_PF ) + }, + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_VF ) + }, + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_CAVIUM , +PCI_DEVID_OCTEONTX2_RVU_AF_VF ) + }, + { + .vendor_id =0 , + }, +}; + +static struct rte_pci_driver pci_nix = { + .id_table = pci_nix_map, + .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_IOVA_AS_VA | +RTE_PCI_DRV_INTR_LSC , + .probe = nix_probe, + .remove = nix_remove, +}; + +RTE_PMD_REGISTER_PCI (net_octeontx2, pci_nix); +RTE_PMD_REGISTER_PCI_TABLE (net_octeontx2, pci_nix_map); +RTE_PMD_REGISTER_KMOD_DEP (net_octeontx2,"vfio-pci" );
drivers/net/octeontx2/otx2_ethdev.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ + +#ifndef __OTX2_ETHDEV_H__ +#define __OTX2_ETHDEV_H__ + +#include <stdint.h> + +#include <rte_common.h> + +#include "otx2_common.h" +#include "otx2_dev.h" +#include "otx2_irq.h" +#include "otx2_mempool.h" + +struct otx2_eth_dev { +OTX2_DEV ;/* Base class */ +} __rte_cache_aligned; + +static inline struct otx2_eth_dev * +otx2_eth_pmd_priv (struct rte_eth_dev *eth_dev) +{ +return eth_dev->data->dev_private; +} + +#endif /* __OTX2_ETHDEV_H__ */
Signature · 1 line
2.21.0
PATCH 3/58 net/octeontx2: add device init and uninit
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add basic init and uninit function which includes
attaching LF device to probed PCIe device.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 277 +++++++++++++++++++++++++++- drivers/net/octeontx2/otx2_ethdev.h | 72 ++++++++ drivers/net/octeontx2/otx2_mac.c | 72 ++++++++ 5 files changed, 418 insertions(+), 5 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_mac.c
drivers/net/octeontx2/Makefile +1 -0
@@ -30,6 +30,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_mac.c \ otx2_ethdev.c LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm
drivers/net/octeontx2/meson.build +1 -0
@@ -3,6 +3,7 @@ # sources = files( + 'otx2_mac.c', 'otx2_ethdev.c', )
drivers/net/octeontx2/otx2_ethdev.c +272 -5
306 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev.h +72 -0
90 lines not on this page · raw message
drivers/net/octeontx2/otx2_mac.c new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 4/58 net/octeontx2: add devargs parsing functions
In reply to [email protected]From: Jerin Jacob <[email protected]>
add various devargs command line options supported by this driver.
--- drivers/net/octeontx2/Makefile | 3 +- drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 7 + drivers/net/octeontx2/otx2_ethdev.h | 20 +++ drivers/net/octeontx2/otx2_ethdev_devargs.c | 143 ++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 10 ++ 6 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev_devargs.c create mode 100644 drivers/net/octeontx2/otx2_rx.h
drivers/net/octeontx2/Makefile +2 -1
@@ -31,7 +31,8 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ - otx2_ethdev.c + otx2_ethdev.c \ + otx2_ethdev_devargs.c LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_bus_pci -lrte_mempool_octeontx2
drivers/net/octeontx2/meson.build +1 -0
@@ -5,6 +5,7 @@ sources = files( 'otx2_mac.c', 'otx2_ethdev.c', + 'otx2_ethdev_devargs.c' ) allow_experimental_apis = true
drivers/net/octeontx2/otx2_ethdev.c +7 -0
@@ -137,6 +137,13 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)memset (&dev->otx2_eth_dev_data_start,0 ,sizeof (*dev) - offsetof(struct otx2_eth_dev , otx2_eth_dev_data_start)); +/* Parse devargs string */ + rc =otx2_ethdev_parse_devargs (eth_dev->device->devargs, dev); +if (rc) { +otx2_err ("Failed to parse devargs rc=%d" , rc); + goto error; + } +if (!dev->mbox_active) {/* Initialize the base otx2_dev object * only if already present
drivers/net/octeontx2/otx2_ethdev.h +20 -0
@@ -9,11 +9,13 @@#include <rte_common.h> #include <rte_ethdev.h> +#include <rte_kvargs.h> #include "otx2_common.h" #include "otx2_dev.h" #include "otx2_irq.h" #include "otx2_mempool.h" +#include "otx2_rx.h" #define OTX2_ETH_DEV_PMD_VERSION "1.0"
@@ -31,6 +33,8 @@/* Used for struct otx2_eth_dev::flags */ #define OTX2_LINK_CFG_IN_PROGRESS_F BIT_ULL(0) +#define NIX_RSS_RETA_SIZE 64 +#define NIX_TX_OFFLOAD_CAPA ( \ DEV_TX_OFFLOAD_MBUF_FAST_FREE | \ DEV_TX_OFFLOAD_MT_LOCKFREE | \
@@ -56,6 +60,15 @@ DEV_RX_OFFLOAD_QINQ_STRIP | \ DEV_RX_OFFLOAD_TIMESTAMP) +struct otx2_rss_info { +uint16_t rss_size; +}; + +struct otx2_npc_flow_info { +uint16_t flow_prealloc_size; +uint16_t flow_max_priority; +}; +struct otx2_eth_dev {OTX2_DEV ;/* Base class */ MARKER otx2_eth_dev_data_start;
@@ -72,12 +85,15 @@ struct otx2_eth_dev {uint16_t nix_msixoff;uintptr_t base;uintptr_t lmt_addr; +uint16_t scalar_ena;uint16_t rx_offload_flags;/* Selected Rx offload flags(NIX_RX_*_F) */ uint64_t rx_offloads;uint16_t tx_offload_flags;/* Selected Tx offload flags(NIX_TX_*_F) */ uint64_t tx_offloads;uint64_t rx_offload_capa;uint64_t tx_offload_capa; +struct otx2_rss_info rss_info; +struct otx2_npc_flow_info npc_flow; } __rte_cache_aligned; static inline struct otx2_eth_dev *
@@ -96,4 +112,8 @@ int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,int otx2_nix_mac_addr_get (struct rte_eth_dev *eth_dev,uint8_t *addr);int otx2_cgx_mac_max_entries_get (struct otx2_eth_dev *dev); +/* Devargs */ +int otx2_ethdev_parse_devargs (struct rte_devargs *devargs, +struct otx2_eth_dev *dev); +#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ethdev_devargs.c new file +143 -0
143 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ + +#ifndef __OTX2_RX_H__ +#define __OTX2_RX_H__ + +#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) + +#endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
PATCH 5/58 net/octeontx2: handle device error interrupts
In reply to [email protected]From: Jerin Jacob <[email protected]>
Handle device specific error and ras interrupts.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 12 +- drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_ethdev_irq.c | 140 ++++++++++++++++++++++++ 5 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev_irq.c
drivers/net/octeontx2/Makefile +1 -0
@@ -32,6 +32,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ otx2_ethdev.c \ + otx2_ethdev_irq.c \ otx2_ethdev_devargs.c LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm
drivers/net/octeontx2/meson.build +1 -0
@@ -5,6 +5,7 @@ sources = files( 'otx2_mac.c', 'otx2_ethdev.c', + 'otx2_ethdev_irq.c', 'otx2_ethdev_devargs.c' )
drivers/net/octeontx2/otx2_ethdev.c +10 -2
@@ -175,12 +175,17 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)if (rc) goto otx2_npa_uninit; +/* Register LF irq handlers */ + rc =otx2_nix_register_irqs (eth_dev); +if (rc) + goto mbox_detach; +/* Get maximum number of supported MAC entries */ max_entries =otx2_cgx_mac_max_entries_get (dev);if (max_entries <0 ) {otx2_err ("Failed to get max entries for mac addr" ); rc = -ENOTSUP ; - goto mbox_detach; + goto unregister_irq; }/* For VFs, returned max_entries will be 0. But to keep default MAC
@@ -194,7 +199,7 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)if (eth_dev->data->mac_addrs ==NULL ) {otx2_err ("Failed to allocate memory for mac addr" ); rc = -ENOMEM ; - goto mbox_detach; + goto unregister_irq; } dev->max_mac_entries = max_entries;
@@ -226,6 +231,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) free_mac_addrs:rte_free (eth_dev->data->mac_addrs); +unregister_irq: +otx2_nix_unregister_irqs (eth_dev); mbox_detach:otx2_eth_dev_lf_detach (dev->mbox); otx2_npa_uninit:
@@ -261,6 +268,7 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) dev->drv_inited = false; pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); +otx2_nix_unregister_irqs (eth_dev); rc =otx2_eth_dev_lf_detach (dev->mbox);if (rc)
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -102,6 +102,10 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)return eth_dev->data->dev_private; } +/* IRQ */ +int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev); +void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev); +/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);int otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_irq.c new file +140 -0
140 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 6/58 net/octeontx2: add info get operation
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add device information get operation.
--- doc/guides/nics/features/octeontx2.ini | 4 ++ doc/guides/nics/features/octeontx2_vec.ini | 4 ++ doc/guides/nics/features/octeontx2_vf.ini | 3 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 7 +++ drivers/net/octeontx2/otx2_ethdev.h | 27 +++++++++ drivers/net/octeontx2/otx2_ethdev_ops.c | 64 ++++++++++++++++++++++ 8 files changed, 111 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_ethdev_ops.c
doc/guides/nics/features/octeontx2.ini +4 -0
@@ -4,5 +4,9 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y Linux VFIO = Y ARMv8 = Y +Lock-free Tx queue = Y +SR-IOV = Y +Multiprocess aware = Y
doc/guides/nics/features/octeontx2_vec.ini +4 -0
@@ -4,5 +4,9 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y Linux VFIO = Y ARMv8 = Y +Lock-free Tx queue = Y +SR-IOV = Y +Multiprocess aware = Y
doc/guides/nics/features/octeontx2_vf.ini +3 -0
@@ -4,5 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y Linux VFIO = Y ARMv8 = Y +Lock-free Tx queue = Y +Multiprocess aware = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -33,6 +33,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ otx2_ethdev.c \ otx2_ethdev_irq.c \ + otx2_ethdev_ops.c \ otx2_ethdev_devargs.c LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm
drivers/net/octeontx2/meson.build +1 -0
@@ -6,6 +6,7 @@ sources = files( 'otx2_mac.c', 'otx2_ethdev.c', 'otx2_ethdev_irq.c', + 'otx2_ethdev_ops.c', 'otx2_ethdev_devargs.c' )
drivers/net/octeontx2/otx2_ethdev.c +7 -0
@@ -64,6 +64,11 @@ nix_lf_free(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +/* Initialize and register driver with DPDK Application */ +static const struct eth_dev_ops otx2_eth_dev_ops = { + .dev_infos_get = otx2_nix_info_get, +}; +static inline int nix_lf_attach (struct otx2_eth_dev *dev) {
@@ -120,6 +125,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)struct rte_pci_device *pci_dev;int rc, max_entries; + eth_dev->dev_ops = &otx2_eth_dev_ops; +/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* Setup callbacks for secondary process */
drivers/net/octeontx2/otx2_ethdev.h +27 -0
@@ -33,7 +33,30 @@/* Used for struct otx2_eth_dev::flags */ #define OTX2_LINK_CFG_IN_PROGRESS_F BIT_ULL(0) +#define VLAN_TAG_SIZE 4 +#define NIX_HW_L2_OVERHEAD 22 +/* ETH_HLEN+2*VLAN_HLEN */ +#define NIX_MAX_HW_MTU 9190 +#define NIX_MAX_HW_FRS (NIX_MAX_HW_MTU + NIX_HW_L2_OVERHEAD) +#define NIX_MIN_HW_FRS 60 +#define NIX_HASH_KEY_SIZE 48/* 352 Bits */ #define NIX_RSS_RETA_SIZE 64 +#define NIX_RX_MIN_DESC 16 +#define NIX_RX_MIN_DESC_ALIGN 16 +#define NIX_RX_NB_SEG_MAX 6 + +/* If PTP is enabled additional SEND MEM DESC is required which +* takes 2 words, hence max 7 iova address are possible +*/ +#if defined(RTE_LIBRTE_IEEE1588 ) +#define NIX_TX_NB_SEG_MAX 7 +#else +#define NIX_TX_NB_SEG_MAX 9 +#endif + +#define NIX_RSS_OFFLOAD (ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP |\ + ETH_RSS_TCP | ETH_RSS_SCTP | \ + ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD)#define NIX_TX_OFFLOAD_CAPA ( \ DEV_TX_OFFLOAD_MBUF_FAST_FREE | \
@@ -102,6 +125,10 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)return eth_dev->data->dev_private; } +/* Ops */ +void otx2_nix_info_get (struct rte_eth_dev *eth_dev, +struct rte_eth_dev_info *dev_info); +/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev);void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 7/58 net/octeontx2: add device configure operation
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add device configure operation. This would call lf_alloc mailbox to allocate a NIX LF and upon return, AF will return the attributes for the select LF.
--- drivers/net/octeontx2/otx2_ethdev.c | 151 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 11 ++ 2 files changed, 162 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +151 -0
@@ -39,6 +39,52 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)return NIX_TX_OFFLOAD_CAPA ; } +static int +nix_lf_alloc (struct otx2_eth_dev *dev,uint32_t nb_rxq,uint32_t nb_txq) +{ +struct otx2_mbox *mbox = dev->mbox; +struct nix_lf_alloc_req *req; +struct nix_lf_alloc_rsp *rsp; +int rc; + + req =otx2_mbox_alloc_msg_nix_lf_alloc (mbox); + req->rq_cnt = nb_rxq; + req->sq_cnt = nb_txq; + req->cq_cnt = nb_rxq; +/* XQE_SZ should be in Sync with NIX_CQ_ENTRY_SZ */ +RTE_BUILD_BUG_ON (NIX_CQ_ENTRY_SZ !=128 ); + req->xqe_sz =NIX_XQESZ_W16 ; + req->rss_sz = dev->rss_info.rss_size; + req->rss_grps =NIX_RSS_GRPS ; + req->npa_func =otx2_npa_pf_func_get (); + req->sso_func =otx2_sso_pf_func_get (); + req->rx_cfg =BIT_ULL (35 /* DIS_APAD */ ); +if (dev->rx_offloads & (DEV_RX_OFFLOAD_TCP_CKSUM | +DEV_RX_OFFLOAD_UDP_CKSUM )) { + req->rx_cfg |=BIT_ULL (37 /* CSUM_OL4 */ ); + req->rx_cfg |=BIT_ULL (36 /* CSUM_IL4 */ ); + } + + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + + dev->sqb_size = rsp->sqb_size; + dev->tx_chan_base = rsp->tx_chan_base; + dev->rx_chan_base = rsp->rx_chan_base; + dev->rx_chan_cnt = rsp->rx_chan_cnt; + dev->tx_chan_cnt = rsp->tx_chan_cnt; + dev->lso_tsov4_idx = rsp->lso_tsov4_idx; + dev->lso_tsov6_idx = rsp->lso_tsov6_idx; + dev->lf_tx_stats = rsp->lf_tx_stats; + dev->lf_rx_stats = rsp->lf_rx_stats; + dev->cints = rsp->cints; + dev->qints = rsp->qints; + dev->npc_flow.channel = dev->rx_chan_base; + +return 0 ; +} +static int nix_lf_free (struct otx2_eth_dev *dev) {
@@ -64,9 +110,114 @@ nix_lf_free(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +static int +otx2_nix_configure (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct rte_eth_dev_data *data = eth_dev->data; +struct rte_eth_conf *conf = &data->dev_conf; +struct rte_eth_rxmode *rxmode = &conf->rxmode; +struct rte_eth_txmode *txmode = &conf->txmode; +char ea_fmt[RTE_ETHER_ADDR_FMT_SIZE ]; +struct rte_ether_addr *ea; +uint8_t nb_rxq, nb_txq; +int rc; + + rc = -EINVAL ; + +/* Sanity checks */ +if (rte_eal_has_hugepages () ==0 ) { +otx2_err ("Huge page is not configured" ); + goto fail; + } + +if (rte_eal_iova_mode () !=RTE_IOVA_VA ) { +otx2_err ("iova mode should be va" ); + goto fail; + } + +if (conf->link_speeds Ð_LINK_SPEED_FIXED ) { +otx2_err ("Setting link speed/duplex not supported" ); + goto fail; + } + +if (conf->dcb_capability_en ==1 ) { +otx2_err ("dcb enable is not supported" ); + goto fail; + } + +if (conf->fdir_conf.mode !=RTE_FDIR_MODE_NONE ) { +otx2_err ("Flow director is not supported" ); + goto fail; + } + +if (rxmode->mq_mode !=ETH_MQ_RX_NONE && + rxmode->mq_mode !=ETH_MQ_RX_RSS ) { +otx2_err ("Unsupported mq rx mode %d" , rxmode->mq_mode); + goto fail; + } + +if (txmode->mq_mode !=ETH_MQ_TX_NONE ) { +otx2_err ("Unsupported mq tx mode %d" , txmode->mq_mode); + goto fail; + } + +/* Free the resources allocated from the previous configure */ +if (dev->configured ==1 ) +nix_lf_free (dev); + +if (otx2_dev_is_A0 (dev) && + (txmode->offloads &DEV_TX_OFFLOAD_SCTP_CKSUM ) && + ((txmode->offloads &DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM ) || + (txmode->offloads &DEV_TX_OFFLOAD_OUTER_UDP_CKSUM ))) { +otx2_err ("Outer IP and SCTP checksum unsupported" ); + rc = -EINVAL ; + goto fail; + } + + dev->rx_offloads = rxmode->offloads; + dev->tx_offloads = txmode->offloads; + dev->rss_info.rss_grps =NIX_RSS_GRPS ; + + nb_rxq =RTE_MAX (data->nb_rx_queues,1 ); + nb_txq =RTE_MAX (data->nb_tx_queues,1 ); + +/* Alloc a nix lf */ + rc =nix_lf_alloc (dev, nb_rxq, nb_txq); +if (rc) { +otx2_err ("Failed to init nix_lf rc=%d" , rc); + goto fail; + } + +/* Update the mac address */ + ea = eth_dev->data->mac_addrs; +memcpy (ea, dev->mac_addr,RTE_ETHER_ADDR_LEN ); +if (rte_is_zero_ether_addr (ea)) +rte_eth_random_addr ((uint8_t *)ea); + +rte_ether_format_addr (ea_fmt,RTE_ETHER_ADDR_FMT_SIZE , ea); + +otx2_nix_dbg ("Configured port%d mac=%s nb_rxq=%d nb_txq=%d" +" rx_offloads=0x%" PRIx64" tx_offloads=0x%" PRIx64"" +" rx_flags=0x%x tx_flags=0x%x" , + eth_dev->data->port_id, ea_fmt, nb_rxq, + nb_txq, dev->rx_offloads, dev->tx_offloads, + dev->rx_offload_flags, dev->tx_offload_flags); + +/* All good */ + dev->configured =1 ; + dev->configured_nb_rx_qs = data->nb_rx_queues; + dev->configured_nb_tx_qs = data->nb_tx_queues; +return 0 ; + +fail: +return rc; +} +/* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, + .dev_configure = otx2_nix_configure, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +11 -0
@@ -39,11 +39,14 @@#define NIX_MAX_HW_MTU 9190#define NIX_MAX_HW_FRS (NIX_MAX_HW_MTU + NIX_HW_L2_OVERHEAD)#define NIX_MIN_HW_FRS 60 +/* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/ +#define NIX_RSS_GRPS 8#define NIX_HASH_KEY_SIZE 48/* 352 Bits */ #define NIX_RSS_RETA_SIZE 64#define NIX_RX_MIN_DESC 16#define NIX_RX_MIN_DESC_ALIGN 16#define NIX_RX_NB_SEG_MAX 6 +#define NIX_CQ_ENTRY_SZ 128/* If PTP is enabled additional SEND MEM DESC is required which * takes 2 words, hence max 7 iova address are possible
@@ -85,9 +88,11 @@struct otx2_rss_info {uint16_t rss_size; +uint8_t rss_grps; };struct otx2_npc_flow_info { +uint16_t channel;/*rx channel */ uint16_t flow_prealloc_size;uint16_t flow_max_priority; };
@@ -104,7 +109,13 @@ struct otx2_eth_dev {uint8_t lso_tsov6_idx;uint8_t mac_addr[RTE_ETHER_ADDR_LEN ];uint8_t max_mac_entries; +uint8_t lf_tx_stats; +uint8_t lf_rx_stats; +uint16_t cints; +uint16_t qints;uint8_t configured; +uint8_t configured_nb_rx_qs; +uint8_t configured_nb_tx_qs;uint16_t nix_msixoff;uintptr_t base;uintptr_t lmt_addr;
Signature · 1 line
2.21.0
PATCH 8/58 net/octeontx2: handle queue specific error interrupts
In reply to [email protected]From: Jerin Jacob <[email protected]>
Handle queue specific error interrupts.
--- drivers/net/octeontx2/otx2_ethdev.c | 16 +- drivers/net/octeontx2/otx2_ethdev.h | 9 ++ drivers/net/octeontx2/otx2_ethdev_irq.c | 191 ++++++++++++++++++++++++ 3 files changed, 215 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.c +15 -1
@@ -163,8 +163,10 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) }/* Free the resources allocated from the previous configure */ -if (dev->configured ==1 ) +if (dev->configured ==1 ) { +oxt2_nix_unregister_queue_irqs (eth_dev);nix_lf_free (dev); + } if (otx2_dev_is_A0(dev) && (txmode->offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
@@ -189,6 +191,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto fail; } +/* Register queue IRQs */ + rc =oxt2_nix_register_queue_irqs (eth_dev); +if (rc) { +otx2_err ("Failed to register queue interrupts rc=%d" , rc); + goto free_nix_lf; + } +/* Update the mac address */ ea = eth_dev->data->mac_addrs;memcpy (ea, dev->mac_addr,RTE_ETHER_ADDR_LEN );
@@ -210,6 +219,8 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) dev->configured_nb_tx_qs = data->nb_tx_queues;return 0 ; +free_nix_lf: + rc =nix_lf_free (dev); fail:return rc; }
@@ -413,6 +424,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +/* Unregister queue irqs */ +oxt2_nix_unregister_queue_irqs (eth_dev); + rc =nix_lf_free (dev);if (rc)otx2_err ("Failed to free nix lf, rc=%d" , rc);
drivers/net/octeontx2/otx2_ethdev.h +9 -0
@@ -86,6 +86,11 @@ DEV_RX_OFFLOAD_QINQ_STRIP | \ DEV_RX_OFFLOAD_TIMESTAMP) +struct otx2_qint { +struct rte_eth_dev *eth_dev; +uint8_t qintx; +}; +struct otx2_rss_info {uint16_t rss_size;uint8_t rss_grps;
@@ -114,6 +119,7 @@ struct otx2_eth_dev {uint16_t cints;uint16_t qints;uint8_t configured; +uint8_t configured_qints;uint8_t configured_nb_rx_qs;uint8_t configured_nb_tx_qs;uint16_t nix_msixoff;
@@ -126,6 +132,7 @@ struct otx2_eth_dev {uint64_t tx_offloads;uint64_t rx_offload_capa;uint64_t tx_offload_capa; +struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ];struct otx2_rss_info rss_info;struct otx2_npc_flow_info npc_flow; } __rte_cache_aligned;
@@ -142,7 +149,9 @@ void otx2_nix_info_get(struct rte_eth_dev *eth_dev,/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev); +int oxt2_nix_register_queue_irqs (struct rte_eth_dev *eth_dev);void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev); +void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev);/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_irq.c +191 -0
197 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 9/58 net/octeontx2: add context debug utils
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add RQ,SQ,CQ context and CQE structure dump utils.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_ethdev_debug.c | 272 ++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_irq.c | 9 + 5 files changed, 287 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_ethdev_debug.c
drivers/net/octeontx2/Makefile +1 -0
@@ -34,6 +34,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_ethdev.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \ + otx2_ethdev_debug.c \ otx2_ethdev_devargs.c LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_common_octeontx2 -lm
drivers/net/octeontx2/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = files( 'otx2_ethdev.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c', + 'otx2_ethdev_debug.c', 'otx2_ethdev_devargs.c' )
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -153,6 +153,10 @@ int oxt2_nix_register_queue_irqs(struct rte_eth_dev *eth_dev);void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev);void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev); +/* Debug */ +int otx2_nix_queues_ctx_dump (struct rte_eth_dev *eth_dev); +void otx2_nix_cqe_dump (const struct nix_cqe_hdr_s *cq); +/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);int otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_debug.c new file +272 -0
272 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +9 -0
@@ -23,6 +23,9 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_error_interrupt\n" ); } static int
@@ -75,6 +78,9 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_ras_interrupt\n" ); } static int
@@ -232,6 +238,9 @@ nix_lf_q_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_q_interrupt\n" ); }int
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH v1 09/58] net/octeontx2: add context debug utils
Quoted 6 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Add RQ,SQ,CQ context and CQE structure dump utils.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Vivek Sharma <[email protected]>
<...>
Quoted 21 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +6
-0@@ -23,6 +23,9 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_error_interrupt\n" ); } static int@@ -75,6 +78,9 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_ras_interrupt\n" ); } static int
drivers/net/octeontx2/otx2_ethdev_irq.c nix_lf_q_irq(void *param) · line 243
Quoted 6 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +3
-0@@ -232,6 +238,9 @@ nix_lf_q_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_q_interrupt\n" );
rte_panic() is not allowed in the PMDs, please remove them.
Quoted 4 lines
(quoted diff) +0
-0} int
Re: [dpdk-dev] [EXT] Re: [PATCH v1 09/58] net/octeontx2: add context debug utils
Quoted 41 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:12 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Vivek Kumar Sharma <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v1 09/58] net/octeontx2: add context debug utilsQuoted 6 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Add RQ,SQ,CQ context and CQE structure dump utils.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Vivek Sharma <[email protected]><...>
Quoted 22 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +6
-0@@ -23,6 +23,9 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_error_interrupt\n" ); } static int@@ -75,6 +78,9 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_ras_interrupt\n" ); } static int@@ -232,6 +238,9 @@ nix_lf_q_irq(void *param)
Quoted 7 lines
drivers/net/octeontx2/otx2_ethdev_irq.c nix_lf_q_irq(void *param) · line 243
Quoted 5 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +3
-0/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_q_interrupt\n" );
rte_panic()is not allowed in the PMDs, please remove them.
It an error interrupt handler ie. fatal error and driver can not proceed. Should I call abort() or simply return ? I think, we can treat this as a special case for rte_panic() if it is in error interrupt handler.
Thoughts?
Quoted 5 lines
Quoted 5 lines
(quoted diff) +0
-0} int
Re: [dpdk-dev] [EXT] Re: [PATCH v1 09/58] net/octeontx2: add context debug utils
Quoted 49 lines · Jerin Jacob Kollanukkaran
Quoted 41 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:12 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Vivek Kumar Sharma <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v1 09/58] net/octeontx2: add context debug utilsQuoted 6 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Add RQ,SQ,CQ context and CQE structure dump utils.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Vivek Sharma <[email protected]><...>
Quoted 22 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +6
-0@@ -23,6 +23,9 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_error_interrupt\n" ); } static int@@ -75,6 +78,9 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_ras_interrupt\n" ); } static int@@ -232,6 +238,9 @@ nix_lf_q_irq(void *param)Quoted 7 lines
drivers/net/octeontx2/otx2_ethdev_irq.c nix_lf_q_irq(void *param) · line 243
Quoted 5 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +3
-0/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_q_interrupt\n" );
rte_panic()is not allowed in the PMDs, please remove them.
Quoted 5 lines
It an error interrupt handler ie. fatal error and driver can not proceed. Should I call
abort()or simply return ? I think, we can treat this as a special case forrte_panic()if it is in error interrupt handler.Thoughts?
Driver may not proceed but perhaps application may, (with a fail-over method etc ... ) a driver shouldn't cause application to exit, app itself should give the decision.
I think best thing to do is, deactivate the driver and send some kind of error to the application.
Re: [dpdk-dev] [EXT] Re: [PATCH v1 09/58] net/octeontx2: add context debug utils
Quoted 63 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:49 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Vivek Kumar Sharma <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v1 09/58] net/octeontx2: add context debug utilsQuoted 52 lines · Jerin Jacob Kollanukkaran
Quoted 40 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:12 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Vivek Kumar Sharma <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v1 09/58] net/octeontx2: addQuoted 6 lines · context debug utils On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Add RQ,SQ,CQ context and CQE structure dump utils.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Vivek Sharma <[email protected]><...>
Quoted 22 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +6
-0@@ -23,6 +23,9 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_error_interrupt\n" ); } static int@@ -75,6 +78,9 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_ras_interrupt\n" ); } static int@@ -232,6 +238,9 @@ nix_lf_q_irq(void *param)Quoted 7 lines
drivers/net/octeontx2/otx2_ethdev_irq.c nix_lf_q_irq(void *param) · line 243
Quoted 5 lines
drivers/net/octeontx2/otx2_ethdev_irq.c +3
-0/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); + +otx2_nix_queues_ctx_dump (eth_dev); +rte_panic ("nix_lf_q_interrupt\n" );
rte_panic()is not allowed in the PMDs, please remove them.It an error interrupt handler ie. fatal error and driver can not proceed. Should I call
abort()or simply return ? I think, we can treat this as a special case forrte_panic()if it is in error interrupt handler.
Quoted 5 lines
Quoted 1 line
Thoughts?
Driver may not proceed but perhaps application may, (with a fail-over method etc ... ) a driver shouldn't cause application to exit, app itself should give the decision.
OK. I will remove the rte_panic().
Quoted 4 lines
I think best thing to do is, deactivate the driver and send some kind of error to the application.
PATCH 10/58 net/octeontx2: add register dump support
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Add register dump support and mark Registers dump in features.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 1 + drivers/net/octeontx2/otx2_ethdev.h | 3 + drivers/net/octeontx2/otx2_ethdev_debug.c | 228 +++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_irq.c | 6 + 7 files changed, 241 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -10,3 +10,4 @@ ARMv8 = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Registers dump = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -10,3 +10,4 @@ ARMv8 = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Registers dump = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -9,3 +9,4 @@ Linux VFIO = Y ARMv8 = Y Lock-free Tx queue = Y Multiprocess aware = Y +Registers dump = Y
drivers/net/octeontx2/otx2_ethdev.c +1 -0
@@ -229,6 +229,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, + .get_reg = otx2_nix_dev_get_reg, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -154,6 +154,9 @@ void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev);/* Debug */ +int otx2_nix_reg_dump (struct otx2_eth_dev *dev,uint64_t *data); +int otx2_nix_dev_get_reg (struct rte_eth_dev *eth_dev, +struct rte_dev_reg_info *regs);int otx2_nix_queues_ctx_dump (struct rte_eth_dev *eth_dev);void otx2_nix_cqe_dump (const struct nix_cqe_hdr_s *cq);
drivers/net/octeontx2/otx2_ethdev_debug.c +228 -0
234 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +6 -0
@@ -24,6 +24,8 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); +/* Dump registers to std out */ +otx2_nix_reg_dump (dev,NULL );otx2_nix_queues_ctx_dump (eth_dev);rte_panic ("nix_lf_error_interrupt\n" ); }
@@ -79,6 +81,8 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); +/* Dump registers to std out */ +otx2_nix_reg_dump (dev,NULL );otx2_nix_queues_ctx_dump (eth_dev);rte_panic ("nix_lf_ras_interrupt\n" ); }
@@ -239,6 +243,8 @@ nix_lf_q_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); +/* Dump registers to std out */ +otx2_nix_reg_dump (dev,NULL );otx2_nix_queues_ctx_dump (eth_dev);rte_panic ("nix_lf_q_interrupt\n" ); }
Signature · 1 line
2.21.0
PATCH 11/58 net/octeontx2: add link stats operations
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add link stats related operations and mark respective items in the documentation.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/features/octeontx2_vf.ini | 2 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 8 ++ drivers/net/octeontx2/otx2_ethdev.h | 8 ++ drivers/net/octeontx2/otx2_link.c | 108 +++++++++++++++++++++ 8 files changed, 132 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_link.c
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -10,4 +10,6 @@ ARMv8 = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Link status = Y +Link status event = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -10,4 +10,6 @@ ARMv8 = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Link status = Y +Link status event = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -9,4 +9,6 @@ Linux VFIO = Y ARMv8 = Y Lock-free Tx queue = Y Multiprocess aware = Y +Link status = Y +Link status event = Y Registers dump = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -31,6 +31,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ + otx2_link.c \ otx2_ethdev.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -4,6 +4,7 @@ sources = files( 'otx2_mac.c', + 'otx2_link.c', 'otx2_ethdev.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +8 -0
@@ -39,6 +39,10 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)return NIX_TX_OFFLOAD_CAPA ; } +static const struct otx2_dev_ops otx2_dev_ops = { + .link_status_update = otx2_eth_dev_link_status_update, +}; +static int nix_lf_alloc (struct otx2_eth_dev *dev,uint32_t nb_rxq,uint32_t nb_txq) {
@@ -229,6 +233,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, + .link_update = otx2_nix_link_update, .get_reg = otx2_nix_dev_get_reg, };
@@ -324,6 +329,9 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) goto error; } } +/* Device generic callbacks */ + dev->ops = &otx2_dev_ops; + dev->eth_dev = eth_dev;/* Grab the NPA LF if required */ rc =otx2_npa_lf_init (pci_dev, dev);
drivers/net/octeontx2/otx2_ethdev.h +8 -0
@@ -116,6 +116,7 @@ struct otx2_eth_dev {uint8_t max_mac_entries;uint8_t lf_tx_stats;uint8_t lf_rx_stats; +uint16_t flags;uint16_t cints;uint16_t qints;uint8_t configured;
@@ -135,6 +136,7 @@ struct otx2_eth_dev {struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ];struct otx2_rss_info rss_info;struct otx2_npc_flow_info npc_flow; +struct rte_eth_dev *eth_dev; } __rte_cache_aligned; static inline struct otx2_eth_dev *
@@ -147,6 +149,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +/* Link */ +void otx2_nix_toggle_flag_link_cfg (struct otx2_eth_dev *dev,bool set); +int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete); +void otx2_eth_dev_link_status_update (struct otx2_dev *dev, +struct cgx_link_user_info *link); +/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev);int oxt2_nix_register_queue_irqs (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_link.c new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 12/58 net/octeontx2: add basic stats operation
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Add basic stat operation and updated the feature list.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/features/octeontx2_vf.ini | 2 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 3 + drivers/net/octeontx2/otx2_ethdev.h | 17 +++ drivers/net/octeontx2/otx2_stats.c | 117 +++++++++++++++++++++ 8 files changed, 145 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_stats.c
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -12,4 +12,6 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Basic stats = Y +Stats per queue = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -12,4 +12,6 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Basic stats = Y +Stats per queue = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -11,4 +11,6 @@ Lock-free Tx queue = Y Multiprocess aware = Y Link status = Y Link status event = Y +Basic stats = Y +Stats per queue = Y Registers dump = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -32,6 +32,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ otx2_link.c \ + otx2_stats.c \ otx2_ethdev.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -5,6 +5,7 @@ sources = files( 'otx2_mac.c', 'otx2_link.c', + 'otx2_stats.c', 'otx2_ethdev.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +3 -0
@@ -234,7 +234,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, .link_update = otx2_nix_link_update, + .stats_get = otx2_nix_dev_stats_get, + .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, + .queue_stats_mapping_set = otx2_nix_queue_stats_mapping, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +17 -0
@@ -57,6 +57,12 @@#define NIX_TX_NB_SEG_MAX 9#endif +#define CQ_OP_STAT_OP_ERR 63 +#define CQ_OP_STAT_CQ_ERR 46 + +#define OP_ERR BIT_ULL(CQ_OP_STAT_OP_ERR) +#define CQ_ERR BIT_ULL(CQ_OP_STAT_CQ_ERR) +#define NIX_RSS_OFFLOAD (ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP |\ ETH_RSS_TCP | ETH_RSS_SCTP | \ ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD)
@@ -135,6 +141,8 @@ struct otx2_eth_dev {uint64_t tx_offload_capa;struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ];struct otx2_rss_info rss_info; +uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ]; +uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];struct otx2_npc_flow_info npc_flow;struct rte_eth_dev *eth_dev; } __rte_cache_aligned;
@@ -168,6 +176,15 @@ int otx2_nix_dev_get_reg(struct rte_eth_dev *eth_dev,int otx2_nix_queues_ctx_dump (struct rte_eth_dev *eth_dev);void otx2_nix_cqe_dump (const struct nix_cqe_hdr_s *cq); +/* Stats */ +int otx2_nix_dev_stats_get (struct rte_eth_dev *eth_dev, +struct rte_eth_stats *stats); +void otx2_nix_dev_stats_reset (struct rte_eth_dev *eth_dev); + +int otx2_nix_queue_stats_mapping (struct rte_eth_dev *dev, +uint16_t queue_id,uint8_t stat_idx, +uint8_t is_rx); +/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);int otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_stats.c new file +117 -0
117 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 13/58 net/octeontx2: add extended stats operations
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Add extended operations and updated the feature list.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 5 + drivers/net/octeontx2/otx2_ethdev.h | 13 + drivers/net/octeontx2/otx2_stats.c | 270 +++++++++++++++++++++ 6 files changed, 291 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -14,4 +14,5 @@ Link status = Y Link status event = Y Basic stats = Y Stats per queue = Y +Extended stats = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -13,5 +13,6 @@ Multiprocess aware = Y Link status = Y Link status event = Y Basic stats = Y +Extended stats = Y Stats per queue = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -12,5 +12,6 @@ Multiprocess aware = Y Link status = Y Link status event = Y Basic stats = Y +Extended stats = Y Stats per queue = Y Registers dump = Y
drivers/net/octeontx2/otx2_ethdev.c +5 -0
@@ -238,6 +238,11 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, .queue_stats_mapping_set = otx2_nix_queue_stats_mapping, + .xstats_get = otx2_nix_xstats_get, + .xstats_get_names = otx2_nix_xstats_get_names, + .xstats_reset = otx2_nix_xstats_reset, + .xstats_get_by_id = otx2_nix_xstats_get_by_id, + .xstats_get_names_by_id = otx2_nix_xstats_get_names_by_id, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +13 -0
@@ -184,6 +184,19 @@ void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);int otx2_nix_queue_stats_mapping (struct rte_eth_dev *dev,uint16_t queue_id,uint8_t stat_idx,uint8_t is_rx); +int otx2_nix_xstats_get (struct rte_eth_dev *eth_dev, +struct rte_eth_xstat *xstats,unsigned int n); +int otx2_nix_xstats_get_names (struct rte_eth_dev *eth_dev, +struct rte_eth_xstat_name *xstats_names, +unsigned int limit); +void otx2_nix_xstats_reset (struct rte_eth_dev *eth_dev); + +int otx2_nix_xstats_get_by_id (struct rte_eth_dev *eth_dev, +const uint64_t *ids, +uint64_t *values,unsigned int n); +int otx2_nix_xstats_get_names_by_id (struct rte_eth_dev *eth_dev, +struct rte_eth_xstat_name *xstats_names, +const uint64_t *ids,unsigned int limit);/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_stats.c +270 -0
279 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 14/58 net/octeontx2: add promiscuous and allmulticast mode
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add promiscuous and allmulticast mode for PF devices and update the respective feature list.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + drivers/net/octeontx2/otx2_ethdev.c | 4 ++ drivers/net/octeontx2/otx2_ethdev.h | 6 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 82 ++++++++++++++++++++++ 5 files changed, 96 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -12,6 +12,8 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Promiscuous mode = Y +Allmulticast mode = Y Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -12,6 +12,8 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Promiscuous mode = Y +Allmulticast mode = Y Basic stats = Y Extended stats = Y Stats per queue = Y
drivers/net/octeontx2/otx2_ethdev.c +4 -0
@@ -237,6 +237,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, + .promiscuous_enable = otx2_nix_promisc_enable, + .promiscuous_disable = otx2_nix_promisc_disable, + .allmulticast_enable = otx2_nix_allmulticast_enable, + .allmulticast_disable = otx2_nix_allmulticast_disable, .queue_stats_mapping_set = otx2_nix_queue_stats_mapping, .xstats_get = otx2_nix_xstats_get, .xstats_get_names = otx2_nix_xstats_get_names,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
@@ -157,6 +157,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +void otx2_nix_promisc_config (struct rte_eth_dev *eth_dev,int en); +void otx2_nix_promisc_enable (struct rte_eth_dev *eth_dev); +void otx2_nix_promisc_disable (struct rte_eth_dev *eth_dev); +void otx2_nix_allmulticast_enable (struct rte_eth_dev *eth_dev); +void otx2_nix_allmulticast_disable (struct rte_eth_dev *eth_dev); +/* Link */ void otx2_nix_toggle_flag_link_cfg (struct otx2_eth_dev *dev,bool set);int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete);
drivers/net/octeontx2/otx2_ethdev_ops.c +82 -0
88 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 15/58 net/octeontx2: add unicast MAC filter
In reply to [email protected]From: Sunil Kumar Kori <[email protected]>
Add unicast MAC filter for PF device and
update the respective feature list.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 3 + drivers/net/octeontx2/otx2_ethdev.h | 6 ++ drivers/net/octeontx2/otx2_mac.c | 77 ++++++++++++++++++++++ 5 files changed, 88 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -14,6 +14,7 @@ Link status = Y Link status event = Y Promiscuous mode = Y Allmulticast mode = Y +Unicast MAC filter = Y Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -14,6 +14,7 @@ Link status = Y Link status event = Y Promiscuous mode = Y Allmulticast mode = Y +Unicast MAC filter = Y Basic stats = Y Extended stats = Y Stats per queue = Y
drivers/net/octeontx2/otx2_ethdev.c +3 -0
@@ -237,6 +237,9 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, + .mac_addr_add = otx2_nix_mac_addr_add, + .mac_addr_remove = otx2_nix_mac_addr_del, + .mac_addr_set = otx2_nix_mac_addr_set, .promiscuous_enable = otx2_nix_promisc_enable, .promiscuous_disable = otx2_nix_promisc_disable, .allmulticast_enable = otx2_nix_allmulticast_enable,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
@@ -211,7 +211,13 @@ int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr);/* Mac address handling */ +int otx2_nix_mac_addr_set (struct rte_eth_dev *eth_dev, +struct rte_ether_addr *addr);int otx2_nix_mac_addr_get (struct rte_eth_dev *eth_dev,uint8_t *addr); +int otx2_nix_mac_addr_add (struct rte_eth_dev *eth_dev, +struct rte_ether_addr *addr, +uint32_t index,uint32_t pool); +void otx2_nix_mac_addr_del (struct rte_eth_dev *eth_dev,uint32_t index);int otx2_cgx_mac_max_entries_get (struct otx2_eth_dev *dev);/* Devargs */
drivers/net/octeontx2/otx2_mac.c +77 -0
83 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 16/58 net/octeontx2: add RSS support
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add RSS support and expose RSS related functions
to implement RSS action for rte_flow driver.
--- doc/guides/nics/features/octeontx2.ini | 4 + doc/guides/nics/features/octeontx2_vec.ini | 4 + doc/guides/nics/features/octeontx2_vf.ini | 4 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 11 + drivers/net/octeontx2/otx2_ethdev.h | 35 ++ drivers/net/octeontx2/otx2_rss.c | 378 +++++++++++++++++++++ 8 files changed, 438 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_rss.c
doc/guides/nics/features/octeontx2.ini +4 -0
@@ -15,6 +15,10 @@ Link status event = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +Inner RSS = Y Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/features/octeontx2_vec.ini +4 -0
@@ -15,6 +15,10 @@ Link status event = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +Inner RSS = Y Basic stats = Y Extended stats = Y Stats per queue = Y
doc/guides/nics/features/octeontx2_vf.ini +4 -0
@@ -11,6 +11,10 @@ Lock-free Tx queue = Y Multiprocess aware = Y Link status = Y Link status event = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +Inner RSS = Y Basic stats = Y Extended stats = Y Stats per queue = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -30,6 +30,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_rss.c \ otx2_mac.c \ otx2_link.c \ otx2_stats.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -3,6 +3,7 @@ # sources = files( + 'otx2_rss.c', 'otx2_mac.c', 'otx2_link.c', 'otx2_stats.c',
drivers/net/octeontx2/otx2_ethdev.c +11 -0
@@ -195,6 +195,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto fail; } +/* Configure RSS */ + rc =otx2_nix_rss_config (eth_dev); +if (rc) { +otx2_err ("Failed to configure rss rc=%d" , rc); + goto free_nix_lf; + } +/* Register queue IRQs */ rc =oxt2_nix_register_queue_irqs (eth_dev);if (rc) {
@@ -245,6 +252,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .allmulticast_enable = otx2_nix_allmulticast_enable, .allmulticast_disable = otx2_nix_allmulticast_disable, .queue_stats_mapping_set = otx2_nix_queue_stats_mapping, + .reta_update = otx2_nix_dev_reta_update, + .reta_query = otx2_nix_dev_reta_query, + .rss_hash_update = otx2_nix_rss_hash_update, + .rss_hash_conf_get = otx2_nix_rss_hash_conf_get, .xstats_get = otx2_nix_xstats_get, .xstats_get_names = otx2_nix_xstats_get_names, .xstats_reset = otx2_nix_xstats_reset,
drivers/net/octeontx2/otx2_ethdev.h +35 -0
@@ -39,6 +39,9 @@#define NIX_MAX_HW_MTU 9190#define NIX_MAX_HW_FRS (NIX_MAX_HW_MTU + NIX_HW_L2_OVERHEAD)#define NIX_MIN_HW_FRS 60 +#define NIX_MIN_SQB 512 +#define NIX_SQB_LIST_SPACE 2 +#define NIX_RSS_RETA_SIZE_MAX 256/* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/ #define NIX_RSS_GRPS 8#define NIX_HASH_KEY_SIZE 48/* 352 Bits */
@@ -92,14 +95,22 @@ DEV_RX_OFFLOAD_QINQ_STRIP | \ DEV_RX_OFFLOAD_TIMESTAMP) +#define NIX_DEFAULT_RSS_CTX_GROUP 0 +#define NIX_DEFAULT_RSS_MCAM_IDX -1 +struct otx2_qint {struct rte_eth_dev *eth_dev;uint8_t qintx; };struct otx2_rss_info { +uint64_t nix_rss; +uint32_t flowkey_cfg;uint16_t rss_size;uint8_t rss_grps; +uint8_t alg_idx;/* Selected algo index */ +uint16_t ind_tbl[NIX_RSS_RETA_SIZE_MAX ]; +uint8_t key[NIX_HASH_KEY_SIZE ]; };struct otx2_npc_flow_info {
@@ -204,6 +215,30 @@ int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,struct rte_eth_xstat_name *xstats_names, const uint64_t *ids, unsigned int limit); +/* RSS */ +void otx2_nix_rss_set_key (struct otx2_eth_dev *dev, +uint8_t *key,uint32_t key_len); +uint32_t otx2_rss_ethdev_to_nix (struct otx2_eth_dev *dev, +uint64_t ethdev_rss,uint8_t rss_level); +int otx2_rss_set_hf (struct otx2_eth_dev *dev, +uint32_t flowkey_cfg,uint8_t *alg_idx, +uint8_t group,int mcam_index); +int otx2_nix_rss_tbl_init (struct otx2_eth_dev *dev,uint8_t group, +uint16_t *ind_tbl); +int otx2_nix_rss_config (struct rte_eth_dev *eth_dev); + +int otx2_nix_dev_reta_update (struct rte_eth_dev *eth_dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +uint16_t reta_size); +int otx2_nix_dev_reta_query (struct rte_eth_dev *eth_dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +uint16_t reta_size); +int otx2_nix_rss_hash_update (struct rte_eth_dev *eth_dev, +struct rte_eth_rss_conf *rss_conf); + +int otx2_nix_rss_hash_conf_get (struct rte_eth_dev *eth_dev, +struct rte_eth_rss_conf *rss_conf); +/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);int otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_rss.c new file +378 -0
378 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 17/58 net/octeontx2: add Rx queue setup and release
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Rx queue setup and release.
--- drivers/net/octeontx2/otx2_ethdev.c | 310 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 51 +++++ 2 files changed, 361 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +310 -0
@@ -2,9 +2,15 @@* Copyright(C) 2019 Marvell International Ltd. */ +#include <inttypes.h> +#include <math.h> +#include <rte_ethdev_pci.h> #include <rte_io.h> #include <rte_malloc.h> +#include <rte_mbuf.h> +#include <rte_mbuf_pool_ops.h> +#include <rte_mempool.h> #include "otx2_ethdev.h"
@@ -114,6 +120,308 @@ nix_lf_free(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +static inline void +nix_rx_queue_reset (struct otx2_eth_rxq *rxq) +{ + rxq->head =0 ; + rxq->available =0 ; +} + +static inline uint32_t +nix_qsize_to_val (enum nix_q_size_e qsize) +{ +return (16UL << (qsize *2 )); +} + +static inline enum nix_q_size_e +nix_qsize_clampup_get (struct otx2_eth_dev *dev,uint32_t val) +{ +int i; + +if (otx2_ethdev_fixup_is_min_4k_q (dev)) + i = nix_q_size_4K; +else + i = nix_q_size_16; + +for (; i < nix_q_size_max; i++) +if (val <=nix_qsize_to_val (i)) +break ; + +if (i >= nix_q_size_max) + i = nix_q_size_max -1 ; + +return i; +} + +static int +nix_cq_rq_init (struct rte_eth_dev *eth_dev,struct otx2_eth_dev *dev, +uint16_t qid,struct otx2_eth_rxq *rxq,struct rte_mempool *mp) +{ +struct otx2_mbox *mbox = dev->mbox; +const struct rte_memzone *rz; +uint32_t ring_size, cq_size; +struct nix_aq_enq_req *aq; +uint16_t first_skip; +int rc; + + cq_size = rxq->qlen; + ring_size = cq_size *NIX_CQ_ENTRY_SZ ; + rz =rte_eth_dma_zone_reserve (eth_dev,"cq" , qid, ring_size, +NIX_CQ_ALIGN , dev->node); +if (rz ==NULL ) { +otx2_err ("Failed to allocate mem for cq hw ring" ); + rc = -ENOMEM ; + goto fail; + } +memset (rz->addr,0 , rz->len); + rxq->desc = (uintptr_t )rz->addr; + rxq->qmask = cq_size -1 ; + + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx = qid; + aq->ctype =NIX_AQ_CTYPE_CQ ; + aq->op =NIX_AQ_INSTOP_INIT ; + + aq->cq.ena =1 ; + aq->cq.caching =1 ; + aq->cq.qsize = rxq->qsize; + aq->cq.base = rz->iova; + aq->cq.avg_level =0xff ; + aq->cq.cq_err_int_ena =BIT (NIX_CQERRINT_CQE_FAULT ); + aq->cq.cq_err_int_ena |=BIT (NIX_CQERRINT_DOOR_ERR ); + +/* Many to one reduction */ + aq->cq.qint_idx = qid % dev->qints; + +if (otx2_ethdev_fixup_is_limit_cq_full (dev)) { +uint16_t min_rx_drop; +const float rx_cq_skid =1024 *256 ; + + min_rx_drop =ceil (rx_cq_skid / (float )cq_size); + aq->cq.drop = min_rx_drop; + aq->cq.drop_ena =1 ; + } + + rc =otx2_mbox_process (mbox); +if (rc) { +otx2_err ("Failed to init cq context" ); + goto fail; + } + + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx = qid; + aq->ctype =NIX_AQ_CTYPE_RQ ; + aq->op =NIX_AQ_INSTOP_INIT ; + + aq->rq.sso_ena =0 ; + aq->rq.cq = qid;/* RQ to CQ 1:1 mapped */ + aq->rq.spb_ena =0 ; + aq->rq.lpb_aura =npa_lf_aura_handle_to_aura (mp->pool_id); + first_skip = (sizeof (struct rte_mbuf )); + first_skip +=RTE_PKTMBUF_HEADROOM ; + first_skip +=rte_pktmbuf_priv_size (mp); + rxq->data_off = first_skip; + + first_skip /=8 ;/* Expressed in number of dwords */ + aq->rq.first_skip = first_skip; + aq->rq.later_skip = (sizeof (struct rte_mbuf ) /8 ); + aq->rq.flow_tagw =32 ;/* 32-bits */ + aq->rq.lpb_sizem1 =rte_pktmbuf_data_room_size (mp); + aq->rq.lpb_sizem1 +=rte_pktmbuf_priv_size (mp); + aq->rq.lpb_sizem1 +=sizeof (struct rte_mbuf ); + aq->rq.lpb_sizem1 /=8 ; + aq->rq.lpb_sizem1 -=1 ;/* Expressed in size minus one */ + aq->rq.ena =1 ; + aq->rq.pb_caching =0x2 ;/* First cache aligned block to LLC */ + aq->rq.xqe_imm_size =0 ;/* No pkt data copy to CQE */ + aq->rq.rq_int_ena =0 ; +/* Many to one reduction */ + aq->rq.qint_idx = qid % dev->qints; + +if (otx2_ethdev_fixup_is_limit_cq_full (dev)) + aq->rq.xqe_drop_ena =1 ; + + rc =otx2_mbox_process (mbox); +if (rc) { +otx2_err ("Failed to init rq context" ); + goto fail; + } + +return 0 ; +fail: +return rc; +} + +static int +nix_cq_rq_uninit (struct rte_eth_dev *eth_dev,struct otx2_eth_rxq *rxq) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct otx2_mbox *mbox = dev->mbox; +struct nix_aq_enq_req *aq; +int rc; + +/* RQ is already disabled */ +/* Disable CQ */ + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx = rxq->rq; + aq->ctype =NIX_AQ_CTYPE_CQ ; + aq->op =NIX_AQ_INSTOP_WRITE ; + + aq->cq.ena =0 ; + aq->cq_mask.ena = ~(aq->cq_mask.ena); + + rc =otx2_mbox_process (mbox); +if (rc <0 ) { +otx2_err ("Failed to disable cq context" ); +return rc; + } + +return 0 ; +} + +static inline int +nix_get_data_off (struct otx2_eth_dev *dev) +{ +RTE_SET_USED (dev); + +return 0 ; +} + +uint64_t +otx2_nix_rxq_mbuf_setup (struct otx2_eth_dev *dev,uint16_t port_id) +{ +struct rte_mbuf mb_def; +uint64_t *tmp; + +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , data_off) %8 !=0 ); +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , refcnt) - + offsetof(struct rte_mbuf , data_off) !=2 ); +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , nb_segs) - + offsetof(struct rte_mbuf , data_off) !=4 ); +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , port) - + offsetof(struct rte_mbuf , data_off) !=6 ); + mb_def.nb_segs =1 ; + mb_def.data_off =RTE_PKTMBUF_HEADROOM +nix_get_data_off (dev); + mb_def.port = port_id; +rte_mbuf_refcnt_set (&mb_def,1 ); + +/* Prevent compiler reordering: rearm_data covers previous fields */ +rte_compiler_barrier (); + tmp = (uint64_t *)&mb_def.rearm_data; + +return *tmp; +} + +static void +otx2_nix_rx_queue_release (void *rx_queue) +{ +struct otx2_eth_rxq *rxq = rx_queue; + +if (!rxq) +return ; + +otx2_nix_dbg ("Releasing rxq %u" , rxq->rq); +nix_cq_rq_uninit (rxq->eth_dev, rxq); +rte_free (rx_queue); +} + +static int +otx2_nix_rx_queue_setup (struct rte_eth_dev *eth_dev,uint16_t rq, +uint16_t nb_desc,unsigned int socket, +const struct rte_eth_rxconf *rx_conf, +struct rte_mempool *mp) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct rte_mempool_ops *ops; +struct otx2_eth_rxq *rxq; +const char *platform_ops; +enum nix_q_size_e qsize; +uint64_t offloads; +int rc; + + rc = -EINVAL ; + +/* Compile time check to make sure all fast path elements in a CL */ +RTE_BUILD_BUG_ON (offsetof(struct otx2_eth_rxq , slow_path_start) >=128 ); + +/* Sanity checks */ +if (rx_conf->rx_deferred_start ==1 ) { +otx2_err ("Deferred Rx start is not supported" ); + goto fail; + } + + platform_ops =rte_mbuf_platform_mempool_ops (); +/* This driver needs octeontx2_npa mempool ops to work */ + ops =rte_mempool_get_ops (mp->ops_index); +if (strncmp (ops->name, platform_ops,RTE_MEMPOOL_OPS_NAMESIZE )) { +otx2_err ("mempool ops should be of octeontx2_npa type" ); + goto fail; + } + +if (mp->pool_id ==0 ) { +otx2_err ("Invalid pool_id" ); + goto fail; + } + +/* Free memory prior to re-allocation if needed */ +if (eth_dev->data->rx_queues[rq] !=NULL ) { +otx2_nix_dbg ("Freeing memory prior to re-allocation %d" , rq); +otx2_nix_rx_queue_release (eth_dev->data->rx_queues[rq]); + eth_dev->data->rx_queues[rq] =NULL ; + } + + offloads = rx_conf->offloads | eth_dev->data->dev_conf.rxmode.offloads; + dev->rx_offloads |= offloads; + +/* Find the CQ queue size */ + qsize =nix_qsize_clampup_get (dev, nb_desc); +/* Allocate rxq memory */ + rxq =rte_zmalloc_socket ("otx2 rxq" ,sizeof (*rxq),OTX2_ALIGN , socket); +if (rxq ==NULL ) { +otx2_err ("Failed to allocate rq=%d" , rq); + rc = -ENOMEM ; + goto fail; + } + + rxq->eth_dev = eth_dev; + rxq->rq = rq; + rxq->cq_door = dev->base +NIX_LF_CQ_OP_DOOR ; + rxq->cq_status = (int64_t *)(dev->base +NIX_LF_CQ_OP_STATUS ); + rxq->wdata = (uint64_t )rq <<32 ; + rxq->aura =npa_lf_aura_handle_to_aura (mp->pool_id); + rxq->mbuf_initializer =otx2_nix_rxq_mbuf_setup (dev, + eth_dev->data->port_id); + rxq->offloads = offloads; + rxq->pool = mp; + rxq->qlen =nix_qsize_to_val (qsize); + rxq->qsize = qsize; + +/* Alloc completion queue */ + rc =nix_cq_rq_init (eth_dev, dev, rq, rxq, mp); +if (rc) { +otx2_err ("Failed to allocate rxq=%u" , rq); + goto free_rxq; + } + + rxq->qconf.socket_id = socket; + rxq->qconf.nb_desc = nb_desc; + rxq->qconf.mempool = mp; +memcpy (&rxq->qconf.conf.rx, rx_conf,sizeof (struct rte_eth_rxconf )); + +nix_rx_queue_reset (rxq); +otx2_nix_dbg ("rq=%d pool=%s qsize=%d nb_desc=%d->%d" , + rq, mp->name, qsize, nb_desc, rxq->qlen); + + eth_dev->data->rx_queues[rq] = rxq; + eth_dev->data->rx_queue_state[rq] =RTE_ETH_QUEUE_STATE_STOPPED ; +return 0 ; + +free_rxq: +otx2_nix_rx_queue_release (rxq); +fail: +return rc; +} +static int otx2_nix_configure (struct rte_eth_dev *eth_dev) {
@@ -241,6 +549,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, .link_update = otx2_nix_link_update, + .rx_queue_setup = otx2_nix_rx_queue_setup, + .rx_queue_release = otx2_nix_rx_queue_release, .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg,
drivers/net/octeontx2/otx2_ethdev.h +51 -0
87 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 18/58 net/octeontx2: add Tx queue setup and release
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Tx queue setup and release.
--- drivers/net/octeontx2/otx2_ethdev.c | 384 +++++++++++++++++++++++++++- drivers/net/octeontx2/otx2_ethdev.h | 24 ++ drivers/net/octeontx2/otx2_tx.h | 28 ++ 3 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 drivers/net/octeontx2/otx2_tx.h
drivers/net/octeontx2/otx2_ethdev.c +383 -1
@@ -422,6 +422,372 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t rq,return rc; } +static inline uint8_t +nix_sq_max_sqe_sz (struct otx2_eth_txq *txq) +{ +/* +* Maximum three segments can be supported with W8, Choose +* NIX_MAXSQESZ_W16 for multi segment offload. +*/ +if (txq->offloads &DEV_TX_OFFLOAD_MULTI_SEGS ) +return NIX_MAXSQESZ_W16 ; +else +return NIX_MAXSQESZ_W8 ; +} + +static int +nix_sq_init (struct otx2_eth_txq *txq) +{ +struct otx2_eth_dev *dev = txq->dev; +struct otx2_mbox *mbox = dev->mbox; +struct nix_aq_enq_req *sq; + +if (txq->sqb_pool->pool_id ==0 ) +return -EINVAL ; + + sq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + sq->qidx = txq->sq; + sq->ctype =NIX_AQ_CTYPE_SQ ; + sq->op =NIX_AQ_INSTOP_INIT ; + sq->sq.max_sqe_size =nix_sq_max_sqe_sz (txq); + + sq->sq.default_chan = dev->tx_chan_base; + sq->sq.sqe_stype =NIX_STYPE_STF ; + sq->sq.ena =1 ; +if (sq->sq.max_sqe_size ==NIX_MAXSQESZ_W8 ) + sq->sq.sqe_stype =NIX_STYPE_STP ; + sq->sq.sqb_aura = +npa_lf_aura_handle_to_aura (txq->sqb_pool->pool_id); + sq->sq.sq_int_ena =BIT (NIX_SQINT_LMT_ERR ); + sq->sq.sq_int_ena |=BIT (NIX_SQINT_SQB_ALLOC_FAIL ); + sq->sq.sq_int_ena |=BIT (NIX_SQINT_SEND_ERR ); + sq->sq.sq_int_ena |=BIT (NIX_SQINT_MNQ_ERR ); + +/* Many to one reduction */ + sq->sq.qint_idx = txq->sq % dev->qints; + +return otx2_mbox_process (mbox); +} + +static int +nix_sq_uninit (struct otx2_eth_txq *txq) +{ +struct otx2_eth_dev *dev = txq->dev; +struct otx2_mbox *mbox = dev->mbox; +struct ndc_sync_op *ndc_req; +struct nix_aq_enq_rsp *rsp; +struct nix_aq_enq_req *aq; +uint16_t sqes_per_sqb; +void *sqb_buf; +int rc, count; + +otx2_nix_dbg ("Cleaning up sq %u" , txq->sq); + + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx = txq->sq; + aq->ctype =NIX_AQ_CTYPE_SQ ; + aq->op =NIX_AQ_INSTOP_READ ; + + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +/* Check if sq is already cleaned up */ +if (!rsp->sq.ena) +return 0 ; + +/* Disable sq */ + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx = txq->sq; + aq->ctype =NIX_AQ_CTYPE_SQ ; + aq->op =NIX_AQ_INSTOP_WRITE ; + + aq->sq_mask.ena = ~aq->sq_mask.ena; + aq->sq.ena =0 ; + + rc =otx2_mbox_process (mbox); +if (rc) +return rc; + +/* Read SQ and free sqb's */ + aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); + aq->qidx = txq->sq; + aq->ctype =NIX_AQ_CTYPE_SQ ; + aq->op =NIX_AQ_INSTOP_READ ; + + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (aq->sq.smq_pend) +rte_panic ("otx2: sq has pending sqe's" ); + + count = aq->sq.sqb_count; + sqes_per_sqb =1 << txq->sqes_per_sqb_log2; +/* Free SQB's that are used */ + sqb_buf = (void *)rsp->sq.head_sqb; +while (count) { +void *next_sqb; + + next_sqb = *(void **)((uintptr_t )sqb_buf + ((sqes_per_sqb -1 ) * +nix_sq_max_sqe_sz (txq))); +npa_lf_aura_op_free (txq->sqb_pool->pool_id,1 , + (uint64_t )sqb_buf); + sqb_buf = next_sqb; + count--; + } + +/* Free next to use sqb */ +if (rsp->sq.next_sqb) +npa_lf_aura_op_free (txq->sqb_pool->pool_id,1 , + rsp->sq.next_sqb); + +/* Sync NDC-NIX-TX for LF */ + ndc_req =otx2_mbox_alloc_msg_ndc_sync_op (mbox); + ndc_req->nix_lf_tx_sync =1 ; + rc =otx2_mbox_process (mbox); +if (rc) +otx2_err ("Error on NDC-NIX-TX LF sync, rc %d" , rc); + +return rc; +} + +static int +nix_alloc_sqb_pool (int port,struct otx2_eth_txq *txq,uint16_t nb_desc) +{ +struct otx2_eth_dev *dev = txq->dev; +uint16_t sqes_per_sqb, nb_sqb_bufs; +char name[RTE_MEMPOOL_NAMESIZE ]; +struct rte_mempool_objsz sz; +struct npa_aura_s *aura; +uint32_t tmp, blk_sz; + + aura = (struct npa_aura_s *)((uintptr_t )txq->fc_mem +OTX2_ALIGN ); +snprintf (name,sizeof (name),"otx2_sqb_pool_%d_%d" , port, txq->sq); + blk_sz = dev->sqb_size; + +if (nix_sq_max_sqe_sz (txq) ==NIX_MAXSQESZ_W16 ) + sqes_per_sqb = (dev->sqb_size /8 ) /16 ; +else + sqes_per_sqb = (dev->sqb_size /8 ) /8 ; + + nb_sqb_bufs = nb_desc / sqes_per_sqb; +/* Clamp up to minimum SQB buffers */ + nb_sqb_bufs =RTE_MAX (NIX_MIN_SQB , nb_sqb_bufs +NIX_SQB_LIST_SPACE ); + + txq->sqb_pool =rte_mempool_create_empty (name, nb_sqb_bufs, blk_sz, +0 ,0 , dev->node, +MEMPOOL_F_NO_SPREAD ); + txq->nb_sqb_bufs = nb_sqb_bufs; + txq->sqes_per_sqb_log2 = (uint16_t )rte_log2_u32 (sqes_per_sqb); + txq->nb_sqb_bufs_adj = nb_sqb_bufs - +RTE_ALIGN_MUL_CEIL (nb_sqb_bufs, sqes_per_sqb) / sqes_per_sqb; + txq->nb_sqb_bufs_adj = + (NIX_SQB_LOWER_THRESH * txq->nb_sqb_bufs_adj) /100 ; + +if (txq->sqb_pool ==NULL ) { +otx2_err ("Failed to allocate sqe mempool" ); + goto fail; + } + +memset (aura,0 ,sizeof (*aura)); + aura->fc_ena =1 ; + aura->fc_addr = txq->fc_iova; + aura->fc_hyst_bits =0 ;/* Store count on all updates */ +if (rte_mempool_set_ops_byname (txq->sqb_pool,"octeontx2_npa" , aura)) { +otx2_err ("Failed to set ops for sqe mempool" ); + goto fail; + } +if (rte_mempool_populate_default (txq->sqb_pool) <0 ) { +otx2_err ("Failed to populate sqe mempool" ); + goto fail; + } + + tmp =rte_mempool_calc_obj_size (blk_sz,MEMPOOL_F_NO_SPREAD , &sz); +if (dev->sqb_size != sz.elt_size) { +otx2_err ("sqe pool block size is not expected %d != %d" , + dev->sqb_size, tmp); + goto fail; + } + +return 0 ; +fail: +return -ENOMEM ; +} + +void +otx2_nix_form_default_desc (struct otx2_eth_txq *txq) +{ +struct nix_send_ext_s *send_hdr_ext; +struct nix_send_hdr_s *send_hdr; +struct nix_send_mem_s *send_mem; +union nix_send_sg_s *sg; + +/* Initialize the fields based on basic single segment packet */ +memset (&txq->cmd,0 ,sizeof (txq->cmd)); + +if (txq->dev->tx_offload_flags &NIX_TX_NEED_EXT_HDR ) { + send_hdr = (struct nix_send_hdr_s *)&txq->cmd[0 ]; +/* 2(HDR) + 2(EXT_HDR) + 1(SG) + 1(IOVA) = 6/2 - 1 = 2 */ + send_hdr->w0.sizem1 =2 ; + + send_hdr_ext = (struct nix_send_ext_s *)&txq->cmd[2 ]; + send_hdr_ext->w0.subdc =NIX_SUBDC_EXT ; +if (txq->dev->tx_offload_flags &NIX_TX_OFFLOAD_TSTAMP_F ) { +/* Default: one seg packet would have: +* 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM) +* => 8/2 - 1 = 3 +*/ + send_hdr->w0.sizem1 =3 ; + send_hdr_ext->w0.tstmp =1 ; + +/* To calculate the offset for send_mem, +* send_hdr->w0.sizem1 * 2 +*/ + send_mem = (struct nix_send_mem_s *)(txq->cmd + + (send_hdr->w0.sizem1 <<1 )); + send_mem->subdc =NIX_SUBDC_MEM ; + send_mem->dsz =0x0 ; + send_mem->wmem =0x1 ; + send_mem->alg =NIX_SENDMEMALG_SETTSTMP ; + } + sg = (union nix_send_sg_s *)&txq->cmd[4 ]; + }else { + send_hdr = (struct nix_send_hdr_s *)&txq->cmd[0 ]; +/* 2(HDR) + 1(SG) + 1(IOVA) = 4/2 - 1 = 1 */ + send_hdr->w0.sizem1 =1 ; + sg = (union nix_send_sg_s *)&txq->cmd[2 ]; + } + + send_hdr->w0.sq = txq->sq; + sg->subdc =NIX_SUBDC_SG ; + sg->segs =1 ; + sg->ld_type =NIX_SENDLDTYPE_LDD ; + +rte_smp_wmb (); +} + +static void +otx2_nix_tx_queue_release (void *_txq) +{ +struct otx2_eth_txq *txq = _txq; + +if (!txq) +return ; + +otx2_nix_dbg ("Releasing txq %u" , txq->sq); + +/* Free sqb's and disable sq */ +nix_sq_uninit (txq); + +if (txq->sqb_pool) { +rte_mempool_free (txq->sqb_pool); + txq->sqb_pool =NULL ; + } +rte_free (txq); +} + + +static int +otx2_nix_tx_queue_setup (struct rte_eth_dev *eth_dev,uint16_t sq, +uint16_t nb_desc,unsigned int socket_id, +const struct rte_eth_txconf *tx_conf) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +const struct rte_memzone *fc; +struct otx2_eth_txq *txq; +uint64_t offloads; +int rc; + + rc = -EINVAL ; + +/* Compile time check to make sure all fast path elements in a CL */ +RTE_BUILD_BUG_ON (offsetof(struct otx2_eth_txq , slow_path_start) >=128 ); + +if (tx_conf->tx_deferred_start) { +otx2_err ("Tx deferred start is not supported" ); + goto fail; + } + +/* Free memory prior to re-allocation if needed. */ +if (eth_dev->data->tx_queues[sq] !=NULL ) { +otx2_nix_dbg ("Freeing memory prior to re-allocation %d" , sq); +otx2_nix_tx_queue_release (eth_dev->data->tx_queues[sq]); + eth_dev->data->tx_queues[sq] =NULL ; + } + +/* Find the expected offloads for this queue */ + offloads = tx_conf->offloads | eth_dev->data->dev_conf.txmode.offloads; + +/* Allocating tx queue data structure */ + txq =rte_zmalloc_socket ("otx2_ethdev TX queue" ,sizeof (*txq), +OTX2_ALIGN , socket_id); +if (txq ==NULL ) { +otx2_err ("Failed to alloc txq=%d" , sq); + rc = -ENOMEM ; + goto fail; + } + txq->sq = sq; + txq->dev = dev; + txq->sqb_pool =NULL ; + txq->offloads = offloads; + dev->tx_offloads |= offloads; + +/* +* Allocate memory for flow control updates from HW. +* Alloc one cache line, so that fits all FC_STYPE modes. +*/ + fc =rte_eth_dma_zone_reserve (eth_dev,"fcmem" , sq, +OTX2_ALIGN +sizeof (struct npa_aura_s ), +OTX2_ALIGN , dev->node); +if (fc ==NULL ) { +otx2_err ("Failed to allocate mem for fcmem" ); + rc = -ENOMEM ; + goto free_txq; + } + txq->fc_iova = fc->iova; + txq->fc_mem = fc->addr; + +/* Initialize the aura sqb pool */ + rc =nix_alloc_sqb_pool (eth_dev->data->port_id, txq, nb_desc); +if (rc) { +otx2_err ("Failed to alloc sqe pool rc=%d" , rc); + goto free_txq; + } + +/* Initialize the SQ */ + rc =nix_sq_init (txq); +if (rc) { +otx2_err ("Failed to init sq=%d context" , sq); + goto free_txq; + } + + txq->fc_cache_pkts =0 ; + txq->io_addr = dev->base +NIX_LF_OP_SENDX (0 ); +/* Evenly distribute LMT slot for each sq */ + txq->lmt_addr = (void *)(dev->lmt_addr + ((sq &LMT_SLOT_MASK ) <<12 )); + + txq->qconf.socket_id = socket_id; + txq->qconf.nb_desc = nb_desc; +memcpy (&txq->qconf.conf.tx, tx_conf,sizeof (struct rte_eth_txconf )); + +otx2_nix_form_default_desc (txq); + +otx2_nix_dbg ("sq=%d fc=%p offload=0x%" PRIx64" sqb=0x%" PRIx64"" +" lmt_addr=%p nb_sqb_bufs=%d sqes_per_sqb_log2=%d" , sq, + fc->addr, offloads, txq->sqb_pool->pool_id, txq->lmt_addr, + txq->nb_sqb_bufs, txq->sqes_per_sqb_log2); + eth_dev->data->tx_queues[sq] = txq; + eth_dev->data->tx_queue_state[sq] =RTE_ETH_QUEUE_STATE_STOPPED ; +return 0 ; + +free_txq: +otx2_nix_tx_queue_release (txq); +fail: +return rc; +} + +static int otx2_nix_configure (struct rte_eth_dev *eth_dev) {
@@ -549,6 +915,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, .link_update = otx2_nix_link_update, + .tx_queue_setup = otx2_nix_tx_queue_setup, + .tx_queue_release = otx2_nix_tx_queue_release, .rx_queue_setup = otx2_nix_rx_queue_setup, .rx_queue_release = otx2_nix_rx_queue_release, .stats_get = otx2_nix_dev_stats_get,
@@ -763,12 +1131,26 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) {struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev);struct rte_pci_device *pci_dev; -int rc; +int rc, i;/* Nothing to be done for secondary processes */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +/* Free up SQs */ +for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) { +otx2_nix_tx_queue_release (eth_dev->data->tx_queues[i]); + eth_dev->data->tx_queues[i] =NULL ; + } + eth_dev->data->nb_tx_queues =0 ; + +/* Free up RQ's and CQ's */ +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { +otx2_nix_rx_queue_release (eth_dev->data->rx_queues[i]); + eth_dev->data->rx_queues[i] =NULL ; + } + eth_dev->data->nb_rx_queues =0 ; +/* Unregister queue irqs */ oxt2_nix_unregister_queue_irqs (eth_dev);
drivers/net/octeontx2/otx2_ethdev.h +24 -0
@@ -19,6 +19,7 @@#include "otx2_irq.h" #include "otx2_mempool.h" #include "otx2_rx.h" +#include "otx2_tx.h" #define OTX2_ETH_DEV_PMD_VERSION "1.0"
@@ -54,6 +55,8 @@#define NIX_RX_NB_SEG_MAX 6#define NIX_CQ_ENTRY_SZ 128#define NIX_CQ_ALIGN 512 +#define NIX_SQB_LOWER_THRESH 90 +#define LMT_SLOT_MASK 0x7f/* If PTP is enabled additional SEND MEM DESC is required which * takes 2 words, hence max 7 iova address are possible
@@ -185,6 +188,24 @@ struct otx2_eth_dev {struct rte_eth_dev *eth_dev; } __rte_cache_aligned; +struct otx2_eth_txq { +uint64_t cmd[8 ]; +int64_t fc_cache_pkts; +uint64_t *fc_mem; +void *lmt_addr; +rte_iova_t io_addr; +rte_iova_t fc_iova; +uint16_t sqes_per_sqb_log2; +int16_t nb_sqb_bufs_adj; +MARKER slow_path_start; +uint16_t nb_sqb_bufs; +uint16_t sq; +uint64_t offloads; +struct otx2_eth_dev *dev; +struct rte_mempool *sqb_pool; +struct otx2_eth_qconf qconf; +} __rte_cache_aligned; +struct otx2_eth_rxq {uint64_t mbuf_initializer;uint64_t data_off;
@@ -310,4 +331,7 @@ int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);int otx2_ethdev_parse_devargs (struct rte_devargs *devargs,struct otx2_eth_dev *dev); +/* Rx and Tx routines */ +void otx2_nix_form_default_desc (struct otx2_eth_txq *txq); +#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_tx.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ + +#ifndef __OTX2_TX_H__ +#define __OTX2_TX_H__ + +#define NIX_TX_OFFLOAD_NONE (0) +#define NIX_TX_OFFLOAD_L3_L4_CSUM_F BIT(0) +#define NIX_TX_OFFLOAD_OL3_OL4_CSUM_F BIT(1) +#define NIX_TX_OFFLOAD_VLAN_QINQ_F BIT(2) +#define NIX_TX_OFFLOAD_MBUF_NOFF_F BIT(3) +#define NIX_TX_OFFLOAD_TSTAMP_F BIT(4) + +/* Flags to control xmit_prepare function. +* Defining it from backwards to denote its been +* not used as offload flags to pick function +*/ +#define NIX_TX_MULTI_SEG_F BIT(15) + +#define NIX_TX_NEED_SEND_HDR_W1 \ + (NIX_TX_OFFLOAD_L3_L4_CSUM_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F | \ + NIX_TX_OFFLOAD_VLAN_QINQ_F) + +#define NIX_TX_NEED_EXT_HDR \ + (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F) + +#endif /* __OTX2_TX_H__ */
Signature · 1 line
2.21.0
PATCH 19/58 net/octeontx2: handle port reconfigure
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
setup tx & rx queues with the previous configuration during port reconfig, it handles cases like port reconfigure without reconfiguring tx & rx queues.
--- drivers/net/octeontx2/otx2_ethdev.c | 180 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 2 + 2 files changed, 182 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +180 -0
@@ -787,6 +787,172 @@ otx2_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t sq,return rc; } +static int +nix_store_queue_cfg_and_then_release (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct otx2_eth_qconf *tx_qconf =NULL ; +struct otx2_eth_qconf *rx_qconf =NULL ; +struct otx2_eth_txq **txq; +struct otx2_eth_rxq **rxq; +int i, nb_rxq, nb_txq; + + nb_rxq =RTE_MIN (dev->configured_nb_rx_qs, eth_dev->data->nb_rx_queues); + nb_txq =RTE_MIN (dev->configured_nb_tx_qs, eth_dev->data->nb_tx_queues); + + tx_qconf =malloc (nb_txq *sizeof (*tx_qconf)); +if (tx_qconf ==NULL ) { +otx2_err ("Failed to allocate memory for tx_qconf" ); + goto fail; + } + + rx_qconf =malloc (nb_rxq *sizeof (*rx_qconf)); +if (rx_qconf ==NULL ) { +otx2_err ("Failed to allocate memory for rx_qconf" ); + goto fail; + } + + txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues; +for (i =0 ; i < nb_txq; i++) { +if (txq[i] ==NULL ) { +otx2_err ("txq[%d] is already released" , i); + goto fail; + } +memcpy (&tx_qconf[i], &txq[i]->qconf,sizeof (*tx_qconf)); +otx2_nix_tx_queue_release (txq[i]); + eth_dev->data->tx_queues[i] =NULL ; + } + + rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues; +for (i =0 ; i < nb_rxq; i++) { +if (rxq[i] ==NULL ) { +otx2_err ("rxq[%d] is already released" , i); + goto fail; + } +memcpy (&rx_qconf[i], &rxq[i]->qconf,sizeof (*rx_qconf)); +otx2_nix_rx_queue_release (rxq[i]); + eth_dev->data->rx_queues[i] =NULL ; + } + + dev->tx_qconf = tx_qconf; + dev->rx_qconf = rx_qconf; +return 0 ; + +fail: +if (tx_qconf) +free (tx_qconf); +if (rx_qconf) +free (rx_qconf); + +return -ENOMEM ; +} + +static int +nix_restore_queue_cfg (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct otx2_eth_qconf *tx_qconf = dev->tx_qconf; +struct otx2_eth_qconf *rx_qconf = dev->rx_qconf; +struct otx2_eth_txq **txq; +struct otx2_eth_rxq **rxq; +int rc, i, nb_rxq, nb_txq; + + nb_rxq =RTE_MIN (dev->configured_nb_rx_qs, eth_dev->data->nb_rx_queues); + nb_txq =RTE_MIN (dev->configured_nb_tx_qs, eth_dev->data->nb_tx_queues); + + rc = -ENOMEM ; +/* Setup tx & rx queues with previous configuration so +* that the queues can be functional in cases like ports +* are started without re configuring queues. +* +* Usual re config sequence is like below: +* port_configure() { +* if(reconfigure) { +* queue_release() +* queue_setup() +* } +* queue_configure() { +* queue_release() +* queue_setup() +* } +* } +* port_start() +* +* In some application's control path, queue_configure() would +* NOT be invoked for TXQs/RXQs in port_configure(). +* In such cases, queues can be functional after start as the +* queues are already setup in port_configure(). +*/ +for (i =0 ; i < nb_txq; i++) { + rc =otx2_nix_tx_queue_setup (eth_dev, i, tx_qconf[i].nb_desc, + tx_qconf[i].socket_id, + &tx_qconf[i].conf.tx); +if (rc) { +otx2_err ("Failed to setup tx queue rc=%d" , rc); + txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues; +for (i -=1 ; i >=0 ; i--) +otx2_nix_tx_queue_release (txq[i]); + goto fail; + } + } + +free (tx_qconf); tx_qconf =NULL ; + +for (i =0 ; i < nb_rxq; i++) { + rc =otx2_nix_rx_queue_setup (eth_dev, i, rx_qconf[i].nb_desc, + rx_qconf[i].socket_id, + &rx_qconf[i].conf.rx, + rx_qconf[i].mempool); +if (rc) { +otx2_err ("Failed to setup rx queue rc=%d" , rc); + rxq = (struct otx2_eth_rxq **)eth_dev->data->rx_queues; +for (i -=1 ; i >=0 ; i--) +otx2_nix_rx_queue_release (rxq[i]); + goto release_tx_queues; + } + } + +free (rx_qconf); rx_qconf =NULL ; + +return 0 ; + +release_tx_queues: + txq = (struct otx2_eth_txq **)eth_dev->data->tx_queues; +for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) +otx2_nix_tx_queue_release (txq[i]); +fail: +if (tx_qconf) +free (tx_qconf); +if (rx_qconf) +free (rx_qconf); + +return rc; +} + +static uint16_t +nix_eth_nop_burst (void *queue,struct rte_mbuf **mbufs,uint16_t pkts) +{ +RTE_SET_USED (queue); +RTE_SET_USED (mbufs); +RTE_SET_USED (pkts); + +return 0 ; +} + +static void +nix_set_nop_rxtx_function (struct rte_eth_dev *eth_dev) +{ +/* These dummy functions are required for supporting +* some applications which reconfigure queues without +* stopping tx burst and rx burst threads(eg kni app) +* When the queues context is saved, txq/rxqs are released +* which caused app crash since rx/tx burst is still +* on different lcores +*/ + eth_dev->tx_pkt_burst = nix_eth_nop_burst; + eth_dev->rx_pkt_burst = nix_eth_nop_burst; +rte_mb (); +}static int otx2_nix_configure (struct rte_eth_dev *eth_dev)
@@ -843,6 +1009,10 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)/* Free the resources allocated from the previous configure */ if (dev->configured ==1 ) {oxt2_nix_unregister_queue_irqs (eth_dev); +nix_set_nop_rxtx_function (eth_dev); + rc =nix_store_queue_cfg_and_then_release (eth_dev); +if (rc) + goto fail;nix_lf_free (dev); }
@@ -883,6 +1053,16 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } +/* +* Restore queue config when reconfigure followed by +* reconfigure and no queue configure invoked from application case. +*/ +if (dev->configured ==1 ) { + rc =nix_restore_queue_cfg (eth_dev); +if (rc) + goto free_nix_lf; + } +/* Update the mac address */ ea = eth_dev->data->mac_addrs;memcpy (ea, dev->mac_addr,RTE_ETHER_ADDR_LEN );
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -185,6 +185,8 @@ struct otx2_eth_dev {uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];struct otx2_npc_flow_info npc_flow; +struct otx2_eth_qconf *tx_qconf; +struct otx2_eth_qconf *rx_qconf;struct rte_eth_dev *eth_dev; } __rte_cache_aligned;
Signature · 1 line
2.21.0
PATCH 20/58 net/octeontx2: add queue start and stop operations
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add queue start and stop operations. Tx queue needs to update the flow control value, Which will be added in sub subsequent patch.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 92 ++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 2 + 5 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -12,6 +12,7 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -12,6 +12,7 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -11,6 +11,7 @@ Lock-free Tx queue = Y Multiprocess aware = Y Link status = Y Link status event = Y +Queue start/stop = Y RSS hash = Y RSS key update = Y RSS reta update = Y
drivers/net/octeontx2/otx2_ethdev.c +92 -0
110 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -246,6 +246,8 @@ void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);void otx2_nix_promisc_disable (struct rte_eth_dev *eth_dev);void otx2_nix_allmulticast_enable (struct rte_eth_dev *eth_dev);void otx2_nix_allmulticast_disable (struct rte_eth_dev *eth_dev); +int otx2_nix_tx_queue_start (struct rte_eth_dev *eth_dev,uint16_t qidx); +int otx2_nix_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx);uint64_t otx2_nix_rxq_mbuf_setup (struct otx2_eth_dev *dev,uint16_t port_id);/* Link */
Signature · 1 line
2.21.0
PATCH 21/58 net/octeontx2: introduce traffic manager
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Introduce traffic manager infra and default hierarchy creation.
Upon ethdev configure, a default hierarchy is created with one-to-one mapped tm nodes. This topology will be overridden when user explicitly creates and commits a new hierarchy using rte_tm interface.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 16 ++ drivers/net/octeontx2/otx2_ethdev.h | 14 ++ drivers/net/octeontx2/otx2_tm.c | 252 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_tm.h | 67 ++++++++ 6 files changed, 351 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_tm.c create mode 100644 drivers/net/octeontx2/otx2_tm.h
drivers/net/octeontx2/Makefile +1 -0
@@ -30,6 +30,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_tm.c \ otx2_rss.c \ otx2_mac.c \ otx2_link.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -3,6 +3,7 @@ # sources = files( + 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c', 'otx2_link.c',
drivers/net/octeontx2/otx2_ethdev.c +16 -0
@@ -1033,6 +1033,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) rc =nix_store_queue_cfg_and_then_release (eth_dev);if (rc) goto fail; +otx2_nix_tm_fini (eth_dev);nix_lf_free (dev); }
@@ -1066,6 +1067,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } +/* Init the default TM scheduler hierarchy */ + rc =otx2_nix_tm_init_default (eth_dev); +if (rc) { +otx2_err ("Failed to init traffic manager rc=%d" , rc); + goto free_nix_lf; + } +/* Register queue IRQs */ rc =oxt2_nix_register_queue_irqs (eth_dev);if (rc) {
@@ -1368,6 +1376,9 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)/* Also sync same MAC address to CGX table */ otx2_cgx_mac_addr_set (eth_dev, ð_dev->data->mac_addrs[0 ]); +/* Initialize the tm data structures */ +otx2_nix_tm_conf_init (eth_dev); + dev->tx_offload_capa =nix_get_tx_offload_capa (dev); dev->rx_offload_capa =nix_get_rx_offload_capa (dev);
@@ -1423,6 +1434,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) } eth_dev->data->nb_rx_queues =0 ; +/* Free tm resources */ + rc =otx2_nix_tm_fini (eth_dev); +if (rc) +otx2_err ("Failed to cleanup tm, rc=%d" , rc); +/* Unregister queue irqs */ oxt2_nix_unregister_queue_irqs (eth_dev);
drivers/net/octeontx2/otx2_ethdev.h +14 -0
@@ -19,6 +19,7 @@#include "otx2_irq.h" #include "otx2_mempool.h" #include "otx2_rx.h" +#include "otx2_tm.h" #include "otx2_tx.h" #define OTX2_ETH_DEV_PMD_VERSION "1.0"
@@ -181,6 +182,19 @@ struct otx2_eth_dev {uint64_t rx_offload_capa;uint64_t tx_offload_capa;struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ]; +uint16_t txschq[NIX_TXSCH_LVL_CNT ]; +uint16_t txschq_contig[NIX_TXSCH_LVL_CNT ]; +uint16_t txschq_index[NIX_TXSCH_LVL_CNT ]; +uint16_t txschq_contig_index[NIX_TXSCH_LVL_CNT ]; +/* Dis-contiguous queues */ +uint16_t txschq_list[NIX_TXSCH_LVL_CNT ][MAX_TXSCHQ_PER_FUNC ]; +/* Contiguous queues */ +uint16_t txschq_contig_list[NIX_TXSCH_LVL_CNT ][MAX_TXSCHQ_PER_FUNC ]; +uint16_t otx2_tm_root_lvl; +uint16_t tm_flags; +uint16_t tm_leaf_cnt; +struct otx2_nix_tm_node_list node_list; +struct otx2_nix_tm_shaper_profile_list shaper_profile_list;struct otx2_rss_info rss_info;uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];
drivers/net/octeontx2/otx2_tm.c new file +252 -0
252 lines not on this page · raw message
drivers/net/octeontx2/otx2_tm.h new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 22/58 net/octeontx2: alloc and free TM HW resources
In reply to [email protected]From: Krzysztof Kanas <[email protected]>
Allocate and free shaper/scheduler hardware resources for nodes of hirearchy levels in sw.
--- drivers/net/octeontx2/otx2_tm.c | 350 ++++++++++++++++++++++++++++++++ 1 file changed, 350 insertions(+)
drivers/net/octeontx2/otx2_tm.c +350 -0
@@ -54,6 +54,69 @@ nix_tm_node_search(struct otx2_eth_dev *dev,return NULL ; } +static uint32_t +check_rr (struct otx2_eth_dev *dev,uint32_t priority,uint32_t parent_id) +{ +struct otx2_nix_tm_node *tm_node; +uint32_t rr_num =0 ; + + TAILQ_FOREACH(tm_node, &dev->node_list, node) { +if (!tm_node->parent) +continue ; + +if (!(tm_node->parent->id == parent_id)) +continue ; + +if (tm_node->priority == priority) + rr_num++; + } +return rr_num; +} + +static int +nix_tm_update_parent_info (struct otx2_eth_dev *dev) +{ +struct otx2_nix_tm_node *tm_node_child; +struct otx2_nix_tm_node *tm_node; +struct otx2_nix_tm_node *parent; +uint32_t rr_num =0 ; +uint32_t priority; + + TAILQ_FOREACH(tm_node, &dev->node_list, node) { +if (!tm_node->parent) +continue ; +/* Count group of children of same priority i.e are RR */ + parent = tm_node->parent; + priority = tm_node->priority; + rr_num =check_rr (dev, priority, parent->id); + +/* Assuming that multiple RR groups are +* not configured based on capability. +*/ +if (rr_num >1 ) { + parent->rr_prio = priority; + parent->rr_num = rr_num; + } + +/* Find out static priority children that are not in RR */ + TAILQ_FOREACH(tm_node_child, &dev->node_list, node) { +if (!tm_node_child->parent) +continue ; +if (parent->id != tm_node_child->parent->id) +continue ; +if (parent->max_prio ==UINT32_MAX && + tm_node_child->priority != parent->rr_prio) + parent->max_prio =0 ; + +if (parent->max_prio < tm_node_child->priority && + parent->rr_prio != tm_node_child->priority) + parent->max_prio = tm_node_child->priority; + } + } + +return 0 ; +} + static int nix_tm_node_add_to_list(struct otx2_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority,
@@ -115,6 +178,274 @@ nix_tm_clear_shaper_profiles(struct otx2_eth_dev *dev)return 0 ; } +static int +nix_tm_free_resources (struct otx2_eth_dev *dev,uint32_t flags_mask, +uint32_t flags,bool hw_only) +{ +struct otx2_nix_tm_shaper_profile *shaper_profile; +struct otx2_nix_tm_node *tm_node, *next_node; +struct otx2_mbox *mbox = dev->mbox; +struct nix_txsch_free_req *req; +uint32_t shaper_profile_id; +bool skip_node = false; +int rc =0 ; + + next_node =TAILQ_FIRST (&dev->node_list); +while (next_node) { + tm_node = next_node; + next_node =TAILQ_NEXT (tm_node, node); + +/* Check for only requested nodes */ +if ((tm_node->flags & flags_mask) != flags) +continue ; + +if (nix_tm_have_tl1_access (dev) && + tm_node->hw_lvl_id ==NIX_TXSCH_LVL_TL1 ) + skip_node = true; + +otx2_tm_dbg ("Free hwres for node %u, hwlvl %u, hw_id %u (%p)" , + tm_node->id, tm_node->hw_lvl_id, + tm_node->hw_id, tm_node); +/* Free specific HW resource if requested */ +if (!skip_node && flags_mask && + tm_node->flags &NIX_TM_NODE_HWRES ) { + req =otx2_mbox_alloc_msg_nix_txsch_free (mbox); + req->flags =0 ; + req->schq_lvl = tm_node->hw_lvl_id; + req->schq = tm_node->hw_id; + rc =otx2_mbox_process (mbox); +if (rc) +break ; + }else { + skip_node = false; + } + tm_node->flags &= ~NIX_TM_NODE_HWRES ; + +/* Leave software elements if needed */ +if (hw_only) +continue ; + + shaper_profile_id = tm_node->params.shaper_profile_id; + shaper_profile = +nix_tm_shaper_profile_search (dev, shaper_profile_id); +if (shaper_profile) + shaper_profile->reference_count--; + +TAILQ_REMOVE (&dev->node_list, tm_node, node); +rte_free (tm_node); + } + +if (!flags_mask) { +/* Free all hw resources */ + req =otx2_mbox_alloc_msg_nix_txsch_free (mbox); + req->flags =TXSCHQ_FREE_ALL ; + +return otx2_mbox_process (mbox); + } + +return rc; +} + +static uint8_t +nix_tm_copy_rsp_to_dev (struct otx2_eth_dev *dev, +struct nix_txsch_alloc_rsp *rsp) +{ +uint16_t schq; +uint8_t lvl; + +for (lvl =0 ; lvl <NIX_TXSCH_LVL_CNT ; lvl++) { +for (schq =0 ; schq <MAX_TXSCHQ_PER_FUNC ; schq++) { + dev->txschq_list[lvl][schq] = rsp->schq_list[lvl][schq]; + dev->txschq_contig_list[lvl][schq] = + rsp->schq_contig_list[lvl][schq]; + } + + dev->txschq[lvl] = rsp->schq[lvl]; + dev->txschq_contig[lvl] = rsp->schq_contig[lvl]; + } +return 0 ; +} + +static int +nix_tm_assign_id_to_node (struct otx2_eth_dev *dev, +struct otx2_nix_tm_node *child, +struct otx2_nix_tm_node *parent) +{ +uint32_t hw_id, schq_con_index, prio_offset; +uint32_t l_id, schq_index; + +otx2_tm_dbg ("Assign hw id for child node %u, lvl %u, hw_lvl %u (%p)" , + child->id, child->level_id, child->hw_lvl_id, child); + + child->flags |=NIX_TM_NODE_HWRES ; + +/* Process root nodes */ +if (dev->otx2_tm_root_lvl ==NIX_TXSCH_LVL_TL2 && + child->hw_lvl_id == dev->otx2_tm_root_lvl && !parent) { +int idx =0 ; +uint32_t tschq_con_index; + + l_id = child->hw_lvl_id; + tschq_con_index = dev->txschq_contig_index[l_id]; + hw_id = dev->txschq_contig_list[l_id][tschq_con_index]; + child->hw_id = hw_id; + dev->txschq_contig_index[l_id]++; +/* Update TL1 hw_id for its parent for config purpose */ + idx = dev->txschq_index[NIX_TXSCH_LVL_TL1 ]++; + hw_id = dev->txschq_list[NIX_TXSCH_LVL_TL1 ][idx]; + child->parent_hw_id = hw_id; +return 0 ; + } +if (dev->otx2_tm_root_lvl ==NIX_TXSCH_LVL_TL1 && + child->hw_lvl_id == dev->otx2_tm_root_lvl && !parent) { +uint32_t tschq_con_index; + + l_id = child->hw_lvl_id; + tschq_con_index = dev->txschq_index[l_id]; + hw_id = dev->txschq_list[l_id][tschq_con_index]; + child->hw_id = hw_id; + dev->txschq_index[l_id]++; +return 0 ; + } + +/* Process children with parents */ + l_id = child->hw_lvl_id; + schq_index = dev->txschq_index[l_id]; + schq_con_index = dev->txschq_contig_index[l_id]; + +if (child->priority == parent->rr_prio) { + hw_id = dev->txschq_list[l_id][schq_index]; + child->hw_id = hw_id; + child->parent_hw_id = parent->hw_id; + dev->txschq_index[l_id]++; + }else { + prio_offset = schq_con_index + child->priority; + hw_id = dev->txschq_contig_list[l_id][prio_offset]; + child->hw_id = hw_id; + } +return 0 ; +} + +static int +nix_tm_assign_hw_id (struct otx2_eth_dev *dev) +{ +struct otx2_nix_tm_node *parent, *child; +uint32_t child_hw_lvl, con_index_inc, i; + +for (i =NIX_TXSCH_LVL_TL1 ; i >0 ; i--) { + TAILQ_FOREACH(parent, &dev->node_list, node) { + child_hw_lvl = parent->hw_lvl_id -1 ; +if (parent->hw_lvl_id != i) +continue ; + TAILQ_FOREACH(child, &dev->node_list, node) { +if (!child->parent) +continue ; +if (child->parent->id != parent->id) +continue ; +nix_tm_assign_id_to_node (dev, child, parent); + } + + con_index_inc = parent->max_prio +1 ; + dev->txschq_contig_index[child_hw_lvl] += con_index_inc; + +/* +* Explicitly assign id to parent node if it +* doesn't have a parent +*/ +if (parent->hw_lvl_id == dev->otx2_tm_root_lvl) +nix_tm_assign_id_to_node (dev, parent,NULL ); + } + } +return 0 ; +} + +static uint8_t +nix_tm_count_req_schq (struct otx2_eth_dev *dev, +struct nix_txsch_alloc_req *req,uint8_t lvl) +{ +struct otx2_nix_tm_node *tm_node; +uint8_t contig_count; + + TAILQ_FOREACH(tm_node, &dev->node_list, node) { +if (lvl == tm_node->hw_lvl_id) { + req->schq[lvl -1 ] += tm_node->rr_num; +if (tm_node->max_prio !=UINT32_MAX ) { + contig_count = tm_node->max_prio +1 ; + req->schq_contig[lvl -1 ] += contig_count; + } + } +if (lvl == dev->otx2_tm_root_lvl && + dev->otx2_tm_root_lvl && lvl ==NIX_TXSCH_LVL_TL2 && + tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) { + req->schq_contig[dev->otx2_tm_root_lvl]++; + } + } + + req->schq[NIX_TXSCH_LVL_TL1 ] =1 ; + req->schq_contig[NIX_TXSCH_LVL_TL1 ] =0 ; + +return 0 ; +} + +static int +nix_tm_prepare_txschq_req (struct otx2_eth_dev *dev, +struct nix_txsch_alloc_req *req) +{ +uint8_t i; + +for (i =NIX_TXSCH_LVL_TL1 ; i >0 ; i--) +nix_tm_count_req_schq (dev, req, i); + +for (i =0 ; i <NIX_TXSCH_LVL_CNT ; i++) { + dev->txschq_index[i] =0 ; + dev->txschq_contig_index[i] =0 ; + } +return 0 ; +} + +static int +nix_tm_send_txsch_alloc_msg (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; +struct nix_txsch_alloc_req *req; +struct nix_txsch_alloc_rsp *rsp; +int rc; + + req =otx2_mbox_alloc_msg_nix_txsch_alloc (mbox); + + rc =nix_tm_prepare_txschq_req (dev, req); +if (rc) +return rc; + + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +nix_tm_copy_rsp_to_dev (dev, rsp); + +nix_tm_assign_hw_id (dev); +return 0 ; +} + +static int +nix_tm_alloc_resources (struct rte_eth_dev *eth_dev,bool xmit_enable) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc; + +RTE_SET_USED (xmit_enable); + +nix_tm_update_parent_info (dev); + + rc =nix_tm_send_txsch_alloc_msg (dev); +if (rc) { +otx2_err ("TM failed to alloc tm resources=%d" , rc); +return rc; + } + +return 0 ; +} +static int nix_tm_prepare_default_tree (struct rte_eth_dev *eth_dev) {
@@ -226,6 +557,13 @@ int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev)uint16_t sq_cnt = eth_dev->data->nb_tx_queues;int rc; +/* Free up all resources already held */ + rc =nix_tm_free_resources (dev,0 ,0 , false); +if (rc) { +otx2_err ("Failed to freeup existing resources,rc=%d" , rc); +return rc; + } +/* Clear shaper profiles */ nix_tm_clear_shaper_profiles (dev); dev->tm_flags =NIX_TM_DEFAULT_TREE ;
@@ -234,6 +572,9 @@ int otx2_nix_tm_init_default(struct rte_eth_dev *eth_dev)if (rc !=0 )return rc; + rc =nix_tm_alloc_resources (eth_dev, false); +if (rc !=0 ) +return rc; dev->tm_leaf_cnt = sq_cnt;return 0 ;
@@ -243,6 +584,15 @@ int otx2_nix_tm_fini(struct rte_eth_dev *eth_dev) {struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc; + +/* Xmit is assumed to be disabled */ +/* Free up resources already held */ + rc =nix_tm_free_resources (dev,0 ,0 , false); +if (rc) { +otx2_err ("Failed to freeup existing resources,rc=%d" , rc); +return rc; + }/* Clear shaper profiles */ nix_tm_clear_shaper_profiles (dev);
Signature · 1 line
2.21.0
PATCH 23/58 net/octeontx2: configure TM HW resources
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
This patch sets up and configure hierarchy in hw nodes. Since all the registers are with RVU AF, register configuration is also done using mbox communication.
--- drivers/net/octeontx2/otx2_tm.c | 504 ++++++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_tm.h | 82 ++++++ 2 files changed, 586 insertions(+)
drivers/net/octeontx2/otx2_tm.c +504 -0
@@ -20,6 +20,41 @@ enum otx2_tm_node_level { OTX2_TM_LVL_MAX, }; +static inline +uint64_t shaper2regval (struct shaper_params *shaper) +{ +return (shaper->burst_exponent <<37 ) | (shaper->burst_mantissa <<29 ) | + (shaper->div_exp <<13 ) | (shaper->exponent <<9 ) | + (shaper->mantissa <<1 ); +} + +static int +nix_get_link (struct otx2_eth_dev *dev) +{ +int link =13 /* SDP */ ; +uint16_t lmac_chan; +uint16_t map; + + lmac_chan = dev->tx_chan_base; + +/* CGX lmac link */ +if (lmac_chan >=0x800 ) { + map = lmac_chan &0x7FF ; + link =4 * ((map >>8 ) &0xF ) + ((map >>4 ) &0xF ); + }else if (lmac_chan <0x700 ) { +/* LBK channel */ + link =12 ; + } + +return link; +} + +static uint8_t +nix_get_relchan (struct otx2_eth_dev *dev) +{ +return dev->tx_chan_base &0xff ; +} +static bool nix_tm_have_tl1_access (struct otx2_eth_dev *dev) {
@@ -28,6 +63,24 @@ nix_tm_have_tl1_access(struct otx2_eth_dev *dev) !is_lbk && !dev->maxvf; } +static int +find_prio_anchor (struct otx2_eth_dev *dev,uint32_t node_id) +{ +struct otx2_nix_tm_node *child_node; + + TAILQ_FOREACH(child_node, &dev->node_list, node) { +if (!child_node->parent) +continue ; +if (!(child_node->parent->id == node_id)) +continue ; +if (child_node->priority == child_node->parent->rr_prio) +continue ; +return child_node->hw_id - child_node->priority; + } +return 0 ; +} + +static struct otx2_nix_tm_shaper_profile *nix_tm_shaper_profile_search (struct otx2_eth_dev *dev,uint32_t shaper_id) {
@@ -40,6 +93,451 @@ nix_tm_shaper_profile_search(struct otx2_eth_dev *dev, uint32_t shaper_id)return NULL ; } +static inline uint64_t +shaper_rate_to_nix (uint64_t cclk_hz,uint64_t cclk_ticks, +uint64_t value,uint64_t *exponent_p, +uint64_t *mantissa_p,uint64_t *div_exp_p) +{ +uint64_t div_exp, exponent, mantissa; + +/* Boundary checks */ +if (value <MIN_SHAPER_RATE (cclk_hz, cclk_ticks) || + value >MAX_SHAPER_RATE (cclk_hz, cclk_ticks)) +return 0 ; + +if (value <=SHAPER_RATE (cclk_hz, cclk_ticks,0 ,0 ,0 )) { +/* Calculate rate div_exp and mantissa using +* the following formula: +* +* value = (cclk_hz * (256 + mantissa) +* / ((cclk_ticks << div_exp) * 256) +*/ + div_exp =0 ; + exponent =0 ; + mantissa =MAX_RATE_MANTISSA ; + +while (value < (cclk_hz / (cclk_ticks << div_exp))) + div_exp +=1 ; + +while (value < + ((cclk_hz * (256 + mantissa)) / + ((cclk_ticks << div_exp) *256 ))) + mantissa -=1 ; + }else { +/* Calculate rate exponent and mantissa using +* the following formula: +* +* value = (cclk_hz * ((256 + mantissa) << exponent) +* / (cclk_ticks * 256) +* +*/ + div_exp =0 ; + exponent =MAX_RATE_EXPONENT ; + mantissa =MAX_RATE_MANTISSA ; + +while (value < (cclk_hz * (1 << exponent)) / cclk_ticks) + exponent -=1 ; + +while (value < (cclk_hz * ((256 + mantissa) << exponent)) / + (cclk_ticks *256 )) + mantissa -=1 ; + } + +if (div_exp >MAX_RATE_DIV_EXP || + exponent >MAX_RATE_EXPONENT || mantissa >MAX_RATE_MANTISSA ) +return 0 ; + +if (div_exp_p) + *div_exp_p = div_exp; +if (exponent_p) + *exponent_p = exponent; +if (mantissa_p) + *mantissa_p = mantissa; + +/* Calculate real rate value */ +return SHAPER_RATE (cclk_hz, cclk_ticks, exponent, mantissa, div_exp); +} + +static inline uint64_t +lx_shaper_rate_to_nix (uint64_t cclk_hz,uint32_t hw_lvl, +uint64_t value,uint64_t *exponent, +uint64_t *mantissa,uint64_t *div_exp) +{ +if (hw_lvl ==NIX_TXSCH_LVL_TL1 ) +return shaper_rate_to_nix (cclk_hz,L1_TIME_WHEEL_CCLK_TICKS , + value, exponent, mantissa, div_exp); +else +return shaper_rate_to_nix (cclk_hz,LX_TIME_WHEEL_CCLK_TICKS , + value, exponent, mantissa, div_exp); +} + +static inline uint64_t +shaper_burst_to_nix (uint64_t value,uint64_t *exponent_p, +uint64_t *mantissa_p) +{ +uint64_t exponent, mantissa; + +if (value <MIN_SHAPER_BURST || value >MAX_SHAPER_BURST ) +return 0 ; + +/* Calculate burst exponent and mantissa using +* the following formula: +* +* value = (((256 + mantissa) << (exponent + 1) +/ 256) +* +*/ + exponent =MAX_BURST_EXPONENT ; + mantissa =MAX_BURST_MANTISSA ; + +while (value < (1ull << (exponent +1 ))) + exponent -=1 ; + +while (value < ((256 + mantissa) << (exponent +1 )) /256 ) + mantissa -=1 ; + +if (exponent >MAX_BURST_EXPONENT || mantissa >MAX_BURST_MANTISSA ) +return 0 ; + +if (exponent_p) + *exponent_p = exponent; +if (mantissa_p) + *mantissa_p = mantissa; + +return SHAPER_BURST (exponent, mantissa); +} + +static int +configure_shaper_cir_pir_reg (struct otx2_eth_dev *dev, +struct otx2_nix_tm_node *tm_node, +struct shaper_params *cir, +struct shaper_params *pir) +{ +uint32_t shaper_profile_id =RTE_TM_SHAPER_PROFILE_ID_NONE ; +struct otx2_nix_tm_shaper_profile *shaper_profile =NULL ; +struct rte_tm_shaper_params *param; + + shaper_profile_id = tm_node->params.shaper_profile_id; + + shaper_profile =nix_tm_shaper_profile_search (dev, shaper_profile_id); +if (shaper_profile) { + param = &shaper_profile->profile; +/* Calculate CIR exponent and mantissa */ +if (param->committed.rate) + cir->rate =lx_shaper_rate_to_nix (CCLK_HZ , + tm_node->hw_lvl_id, + param->committed.rate, + &cir->exponent, + &cir->mantissa, + &cir->div_exp); + +/* Calculate PIR exponent and mantissa */ +if (param->peak.rate) + pir->rate =lx_shaper_rate_to_nix (CCLK_HZ , + tm_node->hw_lvl_id, + param->peak.rate, + &pir->exponent, + &pir->mantissa, + &pir->div_exp); + +/* Calculate CIR burst exponent and mantissa */ +if (param->committed.size) + cir->burst =shaper_burst_to_nix (param->committed.size, + &cir->burst_exponent, + &cir->burst_mantissa); + +/* Calculate PIR burst exponent and mantissa */ +if (param->peak.size) + pir->burst =shaper_burst_to_nix (param->peak.size, + &pir->burst_exponent, + &pir->burst_mantissa); + } + +return 0 ; +} + +static int +send_tm_reqval (struct otx2_mbox *mbox,struct nix_txschq_config *req) +{ +int rc; + +if (req->num_regs >MAX_REGS_PER_MBOX_MSG ) +return -ERANGE ; + + rc =otx2_mbox_process (mbox); +if (rc) +return rc; + + req->num_regs =0 ; +return 0 ; +} + +static int +populate_tm_registers (struct otx2_eth_dev *dev, +struct otx2_nix_tm_node *tm_node) +{ +uint64_t strict_schedul_prio, rr_prio; +struct otx2_mbox *mbox = dev->mbox; +volatile uint64_t *reg, *regval; +uint64_t parent =0 , child =0 ; +struct shaper_params cir, pir; +struct nix_txschq_config *req; +uint64_t rr_quantum; +uint32_t hw_lvl; +uint32_t schq; +int rc; + +memset (&cir,0 ,sizeof (cir)); +memset (&pir,0 ,sizeof (pir)); + +/* Skip leaf nodes */ +if (tm_node->hw_lvl_id ==NIX_TXSCH_LVL_CNT ) +return 0 ; + +/* Root node will not have a parent node */ +if (tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) + parent = tm_node->parent_hw_id; +else + parent = tm_node->parent->hw_id; + +/* Do we need this trigger to configure TL1 */ +if (dev->otx2_tm_root_lvl ==NIX_TXSCH_LVL_TL2 && + tm_node->hw_lvl_id == dev->otx2_tm_root_lvl) { + schq = parent; +/* +* Default config for TL1. +* For VF this is always ignored. +*/ + + req =otx2_mbox_alloc_msg_nix_txschq_cfg (mbox); + req->lvl =NIX_TXSCH_LVL_TL1 ; + +/* Set DWRR quantum */ + req->reg[0 ] =NIX_AF_TL1X_SCHEDULE (schq); + req->regval[0 ] =TXSCH_TL1_DFLT_RR_QTM ; + req->num_regs++; + + req->reg[1 ] =NIX_AF_TL1X_TOPOLOGY (schq); + req->regval[1 ] = (TXSCH_TL1_DFLT_RR_PRIO <<1 ); + req->num_regs++; + + req->reg[2 ] =NIX_AF_TL1X_CIR (schq); + req->regval[2 ] =0 ; + req->num_regs++; + + rc =send_tm_reqval (mbox, req); +if (rc) + goto error; + } + +if (tm_node->hw_lvl_id !=NIX_TXSCH_LVL_SMQ ) + child =find_prio_anchor (dev, tm_node->id); + + rr_prio = tm_node->rr_prio; + hw_lvl = tm_node->hw_lvl_id; + strict_schedul_prio = tm_node->priority; + schq = tm_node->hw_id; + rr_quantum = (tm_node->weight *NIX_TM_RR_QUANTUM_MAX ) / +MAX_SCHED_WEIGHT ; + +configure_shaper_cir_pir_reg (dev, tm_node, &cir, &pir); + +otx2_tm_dbg ("Configure node %p, lvl %u hw_lvl %u, id %u, hw_id %u," +"parent_hw_id %" PRIx64", pir %" PRIx64", cir %" PRIx64, + tm_node, tm_node->level_id, hw_lvl, + tm_node->id, schq, parent, pir.rate, cir.rate); + + rc = -EFAULT ; + +switch (hw_lvl) { +case NIX_TXSCH_LVL_SMQ : + req =otx2_mbox_alloc_msg_nix_txschq_cfg (mbox); + req->lvl = hw_lvl; + reg = req->reg; + regval = req->regval; + req->num_regs =0 ; + +/* Set xoff which will be cleared later */ + *reg++ =NIX_AF_SMQX_CFG (schq); + *regval++ =BIT_ULL (50 ) | + (NIX_MAX_HW_FRS <<8 ) |NIX_MIN_HW_FRS ; + req->num_regs++; + *reg++ =NIX_AF_MDQX_PARENT (schq); + *regval++ = parent <<16 ; + req->num_regs++; + *reg++ =NIX_AF_MDQX_SCHEDULE (schq); + *regval++ = (strict_schedul_prio <<24 ) | rr_quantum; + req->num_regs++; +if (pir.rate && pir.burst) { + *reg++ =NIX_AF_MDQX_PIR (schq); + *regval++ =shaper2regval (&pir) |1 ; + req->num_regs++; + } + +if (cir.rate && cir.burst) { + *reg++ =NIX_AF_MDQX_CIR (schq); + *regval++ =shaper2regval (&cir) |1 ; + req->num_regs++; + } + + rc =send_tm_reqval (mbox, req); +if (rc) + goto error; +break ; +case NIX_TXSCH_LVL_TL4 : + req =otx2_mbox_alloc_msg_nix_txschq_cfg (mbox); + req->lvl = hw_lvl; + req->num_regs =0 ; + reg = req->reg; + regval = req->regval; + + *reg++ =NIX_AF_TL4X_PARENT (schq); + *regval++ = parent <<16 ; + req->num_regs++; + *reg++ =NIX_AF_TL4X_TOPOLOGY (schq); + *regval++ = (child <<32 ) | (rr_prio <<1 ); + req->num_regs++; + *reg++ =NIX_AF_TL4X_SCHEDULE (schq); + *regval++ = (strict_schedul_prio <<24 ) | rr_quantum; + req->num_regs++; +if (pir.rate && pir.burst) { + *reg++ =NIX_AF_TL4X_PIR (schq); + *regval++ =shaper2regval (&pir) |1 ; + req->num_regs++; + } +if (cir.rate && cir.burst) { + *reg++ =NIX_AF_TL4X_CIR (schq); + *regval++ =shaper2regval (&cir) |1 ; + req->num_regs++; + } + + rc =send_tm_reqval (mbox, req); +if (rc) + goto error; +break ; +case NIX_TXSCH_LVL_TL3 : + req =otx2_mbox_alloc_msg_nix_txschq_cfg (mbox); + req->lvl = hw_lvl; + req->num_regs =0 ; + reg = req->reg; + regval = req->regval; + + *reg++ =NIX_AF_TL3X_PARENT (schq); + *regval++ = parent <<16 ; + req->num_regs++; + *reg++ =NIX_AF_TL3X_TOPOLOGY (schq); + *regval++ = (child <<32 ) | (rr_prio <<1 ); + req->num_regs++; + *reg++ =NIX_AF_TL3X_SCHEDULE (schq); + *regval++ = (strict_schedul_prio <<24 ) | rr_quantum; + req->num_regs++; +if (pir.rate && pir.burst) { + *reg++ =NIX_AF_TL3X_PIR (schq); + *regval++ =shaper2regval (&pir) |1 ; + req->num_regs++; + } +if (cir.rate && cir.burst) { + *reg++ =NIX_AF_TL3X_CIR (schq); + *regval++ =shaper2regval (&cir) |1 ; + req->num_regs++; + } + + rc =send_tm_reqval (mbox, req); +if (rc) + goto error; +break ; +case NIX_TXSCH_LVL_TL2 : + req =otx2_mbox_alloc_msg_nix_txschq_cfg (mbox); + req->lvl = hw_lvl; + req->num_regs =0 ; + reg = req->reg; + regval = req->regval; + + *reg++ =NIX_AF_TL2X_PARENT (schq); + *regval++ = parent <<16 ; + req->num_regs++; + *reg++ =NIX_AF_TL2X_TOPOLOGY (schq); + *regval++ = (child <<32 ) | (rr_prio <<1 ); + req->num_regs++; + *reg++ =NIX_AF_TL2X_SCHEDULE (schq); +if (dev->otx2_tm_root_lvl ==NIX_TXSCH_LVL_TL2 ) + *regval++ = (1 <<24 ) | rr_quantum; +else + *regval++ = (strict_schedul_prio <<24 ) | rr_quantum; + req->num_regs++; + *reg++ =NIX_AF_TL3_TL2X_LINKX_CFG (schq,nix_get_link (dev)); + *regval++ =BIT_ULL (12 ) |nix_get_relchan (dev); + req->num_regs++; +if (pir.rate && pir.burst) { + *reg++ =NIX_AF_TL2X_PIR (schq); + *regval++ =shaper2regval (&pir) |1 ; + req->num_regs++; + } +if (cir.rate && cir.burst) { + *reg++ =NIX_AF_TL2X_CIR (schq); + *regval++ =shaper2regval (&cir) |1 ; + req->num_regs++; + } + + rc =send_tm_reqval (mbox, req); +if (rc) + goto error; +break ; +case NIX_TXSCH_LVL_TL1 : + req =otx2_mbox_alloc_msg_nix_txschq_cfg (mbox); + req->lvl = hw_lvl; + req->num_regs =0 ; + reg = req->reg; + regval = req->regval; + + *reg++ =NIX_AF_TL1X_SCHEDULE (schq); + *regval++ = rr_quantum; + req->num_regs++; + *reg++ =NIX_AF_TL1X_TOPOLOGY (schq); + *regval++ = (child <<32 ) | (rr_prio <<1 /*RR_PRIO*/ ); + req->num_regs++; +if (cir.rate && cir.burst) { + *reg++ =NIX_AF_TL1X_CIR (schq); + *regval++ =shaper2regval (&cir) |1 ; + req->num_regs++; + } + + rc =send_tm_reqval (mbox, req); +if (rc) + goto error; +break ; + } + +return 0 ; +error: +otx2_err ("Txschq cfg request failed for node %p, rc=%d" , tm_node, rc); +return rc; +} + + +static int +nix_tm_txsch_reg_config (struct otx2_eth_dev *dev) +{ +struct otx2_nix_tm_node *tm_node; +uint32_t lvl; +int rc =0 ; + +if (nix_get_link (dev) ==13 ) +return -EPERM ; + +for (lvl =0 ; lvl < (uint32_t )dev->otx2_tm_root_lvl +1 ; lvl++) { + TAILQ_FOREACH(tm_node, &dev->node_list, node) { +if (tm_node->hw_lvl_id == lvl) { + rc =populate_tm_registers (dev, tm_node); +if (rc) + goto exit; + } + } + } +exit: +return rc; +} +static struct otx2_nix_tm_node *nix_tm_node_search (struct otx2_eth_dev *dev,uint32_t node_id,bool user)
@@ -443,6 +941,12 @@ nix_tm_alloc_resources(struct rte_eth_dev *eth_dev, bool xmit_enable)return rc; } + rc =nix_tm_txsch_reg_config (dev); +if (rc) { +otx2_err ("TM failed to configure sched registers=%d" , rc); +return rc; + } +return 0 ; }
drivers/net/octeontx2/otx2_tm.h +82 -0
86 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 24/58 net/octeontx2: enable Tx through traffic manager
In reply to [email protected]From: Krzysztof Kanas <[email protected]>
This patch enables pkt transmit through traffic manager hierarchy by clearing software XOFF on the nodes and linking tx queues to corresponding leaf nodes.
It also adds support to start and stop tx queue using traffic manager.
--- drivers/net/octeontx2/otx2_ethdev.c | 72 ++++++- drivers/net/octeontx2/otx2_tm.c | 295 +++++++++++++++++++++++++++- drivers/net/octeontx2/otx2_tm.h | 4 + 3 files changed, 366 insertions(+), 5 deletions(-)
drivers/net/octeontx2/otx2_ethdev.c +70 -2
@@ -120,6 +120,32 @@ nix_lf_free(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +int +otx2_cgx_rxtx_start (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +if (otx2_dev_is_vf (dev)) +return 0 ; + +otx2_mbox_alloc_msg_cgx_start_rxtx (mbox); + +return otx2_mbox_process (mbox); +} + +int +otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +if (otx2_dev_is_vf (dev)) +return 0 ; + +otx2_mbox_alloc_msg_cgx_stop_rxtx (mbox); + +return otx2_mbox_process (mbox); +} +static inline void nix_rx_queue_reset (struct otx2_eth_rxq *rxq) {
@@ -461,16 +487,27 @@ nix_sq_init(struct otx2_eth_txq *txq)struct otx2_eth_dev *dev = txq->dev;struct otx2_mbox *mbox = dev->mbox;struct nix_aq_enq_req *sq; +uint32_t rr_quantum; +uint16_t smq; +int rc;if (txq->sqb_pool->pool_id ==0 )return -EINVAL ; + rc =otx2_nix_tm_get_leaf_data (dev, txq->sq, &rr_quantum, &smq); +if (rc) { +otx2_err ("Failed to get sq->smq(leaf node), rc=%d" , rc); +return rc; + } + sq =otx2_mbox_alloc_msg_nix_aq_enq (mbox); sq->qidx = txq->sq; sq->ctype =NIX_AQ_CTYPE_SQ ; sq->op =NIX_AQ_INSTOP_INIT ; sq->sq.max_sqe_size =nix_sq_max_sqe_sz (txq); + sq->sq.smq = smq; + sq->sq.smq_rr_quantum = rr_quantum; sq->sq.default_chan = dev->tx_chan_base; sq->sq.sqe_stype =NIX_STYPE_STF ; sq->sq.ena =1 ;
@@ -697,6 +734,9 @@ otx2_nix_tx_queue_release(void *_txq)otx2_nix_dbg ("Releasing txq %u" , txq->sq); +/* Flush and disable tm */ +otx2_nix_tm_sw_xoff (txq, false); +/* Free sqb's and disable sq */ nix_sq_uninit (txq);
@@ -1122,24 +1162,52 @@ int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx) {struct rte_eth_dev_data *data = eth_dev->data; +struct otx2_eth_txq *txq; +int rc = -EINVAL ; + + txq = eth_dev->data->tx_queues[qidx];if (data->tx_queue_state[qidx] ==RTE_ETH_QUEUE_STATE_STARTED )return 0 ; + rc =otx2_nix_sq_sqb_aura_fc (txq, true); +if (rc) { +otx2_err ("Failed to enable sqb aura fc, txq=%u, rc=%d" , + qidx, rc); + goto done; + } + data->tx_queue_state[qidx] =RTE_ETH_QUEUE_STATE_STARTED ; -return 0 ; + +done: +return rc; }int otx2_nix_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx) {struct rte_eth_dev_data *data = eth_dev->data; +struct otx2_eth_txq *txq; +int rc; + + txq = eth_dev->data->tx_queues[qidx];if (data->tx_queue_state[qidx] ==RTE_ETH_QUEUE_STATE_STOPPED )return 0 ; + txq->fc_cache_pkts =0 ; + + rc =otx2_nix_sq_sqb_aura_fc (txq, false); +if (rc) { +otx2_err ("Failed to disable sqb aura fc, txq=%u, rc=%d" , + qidx, rc); + goto done; + } + data->tx_queue_state[qidx] =RTE_ETH_QUEUE_STATE_STOPPED ; -return 0 ; + +done: +return rc; } static int
drivers/net/octeontx2/otx2_tm.c +292 -3
318 lines not on this page · raw message
drivers/net/octeontx2/otx2_tm.h +4 -0
@@ -16,6 +16,10 @@ struct otx2_eth_dev;void otx2_nix_tm_conf_init (struct rte_eth_dev *eth_dev);int otx2_nix_tm_init_default (struct rte_eth_dev *eth_dev);int otx2_nix_tm_fini (struct rte_eth_dev *eth_dev); +int otx2_nix_tm_get_leaf_data (struct otx2_eth_dev *dev,uint16_t sq, +uint32_t *rr_quantum,uint16_t *smq); +int otx2_nix_tm_sw_xoff (void *_txq,bool dev_started); +int otx2_nix_sq_sqb_aura_fc (void *_txq,bool enable);struct otx2_nix_tm_node {TAILQ_ENTRY (otx2_nix_tm_node) node;
Signature · 1 line
2.21.0
PATCH 25/58 net/octeontx2: add ptype support
In reply to [email protected]From: Jerin Jacob <[email protected]>
The fields from CQE needs to be converted to
ptype and rx ol flags in mbuf. This patch adds
create lookup memory for those items to be
used in Fastpath.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev.h | 6 + drivers/net/octeontx2/otx2_lookup.c | 279 ++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 7 + .../octeontx2/rte_pmd_octeontx2_version.map | 3 + 10 files changed, 302 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_lookup.c
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -20,6 +20,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Packet type parsing = Y Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -20,6 +20,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Packet type parsing = Y Basic stats = Y Extended stats = Y Stats per queue = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -16,6 +16,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Packet type parsing = Y Basic stats = Y Extended stats = Y Stats per queue = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ otx2_link.c \ otx2_stats.c \ + otx2_lookup.c \ otx2_ethdev.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -8,6 +8,7 @@ sources = files( 'otx2_mac.c', 'otx2_link.c', 'otx2_stats.c', + 'otx2_lookup.c', 'otx2_ethdev.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -441,6 +441,7 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t rq, rxq->pool = mp; rxq->qlen =nix_qsize_to_val (qsize); rxq->qsize = qsize; + rxq->lookup_mem =otx2_nix_fastpath_lookup_mem_get ();/* Alloc completion queue */ rc =nix_cq_rq_init (eth_dev, dev, rq, rxq, mp);
@@ -1267,6 +1268,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .tx_queue_stop = otx2_nix_tx_queue_stop, .rx_queue_start = otx2_nix_rx_queue_start, .rx_queue_stop = otx2_nix_rx_queue_stop, + .dev_supported_ptypes_get = otx2_nix_supported_ptypes_get, .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg,
drivers/net/octeontx2/otx2_ethdev.h +6 -0
@@ -335,6 +335,12 @@ int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);int otx2_cgx_mac_addr_set (struct rte_eth_dev *eth_dev,struct rte_ether_addr *addr); +/* Lookup configuration */ +void *otx2_nix_fastpath_lookup_mem_get (void ); + +/* PTYPES */ +const uint32_t *otx2_nix_supported_ptypes_get (struct rte_eth_dev *dev); +/* Mac address handling */ int otx2_nix_mac_addr_set (struct rte_eth_dev *eth_dev,struct rte_ether_addr *addr);
drivers/net/octeontx2/otx2_lookup.c new file +279 -0
279 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h +7 -0
@@ -5,6 +5,13 @@#ifndef __OTX2_RX_H__#define __OTX2_RX_H__ +#define PTYPE_WIDTH 12 +#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH) +#define PTYPE_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH) +#define PTYPE_ARRAY_SZ ((PTYPE_NON_TUNNEL_ARRAY_SZ +\ + PTYPE_TUNNEL_ARRAY_SZ) *\ + sizeof(uint16_t)) +#define NIX_RX_OFFLOAD_PTYPE_F BIT(1)#endif /* __OTX2_RX_H__ */
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +3 -0
@@ -1,4 +1,7 @@ DPDK_19.05 { + global: + + otx2_nix_fastpath_lookup_mem_get; local: *; };
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype support
Quoted 10 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
The fields from CQE needs to be converted to ptype and rx ol flags in mbuf. This patch adds create lookup memory for those items to be used in Fastpath.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Harman Kalra <[email protected]>
<...>
drivers/net/octeontx2/rte_pmd_octeontx2_version.map line 4
Quoted 5 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +3
-0@@ -1,4 +1,7 @@ DPDK_19.05 { + global: + + otx2_nix_fastpath_lookup_mem_get;
Why this function is in the .map file?
.map file is for the functions that this PMD exposes to application to call, this look intended to use within the library itself, if so no need to be in .map file.
Quoted 4 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +0
-0local: *; };
Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype support
Quoted 26 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:20 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Harman Kalra <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype supportQuoted 9 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
The fields from CQE needs to be converted to ptype and rx ol flags in mbuf. This patch adds create lookup memory for those items to be used in Fastpath.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Harman Kalra <[email protected]><...>
Quoted 7 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map line 4
Quoted 5 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +3
-0@@ -1,4 +1,7 @@ DPDK_19.05 { + global: + + otx2_nix_fastpath_lookup_mem_get;Why this function is in the .map file?
It is used by octeontx2 eventdev driver in driver/event/octeontx2
Quoted 7 lines
.map file is for the functions that this PMD exposes to application to call, this look intended to use within the library itself, if so no need to be in .map file.
Quoted 4 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +0
-0local: *; };
Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype support
Quoted 34 lines · Jerin Jacob Kollanukkaran
Quoted 26 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:20 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Harman Kalra <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype supportQuoted 9 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
The fields from CQE needs to be converted to ptype and rx ol flags in mbuf. This patch adds create lookup memory for those items to be used in Fastpath.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Harman Kalra <[email protected]><...>
Quoted 7 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map line 4
Quoted 5 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +3
-0@@ -1,4 +1,7 @@ DPDK_19.05 { + global: + + otx2_nix_fastpath_lookup_mem_get;Why this function is in the .map file?
Quoted 1 line
It is used by octeontx2 eventdev driver in driver/event/octeontx2
OK, any way to get rid of it, like using event-eth adapters etc ?
Quoted 9 lines
Quoted 8 lines
.map file is for the functions that this PMD exposes to application to call, this look intended to use within the library itself, if so no need to be in .map file.
Quoted 4 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +0
-0local: *; };
Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype support
Quoted 47 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:50 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Harman Kalra <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype supportQuoted 35 lines · Jerin Jacob Kollanukkaran
Quoted 34 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:20 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>
Cc: Harman Kalra <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 25/58] net/octeontx2: add ptype supportQuoted 9 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
The fields from CQE needs to be converted to ptype and rx ol flags in mbuf. This patch adds create lookup memory for those items to be used in Fastpath.
Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Harman Kalra <[email protected]><...>
drivers/net/octeontx2/rte_pmd_octeontx2_version.map line 4
Quoted 5 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +3
-0@@ -1,4 +1,7 @@ DPDK_19.05 { + global: + + otx2_nix_fastpath_lookup_mem_get;Why this function is in the .map file?
Quoted 3 lines
Quoted 1 line
It is used by octeontx2 eventdev driver in driver/event/octeontx2
OK, any way to get rid of it, like using event-eth adapters etc ?
OK. I will try to rework to get rid of this function exposing.
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
.map file is for the functions that this PMD exposes to application to call, this look intended to use within the library itself, if so no need to
be in .map file.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
drivers/net/octeontx2/rte_pmd_octeontx2_version.map +0
-0local: *; };
PATCH 26/58 net/octeontx2: add link status set operations
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add support for setting the link up and down.
--- drivers/net/octeontx2/otx2_ethdev.c | 2 ++ drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_link.c | 49 +++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1268,6 +1268,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .tx_queue_stop = otx2_nix_tx_queue_stop, .rx_queue_start = otx2_nix_rx_queue_start, .rx_queue_stop = otx2_nix_rx_queue_stop, + .dev_set_link_up = otx2_nix_dev_set_link_up, + .dev_set_link_down = otx2_nix_dev_set_link_down, .dev_supported_ptypes_get = otx2_nix_supported_ptypes_get, .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset,
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -269,6 +269,8 @@ void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set);int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete);void otx2_eth_dev_link_status_update (struct otx2_dev *dev,struct cgx_link_user_info *link); +int otx2_nix_dev_set_link_up (struct rte_eth_dev *eth_dev); +int otx2_nix_dev_set_link_down (struct rte_eth_dev *eth_dev);/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_link.c +49 -0
52 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 27/58 net/octeontx2: add queue info and pool supported operations
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add Rx and Tx queue info get and pool ops supported operations.
--- drivers/net/octeontx2/otx2_ethdev.c | 3 ++ drivers/net/octeontx2/otx2_ethdev.h | 5 +++ drivers/net/octeontx2/otx2_ethdev_ops.c | 51 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +3 -0
@@ -1291,6 +1291,9 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .xstats_reset = otx2_nix_xstats_reset, .xstats_get_by_id = otx2_nix_xstats_get_by_id, .xstats_get_names_by_id = otx2_nix_xstats_get_names_by_id, + .rxq_info_get = otx2_nix_rxq_info_get, + .txq_info_get = otx2_nix_txq_info_get, + .pool_ops_supported = otx2_nix_pool_ops_supported, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +5 -0
@@ -254,6 +254,11 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)/* Ops */ void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +int otx2_nix_pool_ops_supported (struct rte_eth_dev *eth_dev,const char *pool); +void otx2_nix_rxq_info_get (struct rte_eth_dev *eth_dev,uint16_t queue_id, +struct rte_eth_rxq_info *qinfo); +void otx2_nix_txq_info_get (struct rte_eth_dev *eth_dev,uint16_t queue_id, +struct rte_eth_txq_info *qinfo);void otx2_nix_promisc_config (struct rte_eth_dev *eth_dev,int en);void otx2_nix_promisc_enable (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 28/58 net/octeontx2: add Rx and Tx descriptor operations
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Rx and Tx queue descriptor related operations.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/features/octeontx2_vf.ini | 2 + drivers/net/octeontx2/otx2_ethdev.c | 4 ++ drivers/net/octeontx2/otx2_ethdev.h | 4 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 83 ++++++++++++++++++++++ 6 files changed, 97 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -12,6 +12,7 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Free Tx mbuf on demand = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y
@@ -21,6 +22,7 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Packet type parsing = Y +Rx descriptor status = Y Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -12,6 +12,7 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Free Tx mbuf on demand = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y
@@ -21,6 +22,7 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Packet type parsing = Y +Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -11,12 +11,14 @@ Lock-free Tx queue = Y Multiprocess aware = Y Link status = Y Link status event = Y +Free Tx mbuf on demand = Y Queue start/stop = Y RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y Packet type parsing = Y +Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y
drivers/net/octeontx2/otx2_ethdev.c +4 -0
@@ -1293,6 +1293,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .xstats_get_names_by_id = otx2_nix_xstats_get_names_by_id, .rxq_info_get = otx2_nix_rxq_info_get, .txq_info_get = otx2_nix_txq_info_get, + .rx_queue_count = otx2_nix_rx_queue_count, + .rx_descriptor_done = otx2_nix_rx_descriptor_done, + .rx_descriptor_status = otx2_nix_rx_descriptor_status, + .tx_done_cleanup = otx2_nix_tx_done_cleanup, .pool_ops_supported = otx2_nix_pool_ops_supported, };
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -259,6 +259,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo);void otx2_nix_txq_info_get (struct rte_eth_dev *eth_dev,uint16_t queue_id,struct rte_eth_txq_info *qinfo); +uint32_t otx2_nix_rx_queue_count (struct rte_eth_dev *eth_dev,uint16_t qidx); +int otx2_nix_tx_done_cleanup (void *txq,uint32_t free_cnt); +int otx2_nix_rx_descriptor_done (void *rxq,uint16_t offset); +int otx2_nix_rx_descriptor_status (void *rx_queue,uint16_t offset);void otx2_nix_promisc_config (struct rte_eth_dev *eth_dev,int en);void otx2_nix_promisc_enable (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_ethdev_ops.c +83 -0
89 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 29/58 net/octeontx2: add module EEPROM dump
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
add module EEPROM dump operation.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev.h | 4 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 51 ++++++++++++++++++++++ 6 files changed, 60 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -26,4 +26,5 @@ Rx descriptor status = Y Basic stats = Y Stats per queue = Y Extended stats = Y +Module EEPROM dump = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -26,4 +26,5 @@ Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y +Module EEPROM dump = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -22,4 +22,5 @@ Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y +Module EEPROM dump = Y Registers dump = Y
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1298,6 +1298,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .rx_descriptor_status = otx2_nix_rx_descriptor_status, .tx_done_cleanup = otx2_nix_tx_done_cleanup, .pool_ops_supported = otx2_nix_pool_ops_supported, + .get_module_info = otx2_nix_get_module_info, + .get_module_eeprom = otx2_nix_get_module_eeprom, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -254,6 +254,10 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)/* Ops */ void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +int otx2_nix_get_module_info (struct rte_eth_dev *eth_dev, +struct rte_eth_dev_module_info *modinfo); +int otx2_nix_get_module_eeprom (struct rte_eth_dev *eth_dev, +struct rte_dev_eeprom_info *info);int otx2_nix_pool_ops_supported (struct rte_eth_dev *eth_dev,const char *pool);void otx2_nix_rxq_info_get (struct rte_eth_dev *eth_dev,uint16_t queue_id,struct rte_eth_rxq_info *qinfo);
drivers/net/octeontx2/otx2_ethdev_ops.c +51 -0
57 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 30/58 net/octeontx2: add flow control support
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add flow control operations and exposedotx2_nix_update_flow_ctrl_mode() to enable on the
configured mode in dev_start().
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 20 ++ drivers/net/octeontx2/otx2_ethdev.h | 23 +++ drivers/net/octeontx2/otx2_flow_ctrl.c | 230 +++++++++++++++++++++ 7 files changed, 277 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow_ctrl.c
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -21,6 +21,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Flow control = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -21,6 +21,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Flow control = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -37,6 +37,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_stats.c \ otx2_lookup.c \ otx2_ethdev.c \ + otx2_flow_ctrl.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \ otx2_ethdev_debug.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -10,6 +10,7 @@ sources = files( 'otx2_stats.c', 'otx2_lookup.c', 'otx2_ethdev.c', + 'otx2_flow_ctrl.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c', 'otx2_ethdev_debug.c',
drivers/net/octeontx2/otx2_ethdev.c +20 -0
@@ -216,6 +216,14 @@ nix_cq_rq_init(struct rte_eth_dev *eth_dev, struct otx2_eth_dev *dev, aq->cq.cq_err_int_ena =BIT (NIX_CQERRINT_CQE_FAULT ); aq->cq.cq_err_int_ena |=BIT (NIX_CQERRINT_DOOR_ERR ); +/* TX pause frames enable flowctrl on RX side */ +if (dev->fc_info.tx_pause) { +/* Single bpid is allocated for all rx channels for now */ + aq->cq.bpid = dev->fc_info.bpid[0 ]; + aq->cq.bp =NIX_CQ_BP_LEVEL ; + aq->cq.bp_ena =1 ; + } +/* Many to one reduction */ aq->cq.qint_idx = qid % dev->qints;
@@ -1069,6 +1077,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)/* Free the resources allocated from the previous configure */ if (dev->configured ==1 ) { +otx2_nix_rxchan_bpid_cfg (eth_dev, false);oxt2_nix_unregister_queue_irqs (eth_dev);nix_set_nop_rxtx_function (eth_dev); rc =nix_store_queue_cfg_and_then_release (eth_dev);
@@ -1122,6 +1131,12 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } + rc =otx2_nix_rxchan_bpid_cfg (eth_dev, true); +if (rc) { +otx2_err ("Failed to configure nix rx chan bpid cfg rc=%d" , rc); + goto free_nix_lf; + } +/* * Restore queue config when reconfigure followed by * reconfigure and no queue configure invoked from application case.
@@ -1300,6 +1315,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .pool_ops_supported = otx2_nix_pool_ops_supported, .get_module_info = otx2_nix_get_module_info, .get_module_eeprom = otx2_nix_get_module_eeprom, + .flow_ctrl_get = otx2_nix_flow_ctrl_get, + .flow_ctrl_set = otx2_nix_flow_ctrl_set, }; static inline int
@@ -1501,6 +1518,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +/* Disable nix bpid config */ +otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Free up SQs */ for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {otx2_nix_tx_queue_release (eth_dev->data->tx_queues[i]);
drivers/net/octeontx2/otx2_ethdev.h +23 -0
@@ -68,6 +68,9 @@#define NIX_TX_NB_SEG_MAX 9#endif +/* Apply BP when CQ is 75% full */ +#define NIX_CQ_BP_LEVEL (25 * 256 / 100) +#define CQ_OP_STAT_OP_ERR 63#define CQ_OP_STAT_CQ_ERR 46
@@ -150,6 +153,14 @@ struct otx2_npc_flow_info {uint16_t flow_max_priority; }; +struct otx2_fc_info { +enum rte_eth_fc_mode mode;/**< Link flow control mode */ +uint8_t rx_pause; +uint8_t tx_pause; +uint8_t chan_cnt; +uint16_t bpid[NIX_MAX_CHAN ]; +}; +struct otx2_eth_dev {OTX2_DEV ;/* Base class */ MARKER otx2_eth_dev_data_start;
@@ -196,6 +207,7 @@ struct otx2_eth_dev {struct otx2_nix_tm_node_list node_list;struct otx2_nix_tm_shaper_profile_list shaper_profile_list;struct otx2_rss_info rss_info; +struct otx2_fc_info fc_info;uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS ];struct otx2_npc_flow_info npc_flow;
@@ -350,6 +362,17 @@ int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);int otx2_cgx_mac_addr_set (struct rte_eth_dev *eth_dev,struct rte_ether_addr *addr); +/* Flow Control */ +int otx2_nix_flow_ctrl_get (struct rte_eth_dev *eth_dev, +struct rte_eth_fc_conf *fc_conf); + +int otx2_nix_flow_ctrl_set (struct rte_eth_dev *eth_dev, +struct rte_eth_fc_conf *fc_conf); + +int otx2_nix_rxchan_bpid_cfg (struct rte_eth_dev *eth_dev,bool enb); + +int otx2_nix_update_flow_ctrl_mode (struct rte_eth_dev *eth_dev); +/* Lookup configuration */ void *otx2_nix_fastpath_lookup_mem_get (void );
drivers/net/octeontx2/otx2_flow_ctrl.c new file +230 -0
230 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 31/58 net/octeontx2: add PTP base support
In reply to [email protected]From: Harman Kalra <[email protected]>
Add PTP enable and disable operations.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 22 ++++- drivers/net/octeontx2/otx2_ethdev.h | 17 ++++ drivers/net/octeontx2/otx2_ptp.c | 135 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 11 +++ 6 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ptp.c
drivers/net/octeontx2/Makefile +1 -0
@@ -33,6 +33,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_tm.c \ otx2_rss.c \ otx2_mac.c \ + otx2_ptp.c \ otx2_link.c \ otx2_stats.c \ otx2_lookup.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -6,6 +6,7 @@ sources = files( 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c', + 'otx2_ptp.c', 'otx2_link.c', 'otx2_stats.c', 'otx2_lookup.c',
drivers/net/octeontx2/otx2_ethdev.c +19 -3
@@ -336,9 +336,7 @@ nix_cq_rq_uninit(struct rte_eth_dev *eth_dev, struct otx2_eth_rxq *rxq)static inline int nix_get_data_off (struct otx2_eth_dev *dev) { -RTE_SET_USED (dev); - -return 0 ; +return otx2_ethdev_is_ptp_en (dev) ?NIX_TIMESYNC_RX_OFFSET :0 ; }uint64_t
@@ -450,6 +448,7 @@ otx2_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t rq, rxq->qlen =nix_qsize_to_val (qsize); rxq->qsize = qsize; rxq->lookup_mem =otx2_nix_fastpath_lookup_mem_get (); + rxq->tstamp = &dev->tstamp;/* Alloc completion queue */ rc =nix_cq_rq_init (eth_dev, dev, rq, rxq, mp);
@@ -716,6 +715,7 @@ otx2_nix_form_default_desc(struct otx2_eth_txq *txq) send_mem->dsz =0x0 ; send_mem->wmem =0x1 ; send_mem->alg =NIX_SENDMEMALG_SETTSTMP ; + send_mem->addr = txq->dev->tstamp.tx_tstamp_iova; } sg = (union nix_send_sg_s *)&txq->cmd[4 ]; }else {
@@ -1137,6 +1137,16 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } +/* Enable PTP if it was requested by the app or if it is already +* enabled in PF owning this VF +*/ +memset (&dev->tstamp,0 ,sizeof (struct otx2_timesync_info )); +if ((dev->rx_offloads &DEV_RX_OFFLOAD_TIMESTAMP ) || +otx2_ethdev_is_ptp_en (dev)) +otx2_nix_timesync_enable (eth_dev); +else +otx2_nix_timesync_disable (eth_dev); +/* * Restore queue config when reconfigure followed by * reconfigure and no queue configure invoked from application case.
@@ -1317,6 +1327,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .get_module_eeprom = otx2_nix_get_module_eeprom, .flow_ctrl_get = otx2_nix_flow_ctrl_get, .flow_ctrl_set = otx2_nix_flow_ctrl_set, + .timesync_enable = otx2_nix_timesync_enable, + .timesync_disable = otx2_nix_timesync_disable, }; static inline int
@@ -1521,6 +1533,10 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Disable PTP if already enabled */ +if (otx2_ethdev_is_ptp_en (dev)) +otx2_nix_timesync_disable (eth_dev); +/* Free up SQs */ for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {otx2_nix_tx_queue_release (eth_dev->data->tx_queues[i]);
drivers/net/octeontx2/otx2_ethdev.h +17 -0
@@ -13,6 +13,7 @@#include <rte_mbuf.h> #include <rte_mempool.h> #include <rte_string_fns.h> +#include <rte_time.h> #include "otx2_common.h" #include "otx2_dev.h"
@@ -109,6 +110,12 @@#define NIX_DEFAULT_RSS_CTX_GROUP 0#define NIX_DEFAULT_RSS_MCAM_IDX -1 +#define otx2_ethdev_is_ptp_en (dev) ((dev)->ptp_en) + +#define NIX_TIMESYNC_TX_CMD_LEN 8 +/* Additional timesync values. */ +#define OTX2_CYCLECOUNTER_MASK 0xffffffffffffffffULL +enum nix_q_size_e { nix_q_size_16,/* 16 entries */ nix_q_size_64,/* 64 entries */
@@ -214,6 +221,12 @@ struct otx2_eth_dev {struct otx2_eth_qconf *tx_qconf;struct otx2_eth_qconf *rx_qconf;struct rte_eth_dev *eth_dev; +/* PTP counters */ +bool ptp_en; +struct otx2_timesync_info tstamp; +struct rte_timecounter systime_tc; +struct rte_timecounter rx_tstamp_tc; +struct rte_timecounter tx_tstamp_tc; } __rte_cache_aligned;struct otx2_eth_txq {
@@ -396,4 +409,8 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,/* Rx and Tx routines */ void otx2_nix_form_default_desc (struct otx2_eth_txq *txq); +/* Timesync - PTP routines */ +int otx2_nix_timesync_enable (struct rte_eth_dev *eth_dev); +int otx2_nix_timesync_disable (struct rte_eth_dev *eth_dev); +#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ptp.c new file +135 -0
135 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h +11 -0
@@ -13,5 +13,16 @@ sizeof(uint16_t))#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) +#define NIX_RX_OFFLOAD_TSTAMP_F BIT(5) + +#define NIX_TIMESYNC_RX_OFFSET 8 + +struct otx2_timesync_info { +uint64_t rx_tstamp; +rte_iova_t tx_tstamp_iova; +uint64_t *tx_tstamp; +uint8_t tx_ready; +uint8_t rx_ready; +} __rte_cache_aligned;#endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
PATCH 32/58 net/octeontx2: add remaining PTP operations
In reply to [email protected]From: Harman Kalra <[email protected]>
Add remaining PTP configuration/slowpath operations. Timesync feature is available only for PF devices.
--- doc/guides/nics/features/octeontx2.ini | 2 + drivers/net/octeontx2/otx2_ethdev.c | 6 ++ drivers/net/octeontx2/otx2_ethdev.h | 11 +++ drivers/net/octeontx2/otx2_ptp.c | 130 +++++++++++++++++++++++++ 4 files changed, 149 insertions(+)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -23,6 +23,8 @@ RSS reta update = Y Inner RSS = Y Flow control = Y Packet type parsing = Y +Timesync = Y +Timestamp offload = Y Rx descriptor status = Y Basic stats = Y Stats per queue = Y
drivers/net/octeontx2/otx2_ethdev.c +6 -0
@@ -47,6 +47,7 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)static const struct otx2_dev_ops otx2_dev_ops = { .link_status_update = otx2_eth_dev_link_status_update, + .ptp_info_update = otx2_eth_dev_ptp_info_update }; static int
@@ -1329,6 +1330,11 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .flow_ctrl_set = otx2_nix_flow_ctrl_set, .timesync_enable = otx2_nix_timesync_enable, .timesync_disable = otx2_nix_timesync_disable, + .timesync_read_rx_timestamp = otx2_nix_timesync_read_rx_timestamp, + .timesync_read_tx_timestamp = otx2_nix_timesync_read_tx_timestamp, + .timesync_adjust_time = otx2_nix_timesync_adjust_time, + .timesync_read_time = otx2_nix_timesync_read_time, + .timesync_write_time = otx2_nix_timesync_write_time, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +11 -0
@@ -412,5 +412,16 @@ void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);/* Timesync - PTP routines */ int otx2_nix_timesync_enable (struct rte_eth_dev *eth_dev);int otx2_nix_timesync_disable (struct rte_eth_dev *eth_dev); +int otx2_nix_timesync_read_rx_timestamp (struct rte_eth_dev *eth_dev, +struct timespec *timestamp, +uint32_t flags); +int otx2_nix_timesync_read_tx_timestamp (struct rte_eth_dev *eth_dev, +struct timespec *timestamp); +int otx2_nix_timesync_adjust_time (struct rte_eth_dev *eth_dev,int64_t delta); +int otx2_nix_timesync_write_time (struct rte_eth_dev *eth_dev, +const struct timespec *ts); +int otx2_nix_timesync_read_time (struct rte_eth_dev *eth_dev, +struct timespec *ts); +int otx2_eth_dev_ptp_info_update (struct otx2_dev *dev,bool ptp_en);#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ptp.c +130 -0
139 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 33/58 net/octeontx2: introducing flow driver
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Introducing flow infra for octeontx2.
This will be used to maintain rte_flow rules.
Create, destroy, validate,query, flush, isolate flow operations will be supported.
--- drivers/net/octeontx2/otx2_ethdev.h | 7 +- drivers/net/octeontx2/otx2_flow.h | 384 ++++++++++++++++++++++++++++ 2 files changed, 385 insertions(+), 6 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_flow.h
drivers/net/octeontx2/otx2_ethdev.h +1 -6
@@ -17,6 +17,7 @@#include "otx2_common.h" #include "otx2_dev.h" +#include "otx2_flow.h" #include "otx2_irq.h" #include "otx2_mempool.h" #include "otx2_rx.h"
@@ -154,12 +155,6 @@ struct otx2_eth_qconf {uint16_t nb_desc; }; -struct otx2_npc_flow_info { -uint16_t channel;/*rx channel */ -uint16_t flow_prealloc_size; -uint16_t flow_max_priority; -}; -struct otx2_fc_info {enum rte_eth_fc_mode mode;/**< Link flow control mode */ uint8_t rx_pause;
drivers/net/octeontx2/otx2_flow.h new file +384 -0
384 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 34/58 net/octeontx2: flow utility functions
In reply to [email protected]From: Kiran Kumar K <[email protected]>
First pass rte_flow utility functions for octeontx2. These will be used to communicate with AF driver.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_flow_utils.c | 369 ++++++++++++++++++++++++ 3 files changed, 371 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow_utils.c
drivers/net/octeontx2/Makefile +1 -0
@@ -39,6 +39,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_lookup.c \ otx2_ethdev.c \ otx2_flow_ctrl.c \ + otx2_flow_utils.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \ otx2_ethdev_debug.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -12,6 +12,7 @@ sources = files( 'otx2_lookup.c', 'otx2_ethdev.c', 'otx2_flow_ctrl.c', + 'otx2_flow_utils.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c', 'otx2_ethdev_debug.c',
drivers/net/octeontx2/otx2_flow_utils.c new file +369 -0
369 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 35/58 net/octeontx2: flow mailbox utility
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding mailbox utility functions for rte_flow. These will be used to alloc, reserve and write the entries to the device on request.
--- drivers/net/octeontx2/otx2_flow.h | 6 +- drivers/net/octeontx2/otx2_flow_utils.c | 259 ++++++++++++++++++++++++ 2 files changed, 264 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_flow.h +5 -1
@@ -380,5 +380,9 @@ int otx2_flow_parse_actions(struct rte_eth_dev *dev,const struct rte_flow_action actions[], struct rte_flow_error *error, struct rte_flow *flow); - +int +flow_validate_and_shift_prio_ent (struct otx2_mbox *mbox,struct rte_flow *flow, +struct otx2_npc_flow_info *flow_info, +struct npc_mcam_alloc_entry_rsp *rsp, +int req_prio);#endif /* __OTX2_FLOW_H__ */
drivers/net/octeontx2/otx2_flow_utils.c +259 -0
262 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 36/58 net/octeontx2: add flow MCAM utility functions
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding MCAM utility functions to alloc and write the entries. These will be used to arrange the flow rules based on priority.
--- drivers/net/octeontx2/otx2_flow.h | 6 +- drivers/net/octeontx2/otx2_flow_utils.c | 258 +++++++++++++++++++++++- 2 files changed, 258 insertions(+), 6 deletions(-)
drivers/net/octeontx2/otx2_flow.h +1 -5
@@ -380,9 +380,5 @@ int otx2_flow_parse_actions(struct rte_eth_dev *dev,const struct rte_flow_action actions[], struct rte_flow_error *error, struct rte_flow *flow); -int -flow_validate_and_shift_prio_ent (struct otx2_mbox *mbox,struct rte_flow *flow, -struct otx2_npc_flow_info *flow_info, -struct npc_mcam_alloc_entry_rsp *rsp, -int req_prio); +#endif /* __OTX2_FLOW_H__ */
drivers/net/octeontx2/otx2_flow_utils.c +257 -1
273 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 37/58 net/octeontx2: add flow parsing for outer layers
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding functionality to parse outer layers from ld to lh. These will be used parse outer layers L2, L3, L4 and tunnel types.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_flow_parse.c | 463 ++++++++++++++++++++++++ 3 files changed, 465 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c
drivers/net/octeontx2/Makefile +1 -0
@@ -39,6 +39,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_lookup.c \ otx2_ethdev.c \ otx2_flow_ctrl.c \ + otx2_flow_parse.c \ otx2_flow_utils.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -12,6 +12,7 @@ sources = files( 'otx2_lookup.c', 'otx2_ethdev.c', 'otx2_flow_ctrl.c', + 'otx2_flow_parse.c', 'otx2_flow_utils.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_flow_parse.c new file +463 -0
463 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 38/58 net/octeontx2: adding flow parsing for inner layers
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding functionality to parse inner layers from la to lc. These will be used to parse inner layers L2, L3, L4 types.
--- drivers/net/octeontx2/otx2_flow_parse.c | 202 ++++++++++++++++++++++++ 1 file changed, 202 insertions(+)
drivers/net/octeontx2/otx2_flow_parse.c +202 -0
@@ -461,3 +461,205 @@ otx2_flow_parse_ld(struct otx2_parse_state *pst)return otx2_flow_update_parse_state (pst, &info, lid, lt, lflags); } + +static inline void +flow_check_lc_ip_tunnel (struct otx2_parse_state *pst) +{ +const struct rte_flow_item *pattern = pst->pattern +1 ; + + pattern =otx2_flow_skip_void_and_any_items (pattern); +if (pattern->type ==RTE_FLOW_ITEM_TYPE_MPLS || + pattern->type ==RTE_FLOW_ITEM_TYPE_IPV4 || + pattern->type ==RTE_FLOW_ITEM_TYPE_IPV6 ) + pst->tunnel =1 ; +} + +/* Outer IPv4, Outer IPv6, MPLS, ARP */ +int +otx2_flow_parse_lc (struct otx2_parse_state *pst) +{ +uint8_t hw_mask[NPC_MAX_EXTRACT_DATA_LEN ]; +struct otx2_flow_item_info info; +int lid, lt; +int rc; + +if (pst->pattern->type ==RTE_FLOW_ITEM_TYPE_MPLS ) +return otx2_flow_parse_lc_ld_mpls (pst,NPC_LID_LC ); + + info.hw_mask = &hw_mask; + info.spec =NULL ; + info.mask =NULL ; + lid =NPC_LID_LC ; + +switch (pst->pattern->type) { +case RTE_FLOW_ITEM_TYPE_IPV4 : + lt =NPC_LT_LC_IP ; + info.def_mask = &rte_flow_item_ipv4_mask; + info.len =sizeof (struct rte_flow_item_ipv4 ); +break ; +case RTE_FLOW_ITEM_TYPE_IPV6 : + lid =NPC_LID_LC ; + lt =NPC_LT_LC_IP6 ; + info.def_mask = &rte_flow_item_ipv6_mask; + info.len =sizeof (struct rte_flow_item_ipv6 ); +break ; +case RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4 : + lt =NPC_LT_LC_ARP ; + info.def_mask = &rte_flow_item_arp_eth_ipv4_mask; + info.len =sizeof (struct rte_flow_item_arp_eth_ipv4 ); +break ; +default : +/* No match at this layer */ +return 0 ; + } + +/* Identify if IP tunnels MPLS or IPv4/v6 */ +flow_check_lc_ip_tunnel (pst); + +otx2_flow_get_hw_supp_mask (pst, &info, lid, lt); + rc =otx2_flow_parse_item_basic (pst->pattern, &info, pst->error); +if (rc !=0 ) +return rc; + +return otx2_flow_update_parse_state (pst, &info, lid, lt,0 ); +} + +/* VLAN, ETAG */ +int +otx2_flow_parse_lb (struct otx2_parse_state *pst) +{ +const struct rte_flow_item *pattern = pst->pattern; +const struct rte_flow_item *last_pattern; +char hw_mask[NPC_MAX_EXTRACT_DATA_LEN ]; +struct otx2_flow_item_info info; +int lid, lt, lflags; +int nr_vlans =0 ; +int rc; + + info.spec =NULL ; + info.mask =NULL ; + + lid =NPC_LID_LB ; + lflags =0 ; + last_pattern = pattern; + +if (pst->pattern->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { +/* RTE vlan is either 802.1q or 802.1ad, +* this maps to either CTAG/STAG. We need to decide +* based on number of VLANS present. Matching is +* supported on first tag only. +*/ + info.def_mask = &rte_flow_item_vlan_mask; + info.hw_mask =NULL ; + info.len =sizeof (struct rte_flow_item_vlan ); + + pattern = pst->pattern; +while (pattern->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + nr_vlans++; + +/* Basic validation of 2nd/3rd vlan item */ +if (nr_vlans >1 ) { +otx2_npc_dbg ("Vlans = %d" , nr_vlans); + rc =otx2_flow_parse_item_basic (pattern, &info, + pst->error); +if (rc !=0 ) +return rc; + } + last_pattern = pattern; + pattern++; + pattern =otx2_flow_skip_void_and_any_items (pattern); + } + +switch (nr_vlans) { +case 1 : + lt =NPC_LT_LB_CTAG ; +break ; +case 2 : + lt =NPC_LT_LB_STAG ; + lflags =NPC_F_STAG_CTAG ; +break ; +case 3 : + lt =NPC_LT_LB_STAG ; + lflags =NPC_F_STAG_STAG_CTAG ; +break ; +default : +rte_flow_error_set (pst->error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , + last_pattern, +"more than 3 vlans not supported" ); +return -rte_errno; + } + }else if (pst->pattern->type ==RTE_FLOW_ITEM_TYPE_E_TAG ) { +/* we can support ETAG and match a subsequent CTAG +* without any matching support. +*/ + lt =NPC_LT_LB_ETAG ; + lflags =0 ; + + last_pattern = pst->pattern; + pattern =otx2_flow_skip_void_and_any_items (pst->pattern +1 ); +if (pattern->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + info.def_mask = &rte_flow_item_vlan_mask; +/* set supported mask to NULL for vlan tag */ + info.hw_mask =NULL ; + info.len =sizeof (struct rte_flow_item_vlan ); + rc =otx2_flow_parse_item_basic (pattern, &info, + pst->error); +if (rc !=0 ) +return rc; + + lflags =NPC_F_ETAG_CTAG ; + last_pattern = pattern; + } + + info.def_mask = &rte_flow_item_e_tag_mask; + info.len =sizeof (struct rte_flow_item_e_tag ); + }else { +return 0 ; + } + + info.hw_mask = &hw_mask; + info.spec =NULL ; + info.mask =NULL ; +otx2_flow_get_hw_supp_mask (pst, &info, lid, lt); + + rc =otx2_flow_parse_item_basic (pst->pattern, &info, pst->error); +if (rc !=0 ) +return rc; + +/* Point pattern to last item consumed */ + pst->pattern = last_pattern; +return otx2_flow_update_parse_state (pst, &info, lid, lt, lflags); +} + +int +otx2_flow_parse_la (struct otx2_parse_state *pst) +{ +struct rte_flow_item_eth hw_mask; +struct otx2_flow_item_info info; +int lid, lt; +int rc; + +/* Identify the pattern type into lid, lt */ +if (pst->pattern->type !=RTE_FLOW_ITEM_TYPE_ETH ) +return 0 ; + + lid =NPC_LID_LA ; + lt =NPC_LT_LA_ETHER ; + +/* Prepare for parsing the item */ + info.def_mask = &rte_flow_item_eth_mask; + info.hw_mask = &hw_mask; + info.len =sizeof (struct rte_flow_item_eth ); +otx2_flow_get_hw_supp_mask (pst, &info, lid, lt); + info.spec =NULL ; + info.mask =NULL ; + +/* Basic validation of item parameters */ + rc =otx2_flow_parse_item_basic (pst->pattern, &info, pst->error); +if (rc) +return rc; + +/* Update pst if not validate only? clash check? */ +return otx2_flow_update_parse_state (pst, &info, lid, lt,0 ); +}
Signature · 1 line
2.21.0
PATCH 39/58 net/octeontx2: add flow actions support
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding support to parse flow actions like drop, count, mark, rss, queue. On egress side, only drop and count actions were supported.
--- drivers/net/octeontx2/otx2_flow_parse.c | 276 ++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 1 + 2 files changed, 277 insertions(+)
drivers/net/octeontx2/otx2_flow_parse.c +276 -0
@@ -663,3 +663,279 @@ otx2_flow_parse_la(struct otx2_parse_state *pst)/* Update pst if not validate only? clash check? */ return otx2_flow_update_parse_state (pst, &info, lid, lt,0 ); } + +static int +parse_rss_action (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_action *act, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct otx2_rss_info *rss_info = &hw->rss_info; +const struct rte_flow_action_rss *rss; +uint32_t i; + + rss = (const struct rte_flow_action_rss *)act->conf; + +/* Not supported */ +if (attr->egress) { +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ATTR_EGRESS , + attr,"No support of RSS in egress" ); + } + +if (dev->data->dev_conf.rxmode.mq_mode !=ETH_MQ_RX_RSS ) +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , + act,"multi-queue mode is disabled" ); + +/* Parse RSS related parameters from configuration */ +if (!rss || !rss->queue_num) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act,"no valid queues" ); + +if (rss->func !=RTE_ETH_HASH_FUNCTION_DEFAULT ) +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"non-default RSS hash functions" +" are not supported" ); + +if (rss->key_len && rss->key_len >RTE_DIM (rss_info->key)) +return rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"RSS hash key too large" ); + +if (rss->queue_num > rss_info->rss_size) +return rte_flow_error_set + (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION , act, +"too many queues for RSS context" ); + +for (i =0 ; i < rss->queue_num; i++) { +if (rss->queue[i] >= dev->data->nb_rx_queues) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , + act, +"queue id > max number" +" of queues" ); + } + +return 0 ; +} + +int +otx2_flow_parse_actions (struct rte_eth_dev *dev, +const struct rte_flow_attr *attr, +const struct rte_flow_action actions[], +struct rte_flow_error *error, +struct rte_flow *flow) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct otx2_npc_flow_info *npc = &hw->npc_flow; +const struct rte_flow_action_count *act_count; +const struct rte_flow_action_mark *act_mark; +const struct rte_flow_action_queue *act_q; +const char *errmsg =NULL ; +int sel_act, req_act =0 ; +uint16_t pf_func; +int errcode =0 ; +int mark =0 ; +int rq =0 ; + +/* Initialize actions */ + flow->ctr_id =NPC_COUNTER_NONE ; + +for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) { +otx2_npc_dbg ("Action type = %d" , actions->type); + +switch (actions->type) { +case RTE_FLOW_ACTION_TYPE_VOID : +break ; +case RTE_FLOW_ACTION_TYPE_MARK : + act_mark = + (const struct rte_flow_action_mark *)actions->conf; + +/* We have only 16 bits. Use highest val for flag */ +if (act_mark->id > (OTX2_FLOW_FLAG_VAL -2 )) { + errmsg ="mark value must be < 0xfffe" ; + errcode =ENOTSUP ; + goto err_exit; + } + mark = act_mark->id +1 ; + req_act |=OTX2_FLOW_ACT_MARK ; +rte_atomic32_inc (&npc->mark_actions); +break ; + +case RTE_FLOW_ACTION_TYPE_FLAG : + mark =OTX2_FLOW_FLAG_VAL ; + req_act |=OTX2_FLOW_ACT_FLAG ; +rte_atomic32_inc (&npc->mark_actions); +break ; + +case RTE_FLOW_ACTION_TYPE_COUNT : + act_count = + (const struct rte_flow_action_count *) + actions->conf; + +if (act_count->shared ==1 ) { + errmsg ="Shared Counters not supported" ; + errcode =ENOTSUP ; + goto err_exit; + } +/* Indicates, need a counter */ + flow->ctr_id =1 ; + req_act |=OTX2_FLOW_ACT_COUNT ; +break ; + +case RTE_FLOW_ACTION_TYPE_DROP : + req_act |=OTX2_FLOW_ACT_DROP ; +break ; + +case RTE_FLOW_ACTION_TYPE_QUEUE : +/* Applicable only to ingress flow */ + act_q = (const struct rte_flow_action_queue *) + actions->conf; + rq = act_q->index; +if (rq >= dev->data->nb_rx_queues) { + errmsg ="invalid queue index" ; + errcode =EINVAL ; + goto err_exit; + } + req_act |=OTX2_FLOW_ACT_QUEUE ; +break ; + +case RTE_FLOW_ACTION_TYPE_RSS : + errcode =parse_rss_action (dev, attr, actions, error); +if (errcode) +return -rte_errno; + + req_act |=OTX2_FLOW_ACT_RSS ; +break ; + +case RTE_FLOW_ACTION_TYPE_SECURITY : +/* Assumes user has already configured security +* session for this flow. Associated conf is +* opaque. When RTE security is implemented for otx2, +* we need to verify that for specified security +* session: +* action_type == +* RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL && +* session_protocol == +* RTE_SECURITY_PROTOCOL_IPSEC +* +* RSS is not supported with inline ipsec. Get the +* rq from associated conf, or make +* RTE_FLOW_ACTION_TYPE_QUEUE compulsory with this +* action. +* Currently, rq = 0 is assumed. +*/ + req_act |=OTX2_FLOW_ACT_SEC ; + rq =0 ; +break ; +default : + errmsg ="Unsupported action specified" ; + errcode =ENOTSUP ; + goto err_exit; + } + } + +/* Check if actions specified are compatible */ +if (attr->egress) { +/* Only DROP/COUNT is supported */ +if (!(req_act &OTX2_FLOW_ACT_DROP )) { + errmsg ="DROP is required action for egress" ; + errcode =EINVAL ; + goto err_exit; + }else if (req_act & ~(OTX2_FLOW_ACT_DROP | +OTX2_FLOW_ACT_COUNT )) { + errmsg ="Unsupported action specified" ; + errcode =ENOTSUP ; + goto err_exit; + } + flow->npc_action =NIX_TX_ACTIONOP_DROP ; +return 0 ; + } + +/* We have already verified the attr, this is ingress. +* - Exactly one terminating action is supported +* - Exactly one of MARK or FLAG is supported +* - If terminating action is DROP, only count is valid. +*/ + sel_act = req_act &OTX2_FLOW_ACT_TERM ; +if ((sel_act & (sel_act -1 )) !=0 ) { + errmsg ="Only one terminating action supported" ; + errcode =EINVAL ; + goto err_exit; + } + +if (req_act &OTX2_FLOW_ACT_DROP ) { + sel_act = req_act & ~OTX2_FLOW_ACT_COUNT ; +if ((sel_act & (sel_act -1 )) !=0 ) { + errmsg ="Only COUNT action is supported " +"with DROP ingress action" ; + errcode =ENOTSUP ; + goto err_exit; + } + } + +if ((req_act & (OTX2_FLOW_ACT_FLAG |OTX2_FLOW_ACT_MARK )) + == (OTX2_FLOW_ACT_FLAG |OTX2_FLOW_ACT_MARK )) { + errmsg ="Only one of FLAG or MARK action is supported" ; + errcode =ENOTSUP ; + goto err_exit; + } + +/* Set NIX_RX_ACTIONOP */ +if (req_act &OTX2_FLOW_ACT_DROP ) { + flow->npc_action =NIX_RX_ACTIONOP_DROP ; + }else if (req_act &OTX2_FLOW_ACT_QUEUE ) { + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + flow->npc_action |= (uint64_t )rq <<20 ; + }else if (req_act &OTX2_FLOW_ACT_RSS ) { +/* When user added a rule for rss, first we will add the +*rule in MCAM and then update the action, once if we have +*FLOW_KEY_ALG index. So, till we update the action with +*flow_key_alg index, set the action to drop. +*/ +if (dev->data->dev_conf.rxmode.mq_mode ==ETH_MQ_RX_RSS ) + flow->npc_action =NIX_RX_ACTIONOP_DROP ; +else + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + }else if (req_act &OTX2_FLOW_ACT_SEC ) { + flow->npc_action =NIX_RX_ACTIONOP_UCAST_IPSEC ; + flow->npc_action |= (uint64_t )rq <<20 ; + }else if (req_act & (OTX2_FLOW_ACT_FLAG |OTX2_FLOW_ACT_MARK )) { + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + }else if (req_act &OTX2_FLOW_ACT_COUNT ) { +/* Keep OTX2_FLOW_ACT_COUNT always at the end +* This is default action, when user specify only +* COUNT ACTION +*/ + flow->npc_action =NIX_RX_ACTIONOP_UCAST ; + }else { +/* Should never reach here */ + errmsg ="Invalid action specified" ; + errcode =EINVAL ; + goto err_exit; + } + +if (mark) + flow->npc_action |= (uint64_t )mark <<40 ; + +if (rte_atomic32_read (&npc->mark_actions) ==1 ) + hw->rx_offload_flags |=NIX_RX_OFFLOAD_MARK_UPDATE_F ; + + +/* Ideally AF must ensure that correct pf_func is set */ + pf_func =otx2_pfvf_func (hw->pf, hw->vf); + flow->npc_action |= (uint64_t )pf_func <<4 ; + +return 0 ; + +err_exit: +rte_flow_error_set (error, errcode, +RTE_FLOW_ERROR_TYPE_ACTION_NUM ,NULL , + errmsg); +return -rte_errno; +} +
drivers/net/octeontx2/otx2_rx.h +1 -0
@@ -14,6 +14,7 @@#define NIX_RX_OFFLOAD_PTYPE_F BIT(1)#define NIX_RX_OFFLOAD_TSTAMP_F BIT(5) +#define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(4)#define NIX_TIMESYNC_RX_OFFSET 8
Signature · 1 line
2.21.0
PATCH 40/58 net/octeontx2: add flow operations
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding the initial flow ops like flow_create and flow_validate. These will be used to alloc and write flow rule to the device and validate the flow rule.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_flow.c | 430 ++++++++++++++++++++++++++++++ 3 files changed, 432 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_flow.c
drivers/net/octeontx2/Makefile +1 -0
@@ -34,6 +34,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_rss.c \ otx2_mac.c \ otx2_ptp.c \ + otx2_flow.c \ otx2_link.c \ otx2_stats.c \ otx2_lookup.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = files( 'otx2_rss.c', 'otx2_mac.c', 'otx2_ptp.c', + 'otx2_flow.c', 'otx2_link.c', 'otx2_stats.c', 'otx2_lookup.c',
drivers/net/octeontx2/otx2_flow.c new file +430 -0
430 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 41/58 net/octeontx2: add additional flow operations
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding the initial flow ops like flow_create and flow_validate. These will be used to alloc and write flow rule to device and validate the flow rule.
--- drivers/net/octeontx2/otx2_flow.c | 197 ++++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 3 + 2 files changed, 200 insertions(+)
drivers/net/octeontx2/otx2_flow.c +197 -0
@@ -5,6 +5,39 @@#include "otx2_ethdev.h" #include "otx2_flow.h" +static int +flow_free_all_resources (struct otx2_eth_dev *hw) +{ +struct otx2_npc_flow_info *npc = &hw->npc_flow; +struct otx2_mbox *mbox = hw->mbox; +struct otx2_mcam_ents_info *info; +struct rte_bitmap *bmap; +struct rte_flow *flow; +int rc, idx; + +/* Free all MCAM entries allocated */ + rc =otx2_flow_mcam_free_all_entries (mbox); + +/* Free any MCAM counters and delete flow list */ +for (idx =0 ; idx < npc->flow_max_priority; idx++) { +while ((flow =TAILQ_FIRST (&npc->flow_list[idx])) !=NULL ) { +if (flow->ctr_id !=NPC_COUNTER_NONE ) + rc |=otx2_flow_mcam_free_counter (mbox, + flow->ctr_id); + +TAILQ_REMOVE (&npc->flow_list[idx], flow, next); +rte_free (flow); + bmap = npc->live_entries[flow->priority]; +rte_bitmap_clear (bmap, flow->mcam_id); + } + info = &npc->flow_entry_info[idx]; + info->free_ent =0 ; + info->live_ent =0 ; + } +return rc; +} + +static int flow_program_npc (struct otx2_parse_state *pst,struct otx2_mbox *mbox,struct otx2_npc_flow_info *flow_info)
@@ -216,6 +249,27 @@ flow_program_rss_action(struct rte_eth_dev *eth_dev,return 0 ; } +static int +flow_free_rss_action (struct rte_eth_dev *eth_dev, +struct rte_flow *flow) +{ +struct otx2_eth_dev *dev = eth_dev->data->dev_private; +struct otx2_npc_flow_info *npc = &dev->npc_flow; +uint32_t rss_grp; + +if (flow->npc_action &NIX_RX_ACTIONOP_RSS ) { + rss_grp = (flow->npc_action >>NIX_RSS_ACT_GRP_OFFSET ) & +NIX_RSS_ACT_GRP_MASK ; +if (rss_grp ==0 || rss_grp >= npc->rss_grps) +return -EINVAL ; + +rte_bitmap_clear (npc->rss_grp_entries, rss_grp); + } + +return 0 ; +} + +static int flow_parse_meta_items(__rte_unused struct otx2_parse_state *pst) {
@@ -424,7 +478,150 @@ otx2_flow_create(struct rte_eth_dev *dev,return NULL ; } +static int +otx2_flow_destroy (struct rte_eth_dev *dev, +struct rte_flow *flow, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct otx2_npc_flow_info *npc = &hw->npc_flow; +struct otx2_mbox *mbox = hw->mbox; +struct rte_bitmap *bmap; +uint16_t match_id; +int rc; + + match_id = (flow->npc_action >>NIX_RX_ACT_MATCH_OFFSET ) & +NIX_RX_ACT_MATCH_MASK ; + +if (match_id && match_id <OTX2_FLOW_ACTION_FLAG_DEFAULT ) { +if (rte_atomic32_read (&npc->mark_actions) ==0 ) +return -EINVAL ; + +/* Clear mark offload flag if there are no more mark actions */ +if (rte_atomic32_sub_return (&npc->mark_actions,1 ) ==0 ) + hw->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F ; + } + + rc =flow_free_rss_action (dev, flow); +if (rc !=0 ) { +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to free rss action" ); + } + + rc =otx2_flow_mcam_free_entry (mbox, flow->mcam_id); +if (rc !=0 ) { +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to destroy filter" ); + } + +TAILQ_REMOVE (&npc->flow_list[flow->priority], flow, next); + + bmap = npc->live_entries[flow->priority]; +rte_bitmap_clear (bmap, flow->mcam_id); + +rte_free (flow); +return 0 ; +} + +static int +otx2_flow_flush (struct rte_eth_dev *dev, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +int rc; + + rc =flow_free_all_resources (hw); +if (rc) { +otx2_err ("Error when deleting NPC MCAM entries " +", counters" ); +rte_flow_error_set (error,EIO , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Failed to flush filter" ); +return -rte_errno; + } + +return 0 ; +} + +static int +otx2_flow_isolate(struct rte_eth_dev *dev __rte_unused, + int enable __rte_unused, +struct rte_flow_error *error) +{ +/* +* If we support, we need to un-install the default mcam +* entry for this port. +*/ + +rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , +"Flow isolation not supported" ); + +return -rte_errno; +} + +static int +otx2_flow_query (struct rte_eth_dev *dev, +struct rte_flow *flow, +const struct rte_flow_action *action, +void *data, +struct rte_flow_error *error) +{ +struct otx2_eth_dev *hw = dev->data->dev_private; +struct rte_flow_query_count *query = data; +struct otx2_mbox *mbox = hw->mbox; +const char *errmsg =NULL ; +int errcode =ENOTSUP ; +int rc; + +if (action->type !=RTE_FLOW_ACTION_TYPE_COUNT ) { + errmsg ="Only COUNT is supported in query" ; + goto err_exit; + } + +if (flow->ctr_id ==NPC_COUNTER_NONE ) { + errmsg ="Counter is not available" ; + goto err_exit; + } + + rc =otx2_flow_mcam_read_counter (mbox, flow->ctr_id, &query->hits); +if (rc !=0 ) { + errcode =EIO ; + errmsg ="Error reading flow counter" ; + goto err_exit; + } + query->hits_set =1 ; + query->bytes_set =0 ; + +if (query->reset) + rc =otx2_flow_mcam_clear_counter (mbox, flow->ctr_id); +if (rc !=0 ) { + errcode =EIO ; + errmsg ="Error clearing flow counter" ; + goto err_exit; + } + +return 0 ; + +err_exit: +rte_flow_error_set (error, errcode, +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL , + errmsg); +return -rte_errno; +} +const struct rte_flow_ops otx2_flow_ops = { .validate = otx2_flow_validate, .create = otx2_flow_create, + .destroy = otx2_flow_destroy, + .flush = otx2_flow_flush, + .query = otx2_flow_query, + .isolate = otx2_flow_isolate, };
drivers/net/octeontx2/otx2_rx.h +3 -0
@@ -5,6 +5,9 @@#ifndef __OTX2_RX_H__#define __OTX2_RX_H__ +/* Default mark value used when none is provided. */ +#define OTX2_FLOW_ACTION_FLAG_DEFAULT 0xffff +#define PTYPE_WIDTH 12#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH)#define PTYPE_TUNNEL_ARRAY_SZ BIT(PTYPE_WIDTH)
Signature · 1 line
2.21.0
PATCH 42/58 net/octeontx2: add flow init and fini
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Adding the flow init and fini functionality. These API will be called from dev init and
will initialize and de-initialize the flow related memory.
--- drivers/net/octeontx2/otx2_flow.c | 315 ++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+)
drivers/net/octeontx2/otx2_flow.c +315 -0
@@ -625,3 +625,318 @@ const struct rte_flow_ops otx2_flow_ops = { .query = otx2_flow_query, .isolate = otx2_flow_isolate, }; + +static int +flow_supp_key_len (uint32_t supp_mask) +{ +int nib_count =0 ; +while (supp_mask) { + nib_count++; + supp_mask &= (supp_mask -1 ); + } +return nib_count *4 ; +} + +/* Refer HRM register: +* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG +* and +* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG +**/ +#define BYTESM1_SHIFT 16 +#define HDR_OFF_SHIFT 8 +static void +flow_update_kex_info (struct npc_xtract_info *xtract_info, +uint64_t val) +{ + xtract_info->len = ((val >>BYTESM1_SHIFT ) &0xf ) +1 ; + xtract_info->hdr_off = (val >>HDR_OFF_SHIFT ) &0xff ; + xtract_info->key_off = val &0x3f ; + xtract_info->enable = ((val >>7 ) &0x1 ); +} + +static void +flow_process_mkex_cfg (struct otx2_npc_flow_info *npc, +struct npc_get_kex_cfg_rsp *kex_rsp) +{ +volatile uint64_t (*q)[NPC_MAX_INTF ][NPC_MAX_LID ][NPC_MAX_LT ] + [NPC_MAX_LD ]; +struct npc_xtract_info *x_info =NULL ; +int lid, lt, ld, fl, ix; +otx2_dxcfg_t *p; +uint64_t keyw; +uint64_t val; + + npc->keyx_supp_nmask[NPC_MCAM_RX ] = + kex_rsp->rx_keyx_cfg &0x7fffffffULL ; + npc->keyx_supp_nmask[NPC_MCAM_TX ] = + kex_rsp->tx_keyx_cfg &0x7fffffffULL ; + npc->keyx_len[NPC_MCAM_RX ] = +flow_supp_key_len (npc->keyx_supp_nmask[NPC_MCAM_RX ]); + npc->keyx_len[NPC_MCAM_TX ] = +flow_supp_key_len (npc->keyx_supp_nmask[NPC_MCAM_TX ]); + + keyw = (kex_rsp->rx_keyx_cfg >>32 ) &0x7ULL ; + npc->keyw[NPC_MCAM_RX ] = keyw; + keyw = (kex_rsp->tx_keyx_cfg >>32 ) &0x7ULL ; + npc->keyw[NPC_MCAM_TX ] = keyw; + +/* Update KEX_LD_FLAG */ +for (ix =0 ; ix <NPC_MAX_INTF ; ix++) { +for (ld =0 ; ld <NPC_MAX_LD ; ld++) { +for (fl =0 ; fl <NPC_MAX_LFL ; fl++) { + x_info = + &npc->prx_fxcfg[ix][ld][fl].xtract[0 ]; + val = kex_rsp->intf_ld_flags[ix][ld][fl]; +flow_update_kex_info (x_info, val); + } + } + } + +/* Update LID, LT and LDATA cfg */ + p = &npc->prx_dxcfg; + q = (volatile uint64_t (*)[][NPC_MAX_LID ][NPC_MAX_LT ][NPC_MAX_LD ]) + (&kex_rsp->intf_lid_lt_ld); +for (ix =0 ; ix <NPC_MAX_INTF ; ix++) { +for (lid =0 ; lid <NPC_MAX_LID ; lid++) { +for (lt =0 ; lt <NPC_MAX_LT ; lt++) { +for (ld =0 ; ld <NPC_MAX_LD ; ld++) { + x_info = &(*p)[ix][lid][lt].xtract[ld]; + val = (*q)[ix][lid][lt][ld]; +flow_update_kex_info (x_info, val); + } + } + } + } +/* Update LDATA Flags cfg */ + npc->prx_lfcfg[0 ].i = kex_rsp->kex_ld_flags[0 ]; + npc->prx_lfcfg[1 ].i = kex_rsp->kex_ld_flags[1 ]; +} + +static struct otx2_idev_kex_cfg * +flow_intra_dev_kex_cfg (void ) +{ +static const char name[] ="octeontx2_intra_device_kex_conf" ; +struct otx2_idev_kex_cfg *idev; +const struct rte_memzone *mz; + + mz =rte_memzone_lookup (name); +if (mz) +return mz->addr; + +/* Request for the first time */ + mz =rte_memzone_reserve_aligned (name,sizeof (struct otx2_idev_kex_cfg ), +SOCKET_ID_ANY ,0 ,OTX2_ALIGN ); +if (mz) { + idev = mz->addr; +rte_atomic16_set (&idev->kex_refcnt,0 ); +return idev; + } +return NULL ; +} + +static int +flow_fetch_kex_cfg (struct otx2_eth_dev *dev) +{ +struct otx2_npc_flow_info *npc = &dev->npc_flow; +struct npc_get_kex_cfg_rsp *kex_rsp; +struct otx2_mbox *mbox = dev->mbox; +struct otx2_idev_kex_cfg *idev; +int rc =0 ; + + idev =flow_intra_dev_kex_cfg (); +if (!idev) +return -ENOMEM ; + +/* Is kex_cfg read by any another driver? */ +if (rte_atomic16_add_return (&idev->kex_refcnt,1 ) ==1 ) { +/* Call mailbox to get key & data size */ + (void )otx2_mbox_alloc_msg_npc_get_kex_cfg (mbox); +otx2_mbox_msg_send (mbox,0 ); + rc =otx2_mbox_get_rsp (mbox,0 , (void *)&kex_rsp); +if (rc) { +otx2_err ("Failed to fetch NPC keyx config" ); + goto done; + } +memcpy (&idev->kex_cfg, kex_rsp, +sizeof (struct npc_get_kex_cfg_rsp )); + } + +flow_process_mkex_cfg (npc, &idev->kex_cfg); + +done: +return rc; +} + +int +otx2_flow_init (struct otx2_eth_dev *hw) +{ +uint8_t *mem =NULL , *nix_mem =NULL , *npc_mem =NULL ; +struct otx2_npc_flow_info *npc = &hw->npc_flow; +uint32_t bmap_sz; +int rc =0 , idx; + + rc =flow_fetch_kex_cfg (hw); +if (rc) { +otx2_err ("Failed to fetch NPC keyx config from idev" ); +return rc; + } + +rte_atomic32_init (&npc->mark_actions); + + npc->mcam_entries =NPC_MCAM_TOT_ENTRIES >> npc->keyw[NPC_MCAM_RX ]; +/* Free, free_rev, live and live_rev entries */ + bmap_sz =rte_bitmap_get_memory_footprint (npc->mcam_entries); + mem =rte_zmalloc (NULL ,4 * bmap_sz * npc->flow_max_priority, +RTE_CACHE_LINE_SIZE ); +if (mem ==NULL ) { +otx2_err ("Bmap alloc failed" ); + rc = -ENOMEM ; +return rc; + } + + npc->flow_entry_info =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct otx2_mcam_ents_info ), +0 ); +if (npc->flow_entry_info ==NULL ) { +otx2_err ("flow_entry_info alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->free_entries =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->free_entries ==NULL ) { +otx2_err ("free_entries alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->free_entries_rev =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->free_entries_rev ==NULL ) { +otx2_err ("free_entries_rev alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->live_entries =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->live_entries ==NULL ) { +otx2_err ("live_entries alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->live_entries_rev =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct rte_bitmap ), +0 ); +if (npc->live_entries_rev ==NULL ) { +otx2_err ("live_entries_rev alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->flow_list =rte_zmalloc (NULL , npc->flow_max_priority + *sizeof (struct otx2_flow_list ), +0 ); +if (npc->flow_list ==NULL ) { +otx2_err ("flow_list alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc_mem = mem; +for (idx =0 ; idx < npc->flow_max_priority; idx++) { +TAILQ_INIT (&npc->flow_list[idx]); + + npc->free_entries[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->free_entries_rev[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->live_entries[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->live_entries_rev[idx] = +rte_bitmap_init (npc->mcam_entries, mem, bmap_sz); + mem += bmap_sz; + + npc->flow_entry_info[idx].free_ent =0 ; + npc->flow_entry_info[idx].live_ent =0 ; + npc->flow_entry_info[idx].max_id =0 ; + npc->flow_entry_info[idx].min_id = ~(0 ); + } + + npc->rss_grps =NIX_RSS_GRPS ; + + bmap_sz =rte_bitmap_get_memory_footprint (npc->rss_grps); + nix_mem =rte_zmalloc (NULL , bmap_sz,RTE_CACHE_LINE_SIZE ); +if (nix_mem ==NULL ) { +otx2_err ("Bmap alloc failed" ); + rc = -ENOMEM ; + goto err; + } + + npc->rss_grp_entries =rte_bitmap_init (npc->rss_grps, nix_mem, bmap_sz); + +/* Group 0 will be used for RSS, +* 1 -7 will be used for rte_flow RSS action +*/ +rte_bitmap_set (npc->rss_grp_entries,0 ); + +return 0 ; + +err: +if (npc->flow_list) +rte_free (npc->flow_list); +if (npc->live_entries_rev) +rte_free (npc->live_entries_rev); +if (npc->live_entries) +rte_free (npc->live_entries); +if (npc->free_entries_rev) +rte_free (npc->free_entries_rev); +if (npc->free_entries) +rte_free (npc->free_entries); +if (npc->flow_entry_info) +rte_free (npc->flow_entry_info); +if (npc_mem) +rte_free (npc_mem); +if (nix_mem) +rte_free (nix_mem); +return rc; +} + +int +otx2_flow_fini (struct otx2_eth_dev *hw) +{ +struct otx2_npc_flow_info *npc = &hw->npc_flow; +int rc; + + rc =flow_free_all_resources (hw); +if (rc) { +otx2_err ("Error when deleting NPC MCAM entries, counters" ); +return rc; + } + +if (npc->flow_list) +rte_free (npc->flow_list); +if (npc->live_entries_rev) +rte_free (npc->live_entries_rev); +if (npc->live_entries) +rte_free (npc->live_entries); +if (npc->free_entries_rev) +rte_free (npc->free_entries_rev); +if (npc->free_entries) +rte_free (npc->free_entries); +if (npc->flow_entry_info) +rte_free (npc->flow_entry_info); + +return 0 ; +}
Signature · 1 line
2.21.0
PATCH 43/58 net/octeontx2: connect flow API to ethdev ops
In reply to [email protected]From: Vivek Sharma <[email protected]>
Connect rte_flow driver ops to ethdev via .filter_ctrl op.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 10 ++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 3 +++ drivers/net/octeontx2/otx2_ethdev_ops.c | 21 +++++++++++++++++++++ 6 files changed, 37 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -22,6 +22,7 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Flow control = Y +Flow API = Y Packet type parsing = Y Timesync = Y Timestamp offload = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -22,6 +22,7 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Flow control = Y +Flow API = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -17,6 +17,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Flow API = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
drivers/net/octeontx2/otx2_ethdev.c +10 -0
@@ -1079,6 +1079,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)/* Free the resources allocated from the previous configure */ if (dev->configured ==1 ) {otx2_nix_rxchan_bpid_cfg (eth_dev, false); +otx2_flow_fini (dev);oxt2_nix_unregister_queue_irqs (eth_dev);nix_set_nop_rxtx_function (eth_dev); rc =nix_store_queue_cfg_and_then_release (eth_dev);
@@ -1324,6 +1325,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .rx_descriptor_status = otx2_nix_rx_descriptor_status, .tx_done_cleanup = otx2_nix_tx_done_cleanup, .pool_ops_supported = otx2_nix_pool_ops_supported, + .filter_ctrl = otx2_nix_dev_filter_ctrl, .get_module_info = otx2_nix_get_module_info, .get_module_eeprom = otx2_nix_get_module_eeprom, .flow_ctrl_get = otx2_nix_flow_ctrl_get,
@@ -1503,6 +1505,11 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) dev->hwcap |=OTX2_FIXUP_F_LIMIT_CQ_FULL ; } +/* Initialize rte-flow */ + rc =otx2_flow_init (dev); +if (rc) + goto free_mac_addrs; + otx2_nix_dbg("Port=%d pf=%d vf=%d ver=%s msix_off=%d hwcap=0x%" PRIx64 " rxoffload_capa=0x%" PRIx64 " txoffload_capa=0x%" PRIx64, eth_dev->data->port_id, dev->pf, dev->vf,
@@ -1539,6 +1546,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Disable other rte_flow entries */ +otx2_flow_fini (dev); +/* Disable PTP if already enabled */ if (otx2_ethdev_is_ptp_en (dev))otx2_nix_timesync_disable (eth_dev);
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -274,6 +274,9 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)/* Ops */ void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +int otx2_nix_dev_filter_ctrl (struct rte_eth_dev *eth_dev, +enum rte_filter_type filter_type, +enum rte_filter_op filter_op,void *arg);int otx2_nix_get_module_info (struct rte_eth_dev *eth_dev,struct rte_eth_dev_module_info *modinfo); int otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
drivers/net/octeontx2/otx2_ethdev_ops.c +21 -0
@@ -220,6 +220,27 @@ otx2_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)return -ENOTSUP ; } +int +otx2_nix_dev_filter_ctrl (struct rte_eth_dev *eth_dev, +enum rte_filter_type filter_type, +enum rte_filter_op filter_op,void *arg) +{ +RTE_SET_USED (eth_dev); + +if (filter_type !=RTE_ETH_FILTER_GENERIC ) { +otx2_err ("Unsupported filter type %d" , filter_type); +return -ENOTSUP ; + } + +if (filter_op ==RTE_ETH_FILTER_GET ) { + *(const void **)arg = &otx2_flow_ops; +return 0 ; + } + +otx2_err ("Invalid filter_op %d" , filter_op); +return -EINVAL ; +} +static struct cgx_fw_data *nix_get_fwdata (struct otx2_eth_dev *dev) {
Signature · 1 line
2.21.0
PATCH 44/58 net/octeontx2: implement VLAN utility functions
In reply to [email protected]From: Vivek Sharma <[email protected]>
Implement accessory functions needed for VLAN functionality. Introduce VLAN related structures as well.
Maximum Vtag insertion size is controlled by SMQ configuration. This patch also configure SMQ for supporting upto double vtag insertion.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 10 ++ drivers/net/octeontx2/otx2_ethdev.h | 48 +++++++ drivers/net/octeontx2/otx2_tm.c | 5 +- drivers/net/octeontx2/otx2_vlan.c | 190 ++++++++++++++++++++++++++++ 6 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_vlan.c
drivers/net/octeontx2/Makefile +1 -0
@@ -36,6 +36,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_ptp.c \ otx2_flow.c \ otx2_link.c \ + otx2_vlan.c \ otx2_stats.c \ otx2_lookup.c \ otx2_ethdev.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -9,6 +9,7 @@ sources = files( 'otx2_ptp.c', 'otx2_flow.c', 'otx2_link.c', + 'otx2_vlan.c', 'otx2_stats.c', 'otx2_lookup.c', 'otx2_ethdev.c',
drivers/net/octeontx2/otx2_ethdev.c +10 -0
@@ -1079,6 +1079,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)/* Free the resources allocated from the previous configure */ if (dev->configured ==1 ) {otx2_nix_rxchan_bpid_cfg (eth_dev, false); +otx2_nix_vlan_fini (eth_dev);otx2_flow_fini (dev);oxt2_nix_unregister_queue_irqs (eth_dev);nix_set_nop_rxtx_function (eth_dev);
@@ -1126,6 +1127,12 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } + rc =otx2_nix_vlan_offload_init (eth_dev); +if (rc) { +otx2_err ("Failed to init vlan offload rc=%d" , rc); + goto free_nix_lf; + } +/* Register queue IRQs */ rc =oxt2_nix_register_queue_irqs (eth_dev);if (rc) {
@@ -1546,6 +1553,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +/* Disable vlan offloads */ +otx2_nix_vlan_fini (eth_dev); +/* Disable other rte_flow entries */ otx2_flow_fini (dev);
drivers/net/octeontx2/otx2_ethdev.h +48 -0
70 lines not on this page · raw message
drivers/net/octeontx2/otx2_tm.c +3 -2
@@ -359,7 +359,7 @@ populate_tm_registers(struct otx2_eth_dev *dev,/* Set xoff which will be cleared later */ *reg++ =NIX_AF_SMQX_CFG (schq); - *regval++ =BIT_ULL (50 ) | + *regval++ =BIT_ULL (50 ) | ((uint64_t )NIX_MAX_VTAG_INS <<36 ) | (NIX_MAX_HW_FRS <<8 ) |NIX_MIN_HW_FRS ; req->num_regs++; *reg++ =NIX_AF_MDQX_PARENT (schq);
@@ -688,7 +688,8 @@ nix_smq_xoff(struct otx2_eth_dev *dev, uint16_t smq, bool enable) req->reg[0 ] =NIX_AF_SMQX_CFG (smq);/* Unmodified fields */ - req->regval[0 ] = (NIX_MAX_HW_FRS <<8 ) |NIX_MIN_HW_FRS ; + req->regval[0 ] = ((uint64_t )NIX_MAX_VTAG_INS <<36 ) | + (NIX_MAX_HW_FRS <<8 ) |NIX_MIN_HW_FRS ;if (enable) req->regval[0 ] |=BIT_ULL (50 ) |BIT_ULL (49 );
drivers/net/octeontx2/otx2_vlan.c new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 45/58 net/octeontx2: support VLAN offloads
In reply to [email protected]From: Vivek Sharma <[email protected]>
Support configuring VLAN offloads for an ethernet device.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/features/octeontx2_vf.ini | 2 + drivers/net/octeontx2/otx2_ethdev.c | 1 + drivers/net/octeontx2/otx2_ethdev.h | 1 + drivers/net/octeontx2/otx2_rx.h | 1 + drivers/net/octeontx2/otx2_vlan.c | 424 ++++++++++++++++++++- 7 files changed, 425 insertions(+), 8 deletions(-)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -23,6 +23,8 @@ RSS reta update = Y Inner RSS = Y Flow control = Y Flow API = Y +VLAN offload = Y +QinQ offload = Y Packet type parsing = Y Timesync = Y Timestamp offload = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -23,6 +23,8 @@ RSS reta update = Y Inner RSS = Y Flow control = Y Flow API = Y +VLAN offload = Y +QinQ offload = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -18,6 +18,8 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Flow API = Y +VLAN offload = Y +QinQ offload = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
drivers/net/octeontx2/otx2_ethdev.c +1 -0
@@ -1344,6 +1344,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .timesync_adjust_time = otx2_nix_timesync_adjust_time, .timesync_read_time = otx2_nix_timesync_read_time, .timesync_write_time = otx2_nix_timesync_write_time, + .vlan_offload_set = otx2_nix_vlan_offload_set, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +1 -0
@@ -468,6 +468,7 @@ int otx2_eth_dev_ptp_info_update(struct otx2_dev *dev, bool ptp_en);/* VLAN */ int otx2_nix_vlan_offload_init (struct rte_eth_dev *eth_dev);int otx2_nix_vlan_fini (struct rte_eth_dev *eth_dev); +int otx2_nix_vlan_offload_set (struct rte_eth_dev *eth_dev,int mask);#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_rx.h +1 -0
@@ -16,6 +16,7 @@ sizeof(uint16_t))#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) +#define NIX_RX_OFFLOAD_VLAN_STRIP_F BIT(3)#define NIX_RX_OFFLOAD_TSTAMP_F BIT(5)#define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(4)
drivers/net/octeontx2/otx2_vlan.c +416 -8
466 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 46/58 net/octeontx2: support VLAN filters
In reply to [email protected]From: Vivek Sharma <[email protected]>
Support setting up VLAN filters so as to allow tagged packet's reception after VLAN HW Filter offload is enabled.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev.h | 5 +- drivers/net/octeontx2/otx2_vlan.c | 147 ++++++++++++++++++++- 6 files changed, 154 insertions(+), 3 deletions(-)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -21,6 +21,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y Flow control = Y Flow API = Y VLAN offload = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -21,6 +21,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y Flow control = Y Flow API = Y VLAN offload = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -17,6 +17,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y Flow API = Y VLAN offload = Y QinQ offload = Y
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1345,6 +1345,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .timesync_read_time = otx2_nix_timesync_read_time, .timesync_write_time = otx2_nix_timesync_write_time, .vlan_offload_set = otx2_nix_vlan_offload_set, + .vlan_filter_set = otx2_nix_vlan_filter_set, + .vlan_strip_queue_set = otx2_nix_vlan_strip_queue_set, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +4 -1
@@ -469,6 +469,9 @@ int otx2_eth_dev_ptp_info_update(struct otx2_dev *dev, bool ptp_en);int otx2_nix_vlan_offload_init (struct rte_eth_dev *eth_dev);int otx2_nix_vlan_fini (struct rte_eth_dev *eth_dev);int otx2_nix_vlan_offload_set (struct rte_eth_dev *eth_dev,int mask); - +int otx2_nix_vlan_filter_set (struct rte_eth_dev *eth_dev,uint16_t vlan_id, +int on); +void otx2_nix_vlan_strip_queue_set (struct rte_eth_dev *dev, +uint16_t queue,int on);#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_vlan.c +145 -2
197 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 47/58 net/octeontx2: support VLAN TPID and PVID for Tx
In reply to [email protected]From: Vivek Sharma <[email protected]>
Implement support for setting VLAN TPID and PVID for Tx packets.
--- drivers/net/octeontx2/otx2_ethdev.c | 2 + drivers/net/octeontx2/otx2_ethdev.h | 5 + drivers/net/octeontx2/otx2_vlan.c | 191 ++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +2 -0
@@ -1347,6 +1347,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .vlan_offload_set = otx2_nix_vlan_offload_set, .vlan_filter_set = otx2_nix_vlan_filter_set, .vlan_strip_queue_set = otx2_nix_vlan_strip_queue_set, + .vlan_tpid_set = otx2_nix_vlan_tpid_set, + .vlan_pvid_set = otx2_nix_vlan_pvid_set, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +5 -0
@@ -473,5 +473,10 @@ int otx2_nix_vlan_filter_set(struct rte_eth_dev *eth_dev, uint16_t vlan_id, int on);void otx2_nix_vlan_strip_queue_set (struct rte_eth_dev *dev,uint16_t queue,int on); +int +otx2_nix_vlan_tpid_set (struct rte_eth_dev *eth_dev, +enum rte_vlan_type type,uint16_t tpid); +int +otx2_nix_vlan_pvid_set (struct rte_eth_dev *dev,uint16_t vlan_id,int on);#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_vlan.c +191 -0
209 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 48/58 net/octeontx2: add FW version get operation
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add firmware version get operation.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 1 + drivers/net/octeontx2/otx2_ethdev.h | 3 +++ drivers/net/octeontx2/otx2_ethdev_ops.c | 22 ++++++++++++++++++++++ drivers/net/octeontx2/otx2_flow.c | 7 +++++++ 7 files changed, 36 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -33,5 +33,6 @@ Rx descriptor status = Y Basic stats = Y Stats per queue = Y Extended stats = Y +FW version = Y Module EEPROM dump = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -31,5 +31,6 @@ Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y Module EEPROM dump = Y Registers dump = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -26,5 +26,6 @@ Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y Module EEPROM dump = Y Registers dump = Y
drivers/net/octeontx2/otx2_ethdev.c +1 -0
@@ -1335,6 +1335,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .filter_ctrl = otx2_nix_dev_filter_ctrl, .get_module_info = otx2_nix_get_module_info, .get_module_eeprom = otx2_nix_get_module_eeprom, + .fw_version_get = otx2_nix_fw_version_get, .flow_ctrl_get = otx2_nix_flow_ctrl_get, .flow_ctrl_set = otx2_nix_flow_ctrl_set, .timesync_enable = otx2_nix_timesync_enable,
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -216,6 +216,7 @@ struct otx2_eth_dev {uint8_t lso_tsov4_idx;uint8_t lso_tsov6_idx;uint8_t mac_addr[RTE_ETHER_ADDR_LEN ]; +uint8_t mkex_pfl_name[MKEX_NAME_LEN ];uint8_t max_mac_entries;uint8_t lf_tx_stats;uint8_t lf_rx_stats;
@@ -320,6 +321,8 @@ void otx2_nix_info_get(struct rte_eth_dev *eth_dev,int otx2_nix_dev_filter_ctrl (struct rte_eth_dev *eth_dev,enum rte_filter_type filter_type,enum rte_filter_op filter_op,void *arg); +int otx2_nix_fw_version_get (struct rte_eth_dev *eth_dev,char *fw_version, +size_t fw_size);int otx2_nix_get_module_info (struct rte_eth_dev *eth_dev,struct rte_eth_dev_module_info *modinfo); int otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
drivers/net/octeontx2/otx2_ethdev_ops.c +22 -0
@@ -209,6 +209,28 @@ otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)return 0 ; } +int +otx2_nix_fw_version_get (struct rte_eth_dev *eth_dev,char *fw_version, +size_t fw_size) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc = (int )fw_size; + +if (fw_size >sizeof (dev->mkex_pfl_name)) + rc =sizeof (dev->mkex_pfl_name); + + rc =strlcpy (fw_version, (char *)dev->mkex_pfl_name, rc); + + rc +=1 ;/* Add the size of '\0' */ +if (fw_size < (uint32_t )rc) + goto done; +else +return 0 ; + +done: +return rc; +} +int otx2_nix_pool_ops_supported (struct rte_eth_dev *eth_dev,const char *pool) {
drivers/net/octeontx2/otx2_flow.c +7 -0
@@ -740,6 +740,7 @@ flow_fetch_kex_cfg(struct otx2_eth_dev *dev)struct otx2_npc_flow_info *npc = &dev->npc_flow;struct npc_get_kex_cfg_rsp *kex_rsp;struct otx2_mbox *mbox = dev->mbox; +char mkex_pfl_name[MKEX_NAME_LEN ];struct otx2_idev_kex_cfg *idev;int rc =0 ;
@@ -761,6 +762,12 @@ flow_fetch_kex_cfg(struct otx2_eth_dev *dev) sizeof(struct npc_get_kex_cfg_rsp)); } +otx2_mbox_memcpy (mkex_pfl_name, + idev->kex_cfg.mkex_pfl_name,MKEX_NAME_LEN ); + +strlcpy ((char *)dev->mkex_pfl_name, + mkex_pfl_name,sizeof (dev->mkex_pfl_name)); +flow_process_mkex_cfg (npc, &idev->kex_cfg); done:
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH v1 48/58] net/octeontx2: add FW version get operation
Quoted 5 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Vamsi Attunuru <[email protected]>
Add firmware version get operation.
Signed-off-by Vamsi Attunuru <[email protected]>
<...>
Quoted 15 lines
drivers/net/octeontx2/otx2_ethdev_ops.c +11
-0@@ -209,6 +209,28 @@ otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)return 0 ; } +int +otx2_nix_fw_version_get (struct rte_eth_dev *eth_dev,char *fw_version, +size_t fw_size) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc = (int )fw_size; + +if (fw_size >sizeof (dev->mkex_pfl_name)) + rc =sizeof (dev->mkex_pfl_name); + + rc =strlcpy (fw_version, (char *)dev->mkex_pfl_name, rc);
drivers/net/octeontx2/otx2_ethdev_ops.c otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt) · line 232
Quoted 10 lines
drivers/net/octeontx2/otx2_ethdev_ops.c +10
-0+ + rc +=1 ;/* Add the size of '\0' */ +if (fw_size < (uint32_t )rc) + goto done; +else +return 0 ; + +done: +return rc; +}
Up to you but this can be done without a 'goto':
... if (fw_size < (uint32_t)rc) return rc; return 0; }
Re: [dpdk-dev] [EXT] Re: [PATCH v1 48/58] net/octeontx2: add FW version get operation
________________________________
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 9:36 PM
To: Jerin Jacob Kollanukkaran; [email protected]; John McNamara; Marko Kovacevic; Nithin Kumar Dabilpuram; Kiran Kumar Kokkilagadda
Cc: Vamsi Krishna Attunuru
Subject: [EXT] Re: [dpdk-dev] [PATCH v1 48/58] net/octeontx2: add FW version get operation
External Email
----------------------------------------------------------------------
Quoted 5 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Vamsi Attunuru <[email protected]>
Add firmware version get operation.
Signed-off-by Vamsi Attunuru <[email protected]>
<...>
Quoted 15 lines
drivers/net/octeontx2/otx2_ethdev_ops.c +11
-0@@ -209,6 +209,28 @@ otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)return 0 ; } +int +otx2_nix_fw_version_get (struct rte_eth_dev *eth_dev,char *fw_version, +size_t fw_size) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc = (int )fw_size; + +if (fw_size >sizeof (dev->mkex_pfl_name)) + rc =sizeof (dev->mkex_pfl_name); + + rc =strlcpy (fw_version, (char *)dev->mkex_pfl_name, rc);
drivers/net/octeontx2/otx2_ethdev_ops.c otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt) · line 232
Quoted 10 lines
drivers/net/octeontx2/otx2_ethdev_ops.c +10
-0+ + rc +=1 ;/* Add the size of '\0' */ +if (fw_size < (uint32_t )rc) + goto done; +else +return 0 ; + +done: +return rc; +}
Up to you but this can be done without a 'goto':
Agreed, will fix it in v2.
...
if (fw_size < (uint32_t)rc)
return rc;
return 0;
}PATCH 49/58 net/octeontx2: add Rx burst support
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Rx burst support.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 2 +- drivers/net/octeontx2/otx2_ethdev.c | 6 - drivers/net/octeontx2/otx2_ethdev.h | 2 + drivers/net/octeontx2/otx2_rx.c | 128 ++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 249 +++++++++++++++++++++++++++- 6 files changed, 380 insertions(+), 8 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_rx.c
drivers/net/octeontx2/Makefile +1 -0
@@ -30,6 +30,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_rx.c \ otx2_tm.c \ otx2_rss.c \ otx2_mac.c \
drivers/net/octeontx2/meson.build +1 -1
@@ -2,7 +2,7 @@ # Copyright(C) 2019 Marvell International Ltd. # -sources = files( +sources = files('otx2_rx.c', 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c',
drivers/net/octeontx2/otx2_ethdev.c +0 -6
@@ -14,12 +14,6 @@#include "otx2_ethdev.h" -static inline void -otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev) -{ -RTE_SET_USED (eth_dev); -} -static inline void otx2_eth_set_tx_function (struct rte_eth_dev *eth_dev) {
drivers/net/octeontx2/otx2_ethdev.h +2 -0
@@ -259,6 +259,7 @@ struct otx2_eth_dev {struct otx2_eth_qconf *tx_qconf;struct otx2_eth_qconf *rx_qconf;struct rte_eth_dev *eth_dev; +eth_rx_burst_t rx_pkt_burst_no_offload;/* PTP counters */ bool ptp_en;struct otx2_timesync_info tstamp;
@@ -451,6 +452,7 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs, struct otx2_eth_dev *dev);/* Rx and Tx routines */ +void otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev);void otx2_nix_form_default_desc (struct otx2_eth_txq *txq);/* Timesync - PTP routines */
drivers/net/octeontx2/otx2_rx.c new file +128 -0
128 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h +248 -1
262 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 50/58 net/octeontx2: add Rx multi segment version
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add multi segment version of packet Receive function.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 2 + drivers/net/octeontx2/otx2_rx.c | 25 ++++++++++ drivers/net/octeontx2/otx2_rx.h | 55 +++++++++++++++++++++- 5 files changed, 84 insertions(+), 1 deletion(-)
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -24,6 +24,8 @@ Inner RSS = Y VLAN filter = Y Flow control = Y Flow API = Y +Jumbo frame = Y +Scattered Rx = Y VLAN offload = Y QinQ offload = Y Packet type parsing = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -24,6 +24,7 @@ Inner RSS = Y VLAN filter = Y Flow control = Y Flow API = Y +Jumbo frame = Y VLAN offload = Y QinQ offload = Y Packet type parsing = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -19,6 +19,8 @@ RSS reta update = Y Inner RSS = Y VLAN filter = Y Flow API = Y +Jumbo frame = Y +Scattered Rx = Y VLAN offload = Y QinQ offload = Y Packet type parsing = Y
drivers/net/octeontx2/otx2_rx.c +25 -0
@@ -91,6 +91,14 @@ otx2_nix_recv_pkts_ ## name(void *rx_queue, \ { \return nix_recv_pkts (rx_queue, rx_pkts, pkts, (flags)); \ } \ + \ +static uint16_t __rte_noinline __hot \ +otx2_nix_recv_pkts_mseg_ ## name(void *rx_queue, \ + struct rte_mbuf **rx_pkts, uint16_t pkts) \ +{ \ + return nix_recv_pkts(rx_queue, rx_pkts, pkts, \ + (flags) | NIX_RX_MULTI_SEG_F); \ +} \NIX_RX_FASTPATH_MODES #undef R
@@ -114,15 +122,32 @@ pick_rx_func(struct rte_eth_dev *eth_dev,void otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev) { +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +const eth_rx_burst_t nix_eth_rx_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { #define R(name, f5, f4, f3, f2, f1, f0, flags) \ [f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_ ## name, +NIX_RX_FASTPATH_MODES +#undef R + }; + +const eth_rx_burst_t nix_eth_rx_burst_mseg[2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f5, f4, f3, f2, f1, f0, flags) \ + [f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_mseg_ ## name, +NIX_RX_FASTPATH_MODES #undef R };pick_rx_func (eth_dev, nix_eth_rx_burst); +if (dev->rx_offloads &DEV_RX_OFFLOAD_SCATTER ) +pick_rx_func (eth_dev, nix_eth_rx_burst_mseg); + +/* Copy multi seg version with no offload for tear down sequence */ +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) + dev->rx_pkt_burst_no_offload = + nix_eth_rx_burst_mseg[0 ][0 ][0 ][0 ][0 ][0 ];rte_mb (); }
drivers/net/octeontx2/otx2_rx.h +54 -1
73 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 51/58 net/octeontx2: add Rx vector version
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add vector version of packet Receive function.
--- drivers/net/octeontx2/otx2_rx.c | 259 +++++++++++++++++++++++++++++++- 1 file changed, 258 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_rx.c +258 -1
@@ -83,6 +83,239 @@ nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,return nb_pkts; } +#if defined(RTE_ARCH_ARM64 ) + +static __rte_always_inline uint64_t +nix_vlan_update (const uint64_t w2,uint64_t ol_flags,uint8x16_t *f) +{ +if (w2 &BIT_ULL (21 )/* vtag0_gone */ ) { + ol_flags |=PKT_RX_VLAN |PKT_RX_VLAN_STRIPPED ; + *f =vsetq_lane_u16 ((uint16_t )(w2 >>32 ), *f,5 ); + } + +return ol_flags; +} + +static __rte_always_inline uint64_t +nix_qinq_update (const uint64_t w2,uint64_t ol_flags,struct rte_mbuf *mbuf) +{ +if (w2 &BIT_ULL (23 )/* vtag1_gone */ ) { + ol_flags |=PKT_RX_QINQ |PKT_RX_QINQ_STRIPPED ; + mbuf->vlan_tci_outer = (uint16_t )(w2 >>48 ); + } + +return ol_flags; +} + +static __rte_always_inline uint16_t +nix_recv_pkts_vector (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t pkts,const uint16_t flags) +{ +struct otx2_eth_rxq *rxq = rx_queue;uint16_t packets =0 ; +uint64x2_t cq0_w8, cq1_w8, cq2_w8, cq3_w8, mbuf01, mbuf23; +const uint64_t mbuf_initializer = rxq->mbuf_initializer; +const uint64x2_t data_off =vdupq_n_u64 (rxq->data_off); +uint64_t ol_flags0, ol_flags1, ol_flags2, ol_flags3; +uint64x2_t rearm0 =vdupq_n_u64 (mbuf_initializer); +uint64x2_t rearm1 =vdupq_n_u64 (mbuf_initializer); +uint64x2_t rearm2 =vdupq_n_u64 (mbuf_initializer); +uint64x2_t rearm3 =vdupq_n_u64 (mbuf_initializer); +struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3; +const uint16_t *lookup_mem = rxq->lookup_mem; +const uint32_t qmask = rxq->qmask; +const uint64_t wdata = rxq->wdata; +const uintptr_t desc = rxq->desc; +uint8x16_t f0, f1, f2, f3; +uint32_t head = rxq->head; + + pkts =nix_rx_nb_pkts (rxq, wdata, pkts, qmask); +/* Packets has to be floor-aligned to NIX_DESCS_PER_LOOP */ + pkts =RTE_ALIGN_FLOOR (pkts,NIX_DESCS_PER_LOOP ); + +while (packets < pkts) { +/* Get the CQ pointers, since the ring size is multiple of +* 4, We can avoid checking the wrap around of head +* value after the each access unlike scalar version. +*/ +const uintptr_t cq0 = desc +CQE_SZ (head); + +/* Prefetch N desc ahead */ +rte_prefetch_non_temporal ((void *)(cq0 +CQE_SZ (8 ))); +rte_prefetch_non_temporal ((void *)(cq0 +CQE_SZ (9 ))); +rte_prefetch_non_temporal ((void *)(cq0 +CQE_SZ (10 ))); +rte_prefetch_non_temporal ((void *)(cq0 +CQE_SZ (11 ))); + +/* Get NIX_RX_SG_S for size and buffer pointer */ + cq0_w8 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (0 ) +64 )); + cq1_w8 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (1 ) +64 )); + cq2_w8 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (2 ) +64 )); + cq3_w8 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (3 ) +64 )); + +/* Extract mbuf from NIX_RX_SG_S */ + mbuf01 =vzip2q_u64 (cq0_w8, cq1_w8); + mbuf23 =vzip2q_u64 (cq2_w8, cq3_w8); + mbuf01 =vqsubq_u64 (mbuf01, data_off); + mbuf23 =vqsubq_u64 (mbuf23, data_off); + +/* Move mbufs to scalar registers for future use */ + mbuf0 = (struct rte_mbuf *)vgetq_lane_u64 (mbuf01,0 ); + mbuf1 = (struct rte_mbuf *)vgetq_lane_u64 (mbuf01,1 ); + mbuf2 = (struct rte_mbuf *)vgetq_lane_u64 (mbuf23,0 ); + mbuf3 = (struct rte_mbuf *)vgetq_lane_u64 (mbuf23,1 ); + +/* Mask to get packet len from NIX_RX_SG_S */ +const uint8x16_t shuf_msk = { +0xFF ,0xFF ,/* pkt_type set as unknown */ +0xFF ,0xFF ,/* pkt_type set as unknown */ +0 ,1 ,/* octet 1~0, low 16 bits pkt_len */ +0xFF ,0xFF ,/* skip high 16 bits pkt_len, zero out */ +0 ,1 ,/* octet 1~0, 16 bits data_len */ +0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF + }; + +/* Form the rx_descriptor_fields1 with pkt_len and data_len */ + f0 =vqtbl1q_u8 (cq0_w8, shuf_msk); + f1 =vqtbl1q_u8 (cq1_w8, shuf_msk); + f2 =vqtbl1q_u8 (cq2_w8, shuf_msk); + f3 =vqtbl1q_u8 (cq3_w8, shuf_msk); + +/* Load CQE word0 and word 1 */ +uint64x2_t cq0_w0 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (0 ))); +uint64x2_t cq1_w0 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (1 ))); +uint64x2_t cq2_w0 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (2 ))); +uint64x2_t cq3_w0 =vld1q_u64 ((uint64_t *)(cq0 +CQE_SZ (3 ))); + +if (flags &NIX_RX_OFFLOAD_RSS_F ) { +/* Fill rss in the rx_descriptor_fields1 */ + f0 =vsetq_lane_u32 (vgetq_lane_u32 (cq0_w0,0 ), f0,3 ); + f1 =vsetq_lane_u32 (vgetq_lane_u32 (cq1_w0,0 ), f1,3 ); + f2 =vsetq_lane_u32 (vgetq_lane_u32 (cq2_w0,0 ), f2,3 ); + f3 =vsetq_lane_u32 (vgetq_lane_u32 (cq3_w0,0 ), f3,3 ); + ol_flags0 =PKT_RX_RSS_HASH ; + ol_flags1 =PKT_RX_RSS_HASH ; + ol_flags2 =PKT_RX_RSS_HASH ; + ol_flags3 =PKT_RX_RSS_HASH ; + }else { + ol_flags0 =0 ; ol_flags1 =0 ; + ol_flags2 =0 ; ol_flags3 =0 ; + } + +if (flags &NIX_RX_OFFLOAD_PTYPE_F ) { +/* Fill packet_type in the rx_descriptor_fields1 */ + f0 =vsetq_lane_u32 (nix_ptype_get (lookup_mem, +vgetq_lane_u64 (cq0_w0,1 )), f0,0 ); + f1 =vsetq_lane_u32 (nix_ptype_get (lookup_mem, +vgetq_lane_u64 (cq1_w0,1 )), f1,0 ); + f2 =vsetq_lane_u32 (nix_ptype_get (lookup_mem, +vgetq_lane_u64 (cq2_w0,1 )), f2,0 ); + f3 =vsetq_lane_u32 (nix_ptype_get (lookup_mem, +vgetq_lane_u64 (cq3_w0,1 )), f3,0 ); + } + +if (flags &NIX_RX_OFFLOAD_CHECKSUM_F ) { + ol_flags0 |=nix_rx_olflags_get (lookup_mem, +vgetq_lane_u64 (cq0_w0,1 )); + ol_flags1 |=nix_rx_olflags_get (lookup_mem, +vgetq_lane_u64 (cq1_w0,1 )); + ol_flags2 |=nix_rx_olflags_get (lookup_mem, +vgetq_lane_u64 (cq2_w0,1 )); + ol_flags3 |=nix_rx_olflags_get (lookup_mem, +vgetq_lane_u64 (cq3_w0,1 )); + } + +if (flags &NIX_RX_OFFLOAD_VLAN_STRIP_F ) { +uint64_t cq0_w2 = *(uint64_t *)(cq0 +CQE_SZ (0 ) +16 ); +uint64_t cq1_w2 = *(uint64_t *)(cq0 +CQE_SZ (1 ) +16 ); +uint64_t cq2_w2 = *(uint64_t *)(cq0 +CQE_SZ (2 ) +16 ); +uint64_t cq3_w2 = *(uint64_t *)(cq0 +CQE_SZ (3 ) +16 ); + + ol_flags0 =nix_vlan_update (cq0_w2, ol_flags0, &f0); + ol_flags1 =nix_vlan_update (cq1_w2, ol_flags1, &f1); + ol_flags2 =nix_vlan_update (cq2_w2, ol_flags2, &f2); + ol_flags3 =nix_vlan_update (cq3_w2, ol_flags3, &f3); + + ol_flags0 =nix_qinq_update (cq0_w2, ol_flags0, mbuf0); + ol_flags1 =nix_qinq_update (cq1_w2, ol_flags1, mbuf1); + ol_flags2 =nix_qinq_update (cq2_w2, ol_flags2, mbuf2); + ol_flags3 =nix_qinq_update (cq3_w2, ol_flags3, mbuf3); + } + +if (flags &NIX_RX_OFFLOAD_MARK_UPDATE_F ) { + ol_flags0 =nix_update_match_id (*(uint16_t *) + (cq0 +CQE_SZ (0 ) +38 ), ol_flags0, mbuf0); + ol_flags1 =nix_update_match_id (*(uint16_t *) + (cq0 +CQE_SZ (1 ) +38 ), ol_flags1, mbuf1); + ol_flags2 =nix_update_match_id (*(uint16_t *) + (cq0 +CQE_SZ (2 ) +38 ), ol_flags2, mbuf2); + ol_flags3 =nix_update_match_id (*(uint16_t *) + (cq0 +CQE_SZ (3 ) +38 ), ol_flags3, mbuf3); + } + +/* Form rearm_data with ol_flags */ + rearm0 =vsetq_lane_u64 (ol_flags0, rearm0,1 ); + rearm1 =vsetq_lane_u64 (ol_flags1, rearm1,1 ); + rearm2 =vsetq_lane_u64 (ol_flags2, rearm2,1 ); + rearm3 =vsetq_lane_u64 (ol_flags3, rearm3,1 ); + +/* Update rx_descriptor_fields1 */ +vst1q_u64 ((uint64_t *)mbuf0->rx_descriptor_fields1, f0); +vst1q_u64 ((uint64_t *)mbuf1->rx_descriptor_fields1, f1); +vst1q_u64 ((uint64_t *)mbuf2->rx_descriptor_fields1, f2); +vst1q_u64 ((uint64_t *)mbuf3->rx_descriptor_fields1, f3); + +/* Update rearm_data */ +vst1q_u64 ((uint64_t *)mbuf0->rearm_data, rearm0); +vst1q_u64 ((uint64_t *)mbuf1->rearm_data, rearm1); +vst1q_u64 ((uint64_t *)mbuf2->rearm_data, rearm2); +vst1q_u64 ((uint64_t *)mbuf3->rearm_data, rearm3); + +/* Store the mbufs to rx_pkts */ +vst1q_u64 ((uint64_t *)&rx_pkts[packets], mbuf01); +vst1q_u64 ((uint64_t *)&rx_pkts[packets +2 ], mbuf23); + +/* Prefetch mbufs */ +otx2_prefetch_store_keep (mbuf0); +otx2_prefetch_store_keep (mbuf1); +otx2_prefetch_store_keep (mbuf2); +otx2_prefetch_store_keep (mbuf3); + +/* Mark mempool obj as "get" as it is alloc'ed by NIX */ +__mempool_check_cookies (mbuf0->pool, (void **)&mbuf0,1 ,1 ); +__mempool_check_cookies (mbuf1->pool, (void **)&mbuf1,1 ,1 ); +__mempool_check_cookies (mbuf2->pool, (void **)&mbuf2,1 ,1 ); +__mempool_check_cookies (mbuf3->pool, (void **)&mbuf3,1 ,1 ); + +/* Advance head pointer and packets */ + head +=NIX_DESCS_PER_LOOP ; head &= qmask; + packets +=NIX_DESCS_PER_LOOP ; + } + + rxq->head = head; + rxq->available -= packets; + +rte_cio_wmb (); +/* Free all the CQs that we've processed */ +otx2_write64 ((rxq->wdata | packets), rxq->cq_door); + +return packets; +} + +#else + +static inline uint16_t +nix_recv_pkts_vector (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t pkts,const uint16_t flags) +{ +RTE_SET_USED (rx_queue); +RTE_SET_USED (rx_pkts); +RTE_SET_USED (pkts); +RTE_SET_USED (flags); + +return 0 ; +} + +#endif #define R (name, f5, f4, f3, f2, f1, f0, flags) \ static uint16_t __rte_noinline __hot \
@@ -99,6 +332,16 @@ otx2_nix_recv_pkts_mseg_ ## name(void *rx_queue, \return nix_recv_pkts (rx_queue, rx_pkts, pkts, \ (flags) |NIX_RX_MULTI_SEG_F ); \ } \ + \ +static uint16_t __rte_noinline __hot \ +otx2_nix_recv_pkts_vec_ ## name(void *rx_queue, \ + struct rte_mbuf **rx_pkts, uint16_t pkts) \ +{ \ +/* TSTMP is not supported by vector */ \ +if ((flags) &NIX_RX_OFFLOAD_TSTAMP_F ) \ +return 0 ; \ +return nix_recv_pkts_vector (rx_queue, rx_pkts, pkts, (flags)); \ +} \NIX_RX_FASTPATH_MODES #undef R
@@ -140,7 +383,21 @@ NIX_RX_FASTPATH_MODES#undef R }; -pick_rx_func (eth_dev, nix_eth_rx_burst); +const eth_rx_burst_t nix_eth_rx_vec_burst[2 ][2 ][2 ][2 ][2 ][2 ] = { +#define R(name, f5, f4, f3, f2, f1, f0, flags) \ + [f5][f4][f3][f2][f1][f0] = otx2_nix_recv_pkts_vec_ ## name, + +NIX_RX_FASTPATH_MODES +#undef R + }; + +/* For PTP enabled, scalar rx function should be chosen as most of the +* PTP apps are implemented to rx burst 1 pkt. +*/ +if (dev->scalar_ena || dev->rx_offloads &DEV_RX_OFFLOAD_TIMESTAMP ) +pick_rx_func (eth_dev, nix_eth_rx_burst); +else +pick_rx_func (eth_dev, nix_eth_rx_vec_burst);if (dev->rx_offloads &DEV_RX_OFFLOAD_SCATTER )pick_rx_func (eth_dev, nix_eth_rx_burst_mseg);
Signature · 1 line
2.21.0
PATCH 52/58 net/octeontx2: add Tx burst support
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Tx burst support.
--- doc/guides/nics/features/octeontx2.ini | 5 + doc/guides/nics/features/octeontx2_vec.ini | 5 + doc/guides/nics/features/octeontx2_vf.ini | 5 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 6 - drivers/net/octeontx2/otx2_ethdev.h | 1 + drivers/net/octeontx2/otx2_tx.c | 94 ++++++++ drivers/net/octeontx2/otx2_tx.h | 261 +++++++++++++++++++++ 9 files changed, 373 insertions(+), 6 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_tx.c
doc/guides/nics/features/octeontx2.ini +5 -0
@@ -12,6 +12,7 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y Promiscuous mode = Y
@@ -28,6 +29,10 @@ Jumbo frame = Y Scattered Rx = Y VLAN offload = Y QinQ offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Packet type parsing = Y Timesync = Y Timestamp offload = Y
doc/guides/nics/features/octeontx2_vec.ini +5 -0
@@ -12,6 +12,7 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y Promiscuous mode = Y
@@ -27,6 +28,10 @@ Flow API = Y Jumbo frame = Y VLAN offload = Y QinQ offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
doc/guides/nics/features/octeontx2_vf.ini +5 -0
@@ -11,6 +11,7 @@ Lock-free Tx queue = Y Multiprocess aware = Y Link status = Y Link status event = Y +Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y RSS hash = Y
@@ -23,6 +24,10 @@ Jumbo frame = Y Scattered Rx = Y VLAN offload = Y QinQ offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Packet type parsing = Y Rx descriptor status = Y Basic stats = Y
drivers/net/octeontx2/Makefile +1 -0
@@ -31,6 +31,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_rx.c \ + otx2_tx.c \ otx2_tm.c \ otx2_rss.c \ otx2_mac.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -3,6 +3,7 @@ # sources = files('otx2_rx.c', + 'otx2_tx.c', 'otx2_tm.c', 'otx2_rss.c', 'otx2_mac.c',
drivers/net/octeontx2/otx2_ethdev.c +0 -6
@@ -14,12 +14,6 @@#include "otx2_ethdev.h" -static inline void -otx2_eth_set_tx_function (struct rte_eth_dev *eth_dev) -{ -RTE_SET_USED (eth_dev); -} -static inline uint64_t nix_get_rx_offload_capa (struct otx2_eth_dev *dev) {
drivers/net/octeontx2/otx2_ethdev.h +1 -0
@@ -453,6 +453,7 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,/* Rx and Tx routines */ void otx2_eth_set_rx_function (struct rte_eth_dev *eth_dev); +void otx2_eth_set_tx_function (struct rte_eth_dev *eth_dev);void otx2_nix_form_default_desc (struct otx2_eth_txq *txq);/* Timesync - PTP routines */
drivers/net/octeontx2/otx2_tx.c new file +94 -0
94 lines not on this page · raw message
drivers/net/octeontx2/otx2_tx.h +261 -0
265 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 53/58 net/octeontx2: add Tx multi segment version
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add multi segment version of packet Transmit function.
--- drivers/net/octeontx2/otx2_ethdev.h | 4 ++ drivers/net/octeontx2/otx2_tx.c | 58 +++++++++++++++++++++ drivers/net/octeontx2/otx2_tx.h | 81 +++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+)
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -71,6 +71,10 @@#define NIX_TX_NB_SEG_MAX 9#endif +#define NIX_TX_MSEG_SG_DWORDS \ + ((RTE_ALIGN_MUL_CEIL(NIX_TX_NB_SEG_MAX, 3) / 3) \ + + NIX_TX_NB_SEG_MAX) +/* Apply BP when CQ is 75% full */ #define NIX_CQ_BP_LEVEL (25 * 256 / 100)
drivers/net/octeontx2/otx2_tx.c +58 -0
85 lines not on this page · raw message
drivers/net/octeontx2/otx2_tx.h +81 -0
87 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 54/58 net/octeontx2: add Tx vector version
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add vector version of packet transmit function.
--- drivers/net/octeontx2/otx2_tx.c | 883 +++++++++++++++++++++++++++++++- 1 file changed, 882 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_tx.c +882 -1
@@ -80,6 +80,859 @@ nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts,return pkts; } +#if defined(RTE_ARCH_ARM64 ) + +#define NIX_DESCS_PER_LOOP 4 +static __rte_always_inline uint16_t +nix_xmit_pkts_vector (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t pkts,const uint16_t flags) +{ +uint64x2_t dataoff_iova0, dataoff_iova1, dataoff_iova2, dataoff_iova3; +uint64x2_t len_olflags0, len_olflags1, len_olflags2, len_olflags3; +uint64_t *mbuf0, *mbuf1, *mbuf2, *mbuf3; +uint64x2_t senddesc01_w0, senddesc23_w0; +uint64x2_t senddesc01_w1, senddesc23_w1; +uint64x2_t sgdesc01_w0, sgdesc23_w0; +uint64x2_t sgdesc01_w1, sgdesc23_w1; +struct otx2_eth_txq *txq = tx_queue; +uint64_t *lmt_addr = txq->lmt_addr; +rte_iova_t io_addr = txq->io_addr; +uint64x2_t ltypes01, ltypes23; +uint64x2_t xtmp128, ytmp128; +uint64x2_t xmask01, xmask23; +uint64x2_t mbuf01, mbuf23; +uint64x2_t cmd00, cmd01; +uint64x2_t cmd10, cmd11; +uint64x2_t cmd20, cmd21; +uint64x2_t cmd30, cmd31; +uint64_t lmt_status, i; + + pkts =RTE_ALIGN_FLOOR (pkts,NIX_DESCS_PER_LOOP ); + +NIX_XMIT_FC_OR_RETURN (txq, pkts); + +/* Reduce the cached count */ + txq->fc_cache_pkts -= pkts; + +/* Lets commit any changes in the packet */ +rte_cio_wmb (); + + senddesc01_w0 =vld1q_dup_u64 (&txq->cmd[0 ]); + senddesc23_w0 = senddesc01_w0; + senddesc01_w1 =vdupq_n_u64 (0 ); + senddesc23_w1 = senddesc01_w1; + sgdesc01_w0 =vld1q_dup_u64 (&txq->cmd[2 ]); + sgdesc23_w0 = sgdesc01_w0; + +for (i =0 ; i < pkts; i +=NIX_DESCS_PER_LOOP ) { + mbuf01 =vld1q_u64 ((uint64_t *)tx_pkts); + mbuf23 =vld1q_u64 ((uint64_t *)(tx_pkts +2 )); + +/* Clear lower 32bit of SEND_HDR_W0 and SEND_SG_W0 */ + senddesc01_w0 =vbicq_u64 (senddesc01_w0, +vdupq_n_u64 (0xFFFFFFFF )); + sgdesc01_w0 =vbicq_u64 (sgdesc01_w0, +vdupq_n_u64 (0xFFFFFFFF )); + + senddesc23_w0 = senddesc01_w0; + sgdesc23_w0 = sgdesc01_w0; + + tx_pkts = tx_pkts +NIX_DESCS_PER_LOOP ; + +/* Move mbufs to iova */ + mbuf0 = (uint64_t *)vgetq_lane_u64 (mbuf01,0 ); + mbuf1 = (uint64_t *)vgetq_lane_u64 (mbuf01,1 ); + mbuf2 = (uint64_t *)vgetq_lane_u64 (mbuf23,0 ); + mbuf3 = (uint64_t *)vgetq_lane_u64 (mbuf23,1 ); + + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mbuf , buf_iova)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mbuf , buf_iova)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mbuf , buf_iova)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mbuf , buf_iova)); +/* +* Get mbuf's, olflags, iova, pktlen, dataoff +* dataoff_iovaX.D[0] = iova, +* dataoff_iovaX.D[1](15:0) = mbuf->dataoff +* len_olflagsX.D[0] = ol_flags, +* len_olflagsX.D[1](63:32) = mbuf->pkt_len +*/ + dataoff_iova0 =vld1q_u64 (mbuf0); + len_olflags0 =vld1q_u64 (mbuf0 +2 ); + dataoff_iova1 =vld1q_u64 (mbuf1); + len_olflags1 =vld1q_u64 (mbuf1 +2 ); + dataoff_iova2 =vld1q_u64 (mbuf2); + len_olflags2 =vld1q_u64 (mbuf2 +2 ); + dataoff_iova3 =vld1q_u64 (mbuf3); + len_olflags3 =vld1q_u64 (mbuf3 +2 ); + +if (flags &NIX_TX_OFFLOAD_MBUF_NOFF_F ) { +struct rte_mbuf *mbuf; +/* Set don't free bit if reference count > 1 */ + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf0 - + offsetof(struct rte_mbuf , buf_iova)); + +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask01,0 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf1 - + offsetof(struct rte_mbuf , buf_iova)); +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask01,1 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf2 - + offsetof(struct rte_mbuf , buf_iova)); +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask23,0 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf3 - + offsetof(struct rte_mbuf , buf_iova)); +if (rte_pktmbuf_prefree_seg (mbuf) ==NULL ) +vsetq_lane_u64 (0x80000 , xmask23,1 ); +else +__mempool_check_cookies (mbuf->pool, + (void **)&mbuf, +1 ,0 ); + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); + }else { +struct rte_mbuf *mbuf; +/* Mark mempool object as "put" since +* it is freed by NIX +*/ + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf0 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf1 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf2 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); + + mbuf = (struct rte_mbuf *)((uintptr_t )mbuf3 - + offsetof(struct rte_mbuf , buf_iova)); +__mempool_check_cookies (mbuf->pool, (void **)&mbuf, +1 ,0 ); +RTE_SET_USED (mbuf); + } + +/* Move mbufs to point pool */ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mbuf , pool) - + offsetof(struct rte_mbuf , buf_iova)); + +if (flags & + (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F | +NIX_TX_OFFLOAD_L3_L4_CSUM_F )) { +/* Get tx_offload for ol2, ol3, l2, l3 lengths */ +/* +* E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7) +* E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7) +*/ + + asmvolatile ("LD1 {%[a].D}[0],[%[in]]\n\t" : + [a]"+w" (senddesc01_w1) : + [in]"r" (mbuf0 +2 ) :"memory" ); + + asmvolatile ("LD1 {%[a].D}[1],[%[in]]\n\t" : + [a]"+w" (senddesc01_w1) : + [in]"r" (mbuf1 +2 ) :"memory" ); + + asmvolatile ("LD1 {%[b].D}[0],[%[in]]\n\t" : + [b]"+w" (senddesc23_w1) : + [in]"r" (mbuf2 +2 ) :"memory" ); + + asmvolatile ("LD1 {%[b].D}[1],[%[in]]\n\t" : + [b]"+w" (senddesc23_w1) : + [in]"r" (mbuf3 +2 ) :"memory" ); + +/* Get pool pointer alone */ + mbuf0 = (uint64_t *)*mbuf0; + mbuf1 = (uint64_t *)*mbuf1; + mbuf2 = (uint64_t *)*mbuf2; + mbuf3 = (uint64_t *)*mbuf3; + }else { +/* Get pool pointer alone */ + mbuf0 = (uint64_t *)*mbuf0; + mbuf1 = (uint64_t *)*mbuf1; + mbuf2 = (uint64_t *)*mbuf2; + mbuf3 = (uint64_t *)*mbuf3; + } + +const uint8x16_t shuf_mask2 = { +0x4 ,0x5 ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , +0xc ,0xd ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , + }; + xtmp128 =vzip2q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip2q_u64 (len_olflags2, len_olflags3); + +/* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */ +const uint64x2_t and_mask0 = { +0xFFFFFFFFFFFFFFFF , +0x000000000000FFFF , + }; + + dataoff_iova0 =vandq_u64 (dataoff_iova0, and_mask0); + dataoff_iova1 =vandq_u64 (dataoff_iova1, and_mask0); + dataoff_iova2 =vandq_u64 (dataoff_iova2, and_mask0); + dataoff_iova3 =vandq_u64 (dataoff_iova3, and_mask0); + +/* +* Pick only 16 bits of pktlen preset at bits 63:32 +* and place them at bits 15:0. +*/ + xtmp128 =vqtbl1q_u8 (xtmp128, shuf_mask2); + ytmp128 =vqtbl1q_u8 (ytmp128, shuf_mask2); + +/* Add pairwise to get dataoff + iova in sgdesc_w1 */ + sgdesc01_w1 =vpaddq_u64 (dataoff_iova0, dataoff_iova1); + sgdesc23_w1 =vpaddq_u64 (dataoff_iova2, dataoff_iova3); + +/* Orr both sgdesc_w0 and senddesc_w0 with 16 bits of +* pktlen at 15:0 position. +*/ + sgdesc01_w0 =vorrq_u64 (sgdesc01_w0, xtmp128); + sgdesc23_w0 =vorrq_u64 (sgdesc23_w0, ytmp128); + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xtmp128); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, ytmp128); + +if ((flags &NIX_TX_OFFLOAD_L3_L4_CSUM_F ) && + !(flags &NIX_TX_OFFLOAD_OL3_OL4_CSUM_F )) { +/* +* Lookup table to translate ol_flags to +* il3/il4 types. But we still use ol3/ol4 types in +* senddesc_w1 as only one header processing is enabled. +*/ +const uint8x16_t tbl = { +/* [0-15] = il4type:il3type */ +0x04 ,/* none (IPv6 assumed) */ +0x14 ,/* PKT_TX_TCP_CKSUM (IPv6 assumed) */ +0x24 ,/* PKT_TX_SCTP_CKSUM (IPv6 assumed) */ +0x34 ,/* PKT_TX_UDP_CKSUM (IPv6 assumed) */ +0x03 ,/* PKT_TX_IP_CKSUM */ +0x13 ,/* PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM */ +0x23 ,/* PKT_TX_IP_CKSUM | PKT_TX_SCTP_CKSUM */ +0x33 ,/* PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM */ +0x02 ,/* PKT_TX_IPV4 */ +0x12 ,/* PKT_TX_IPV4 | PKT_TX_TCP_CKSUM */ +0x22 ,/* PKT_TX_IPV4 | PKT_TX_SCTP_CKSUM */ +0x32 ,/* PKT_TX_IPV4 | PKT_TX_UDP_CKSUM */ +0x03 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM */ +0x13 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_TCP_CKSUM +*/ +0x23 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_SCTP_CKSUM +*/ +0x33 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_UDP_CKSUM +*/ + }; + +/* Extract olflags to translate to iltypes */ + xtmp128 =vzip1q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip1q_u64 (len_olflags2, len_olflags3); + +/* +* E(47):L3_LEN(9):L2_LEN(7+z) +* E(47):L3_LEN(9):L2_LEN(7+z) +*/ + senddesc01_w1 =vshlq_n_u64 (senddesc01_w1,1 ); + senddesc23_w1 =vshlq_n_u64 (senddesc23_w1,1 ); + +/* Move OLFLAGS bits 55:52 to 51:48 +* with zeros preprended on the byte and rest +* don't care +*/ + xtmp128 =vshrq_n_u8 (xtmp128,4 ); + ytmp128 =vshrq_n_u8 (ytmp128,4 ); +/* +* E(48):L3_LEN(8):L2_LEN(z+7) +* E(48):L3_LEN(8):L2_LEN(z+7) +*/ +const int8x16_t tshft3 = { +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , + }; + + senddesc01_w1 =vshlq_u8 (senddesc01_w1, tshft3); + senddesc23_w1 =vshlq_u8 (senddesc23_w1, tshft3); + +/* Do the lookup */ + ltypes01 =vqtbl1q_u8 (tbl, xtmp128); + ltypes23 =vqtbl1q_u8 (tbl, ytmp128); + +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + +/* Pick only relevant fields i.e Bit 48:55 of iltype +* and place it in ol3/ol4type of senddesc_w1 +*/ +const uint8x16_t shuf_mask0 = { +0xFF ,0xFF ,0xFF ,0xFF ,0x6 ,0xFF ,0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF ,0xE ,0xFF ,0xFF ,0xFF , + }; + + ltypes01 =vqtbl1q_u8 (ltypes01, shuf_mask0); + ltypes23 =vqtbl1q_u8 (ltypes23, shuf_mask0); + +/* Prepare ol4ptr, ol3ptr from ol3len, ol2len. +* a [E(32):E(16):OL3(8):OL2(8)] +* a = a + (a << 8) +* a [E(32):E(16):(OL3+OL2):OL2] +* => E(32):E(16)::OL4PTR(8):OL3PTR(8) +*/ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u16 (senddesc01_w1,8 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u16 (senddesc23_w1,8 )); + +/* Create first half of 4W cmd for 4 mbufs (sgdesc) */ + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); +/* Move ltypes to senddesc*_w1 */ + senddesc01_w1 =vorrq_u64 (senddesc01_w1, ltypes01); + senddesc23_w1 =vorrq_u64 (senddesc23_w1, ltypes23); + +/* Create first half of 4W cmd for 4 mbufs (sendhdr) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + + }else if (!(flags &NIX_TX_OFFLOAD_L3_L4_CSUM_F ) && + (flags &NIX_TX_OFFLOAD_OL3_OL4_CSUM_F )) { +/* +* Lookup table to translate ol_flags to +* ol3/ol4 types. +*/ + +const uint8x16_t tbl = { +/* [0-15] = ol4type:ol3type */ +0x00 ,/* none */ +0x03 ,/* OUTER_IP_CKSUM */ +0x02 ,/* OUTER_IPV4 */ +0x03 ,/* OUTER_IPV4 | OUTER_IP_CKSUM */ +0x04 ,/* OUTER_IPV6 */ +0x00 ,/* OUTER_IPV6 | OUTER_IP_CKSUM */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM */ +0x33 ,/* OUTER_UDP_CKSUM | OUTER_IP_CKSUM */ +0x32 ,/* OUTER_UDP_CKSUM | OUTER_IPV4 */ +0x33 ,/* OUTER_UDP_CKSUM | OUTER_IPV4 | +* OUTER_IP_CKSUM +*/ +0x34 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 */ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 | OUTER_IP_CKSUM +*/ + }; + +/* Extract olflags to translate to iltypes */ + xtmp128 =vzip1q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip1q_u64 (len_olflags2, len_olflags3); + +/* +* E(47):OL3_LEN(9):OL2_LEN(7+z) +* E(47):OL3_LEN(9):OL2_LEN(7+z) +*/ +const uint8x16_t shuf_mask5 = { +0x6 ,0x5 ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , +0xE ,0xD ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF , + }; + senddesc01_w1 =vqtbl1q_u8 (senddesc01_w1, shuf_mask5); + senddesc23_w1 =vqtbl1q_u8 (senddesc23_w1, shuf_mask5); + +/* Extract outer ol flags only */ +const uint64x2_t o_cksum_mask = { +0x1C00020000000000 , +0x1C00020000000000 , + }; + + xtmp128 =vandq_u64 (xtmp128, o_cksum_mask); + ytmp128 =vandq_u64 (ytmp128, o_cksum_mask); + +/* Extract OUTER_UDP_CKSUM bit 41 and +* move it to bit 61 +*/ + + xtmp128 = xtmp128 |vshlq_n_u64 (xtmp128,20 ); + ytmp128 = ytmp128 |vshlq_n_u64 (ytmp128,20 ); + +/* Shift oltype by 2 to start nibble from BIT(56) +* instead of BIT(58) +*/ + xtmp128 =vshrq_n_u8 (xtmp128,2 ); + ytmp128 =vshrq_n_u8 (ytmp128,2 ); +/* +* E(48):L3_LEN(8):L2_LEN(z+7) +* E(48):L3_LEN(8):L2_LEN(z+7) +*/ +const int8x16_t tshft3 = { +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , +-1 ,0 ,8 ,8 ,8 ,8 ,8 ,8 , + }; + + senddesc01_w1 =vshlq_u8 (senddesc01_w1, tshft3); + senddesc23_w1 =vshlq_u8 (senddesc23_w1, tshft3); + +/* Do the lookup */ + ltypes01 =vqtbl1q_u8 (tbl, xtmp128); + ltypes23 =vqtbl1q_u8 (tbl, ytmp128); + +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + +/* Pick only relevant fields i.e Bit 56:63 of oltype +* and place it in ol3/ol4type of senddesc_w1 +*/ +const uint8x16_t shuf_mask0 = { +0xFF ,0xFF ,0xFF ,0xFF ,0x7 ,0xFF ,0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF ,0xF ,0xFF ,0xFF ,0xFF , + }; + + ltypes01 =vqtbl1q_u8 (ltypes01, shuf_mask0); + ltypes23 =vqtbl1q_u8 (ltypes23, shuf_mask0); + +/* Prepare ol4ptr, ol3ptr from ol3len, ol2len. +* a [E(32):E(16):OL3(8):OL2(8)] +* a = a + (a << 8) +* a [E(32):E(16):(OL3+OL2):OL2] +* => E(32):E(16)::OL4PTR(8):OL3PTR(8) +*/ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u16 (senddesc01_w1,8 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u16 (senddesc23_w1,8 )); + +/* Create second half of 4W cmd for 4 mbufs (sgdesc) */ + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); +/* Move ltypes to senddesc*_w1 */ + senddesc01_w1 =vorrq_u64 (senddesc01_w1, ltypes01); + senddesc23_w1 =vorrq_u64 (senddesc23_w1, ltypes23); + +/* Create first half of 4W cmd for 4 mbufs (sendhdr) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + + }else if ((flags &NIX_TX_OFFLOAD_L3_L4_CSUM_F ) && + (flags &NIX_TX_OFFLOAD_OL3_OL4_CSUM_F )) { +/* Lookup table to translate ol_flags to +* ol4type, ol3type, il4type, il3type of senddesc_w1 +*/ +const uint8x16x2_t tbl = { + { + { +/* [0-15] = il4type:il3type */ +0x04 ,/* none (IPv6) */ +0x14 ,/* PKT_TX_TCP_CKSUM (IPv6) */ +0x24 ,/* PKT_TX_SCTP_CKSUM (IPv6) */ +0x34 ,/* PKT_TX_UDP_CKSUM (IPv6) */ +0x03 ,/* PKT_TX_IP_CKSUM */ +0x13 ,/* PKT_TX_IP_CKSUM | +* PKT_TX_TCP_CKSUM +*/ +0x23 ,/* PKT_TX_IP_CKSUM | +* PKT_TX_SCTP_CKSUM +*/ +0x33 ,/* PKT_TX_IP_CKSUM | +* PKT_TX_UDP_CKSUM +*/ +0x02 ,/* PKT_TX_IPV4 */ +0x12 ,/* PKT_TX_IPV4 | +* PKT_TX_TCP_CKSUM +*/ +0x22 ,/* PKT_TX_IPV4 | +* PKT_TX_SCTP_CKSUM +*/ +0x32 ,/* PKT_TX_IPV4 | +* PKT_TX_UDP_CKSUM +*/ +0x03 ,/* PKT_TX_IPV4 | +* PKT_TX_IP_CKSUM +*/ +0x13 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_TCP_CKSUM +*/ +0x23 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_SCTP_CKSUM +*/ +0x33 ,/* PKT_TX_IPV4 | PKT_TX_IP_CKSUM | +* PKT_TX_UDP_CKSUM +*/ + }, + + { +/* [16-31] = ol4type:ol3type */ +0x00 ,/* none */ +0x03 ,/* OUTER_IP_CKSUM */ +0x02 ,/* OUTER_IPV4 */ +0x03 ,/* OUTER_IPV4 | OUTER_IP_CKSUM */ +0x04 ,/* OUTER_IPV6 */ +0x00 ,/* OUTER_IPV6 | OUTER_IP_CKSUM */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 */ +0x00 ,/* OUTER_IPV6 | OUTER_IPV4 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM */ +0x33 ,/* OUTER_UDP_CKSUM | +* OUTER_IP_CKSUM +*/ +0x32 ,/* OUTER_UDP_CKSUM | +* OUTER_IPV4 +*/ +0x33 ,/* OUTER_UDP_CKSUM | +* OUTER_IPV4 | OUTER_IP_CKSUM +*/ +0x34 ,/* OUTER_UDP_CKSUM | +* OUTER_IPV6 +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IP_CKSUM +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 +*/ +0x00 ,/* OUTER_UDP_CKSUM | OUTER_IPV6 | +* OUTER_IPV4 | OUTER_IP_CKSUM +*/ + }, + } + }; + +/* Extract olflags to translate to oltype & iltype */ + xtmp128 =vzip1q_u64 (len_olflags0, len_olflags1); + ytmp128 =vzip1q_u64 (len_olflags2, len_olflags3); + +/* +* E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z) +* E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z) +*/ +const uint32x4_t tshft_4 = { +1 ,0 , +1 ,0 , + }; + senddesc01_w1 =vshlq_u32 (senddesc01_w1, tshft_4); + senddesc23_w1 =vshlq_u32 (senddesc23_w1, tshft_4); + +/* +* E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z) +* E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z) +*/ +const uint8x16_t shuf_mask5 = { +0x6 ,0x5 ,0x0 ,0x1 ,0xFF ,0xFF ,0xFF ,0xFF , +0xE ,0xD ,0x8 ,0x9 ,0xFF ,0xFF ,0xFF ,0xFF , + }; + senddesc01_w1 =vqtbl1q_u8 (senddesc01_w1, shuf_mask5); + senddesc23_w1 =vqtbl1q_u8 (senddesc23_w1, shuf_mask5); + +/* Extract outer and inner header ol_flags */ +const uint64x2_t oi_cksum_mask = { +0x1CF0020000000000 , +0x1CF0020000000000 , + }; + + xtmp128 =vandq_u64 (xtmp128, oi_cksum_mask); + ytmp128 =vandq_u64 (ytmp128, oi_cksum_mask); + +/* Extract OUTER_UDP_CKSUM bit 41 and +* move it to bit 61 +*/ + + xtmp128 = xtmp128 |vshlq_n_u64 (xtmp128,20 ); + ytmp128 = ytmp128 |vshlq_n_u64 (ytmp128,20 ); + +/* Shift right oltype by 2 and iltype by 4 +* to start oltype nibble from BIT(58) +* instead of BIT(56) and iltype nibble from BIT(48) +* instead of BIT(52). +*/ +const int8x16_t tshft5 = { +8 ,8 ,8 ,8 ,8 ,8 ,-4 ,-2 , +8 ,8 ,8 ,8 ,8 ,8 ,-4 ,-2 , + }; + + xtmp128 =vshlq_u8 (xtmp128, tshft5); + ytmp128 =vshlq_u8 (ytmp128, tshft5); +/* +* E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8) +* E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8) +*/ +const int8x16_t tshft3 = { +-1 ,0 ,-1 ,0 ,0 ,0 ,0 ,0 , +-1 ,0 ,-1 ,0 ,0 ,0 ,0 ,0 , + }; + + senddesc01_w1 =vshlq_u8 (senddesc01_w1, tshft3); + senddesc23_w1 =vshlq_u8 (senddesc23_w1, tshft3); + +/* Mark Bit(4) of oltype */ +const uint64x2_t oi_cksum_mask2 = { +0x1000000000000000 , +0x1000000000000000 , + }; + + xtmp128 =vorrq_u64 (xtmp128, oi_cksum_mask2); + ytmp128 =vorrq_u64 (ytmp128, oi_cksum_mask2); + +/* Do the lookup */ + ltypes01 =vqtbl2q_u8 (tbl, xtmp128); + ltypes23 =vqtbl2q_u8 (tbl, ytmp128); + +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + +/* Pick only relevant fields i.e Bit 48:55 of iltype and +* Bit 56:63 of oltype and place it in corresponding +* place in senddesc_w1. +*/ +const uint8x16_t shuf_mask0 = { +0xFF ,0xFF ,0xFF ,0xFF ,0x7 ,0x6 ,0xFF ,0xFF , +0xFF ,0xFF ,0xFF ,0xFF ,0xF ,0xE ,0xFF ,0xFF , + }; + + ltypes01 =vqtbl1q_u8 (ltypes01, shuf_mask0); + ltypes23 =vqtbl1q_u8 (ltypes23, shuf_mask0); + +/* Prepare l4ptr, l3ptr, ol4ptr, ol3ptr from +* l3len, l2len, ol3len, ol2len. +* a [E(32):L3(8):L2(8):OL3(8):OL2(8)] +* a = a + (a << 8) +* a [E:(L3+L2):(L2+OL3):(OL3+OL2):OL2] +* a = a + (a << 16) +* a [E:(L3+L2+OL3+OL2):(L2+OL3+OL2):(OL3+OL2):OL2] +* => E(32):IL4PTR(8):IL3PTR(8):OL4PTR(8):OL3PTR(8) +*/ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u32 (senddesc01_w1,8 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u32 (senddesc23_w1,8 )); + +/* Create second half of 4W cmd for 4 mbufs (sgdesc) */ + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + +/* Continue preparing l4ptr, l3ptr, ol4ptr, ol3ptr */ + senddesc01_w1 =vaddq_u8 (senddesc01_w1, +vshlq_n_u32 (senddesc01_w1,16 )); + senddesc23_w1 =vaddq_u8 (senddesc23_w1, +vshlq_n_u32 (senddesc23_w1,16 )); + + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); +/* Move ltypes to senddesc*_w1 */ + senddesc01_w1 =vorrq_u64 (senddesc01_w1, ltypes01); + senddesc23_w1 =vorrq_u64 (senddesc23_w1, ltypes23); + +/* Create first half of 4W cmd for 4 mbufs (sendhdr) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + }else { +/* Just use ld1q to retrieve aura +* when we don't need tx_offload +*/ + mbuf0 = (uint64_t *)((uintptr_t )mbuf0 + + offsetof(struct rte_mempool , pool_id)); + mbuf1 = (uint64_t *)((uintptr_t )mbuf1 + + offsetof(struct rte_mempool , pool_id)); + mbuf2 = (uint64_t *)((uintptr_t )mbuf2 + + offsetof(struct rte_mempool , pool_id)); + mbuf3 = (uint64_t *)((uintptr_t )mbuf3 + + offsetof(struct rte_mempool , pool_id)); + xmask01 =vdupq_n_u64 (0 ); + xmask23 = xmask01; + asmvolatile ("LD1 {%[a].H}[0],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf0) :"memory" ); + + asmvolatile ("LD1 {%[a].H}[4],[%[in]]\n\t" : + [a]"+w" (xmask01) : [in]"r" (mbuf1) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[0],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf2) :"memory" ); + + asmvolatile ("LD1 {%[b].H}[4],[%[in]]\n\t" : + [b]"+w" (xmask23) : [in]"r" (mbuf3) :"memory" ); + xmask01 =vshlq_n_u64 (xmask01,20 ); + xmask23 =vshlq_n_u64 (xmask23,20 ); + + senddesc01_w0 =vorrq_u64 (senddesc01_w0, xmask01); + senddesc23_w0 =vorrq_u64 (senddesc23_w0, xmask23); + +/* Create 4W cmd for 4 mbufs (sendhdr, sgdesc) */ + cmd00 =vzip1q_u64 (senddesc01_w0, senddesc01_w1); + cmd01 =vzip1q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd10 =vzip2q_u64 (senddesc01_w0, senddesc01_w1); + cmd11 =vzip2q_u64 (sgdesc01_w0, sgdesc01_w1); + cmd20 =vzip1q_u64 (senddesc23_w0, senddesc23_w1); + cmd21 =vzip1q_u64 (sgdesc23_w0, sgdesc23_w1); + cmd30 =vzip2q_u64 (senddesc23_w0, senddesc23_w1); + cmd31 =vzip2q_u64 (sgdesc23_w0, sgdesc23_w1); + } + +do { +vst1q_u64 (lmt_addr, cmd00); +vst1q_u64 (lmt_addr +2 , cmd01); +vst1q_u64 (lmt_addr +4 , cmd10); +vst1q_u64 (lmt_addr +6 , cmd11); +vst1q_u64 (lmt_addr +8 , cmd20); +vst1q_u64 (lmt_addr +10 , cmd21); +vst1q_u64 (lmt_addr +12 , cmd30); +vst1q_u64 (lmt_addr +14 , cmd31); + lmt_status =otx2_lmt_submit (io_addr); + + }while (lmt_status ==0 ); + } + +return pkts; +} + +#else +static __rte_always_inline uint16_t +nix_xmit_pkts_vector (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t pkts,const uint16_t flags) +{ +RTE_SET_USED (tx_queue); +RTE_SET_USED (tx_pkts); +RTE_SET_USED (pkts); +RTE_SET_USED (flags); +return 0 ; +} +#endif +#define T (name, f4, f3, f2, f1, f0, sz, flags) \ static uint16_t __rte_noinline __hot \ otx2_nix_xmit_pkts_ ## name(void *tx_queue, \
@@ -107,6 +960,21 @@ otx2_nix_xmit_pkts_mseg_ ## name(void *tx_queue, \ NIX_TX_FASTPATH_MODES#undef T +#define T (name, f4, f3, f2, f1, f0, sz, flags) \ +static uint16_t __rte_noinline __hot \ +otx2_nix_xmit_pkts_vec_ ## name(void *tx_queue, \ + struct rte_mbuf **tx_pkts, uint16_t pkts) \ +{ \ +/* VLAN and TSTMP is not supported by vec */ \ +if ((flags) &NIX_TX_OFFLOAD_VLAN_QINQ_F || \ + (flags) &NIX_TX_OFFLOAD_TSTAMP_F ) \ +return 0 ; \ +return nix_xmit_pkts_vector (tx_queue, tx_pkts, pkts, (flags)); \ +} + +NIX_TX_FASTPATH_MODES +#undef T +static inline void pick_tx_func (struct rte_eth_dev *eth_dev,const eth_tx_burst_t tx_burst[2 ][2 ][2 ][2 ][2 ])
@@ -143,7 +1011,20 @@ NIX_TX_FASTPATH_MODES#undef T }; -pick_tx_func (eth_dev, nix_eth_tx_burst); +const eth_tx_burst_t nix_eth_tx_vec_burst[2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f4, f3, f2, f1, f0, sz, flags) \ + [f4][f3][f2][f1][f0] = otx2_nix_xmit_pkts_vec_ ## name, + +NIX_TX_FASTPATH_MODES +#undef T + }; + +if (dev->scalar_ena || + (dev->tx_offload_flags & + (NIX_TX_OFFLOAD_VLAN_QINQ_F |NIX_TX_OFFLOAD_TSTAMP_F ))) +pick_tx_func (eth_dev, nix_eth_tx_burst); +else +pick_tx_func (eth_dev, nix_eth_tx_vec_burst);if (dev->tx_offloads &DEV_TX_OFFLOAD_MULTI_SEGS )pick_tx_func (eth_dev, nix_eth_tx_burst_mseg);
Signature · 1 line
2.21.0
PATCH 55/58 net/octeontx2: add device start operation
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add device start operation and update the correct function pointers for Rx and Tx burst functions.
--- drivers/net/octeontx2/otx2_ethdev.c | 180 ++++++++++++++++++++++++ drivers/net/octeontx2/otx2_flow.c | 4 +- drivers/net/octeontx2/otx2_flow_parse.c | 7 +- drivers/net/octeontx2/otx2_ptp.c | 8 ++ drivers/net/octeontx2/otx2_vlan.c | 1 + 5 files changed, 197 insertions(+), 3 deletions(-)
drivers/net/octeontx2/otx2_ethdev.c +180 -0
@@ -135,6 +135,55 @@ otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +static int +npc_rx_enable (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +otx2_mbox_alloc_msg_nix_lf_start_rx (mbox); + +return otx2_mbox_process (mbox); +} + +static int +npc_rx_disable (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +otx2_mbox_alloc_msg_nix_lf_stop_rx (mbox); + +return otx2_mbox_process (mbox); +} + +static int +nix_cgx_start_link_event (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +if (otx2_dev_is_vf (dev)) +return 0 ; + +otx2_mbox_alloc_msg_cgx_start_linkevents (mbox); + +return otx2_mbox_process (mbox); +} + +static int +cgx_intlbk_enable (struct otx2_eth_dev *dev,bool en) +{ +struct otx2_mbox *mbox = dev->mbox; + +if (otx2_dev_is_vf (dev)) +return 0 ; + +if (en) +otx2_mbox_alloc_msg_cgx_intlbk_enable (mbox); +else +otx2_mbox_alloc_msg_cgx_intlbk_disable (mbox); + +return otx2_mbox_process (mbox); +} +static inline void nix_rx_queue_reset (struct otx2_eth_rxq *rxq) {
@@ -478,6 +527,74 @@ nix_sq_max_sqe_sz(struct otx2_eth_txq *txq)return NIX_MAXSQESZ_W8 ; } +static uint16_t +nix_rx_offload_flags (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct rte_eth_dev_data *data = eth_dev->data; +struct rte_eth_conf *conf = &data->dev_conf; +struct rte_eth_rxmode *rxmode = &conf->rxmode; +uint16_t flags =0 ; + +if (rxmode->mq_mode ==ETH_MQ_RX_RSS ) + flags |=NIX_RX_OFFLOAD_RSS_F ; + +if (dev->rx_offloads & (DEV_RX_OFFLOAD_TCP_CKSUM | +DEV_RX_OFFLOAD_UDP_CKSUM )) + flags |=NIX_RX_OFFLOAD_CHECKSUM_F ; + +if (dev->rx_offloads & (DEV_RX_OFFLOAD_IPV4_CKSUM | +DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM )) + flags |=NIX_RX_OFFLOAD_CHECKSUM_F ; + +if (dev->rx_offloads &DEV_RX_OFFLOAD_SCATTER ) + flags |=NIX_RX_MULTI_SEG_F ; + +if (dev->rx_offloads & (DEV_RX_OFFLOAD_VLAN_STRIP | +DEV_RX_OFFLOAD_QINQ_STRIP )) + flags |=NIX_RX_OFFLOAD_VLAN_STRIP_F ; + +if ((dev->rx_offloads &DEV_RX_OFFLOAD_TIMESTAMP )) + flags |=NIX_RX_OFFLOAD_TSTAMP_F ; + +return flags; +} + +static uint16_t +nix_tx_offload_flags (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +uint64_t conf = dev->tx_offloads; +uint16_t flags =0 ; + +/* Fastpath is dependent on these enums */ +RTE_BUILD_BUG_ON (PKT_TX_TCP_CKSUM != (1ULL <<52 )); +RTE_BUILD_BUG_ON (PKT_TX_SCTP_CKSUM != (2ULL <<52 )); +RTE_BUILD_BUG_ON (PKT_TX_UDP_CKSUM != (3ULL <<52 )); + +if (conf &DEV_TX_OFFLOAD_VLAN_INSERT || + conf &DEV_TX_OFFLOAD_QINQ_INSERT ) + flags |=NIX_TX_OFFLOAD_VLAN_QINQ_F ; + +if (conf &DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM || + conf &DEV_TX_OFFLOAD_OUTER_UDP_CKSUM ) + flags |=NIX_TX_OFFLOAD_OL3_OL4_CSUM_F ; + +if (conf &DEV_TX_OFFLOAD_IPV4_CKSUM || + conf &DEV_TX_OFFLOAD_TCP_CKSUM || + conf &DEV_TX_OFFLOAD_UDP_CKSUM || + conf &DEV_TX_OFFLOAD_SCTP_CKSUM ) + flags |=NIX_TX_OFFLOAD_L3_L4_CSUM_F ; + +if (!(conf &DEV_TX_OFFLOAD_MBUF_FAST_FREE )) + flags |=NIX_TX_OFFLOAD_MBUF_NOFF_F ; + +if (conf &DEV_TX_OFFLOAD_MULTI_SEGS ) + flags |=NIX_TX_MULTI_SEG_F ; + +return flags; +} +static int nix_sq_init (struct otx2_eth_txq *txq) {
@@ -1089,6 +1206,8 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) dev->rx_offloads = rxmode->offloads; dev->tx_offloads = txmode->offloads; + dev->rx_offload_flags |=nix_rx_offload_flags (eth_dev); + dev->tx_offload_flags |=nix_tx_offload_flags (eth_dev); dev->rss_info.rss_grps =NIX_RSS_GRPS ; nb_rxq =RTE_MAX (data->nb_rx_queues,1 );
@@ -1128,6 +1247,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto free_nix_lf; } +/* Configure loop back mode */ + rc =cgx_intlbk_enable (dev, eth_dev->data->dev_conf.lpbk_mode); +if (rc) { +otx2_err ("Failed to configure cgx loop back mode rc=%d" , rc); + goto free_nix_lf; + } + rc =otx2_nix_rxchan_bpid_cfg (eth_dev, true);if (rc) {otx2_err ("Failed to configure nix rx chan bpid cfg rc=%d" , rc);
@@ -1277,6 +1403,59 @@ otx2_nix_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)return rc; } +static int +otx2_nix_dev_start (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +int rc, i; + +/* Start rx queues */ +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { + rc =otx2_nix_rx_queue_start (eth_dev, i); +if (rc) +return rc; + } + +/* Start tx queues */ +for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) { + rc =otx2_nix_tx_queue_start (eth_dev, i); +if (rc) +return rc; + } + + rc =otx2_nix_update_flow_ctrl_mode (eth_dev); +if (rc) { +otx2_err ("Failed to update flow ctrl mode %d" , rc); +return rc; + } + + rc =npc_rx_enable (dev); +if (rc) { +otx2_err ("Failed to enable NPC rx %d" , rc); +return rc; + } + +otx2_nix_toggle_flag_link_cfg (dev, true); + + rc =nix_cgx_start_link_event (dev); +if (rc) { +otx2_err ("Failed to start cgx link event %d" , rc); + goto rx_disable; + } + +otx2_nix_toggle_flag_link_cfg (dev, false); +otx2_eth_set_tx_function (eth_dev); +otx2_eth_set_rx_function (eth_dev); + +return 0 ; + +rx_disable: +npc_rx_disable (dev); +otx2_nix_toggle_flag_link_cfg (dev, false); +return rc; +} + +/* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get,
@@ -1286,6 +1465,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .tx_queue_release = otx2_nix_tx_queue_release, .rx_queue_setup = otx2_nix_rx_queue_setup, .rx_queue_release = otx2_nix_rx_queue_release, + .dev_start = otx2_nix_dev_start, .tx_queue_start = otx2_nix_tx_queue_start, .tx_queue_stop = otx2_nix_tx_queue_stop, .rx_queue_start = otx2_nix_rx_queue_start,
drivers/net/octeontx2/otx2_flow.c +3 -1
@@ -498,8 +498,10 @@ otx2_flow_destroy(struct rte_eth_dev *dev,return -EINVAL ;/* Clear mark offload flag if there are no more mark actions */ -if (rte_atomic32_sub_return (&npc->mark_actions,1 ) ==0 ) +if (rte_atomic32_sub_return (&npc->mark_actions,1 ) ==0 ) { hw->rx_offload_flags &= ~NIX_RX_OFFLOAD_MARK_UPDATE_F ; +otx2_eth_set_rx_function (dev); + } } rc =flow_free_rss_action (dev, flow);
drivers/net/octeontx2/otx2_flow_parse.c +5 -2
@@ -922,8 +922,11 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev,if (mark) flow->npc_action |= (uint64_t )mark <<40 ; -if (rte_atomic32_read (&npc->mark_actions) ==1 ) - hw->rx_offload_flags |=NIX_RX_OFFLOAD_MARK_UPDATE_F ; +if (rte_atomic32_read (&npc->mark_actions) ==1 ) { + hw->rx_offload_flags |= +NIX_RX_OFFLOAD_MARK_UPDATE_F ; +otx2_eth_set_rx_function (dev); + }/* Ideally AF must ensure that correct pf_func is set */
drivers/net/octeontx2/otx2_ptp.c +8 -0
@@ -118,6 +118,10 @@ otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev)struct otx2_eth_txq *txq = eth_dev->data->tx_queues[i];otx2_nix_form_default_desc (txq); } + +/* Setting up the function pointers as per new offload flags */ +otx2_eth_set_rx_function (eth_dev); +otx2_eth_set_tx_function (eth_dev); }return rc; }
@@ -147,6 +151,10 @@ otx2_nix_timesync_disable(struct rte_eth_dev *eth_dev)struct otx2_eth_txq *txq = eth_dev->data->tx_queues[i];otx2_nix_form_default_desc (txq); } + +/* Setting up the function pointers as per new offload flags */ +otx2_eth_set_rx_function (eth_dev); +otx2_eth_set_tx_function (eth_dev); }return rc; }
drivers/net/octeontx2/otx2_vlan.c +1 -0
@@ -656,6 +656,7 @@ otx2_nix_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) DEV_RX_OFFLOAD_QINQ_STRIP)) { dev->rx_offloads |= offloads; dev->rx_offload_flags |=NIX_RX_OFFLOAD_VLAN_STRIP_F ; +otx2_eth_set_rx_function (eth_dev); } done:
Signature · 1 line
2.21.0
PATCH 56/58 net/octeontx2: add device stop and close operations
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
Add device stop, close and reset operations.
--- drivers/net/octeontx2/otx2_ethdev.c | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +70 -0
@@ -184,6 +184,19 @@ cgx_intlbk_enable(struct otx2_eth_dev *dev, bool en)return otx2_mbox_process (mbox); } +static int +nix_cgx_stop_link_event (struct otx2_eth_dev *dev) +{ +struct otx2_mbox *mbox = dev->mbox; + +if (otx2_dev_is_vf (dev)) +return 0 ; + +otx2_mbox_alloc_msg_cgx_stop_linkevents (mbox); + +return otx2_mbox_process (mbox); +} +static inline void nix_rx_queue_reset (struct otx2_eth_rxq *rxq) {
@@ -1403,6 +1416,37 @@ otx2_nix_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)return rc; } +static void +otx2_nix_dev_stop (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct rte_mbuf *rx_pkts[32 ]; +struct otx2_eth_rxq *rxq; +int count, i, j, rc; + +nix_cgx_stop_link_event (dev); +npc_rx_disable (dev); + +/* Stop rx queues and free up pkts pending */ +for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { + rc =otx2_nix_rx_queue_stop (eth_dev, i); +if (rc) +continue ; + + rxq = eth_dev->data->rx_queues[i]; + count = dev->rx_pkt_burst_no_offload (rxq, rx_pkts,32 ); +while (count) { +for (j =0 ; j < count; j++) +rte_pktmbuf_free (rx_pkts[j]); + count = dev->rx_pkt_burst_no_offload (rxq, rx_pkts,32 ); + } + } + +/* Stop tx queues */ +for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) +otx2_nix_tx_queue_stop (eth_dev, i); +} +static int otx2_nix_dev_start (struct rte_eth_dev *eth_dev) {
@@ -1455,6 +1499,8 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)return rc; } +static int otx2_nix_dev_reset (struct rte_eth_dev *eth_dev); +static void otx2_nix_dev_close (struct rte_eth_dev *eth_dev);/* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops otx2_eth_dev_ops = {
@@ -1466,6 +1512,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .rx_queue_setup = otx2_nix_rx_queue_setup, .rx_queue_release = otx2_nix_rx_queue_release, .dev_start = otx2_nix_dev_start, + .dev_stop = otx2_nix_dev_stop, + .dev_close = otx2_nix_dev_close, .tx_queue_start = otx2_nix_tx_queue_start, .tx_queue_stop = otx2_nix_tx_queue_stop, .rx_queue_start = otx2_nix_rx_queue_start,
@@ -1473,6 +1521,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_set_link_up = otx2_nix_dev_set_link_up, .dev_set_link_down = otx2_nix_dev_set_link_down, .dev_supported_ptypes_get = otx2_nix_supported_ptypes_get, + .dev_reset = otx2_nix_dev_reset, .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg,
@@ -1727,6 +1776,7 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)/* Disable nix bpid config */ otx2_nix_rxchan_bpid_cfg (eth_dev, false); +npc_rx_disable (dev);/* Disable vlan offloads */ otx2_nix_vlan_fini (eth_dev);
@@ -1737,6 +1787,8 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (otx2_ethdev_is_ptp_en (dev))otx2_nix_timesync_disable (eth_dev); +nix_cgx_stop_link_event (dev); +/* Free up SQs */ for (i =0 ; i < eth_dev->data->nb_tx_queues; i++) {otx2_nix_tx_queue_release (eth_dev->data->tx_queues[i]);
@@ -1792,6 +1844,24 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)return 0 ; } +static void +otx2_nix_dev_close (struct rte_eth_dev *eth_dev) +{ +otx2_eth_dev_uninit (eth_dev, true); +} + +static int +otx2_nix_dev_reset (struct rte_eth_dev *eth_dev) +{ +int rc; + + rc =otx2_eth_dev_uninit (eth_dev, false); +if (rc) +return rc; + +return otx2_eth_dev_init (eth_dev); +} +static int nix_remove (struct rte_pci_device *pci_dev) {
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH v1 56/58] net/octeontx2: add device stop and close operations
Quoted 6 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Nithin Dabilpuram <[email protected]>
Add device stop, close and reset operations.
Signed-off-by Nithin Dabilpuram <[email protected]>Signed-off-by Vamsi Attunuru <[email protected]>
<...>
drivers/net/octeontx2/otx2_ethdev.c otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) · line 1851
Quoted 9 lines
drivers/net/octeontx2/otx2_ethdev.c +5
-0@@ -1792,6 +1844,24 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)return 0 ; } +static void +otx2_nix_dev_close (struct rte_eth_dev *eth_dev) +{ +otx2_eth_dev_uninit (eth_dev, true); +}
'close' should free all PMD resources, with 'RTE_ETH_DEV_CLOSE_REMOVE' flag ethdev API can free the ethdev level allocated memory itself.
Re: [dpdk-dev] [PATCH v1 56/58] net/octeontx2: add device stop and close operations
Quoted 14 lines · Ferruh Yigit
Quoted 6 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Nithin Dabilpuram <[email protected]>
Add device stop, close and reset operations.
Signed-off-by Nithin Dabilpuram <[email protected]>Signed-off-by Vamsi Attunuru <[email protected]><...>
Quoted 4 lines
drivers/net/octeontx2/otx2_ethdev.c +0
-0@@ -1792,6 +1844,24 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)return 0 ; }
Quoted 9 lines
drivers/net/octeontx2/otx2_ethdev.c otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) · line 1851
Quoted 5 lines
drivers/net/octeontx2/otx2_ethdev.c +5
-0+static void +otx2_nix_dev_close (struct rte_eth_dev *eth_dev) +{ +otx2_eth_dev_uninit (eth_dev, true); +}'close' should free all PMD resources, with '
RTE_ETH_DEV_CLOSE_REMOVE' flag ethdev API can free the ethdev level allocated memory itself.
Agreed, we are adhering to the spec and handling close with RTE_ETH_DEV_CLOSE_REMOVE flag behavior where close cannot return error and even rte_eth_dev will itself be freed. Do you see any issue ?
Quoted 2 lines
PATCH 57/58 net/octeontx2: add MTU set operation
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add MTU set operation and MTU update feature.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 7 ++ drivers/net/octeontx2/otx2_ethdev.h | 4 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 80 ++++++++++++++++++++++ 5 files changed, 93 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -15,6 +15,7 @@ Link status event = Y Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y +MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -15,6 +15,7 @@ Link status event = Y Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y +MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
drivers/net/octeontx2/otx2_ethdev.c +7 -0
@@ -1453,6 +1453,12 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev);int rc, i; +if (eth_dev->data->nb_rx_queues !=0 ) { + rc =otx2_nix_recalc_mtu (eth_dev); +if (rc) +return rc; + } +/* Start rx queues */ for (i =0 ; i < eth_dev->data->nb_rx_queues; i++) { rc =otx2_nix_rx_queue_start (eth_dev, i);
@@ -1525,6 +1531,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, + .mtu_set = otx2_nix_mtu_set, .mac_addr_add = otx2_nix_mac_addr_add, .mac_addr_remove = otx2_nix_mac_addr_del, .mac_addr_set = otx2_nix_mac_addr_set,
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -351,6 +351,10 @@ int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);int otx2_nix_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx);uint64_t otx2_nix_rxq_mbuf_setup (struct otx2_eth_dev *dev,uint16_t port_id); +/* MTU */ +int otx2_nix_mtu_set (struct rte_eth_dev *eth_dev,uint16_t mtu); +int otx2_nix_recalc_mtu (struct rte_eth_dev *eth_dev); +/* Link */ void otx2_nix_toggle_flag_link_cfg (struct otx2_eth_dev *dev,bool set);int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete);
drivers/net/octeontx2/otx2_ethdev_ops.c +80 -0
86 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 58/58 doc: add Marvell OCTEON TX2 ethdev documentation
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add Marvell OCTEON TX2 ethdev documentation.
This patch also updates the MAINTAINERS file and
shared library versions in release_19_08.rst.
--- MAINTAINERS | 8 + doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + doc/guides/nics/index.rst | 1 + doc/guides/nics/octeontx2.rst | 289 +++++++++++++++++++++ doc/guides/platform/octeontx2.rst | 3 + doc/guides/rel_notes/release_19_05.rst | 1 + 8 files changed, 305 insertions(+) create mode 100644 doc/guides/nics/octeontx2.rst
MAINTAINERS +8 -0
@@ -668,6 +668,14 @@ F: drivers/net/mvneta/ F: doc/guides/nics/mvneta.rst F: doc/guides/nics/features/mvneta.ini +Marvell OCTEON TX2 +M: Jerin Jacob <[email protected]> +M: Nithin Dabilpuram <[email protected]> +M: Kiran Kumar K <[email protected]> +F: drivers/net/octeontx2/ +F: doc/guides/nics/features/octeontx2*.rst +F: doc/guides/nics/octeontx2.rst + Mellanox mlx4 M: Matan Azrad <[email protected]> M: Shahaf Shuler <[email protected]>
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -44,3 +44,4 @@ Extended stats = Y FW version = Y Module EEPROM dump = Y Registers dump = Y +Usage doc = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -41,3 +41,4 @@ Stats per queue = Y FW version = Y Module EEPROM dump = Y Registers dump = Y +Usage doc = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -36,3 +36,4 @@ Stats per queue = Y FW version = Y Module EEPROM dump = Y Registers dump = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -44,6 +44,7 @@ Network Interface Controller Drivers nfb nfp octeontx + octeontx2 qede sfc_efx softnic
doc/guides/nics/octeontx2.rst new file +289 -0
289 lines not on this page · raw message
doc/guides/platform/octeontx2.rst +3 -0
@@ -98,6 +98,9 @@ HW Offload Drivers This section lists dataplane H/W block(s) available in OCTEON TX2 SoC. +#. **Ethdev Driver** + See :doc:`../nics/octeontx2` for NIX Ethdev driver information. + #. **Mempool Driver** See :doc:`../mempool/octeontx2` for NPA mempool driver information.
doc/guides/rel_notes/release_19_05.rst +1 -0
@@ -386,6 +386,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_pmd_i40e.so.2 librte_pmd_ixgbe.so.2 librte_pmd_dpaa2_qdma.so.1 + + librte_pmd_octeontx2.so.1 librte_pmd_ring.so.2 librte_pmd_softnic.so.1 librte_pmd_vhost.so.2
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH v1 58/58] doc: add Marvell OCTEON TX2 ethdev documentation
Quoted 14 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Add Marvell OCTEON TX2 ethdev documentation.
This patch also updates the
MAINTAINERSfile and shared library versions inrelease_19_08.rst.Cc John McNamara <[email protected]>Cc Thomas Monjalon <[email protected]>Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Vamsi Attunuru <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Nithin Dabilpuram <[email protected]>
<...>
Quoted 4 lines
doc/guides/nics/octeontx2.rst new file +4
-0+Debugging Options +----------------- + +.. _table_octeontx2_ethdev_debug_options:
doc/guides/nics/octeontx2.rst line 197
Quoted 10 lines
doc/guides/nics/octeontx2.rst new file +10
-0+ +.. table:: OCTEON TX2 ethdev debug options + + +---+------------+-------------------------------------------------------+ + | # | Component | EAL log command | + +===+============+=======================================================+ + | 1 | NIX | --log-level='pmd\.net.octeontx2,8' | + +---+------------+-------------------------------------------------------+ + | 2 | NPC | --log-level='pmd\.net.octeontx2\.flow,8' | + +---+------------+-------------------------------------------------------+
Are these log types registered?
I can't find them, but I may be missed them since not applied whole set.
<...>
doc/guides/rel_notes/release_19_05.rst
Quoted 4 lines
doc/guides/rel_notes/release_19_05.rst +0
-0
Can you please use 19.08 release notes, instead of 19.05.
Also can you please announce the PMD in "New Features" section of the release notes?
Re: [dpdk-dev] [PATCH v1 58/58] doc: add Marvell OCTEON TX2 ethdev documentation
Quoted 50 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 10:20 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 58/58] doc: add Marvell OCTEON TX2 ethdev documentationQuoted 14 lines · On 6/2/2019 4:24 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
Add Marvell OCTEON TX2 ethdev documentation.
This patch also updates the
MAINTAINERSfile and shared library versions inrelease_19_08.rst.Cc John McNamara <[email protected]>Cc Thomas Monjalon <[email protected]>Signed-off-by Jerin Jacob <[email protected]>Signed-off-by Vamsi Attunuru <[email protected]>Signed-off-by Kiran Kumar K <[email protected]>Signed-off-by Nithin Dabilpuram <[email protected]><...>
doc/guides/nics/octeontx2.rst line 198
Quoted 10 lines
doc/guides/nics/octeontx2.rst new file +10
-0+Debugging Options +----------------- + +.. _table_octeontx2_ethdev_debug_options: + +.. table:: OCTEON TX2 ethdev debug options + + +---+------------+-------------------------------------------------------+ + | # | Component | EAL log command | ++===+============+========================================
===============+doc/guides/nics/octeontx2.rst
Quoted 6 lines
doc/guides/nics/octeontx2.rst new file +6
-0+ | 1 | NIX | --log-level='pmd\.net.octeontx2,8' | + +---+------------+-------------------------------------------------------+ + | 2 | NPC | --log-level='pmd\.net.octeontx2\.flow,8' | + + +---+------------+-------------------------------------------------- + -----+
Quoted 2 lines
Are these log types registered?
I can't find them, but I may be missed them since not applied whole set.
Yes.
Quoted 10 lines
<...>
doc/guides/rel_notes/release_19_05.rst
Quoted 5 lines
doc/guides/rel_notes/release_19_05.rst +0
-0Can you please use 19.08 release notes, instead of 19.05.
My bad. Will fix it in v2.
Quoted 3 lines
Also can you please announce the PMD in "New Features" section of the release notes?
Yes. I will send a separate patch for the same as there are multiple drivers(ethdev, evendev, mempool, rawdriver for dma) getting added for octeontx2. I will combine them to single entry in "New Features"
Quoted 6 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
This patchset adds support for OCTEON TX2 ethdev driver.
This patch set is depended on "OCTEON TX2 common and mempool driver" series.
http://mails.dpdk.org/archives/dev/2019-June/133329.html
Hi Jerin,
I will wait for the dependent patches to be merged to be able to full review the patchset, I will go through it for now.
It can be good to try to get dependent patchsets early so that this also can make in on time.
Quoted 77 lines
This patches series also available at https://github.com/jerinjacobk/dpdk-octeontx2-nix
including the dependency patches for quick download and review.Harman Kalra (2):
net/octeontx2: add PTP base support
net/octeontx2: add remaining PTP operationsJerin Jacob (17):
net/octeontx2: add build infrastructure net/octeontx2: add ethdev probe and remove net/octeontx2: add device init and uninit net/octeontx2: add devargs parsing functions net/octeontx2: handle device error interrupts net/octeontx2: add info get operation net/octeontx2: add device configure operation net/octeontx2: handle queue specific error interrupts net/octeontx2: add context debug utils net/octeontx2: add Rx queue setup and release net/octeontx2: add Tx queue setup and release net/octeontx2: add ptype support net/octeontx2: add Rx and Tx descriptor operations net/octeontx2: add Rx burst support net/octeontx2: add Rx vector version net/octeontx2: add Tx burst support
doc: add Marvell OCTEON TX2 ethdev documentationKiran Kumar K (13):
net/octeontx2: add register dump support net/octeontx2: add basic stats operation net/octeontx2: add extended stats operations net/octeontx2: introducing flow driver net/octeontx2: flow utility functions net/octeontx2: flow mailbox utility net/octeontx2: add flow MCAM utility functions net/octeontx2: add flow parsing for outer layers net/octeontx2: adding flow parsing for inner layers net/octeontx2: add flow actions support net/octeontx2: add flow operations net/octeontx2: add additional flow operations net/octeontx2: add flow init and finiKrzysztof Kanas (2):
net/octeontx2: alloc and free TM HW resources net/octeontx2: enable Tx through traffic managerNithin Dabilpuram (9):
net/octeontx2: add queue start and stop operations net/octeontx2: introduce traffic manager net/octeontx2: configure TM HW resources net/octeontx2: add queue info and pool supported operations net/octeontx2: add Rx multi segment version net/octeontx2: add Tx multi segment version net/octeontx2: add Tx vector version net/octeontx2: add device start operation net/octeontx2: add device stop and close operationsSunil Kumar Kori (1):
net/octeontx2: add unicast MAC filterVamsi Attunuru (9):
net/octeontx2: add link stats operations net/octeontx2: add promiscuous and allmulticast mode net/octeontx2: add RSS support net/octeontx2: handle port reconfigure net/octeontx2: add link status set operations net/octeontx2: add module EEPROM dump net/octeontx2: add flow control support net/octeontx2: add FW version get operation net/octeontx2: add MTU set operationVivek Sharma (5):
net/octeontx2: connect flow API to ethdev ops net/octeontx2: implement VLAN utility functions net/octeontx2: support VLAN offloads net/octeontx2: support VLAN filters net/octeontx2: support VLAN TPID and PVID for Tx
<...>
Quoted 13 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, June 6, 2019 8:53 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 00/58] OCTEON TX2 Ethdev driverQuoted 4 lines · On 6/2/2019 4:23 PM, [email protected] wrote:
From: Jerin Jacob <[email protected]>
This patchset adds support for OCTEON TX2 ethdev driver.
Quoted 8 lines
Quoted 1 line
This patch set is depended on "OCTEON TX2 common and mempool driver"
series.
Hi Jerin,
I will wait for the dependent patches to be merged to be able to full review the patchset, I will go through it for now.
Hi Thomas,
Could you merge the "OCTEON TX2 common and mempool driver"[1] series If there are no more review comments.
Following patches sets[2] has dependency on this series.
[1] http://mails.dpdk.org/archives/dev/2019-June/133329.html
[2]
http://patches.dpdk.org/patch/54002/
http://patches.dpdk.org/patch/54057/
http://patches.dpdk.org/patch/54017/
v2 cover OCTEON TX2 Ethdev driver
In reply to [email protected]From: Jerin Jacob <[email protected]>
This patchset adds support for OCTEON TX2 ethdev driver.
v2:
# Moved maintainers file to the first patch(Ferruh)
# removed reference to to v19.05(Ferruh) # Makefile/Meson CFLAGS moved to specific patches(Ferruh) # Move Documentation updates to specific patches(Ferruh) # reworked the code to remove the need for exposing otx2_nix_fastpath_lookup_mem_get function(Ferruh) # Updated goto logic in net/octeontx2: add FW version get operation(Ferruh) # Added "add Rx interrupts support" patch
Harman Kalra (3):
net/octeontx2: add PTP base support
net/octeontx2: add remaining PTP operations
net/octeontx2: add Rx interrupts support
Jerin Jacob (16):
net/octeontx2: add build and doc infrastructure net/octeontx2: add ethdev probe and remove net/octeontx2: add device init and uninit net/octeontx2: add devargs parsing functions net/octeontx2: handle device error interrupts net/octeontx2: add info get operation net/octeontx2: add device configure operation net/octeontx2: handle queue specific error interrupts net/octeontx2: add context debug utils net/octeontx2: add Rx queue setup and release net/octeontx2: add Tx queue setup and release net/octeontx2: add ptype support net/octeontx2: add Rx and Tx descriptor operations net/octeontx2: add Rx burst support net/octeontx2: add Rx vector version net/octeontx2: add Tx burst support
Kiran Kumar K (13):
net/octeontx2: add register dump support net/octeontx2: add basic stats operation net/octeontx2: add extended stats operations net/octeontx2: introducing flow driver net/octeontx2: add flow utility functions net/octeontx2: add flow mbox utility functions net/octeontx2: add flow MCAM utility functions net/octeontx2: add flow parsing for outer layers net/octeontx2: add flow actions support net/octeontx2: add flow parse actions support net/octeontx2: add flow operations net/octeontx2: add flow destroy ops support net/octeontx2: add flow init and fini
Krzysztof Kanas (2):
net/octeontx2: alloc and free TM HW resources net/octeontx2: enable Tx through traffic manager
Nithin Dabilpuram (9):
net/octeontx2: add queue start and stop operations net/octeontx2: introduce traffic manager net/octeontx2: configure TM HW resources net/octeontx2: add queue info and pool supported operations net/octeontx2: add Rx multi segment version net/octeontx2: add Tx multi segment version net/octeontx2: add Tx vector version net/octeontx2: add device start operation net/octeontx2: add device stop and close operations
Sunil Kumar Kori (1):
net/octeontx2: add unicast MAC filter
Vamsi Attunuru (8):
net/octeontx2: add link stats operations net/octeontx2: add promiscuous and allmulticast mode net/octeontx2: add RSS support net/octeontx2: handle port reconfigure net/octeontx2: add module EEPROM dump net/octeontx2: add flow control support net/octeontx2: add FW version get operation net/octeontx2: add MTU set operation
Vivek Sharma (5):
net/octeontx2: connect flow API to ethdev ops net/octeontx2: implement VLAN utility functions net/octeontx2: support VLAN offloads net/octeontx2: support VLAN filters net/octeontx2: support VLAN TPID and PVID for Tx
MAINTAINERS | 9 + config/common_base | 5 + doc/guides/nics/features/octeontx2.ini | 50 + doc/guides/nics/features/octeontx2_vec.ini | 46 + doc/guides/nics/features/octeontx2_vf.ini | 42 + doc/guides/nics/index.rst | 1 + doc/guides/nics/octeontx2.rst | 302 +++ doc/guides/platform/octeontx2.rst | 3 + drivers/net/Makefile | 1 + drivers/net/meson.build | 6 +- drivers/net/octeontx2/Makefile | 55 + drivers/net/octeontx2/meson.build | 40 + drivers/net/octeontx2/otx2_ethdev.c | 1996 +++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 529 +++++ drivers/net/octeontx2/otx2_ethdev_debug.c | 500 +++++ drivers/net/octeontx2/otx2_ethdev_devargs.c | 165 ++ drivers/net/octeontx2/otx2_ethdev_irq.c | 468 ++++ drivers/net/octeontx2/otx2_ethdev_ops.c | 461 ++++ drivers/net/octeontx2/otx2_flow.c | 981 ++++++++ drivers/net/octeontx2/otx2_flow.h | 390 ++++ drivers/net/octeontx2/otx2_flow_ctrl.c | 220 ++ drivers/net/octeontx2/otx2_flow_parse.c | 947 ++++++++ drivers/net/octeontx2/otx2_flow_utils.c | 910 ++++++++ drivers/net/octeontx2/otx2_link.c | 108 + drivers/net/octeontx2/otx2_lookup.c | 315 +++ drivers/net/octeontx2/otx2_mac.c | 149 ++ drivers/net/octeontx2/otx2_ptp.c | 273 +++ drivers/net/octeontx2/otx2_rss.c | 372 +++ drivers/net/octeontx2/otx2_rx.c | 411 ++++ drivers/net/octeontx2/otx2_rx.h | 333 +++ drivers/net/octeontx2/otx2_stats.c | 387 ++++ drivers/net/octeontx2/otx2_tm.c | 1396 ++++++++++++ drivers/net/octeontx2/otx2_tm.h | 153 ++ drivers/net/octeontx2/otx2_tx.c | 1033 +++++++++ drivers/net/octeontx2/otx2_tx.h | 370 +++ drivers/net/octeontx2/otx2_vlan.c | 1034 +++++++++ .../octeontx2/rte_pmd_octeontx2_version.map | 4 + mk/rte.app.mk | 2 + 38 files changed, 14466 insertions(+), 1 deletion(-) create mode 100644 doc/guides/nics/features/octeontx2.ini create mode 100644 doc/guides/nics/features/octeontx2_vec.ini create mode 100644 doc/guides/nics/features/octeontx2_vf.ini create mode 100644 doc/guides/nics/octeontx2.rst create mode 100644 drivers/net/octeontx2/Makefile create mode 100644 drivers/net/octeontx2/meson.build create mode 100644 drivers/net/octeontx2/otx2_ethdev.c create mode 100644 drivers/net/octeontx2/otx2_ethdev.h create mode 100644 drivers/net/octeontx2/otx2_ethdev_debug.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_devargs.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_irq.c create mode 100644 drivers/net/octeontx2/otx2_ethdev_ops.c create mode 100644 drivers/net/octeontx2/otx2_flow.c create mode 100644 drivers/net/octeontx2/otx2_flow.h create mode 100644 drivers/net/octeontx2/otx2_flow_ctrl.c create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c create mode 100644 drivers/net/octeontx2/otx2_flow_utils.c create mode 100644 drivers/net/octeontx2/otx2_link.c create mode 100644 drivers/net/octeontx2/otx2_lookup.c create mode 100644 drivers/net/octeontx2/otx2_mac.c create mode 100644 drivers/net/octeontx2/otx2_ptp.c create mode 100644 drivers/net/octeontx2/otx2_rss.c create mode 100644 drivers/net/octeontx2/otx2_rx.c create mode 100644 drivers/net/octeontx2/otx2_rx.h create mode 100644 drivers/net/octeontx2/otx2_stats.c create mode 100644 drivers/net/octeontx2/otx2_tm.c create mode 100644 drivers/net/octeontx2/otx2_tm.h create mode 100644 drivers/net/octeontx2/otx2_tx.c create mode 100644 drivers/net/octeontx2/otx2_tx.h create mode 100644 drivers/net/octeontx2/otx2_vlan.c create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.map
Signature · 1 line
2.21.0
PATCH v2 1/57 net/octeontx2: add build and doc infrastructure
From: Jerin Jacob <[email protected]>
Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx2 PMD.
--- MAINTAINERS | 9 ++++++ config/common_base | 5 +++ doc/guides/nics/features/octeontx2.ini | 9 ++++++ doc/guides/nics/features/octeontx2_vec.ini | 9 ++++++ doc/guides/nics/features/octeontx2_vf.ini | 9 ++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/octeontx2.rst | 32 +++++++++++++++++++ doc/guides/platform/octeontx2.rst | 3 ++ drivers/net/Makefile | 1 + drivers/net/meson.build | 6 +++- drivers/net/octeontx2/Makefile | 30 +++++++++++++++++ drivers/net/octeontx2/meson.build | 9 ++++++ drivers/net/octeontx2/otx2_ethdev.c | 3 ++ .../octeontx2/rte_pmd_octeontx2_version.map | 4 +++ mk/rte.app.mk | 2 ++ 15 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 doc/guides/nics/features/octeontx2.ini create mode 100644 doc/guides/nics/features/octeontx2_vec.ini create mode 100644 doc/guides/nics/features/octeontx2_vf.ini create mode 100644 doc/guides/nics/octeontx2.rst create mode 100644 drivers/net/octeontx2/Makefile create mode 100644 drivers/net/octeontx2/meson.build create mode 100644 drivers/net/octeontx2/otx2_ethdev.c create mode 100644 drivers/net/octeontx2/rte_pmd_octeontx2_version.map
MAINTAINERS +9 -0
@@ -684,6 +684,15 @@ F: drivers/net/mvneta/ F: doc/guides/nics/mvneta.rst F: doc/guides/nics/features/mvneta.ini +Marvell OCTEON TX2 +M: Jerin Jacob <[email protected]> +M: Nithin Dabilpuram <[email protected]> +M: Kiran Kumar K <[email protected]> +T: git://dpdk.org/next/dpdk-next-net-mrvl +F: drivers/net/octeontx2/ +F: doc/guides/nics/features/octeontx2*.rst +F: doc/guides/nics/octeontx2.rst + Mellanox mlx4 M: Matan Azrad <[email protected]> M: Shahaf Shuler <[email protected]>
config/common_base +5 -0
@@ -411,6 +411,11 @@ CONFIG_RTE_LIBRTE_LIO_DEBUG_REGS=n # CONFIG_RTE_LIBRTE_OCTEONTX_PMD=y +# +# Compile burst-oriented Marvell OCTEON TX2 network PMD driver +# +CONFIG_RTE_LIBRTE_OCTEONTX2_PMD=y + # # Compile WRS accelerated virtual port (AVP) guest PMD driver #
doc/guides/nics/features/octeontx2.ini new file +9 -0
@@ -0,0 +1,9 @@ +; +; Supported features of the 'octeontx2' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y +Usage doc = Y
doc/guides/nics/features/octeontx2_vec.ini new file +9 -0
@@ -0,0 +1,9 @@ +; +; Supported features of the 'octeontx2_vec' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y +Usage doc = Y
doc/guides/nics/features/octeontx2_vf.ini new file +9 -0
@@ -0,0 +1,9 @@ +; +; Supported features of the 'octeontx2_vf' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux VFIO = Y +ARMv8 = Y +Usage doc = Y
doc/guides/nics/index.rst +1 -0
@@ -46,6 +46,7 @@ Network Interface Controller Drivers nfb nfp octeontx + octeontx2 qede sfc_efx softnic
doc/guides/nics/octeontx2.rst new file +32 -0
@@ -0,0 +1,32 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(C) 2019 Marvell International Ltd. + +OCTEON TX2 Poll Mode driver +=========================== + +The OCTEON TX2 ETHDEV PMD (**librte_pmd_octeontx2**) provides poll mode ethdev +driver support for the inbuilt network device found in **Marvell OCTEON TX2** +SoC family as well as for their virtual functions (VF) in SR-IOV context. + +More information can be found at `Marvell Official Website +<https://www.marvell.com/embedded-processors/infrastructure-processors>`_. + +Features +-------- + +Features of the OCTEON TX2 Ethdev PMD are: + + +Prerequisites +------------- + +See :doc:`../platform/octeontx2` for setup information. + +Compile time Config Options +--------------------------- + +The following options may be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_OCTEONTX2_PMD`` (default ``y``) + + Toggle compilation of the ``librte_pmd_octeontx2`` driver.
doc/guides/platform/octeontx2.rst +3 -0
@@ -98,6 +98,9 @@ HW Offload Drivers This section lists dataplane H/W block(s) available in OCTEON TX2 SoC. +#. **Ethdev Driver** + See :doc:`../nics/octeontx2` for NIX Ethdev driver information. + #. **Mempool Driver** See :doc:`../mempool/octeontx2` for NPA mempool driver information.
drivers/net/Makefile +1 -0
@@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx +DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += octeontx2 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
drivers/net/meson.build +5 -1
@@ -33,7 +33,11 @@ drivers = ['af_packet', 'netvsc', 'nfb', 'nfp', - 'null', 'octeontx', 'pcap', 'qede', 'ring', + 'null', + 'octeontx', + 'octeontx2', + 'pcap', + 'ring', 'sfc', 'softnic', 'szedata2',
drivers/net/octeontx2/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_octeontx2.a + +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 +CFLAGS += -O3 + +EXPORT_MAP := rte_pmd_octeontx2_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_ethdev.c + +LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +sources = files( + 'otx2_ethdev.c', + ) + +deps += ['common_octeontx2', 'mempool_octeontx2']
drivers/net/octeontx2/otx2_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/
drivers/net/octeontx2/rte_pmd_octeontx2_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_19.08 { + + local: *; +};
mk/rte.app.mk +2 -0
@@ -109,6 +109,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO _LDLIBS-y += -lrte_common_octeontx endif OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) +OCTEONTX2-y += $(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) ifeq ($(findstring y,$(OCTEONTX2-y)),y) _LDLIBS-y += -lrte_common_octeontx2 endif
@@ -195,6 +196,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += -lrte_pmd_mvneta _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += -lrte_pmd_octeontx2 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring
Signature · 1 line
2.21.0
PATCH v2 2/57 net/octeontx2: add ethdev probe and remove
In reply to [email protected]From: Jerin Jacob <[email protected]>
add basic PCIe ethdev probe and remove.
--- drivers/net/octeontx2/Makefile | 8 ++- drivers/net/octeontx2/meson.build | 14 ++++- drivers/net/octeontx2/otx2_ethdev.c | 93 +++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 27 +++++++++ 4 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev.h
drivers/net/octeontx2/Makefile +7 -1
@@ -15,6 +15,11 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx2 CFLAGS += -O3 +ifneq ($(CONFIG_RTE_ARCH_64),y) +CFLAGS += -Wno-int-to-pointer-cast +CFLAGS += -Wno-pointer-to-int-cast +endif + EXPORT_MAP := rte_pmd_octeontx2_version.map LIBABIVER := 1
@@ -25,6 +30,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_ethdev.c -LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 +LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal +LDLIBS += -lrte_ethdev -lrte_bus_pci include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build +13 -1
@@ -6,4 +6,16 @@ sources = files( 'otx2_ethdev.c', ) -deps += ['common_octeontx2', 'mempool_octeontx2'] +deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2'] + +extra_flags = [] +# This integrated controller runs only on a arm64 machine, remove 32bit warnings +if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] +endif + +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeach
drivers/net/octeontx2/otx2_ethdev.c +93 -0
96 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ + +#ifndef __OTX2_ETHDEV_H__ +#define __OTX2_ETHDEV_H__ + +#include <stdint.h> + +#include <rte_common.h> + +#include "otx2_common.h" +#include "otx2_dev.h" +#include "otx2_irq.h" +#include "otx2_mempool.h" + +struct otx2_eth_dev { +OTX2_DEV ;/* Base class */ +} __rte_cache_aligned; + +static inline struct otx2_eth_dev * +otx2_eth_pmd_priv (struct rte_eth_dev *eth_dev) +{ +return eth_dev->data->dev_private; +} + +#endif /* __OTX2_ETHDEV_H__ */
Signature · 1 line
2.21.0
PATCH v2 3/57 net/octeontx2: add device init and uninit
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add basic init and uninit function which includes
attaching LF device to probed PCIe device.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 277 +++++++++++++++++++++++++++- drivers/net/octeontx2/otx2_ethdev.h | 72 ++++++++ drivers/net/octeontx2/otx2_mac.c | 72 ++++++++ 5 files changed, 418 insertions(+), 5 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_mac.c
drivers/net/octeontx2/Makefile +1 -0
@@ -28,6 +28,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ + otx2_mac.c \ otx2_ethdev.c LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
@@ -3,6 +3,7 @@ # sources = files( + 'otx2_mac.c', 'otx2_ethdev.c', )
drivers/net/octeontx2/otx2_ethdev.c +272 -5
306 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev.h +72 -0
90 lines not on this page · raw message
drivers/net/octeontx2/otx2_mac.c new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 4/57 net/octeontx2: add devargs parsing functions
In reply to [email protected]From: Jerin Jacob <[email protected]>
add various devargs command line options supported by this driver.
--- doc/guides/nics/octeontx2.rst | 67 ++++++++ drivers/net/octeontx2/Makefile | 5 +- drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 7 + drivers/net/octeontx2/otx2_ethdev.h | 23 +++ drivers/net/octeontx2/otx2_ethdev_devargs.c | 165 ++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 10 ++ 7 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev_devargs.c create mode 100644 drivers/net/octeontx2/otx2_rx.h
doc/guides/nics/octeontx2.rst +67 -0
@@ -30,3 +30,70 @@ The following options may be modified in the ``config`` file. - ``CONFIG_RTE_LIBRTE_OCTEONTX2_PMD`` (default ``y``) Toggle compilation of the ``librte_pmd_octeontx2`` driver. + +Runtime Config Options +---------------------- + +- ``HW offload ptype parsing disable`` (default ``0``) + + Packet type parsing is HW offloaded by default and this feature may be toggled + using ``ptype_disable`` ``devargs`` parameter. + +- ``Rx&Tx scalar mode enable`` (default ``0``) + + Ethdev supports both scalar and vector mode, it may be selected at runtime + using ``scalar_enable`` ``devargs`` parameter. + +- ``RSS reta size`` (default ``64``) + + RSS redirection table size may be configured during runtime using ``reta_size`` + ``devargs`` parameter. + + For example:: + + -w 0002:02:00.0,reta_size=256 + + With the above configuration, reta table of size 256 is populated. + +- ``Flow priority levels`` (default ``3``) + + RTE Flow priority levels can be configured during runtime using + ``flow_max_priority`` ``devargs`` parameter. + + For example:: + + -w 0002:02:00.0,flow_max_priority=10 + + With the above configuration, priority level was set to 10 (0-9). Max + priority level supported is 32. + +- ``Reserve Flow entries`` (default ``8``) + + RTE flow entries can be pre allocated and the size of pre allocation can be + selected runtime using ``flow_prealloc_size`` ``devargs`` parameter. + + For example:: + + -w 0002:02:00.0,flow_prealloc_size=4 + + With the above configuration, pre alloc size was set to 4. Max pre alloc + size supported is 32. + +- ``Max SQB buffer count`` (default ``512``) + + Send queue descriptor buffer count may be limited during runtime using + ``max_sqb_count`` ``devargs`` parameter. + + For example:: + + -w 0002:02:00.0,max_sqb_count=64 + + With the above configuration, each send queue's decscriptor buffer count is + limited to a maximum of 64 buffers. + + +.. note:: + + Above devarg parameters are configurable per device, user needs to pass the + parameters to all the PCIe devices if application requires to configure on + all the ethdev ports.
drivers/net/octeontx2/Makefile +3 -2
@@ -29,9 +29,10 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ - otx2_ethdev.c + otx2_ethdev.c \ + otx2_ethdev_devargs.c LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal -LDLIBS += -lrte_ethdev -lrte_bus_pci +LDLIBS += -lrte_ethdev -lrte_bus_pci -lrte_kvargs include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/octeontx2/meson.build +1 -0
@@ -5,6 +5,7 @@ sources = files( 'otx2_mac.c', 'otx2_ethdev.c', + 'otx2_ethdev_devargs.c' ) deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2']
drivers/net/octeontx2/otx2_ethdev.c +7 -0
@@ -137,6 +137,13 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)memset (&dev->otx2_eth_dev_data_start,0 ,sizeof (*dev) - offsetof(struct otx2_eth_dev , otx2_eth_dev_data_start)); +/* Parse devargs string */ + rc =otx2_ethdev_parse_devargs (eth_dev->device->devargs, dev); +if (rc) { +otx2_err ("Failed to parse devargs rc=%d" , rc); + goto error; + } +if (!dev->mbox_active) {/* Initialize the base otx2_dev object * only if already present
drivers/net/octeontx2/otx2_ethdev.h +23 -0
@@ -9,11 +9,13 @@#include <rte_common.h> #include <rte_ethdev.h> +#include <rte_kvargs.h> #include "otx2_common.h" #include "otx2_dev.h" #include "otx2_irq.h" #include "otx2_mempool.h" +#include "otx2_rx.h" #define OTX2_ETH_DEV_PMD_VERSION "1.0"
@@ -31,6 +33,10 @@/* Used for struct otx2_eth_dev::flags */ #define OTX2_LINK_CFG_IN_PROGRESS_F BIT_ULL(0) +#define NIX_MAX_SQB 512 +#define NIX_MIN_SQB 32 +#define NIX_RSS_RETA_SIZE 64 +#define NIX_TX_OFFLOAD_CAPA ( \ DEV_TX_OFFLOAD_MBUF_FAST_FREE | \ DEV_TX_OFFLOAD_MT_LOCKFREE | \
@@ -56,6 +62,15 @@ DEV_RX_OFFLOAD_QINQ_STRIP | \ DEV_RX_OFFLOAD_TIMESTAMP) +struct otx2_rss_info { +uint16_t rss_size; +}; + +struct otx2_npc_flow_info { +uint16_t flow_prealloc_size; +uint16_t flow_max_priority; +}; +struct otx2_eth_dev {OTX2_DEV ;/* Base class */ MARKER otx2_eth_dev_data_start;
@@ -72,12 +87,16 @@ struct otx2_eth_dev {uint16_t nix_msixoff;uintptr_t base;uintptr_t lmt_addr; +uint16_t scalar_ena; +uint16_t max_sqb_count;uint16_t rx_offload_flags;/* Selected Rx offload flags(NIX_RX_*_F) */ uint64_t rx_offloads;uint16_t tx_offload_flags;/* Selected Tx offload flags(NIX_TX_*_F) */ uint64_t tx_offloads;uint64_t rx_offload_capa;uint64_t tx_offload_capa; +struct otx2_rss_info rss_info; +struct otx2_npc_flow_info npc_flow; } __rte_cache_aligned; static inline struct otx2_eth_dev *
@@ -96,4 +115,8 @@ int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,int otx2_nix_mac_addr_get (struct rte_eth_dev *eth_dev,uint8_t *addr);int otx2_cgx_mac_max_entries_get (struct otx2_eth_dev *dev); +/* Devargs */ +int otx2_ethdev_parse_devargs (struct rte_devargs *devargs, +struct otx2_eth_dev *dev); +#endif /* __OTX2_ETHDEV_H__ */
drivers/net/octeontx2/otx2_ethdev_devargs.c new file +165 -0
165 lines not on this page · raw message
drivers/net/octeontx2/otx2_rx.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2019 Marvell International Ltd. +*/ + +#ifndef __OTX2_RX_H__ +#define __OTX2_RX_H__ + +#define NIX_RX_OFFLOAD_PTYPE_F BIT(1) + +#endif /* __OTX2_RX_H__ */
Signature · 1 line
2.21.0
PATCH v2 5/57 net/octeontx2: handle device error interrupts
In reply to [email protected]From: Jerin Jacob <[email protected]>
Handle device specific error and ras interrupts.
--- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 12 +- drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_ethdev_irq.c | 140 ++++++++++++++++++++++++ 5 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev_irq.c
drivers/net/octeontx2/Makefile +1 -0
@@ -30,6 +30,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ otx2_ethdev.c \ + otx2_ethdev_irq.c \ otx2_ethdev_devargs.c LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
@@ -5,6 +5,7 @@ sources = files( 'otx2_mac.c', 'otx2_ethdev.c', + 'otx2_ethdev_irq.c', 'otx2_ethdev_devargs.c' )
drivers/net/octeontx2/otx2_ethdev.c +10 -2
@@ -175,12 +175,17 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)if (rc) goto otx2_npa_uninit; +/* Register LF irq handlers */ + rc =otx2_nix_register_irqs (eth_dev); +if (rc) + goto mbox_detach; +/* Get maximum number of supported MAC entries */ max_entries =otx2_cgx_mac_max_entries_get (dev);if (max_entries <0 ) {otx2_err ("Failed to get max entries for mac addr" ); rc = -ENOTSUP ; - goto mbox_detach; + goto unregister_irq; }/* For VFs, returned max_entries will be 0. But to keep default MAC
@@ -194,7 +199,7 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)if (eth_dev->data->mac_addrs ==NULL ) {otx2_err ("Failed to allocate memory for mac addr" ); rc = -ENOMEM ; - goto mbox_detach; + goto unregister_irq; } dev->max_mac_entries = max_entries;
@@ -226,6 +231,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) free_mac_addrs:rte_free (eth_dev->data->mac_addrs); +unregister_irq: +otx2_nix_unregister_irqs (eth_dev); mbox_detach:otx2_eth_dev_lf_detach (dev->mbox); otx2_npa_uninit:
@@ -261,6 +268,7 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) dev->drv_inited = false; pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); +otx2_nix_unregister_irqs (eth_dev); rc =otx2_eth_dev_lf_detach (dev->mbox);if (rc)
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -105,6 +105,10 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)return eth_dev->data->dev_private; } +/* IRQ */ +int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev); +void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev); +/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);int otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_irq.c new file +140 -0
140 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 6/57 net/octeontx2: add info get operation
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add device information get operation.
--- doc/guides/nics/features/octeontx2.ini | 4 ++ doc/guides/nics/features/octeontx2_vec.ini | 4 ++ doc/guides/nics/features/octeontx2_vf.ini | 3 + doc/guides/nics/octeontx2.rst | 2 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 7 +++ drivers/net/octeontx2/otx2_ethdev.h | 45 +++++++++++++++ drivers/net/octeontx2/otx2_ethdev_ops.c | 64 ++++++++++++++++++++++ 9 files changed, 131 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_ethdev_ops.c
doc/guides/nics/features/octeontx2.ini +4 -0
@@ -4,6 +4,10 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y +Lock-free Tx queue = Y +SR-IOV = Y +Multiprocess aware = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y
doc/guides/nics/features/octeontx2_vec.ini +4 -0
@@ -4,6 +4,10 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y +Lock-free Tx queue = Y +SR-IOV = Y +Multiprocess aware = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y
doc/guides/nics/features/octeontx2_vf.ini +3 -0
@@ -4,6 +4,9 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y +Lock-free Tx queue = Y +Multiprocess aware = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y
doc/guides/nics/octeontx2.rst +2 -0
@@ -16,6 +16,8 @@ Features Features of the OCTEON TX2 Ethdev PMD are: +- SR-IOV VF +- Lock-free Tx queue Prerequisites -------------
drivers/net/octeontx2/Makefile +1 -0
@@ -31,6 +31,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ otx2_ethdev.c \ otx2_ethdev_irq.c \ + otx2_ethdev_ops.c \ otx2_ethdev_devargs.c LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
@@ -6,6 +6,7 @@ sources = files( 'otx2_mac.c', 'otx2_ethdev.c', 'otx2_ethdev_irq.c', + 'otx2_ethdev_ops.c', 'otx2_ethdev_devargs.c' )
drivers/net/octeontx2/otx2_ethdev.c +7 -0
@@ -64,6 +64,11 @@ nix_lf_free(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +/* Initialize and register driver with DPDK Application */ +static const struct eth_dev_ops otx2_eth_dev_ops = { + .dev_infos_get = otx2_nix_info_get, +}; +static inline int nix_lf_attach (struct otx2_eth_dev *dev) {
@@ -120,6 +125,8 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev)struct rte_pci_device *pci_dev;int rc, max_entries; + eth_dev->dev_ops = &otx2_eth_dev_ops; +/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* Setup callbacks for secondary process */
drivers/net/octeontx2/otx2_ethdev.h +45 -0
60 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_ops.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 7/57 net/octeontx2: add device configure operation
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add device configure operation. This would call lf_alloc mailbox to allocate a NIX LF and upon return, AF will return the attributes for the select LF.
--- drivers/net/octeontx2/otx2_ethdev.c | 151 ++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev.h | 11 ++ 2 files changed, 162 insertions(+)
drivers/net/octeontx2/otx2_ethdev.c +151 -0
@@ -39,6 +39,52 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)return NIX_TX_OFFLOAD_CAPA ; } +static int +nix_lf_alloc (struct otx2_eth_dev *dev,uint32_t nb_rxq,uint32_t nb_txq) +{ +struct otx2_mbox *mbox = dev->mbox; +struct nix_lf_alloc_req *req; +struct nix_lf_alloc_rsp *rsp; +int rc; + + req =otx2_mbox_alloc_msg_nix_lf_alloc (mbox); + req->rq_cnt = nb_rxq; + req->sq_cnt = nb_txq; + req->cq_cnt = nb_rxq; +/* XQE_SZ should be in Sync with NIX_CQ_ENTRY_SZ */ +RTE_BUILD_BUG_ON (NIX_CQ_ENTRY_SZ !=128 ); + req->xqe_sz =NIX_XQESZ_W16 ; + req->rss_sz = dev->rss_info.rss_size; + req->rss_grps =NIX_RSS_GRPS ; + req->npa_func =otx2_npa_pf_func_get (); + req->sso_func =otx2_sso_pf_func_get (); + req->rx_cfg =BIT_ULL (35 /* DIS_APAD */ ); +if (dev->rx_offloads & (DEV_RX_OFFLOAD_TCP_CKSUM | +DEV_RX_OFFLOAD_UDP_CKSUM )) { + req->rx_cfg |=BIT_ULL (37 /* CSUM_OL4 */ ); + req->rx_cfg |=BIT_ULL (36 /* CSUM_IL4 */ ); + } + + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + + dev->sqb_size = rsp->sqb_size; + dev->tx_chan_base = rsp->tx_chan_base; + dev->rx_chan_base = rsp->rx_chan_base; + dev->rx_chan_cnt = rsp->rx_chan_cnt; + dev->tx_chan_cnt = rsp->tx_chan_cnt; + dev->lso_tsov4_idx = rsp->lso_tsov4_idx; + dev->lso_tsov6_idx = rsp->lso_tsov6_idx; + dev->lf_tx_stats = rsp->lf_tx_stats; + dev->lf_rx_stats = rsp->lf_rx_stats; + dev->cints = rsp->cints; + dev->qints = rsp->qints; + dev->npc_flow.channel = dev->rx_chan_base; + +return 0 ; +} +static int nix_lf_free (struct otx2_eth_dev *dev) {
@@ -64,9 +110,114 @@ nix_lf_free(struct otx2_eth_dev *dev)return otx2_mbox_process (mbox); } +static int +otx2_nix_configure (struct rte_eth_dev *eth_dev) +{ +struct otx2_eth_dev *dev =otx2_eth_pmd_priv (eth_dev); +struct rte_eth_dev_data *data = eth_dev->data; +struct rte_eth_conf *conf = &data->dev_conf; +struct rte_eth_rxmode *rxmode = &conf->rxmode; +struct rte_eth_txmode *txmode = &conf->txmode; +char ea_fmt[RTE_ETHER_ADDR_FMT_SIZE ]; +struct rte_ether_addr *ea; +uint8_t nb_rxq, nb_txq; +int rc; + + rc = -EINVAL ; + +/* Sanity checks */ +if (rte_eal_has_hugepages () ==0 ) { +otx2_err ("Huge page is not configured" ); + goto fail; + } + +if (rte_eal_iova_mode () !=RTE_IOVA_VA ) { +otx2_err ("iova mode should be va" ); + goto fail; + } + +if (conf->link_speeds Ð_LINK_SPEED_FIXED ) { +otx2_err ("Setting link speed/duplex not supported" ); + goto fail; + } + +if (conf->dcb_capability_en ==1 ) { +otx2_err ("dcb enable is not supported" ); + goto fail; + } + +if (conf->fdir_conf.mode !=RTE_FDIR_MODE_NONE ) { +otx2_err ("Flow director is not supported" ); + goto fail; + } + +if (rxmode->mq_mode !=ETH_MQ_RX_NONE && + rxmode->mq_mode !=ETH_MQ_RX_RSS ) { +otx2_err ("Unsupported mq rx mode %d" , rxmode->mq_mode); + goto fail; + } + +if (txmode->mq_mode !=ETH_MQ_TX_NONE ) { +otx2_err ("Unsupported mq tx mode %d" , txmode->mq_mode); + goto fail; + } + +/* Free the resources allocated from the previous configure */ +if (dev->configured ==1 ) +nix_lf_free (dev); + +if (otx2_dev_is_A0 (dev) && + (txmode->offloads &DEV_TX_OFFLOAD_SCTP_CKSUM ) && + ((txmode->offloads &DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM ) || + (txmode->offloads &DEV_TX_OFFLOAD_OUTER_UDP_CKSUM ))) { +otx2_err ("Outer IP and SCTP checksum unsupported" ); + rc = -EINVAL ; + goto fail; + } + + dev->rx_offloads = rxmode->offloads; + dev->tx_offloads = txmode->offloads; + dev->rss_info.rss_grps =NIX_RSS_GRPS ; + + nb_rxq =RTE_MAX (data->nb_rx_queues,1 ); + nb_txq =RTE_MAX (data->nb_tx_queues,1 ); + +/* Alloc a nix lf */ + rc =nix_lf_alloc (dev, nb_rxq, nb_txq); +if (rc) { +otx2_err ("Failed to init nix_lf rc=%d" , rc); + goto fail; + } + +/* Update the mac address */ + ea = eth_dev->data->mac_addrs; +memcpy (ea, dev->mac_addr,RTE_ETHER_ADDR_LEN ); +if (rte_is_zero_ether_addr (ea)) +rte_eth_random_addr ((uint8_t *)ea); + +rte_ether_format_addr (ea_fmt,RTE_ETHER_ADDR_FMT_SIZE , ea); + +otx2_nix_dbg ("Configured port%d mac=%s nb_rxq=%d nb_txq=%d" +" rx_offloads=0x%" PRIx64" tx_offloads=0x%" PRIx64"" +" rx_flags=0x%x tx_flags=0x%x" , + eth_dev->data->port_id, ea_fmt, nb_rxq, + nb_txq, dev->rx_offloads, dev->tx_offloads, + dev->rx_offload_flags, dev->tx_offload_flags); + +/* All good */ + dev->configured =1 ; + dev->configured_nb_rx_qs = data->nb_rx_queues; + dev->configured_nb_tx_qs = data->nb_tx_queues; +return 0 ; + +fail: +return rc; +} +/* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, + .dev_configure = otx2_nix_configure, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +11 -0
@@ -59,11 +59,14 @@#define NIX_MAX_SQB 512#define NIX_MIN_SQB 32 +/* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/ +#define NIX_RSS_GRPS 8#define NIX_HASH_KEY_SIZE 48/* 352 Bits */ #define NIX_RSS_RETA_SIZE 64#define NIX_RX_MIN_DESC 16#define NIX_RX_MIN_DESC_ALIGN 16#define NIX_RX_NB_SEG_MAX 6 +#define NIX_CQ_ENTRY_SZ 128/* If PTP is enabled additional SEND MEM DESC is required which * takes 2 words, hence max 7 iova address are possible
@@ -105,9 +108,11 @@struct otx2_rss_info {uint16_t rss_size; +uint8_t rss_grps; };struct otx2_npc_flow_info { +uint16_t channel;/*rx channel */ uint16_t flow_prealloc_size;uint16_t flow_max_priority; };
@@ -124,7 +129,13 @@ struct otx2_eth_dev {uint8_t lso_tsov6_idx;uint8_t mac_addr[RTE_ETHER_ADDR_LEN ];uint8_t max_mac_entries; +uint8_t lf_tx_stats; +uint8_t lf_rx_stats; +uint16_t cints; +uint16_t qints;uint8_t configured; +uint8_t configured_nb_rx_qs; +uint8_t configured_nb_tx_qs;uint16_t nix_msixoff;uintptr_t base;uintptr_t lmt_addr;
Signature · 1 line
2.21.0
PATCH v2 8/57 net/octeontx2: handle queue specific error interrupts
In reply to [email protected]From: Jerin Jacob <[email protected]>
Handle queue specific error interrupts.
--- doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/otx2_ethdev.c | 16 +- drivers/net/octeontx2/otx2_ethdev.h | 9 ++ drivers/net/octeontx2/otx2_ethdev_irq.c | 191 ++++++++++++++++++++++++ 4 files changed, 216 insertions(+), 1 deletion(-)
doc/guides/nics/octeontx2.rst +1 -0
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - SR-IOV VF - Lock-free Tx queue +- Debug utilities - error interrupt support Prerequisites -------------
drivers/net/octeontx2/otx2_ethdev.c +15 -1
@@ -163,8 +163,10 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) }/* Free the resources allocated from the previous configure */ -if (dev->configured ==1 ) +if (dev->configured ==1 ) { +oxt2_nix_unregister_queue_irqs (eth_dev);nix_lf_free (dev); + } if (otx2_dev_is_A0(dev) && (txmode->offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
@@ -189,6 +191,13 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto fail; } +/* Register queue IRQs */ + rc =oxt2_nix_register_queue_irqs (eth_dev); +if (rc) { +otx2_err ("Failed to register queue interrupts rc=%d" , rc); + goto free_nix_lf; + } +/* Update the mac address */ ea = eth_dev->data->mac_addrs;memcpy (ea, dev->mac_addr,RTE_ETHER_ADDR_LEN );
@@ -210,6 +219,8 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) dev->configured_nb_tx_qs = data->nb_tx_queues;return 0 ; +free_nix_lf: + rc =nix_lf_free (dev); fail:return rc; }
@@ -413,6 +424,9 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; +/* Unregister queue irqs */ +oxt2_nix_unregister_queue_irqs (eth_dev); + rc =nix_lf_free (dev);if (rc)otx2_err ("Failed to free nix lf, rc=%d" , rc);
drivers/net/octeontx2/otx2_ethdev.h +9 -0
@@ -106,6 +106,11 @@ DEV_RX_OFFLOAD_QINQ_STRIP | \ DEV_RX_OFFLOAD_TIMESTAMP) +struct otx2_qint { +struct rte_eth_dev *eth_dev; +uint8_t qintx; +}; +struct otx2_rss_info {uint16_t rss_size;uint8_t rss_grps;
@@ -134,6 +139,7 @@ struct otx2_eth_dev {uint16_t cints;uint16_t qints;uint8_t configured; +uint8_t configured_qints;uint8_t configured_nb_rx_qs;uint8_t configured_nb_tx_qs;uint16_t nix_msixoff;
@@ -147,6 +153,7 @@ struct otx2_eth_dev {uint64_t tx_offloads;uint64_t rx_offload_capa;uint64_t tx_offload_capa; +struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ];struct otx2_rss_info rss_info;struct otx2_npc_flow_info npc_flow; } __rte_cache_aligned;
@@ -163,7 +170,9 @@ void otx2_nix_info_get(struct rte_eth_dev *eth_dev,/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev); +int oxt2_nix_register_queue_irqs (struct rte_eth_dev *eth_dev);void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev); +void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev);/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_irq.c +191 -0
197 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v2 9/57 net/octeontx2: add context debug utils
In reply to [email protected]From: Jerin Jacob <[email protected]>
Add RQ,SQ,CQ context and CQE structure dump utils.
--- doc/guides/nics/octeontx2.rst | 2 +- drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_ethdev_debug.c | 272 ++++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_irq.c | 6 + 6 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 drivers/net/octeontx2/otx2_ethdev_debug.c
doc/guides/nics/octeontx2.rst +1 -1
@@ -18,7 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - SR-IOV VF - Lock-free Tx queue -- Debug utilities - error interrupt support +- Debug utilities - Context dump and error interrupt support Prerequisites -------------
drivers/net/octeontx2/Makefile +1 -0
@@ -32,6 +32,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_ethdev.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \ + otx2_ethdev_debug.c \ otx2_ethdev_devargs.c LDLIBS += -lrte_common_octeontx2 -lrte_mempool_octeontx2 -lrte_eal
drivers/net/octeontx2/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = files( 'otx2_ethdev.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c', + 'otx2_ethdev_debug.c', 'otx2_ethdev_devargs.c' )
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -174,6 +174,10 @@ int oxt2_nix_register_queue_irqs(struct rte_eth_dev *eth_dev);void otx2_nix_unregister_irqs (struct rte_eth_dev *eth_dev);void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev); +/* Debug */ +int otx2_nix_queues_ctx_dump (struct rte_eth_dev *eth_dev); +void otx2_nix_cqe_dump (const struct nix_cqe_hdr_s *cq); +/* CGX */ int otx2_cgx_rxtx_start (struct otx2_eth_dev *dev);int otx2_cgx_rxtx_stop (struct otx2_eth_dev *dev);
drivers/net/octeontx2/otx2_ethdev_debug.c new file +272 -0
272 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +6 -0
@@ -23,6 +23,8 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); + +otx2_nix_queues_ctx_dump (eth_dev); } static int
@@ -75,6 +77,8 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); + +otx2_nix_queues_ctx_dump (eth_dev); } static int
@@ -232,6 +236,8 @@ nix_lf_q_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); + +otx2_nix_queues_ctx_dump (eth_dev); }int
Signature · 1 line
2.21.0
PATCH v2 10/57 net/octeontx2: add register dump support
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Add register dump support and mark Registers dump in features.
--- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/features/octeontx2_vec.ini | 1 + doc/guides/nics/features/octeontx2_vf.ini | 1 + drivers/net/octeontx2/otx2_ethdev.c | 1 + drivers/net/octeontx2/otx2_ethdev.h | 3 + drivers/net/octeontx2/otx2_ethdev_debug.c | 228 +++++++++++++++++++++ drivers/net/octeontx2/otx2_ethdev_irq.c | 6 + 7 files changed, 241 insertions(+)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -8,6 +8,7 @@ Speed capabilities = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Registers dump = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y
doc/guides/nics/features/octeontx2_vec.ini +1 -0
@@ -8,6 +8,7 @@ Speed capabilities = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Registers dump = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y
doc/guides/nics/features/octeontx2_vf.ini +1 -0
@@ -7,6 +7,7 @@ Speed capabilities = Y Lock-free Tx queue = Y Multiprocess aware = Y +Registers dump = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y
drivers/net/octeontx2/otx2_ethdev.c +1 -0
@@ -229,6 +229,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, + .get_reg = otx2_nix_dev_get_reg, }; static inline int
drivers/net/octeontx2/otx2_ethdev.h +3 -0
@@ -175,6 +175,9 @@ void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);void oxt2_nix_unregister_queue_irqs (struct rte_eth_dev *eth_dev);/* Debug */ +int otx2_nix_reg_dump (struct otx2_eth_dev *dev,uint64_t *data); +int otx2_nix_dev_get_reg (struct rte_eth_dev *eth_dev, +struct rte_dev_reg_info *regs);int otx2_nix_queues_ctx_dump (struct rte_eth_dev *eth_dev);void otx2_nix_cqe_dump (const struct nix_cqe_hdr_s *cq);
drivers/net/octeontx2/otx2_ethdev_debug.c +228 -0
234 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +6 -0
@@ -24,6 +24,8 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_ERR_INT ); +/* Dump registers to std out */ +otx2_nix_reg_dump (dev,NULL );otx2_nix_queues_ctx_dump (eth_dev); }
@@ -78,6 +80,8 @@ nix_lf_ras_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_RAS ); +/* Dump registers to std out */ +otx2_nix_reg_dump (dev,NULL );otx2_nix_queues_ctx_dump (eth_dev); }
@@ -237,6 +241,8 @@ nix_lf_q_irq(void *param)/* Clear interrupt */ otx2_write64 (intr, dev->base +NIX_LF_QINTX_INT (qintx)); +/* Dump registers to std out */ +otx2_nix_reg_dump (dev,NULL );otx2_nix_queues_ctx_dump (eth_dev); }
Signature · 1 line
2.21.0
PATCH v2 11/57 net/octeontx2: add link stats operations
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Add link stats related operations and mark respective items in the documentation.
--- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/features/octeontx2_vf.ini | 2 + doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/Makefile | 1 + drivers/net/octeontx2/meson.build | 1 + drivers/net/octeontx2/otx2_ethdev.c | 8 ++ drivers/net/octeontx2/otx2_ethdev.h | 8 ++ drivers/net/octeontx2/otx2_link.c | 108 +++++++++++++++++++++ 9 files changed, 133 insertions(+) create mode 100644 drivers/net/octeontx2/otx2_link.c
doc/guides/nics/features/octeontx2.ini +2 -0
@@ -8,6 +8,8 @@ Speed capabilities = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Link status = Y +Link status event = Y Registers dump = Y Linux VFIO = Y ARMv8 = Y
doc/guides/nics/features/octeontx2_vec.ini +2 -0
@@ -8,6 +8,8 @@ Speed capabilities = Y Lock-free Tx queue = Y SR-IOV = Y Multiprocess aware = Y +Link status = Y +Link status event = Y Registers dump = Y Linux VFIO = Y ARMv8 = Y
doc/guides/nics/features/octeontx2_vf.ini +2 -0
@@ -7,6 +7,8 @@ Speed capabilities = Y Lock-free Tx queue = Y Multiprocess aware = Y +Link status = Y +Link status event = Y Registers dump = Y Linux VFIO = Y ARMv8 = Y
doc/guides/nics/octeontx2.rst +1 -0
@@ -18,6 +18,7 @@ Features of the OCTEON TX2 Ethdev PMD are: - SR-IOV VF - Lock-free Tx queue +- Link state information - Debug utilities - Context dump and error interrupt support Prerequisites
drivers/net/octeontx2/Makefile +1 -0
@@ -29,6 +29,7 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \ otx2_mac.c \ + otx2_link.c \ otx2_ethdev.c \ otx2_ethdev_irq.c \ otx2_ethdev_ops.c \
drivers/net/octeontx2/meson.build +1 -0
@@ -4,6 +4,7 @@ sources = files( 'otx2_mac.c', + 'otx2_link.c', 'otx2_ethdev.c', 'otx2_ethdev_irq.c', 'otx2_ethdev_ops.c',
drivers/net/octeontx2/otx2_ethdev.c +8 -0
@@ -39,6 +39,10 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)return NIX_TX_OFFLOAD_CAPA ; } +static const struct otx2_dev_ops otx2_dev_ops = { + .link_status_update = otx2_eth_dev_link_status_update, +}; +static int nix_lf_alloc (struct otx2_eth_dev *dev,uint32_t nb_rxq,uint32_t nb_txq) {
@@ -229,6 +233,7 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)static const struct eth_dev_ops otx2_eth_dev_ops = { .dev_infos_get = otx2_nix_info_get, .dev_configure = otx2_nix_configure, + .link_update = otx2_nix_link_update, .get_reg = otx2_nix_dev_get_reg, };
@@ -324,6 +329,9 @@ otx2_eth_dev_init(struct rte_eth_dev *eth_dev) goto error; } } +/* Device generic callbacks */ + dev->ops = &otx2_dev_ops; + dev->eth_dev = eth_dev;/* Grab the NPA LF if required */ rc =otx2_npa_lf_init (pci_dev, dev);
drivers/net/octeontx2/otx2_ethdev.h +8 -0
@@ -136,6 +136,7 @@ struct otx2_eth_dev {uint8_t max_mac_entries;uint8_t lf_tx_stats;uint8_t lf_rx_stats; +uint16_t flags;uint16_t cints;uint16_t qints;uint8_t configured;
@@ -156,6 +157,7 @@ struct otx2_eth_dev {struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT ];struct otx2_rss_info rss_info;struct otx2_npc_flow_info npc_flow; +struct rte_eth_dev *eth_dev; } __rte_cache_aligned; static inline struct otx2_eth_dev *
@@ -168,6 +170,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)void otx2_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *dev_info); +/* Link */ +void otx2_nix_toggle_flag_link_cfg (struct otx2_eth_dev *dev,bool set); +int otx2_nix_link_update (struct rte_eth_dev *eth_dev,int wait_to_complete); +void otx2_eth_dev_link_status_update (struct otx2_dev *dev, +struct cgx_link_user_info *link); +/* IRQ */ int otx2_nix_register_irqs (struct rte_eth_dev *eth_dev);int oxt2_nix_register_queue_irqs (struct rte_eth_dev *eth_dev);
drivers/net/octeontx2/otx2_link.c new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
2.21.0