Skip to contentSkip to conversation

OCTEON TX2 common and mempool driver

PATCH Superseded [email protected] 6 participants 122 messages May 23, 2019 – Jun 26, 2019 Arm/Amlogic Meson SoC support Page 1 of 3

lore
Share & tools
lore
#0 lore raw

cover OCTEON TX2 common and mempool driver

From: Jerin Jacob <[email protected]>

This patch set adds initial driver support for OCTEON TX2 SoC.

OCTEON TX2 is an armv8.2 SoC with integrated HW based mempool, ethdev, cryptodev, compressdev, and eventdev devices.

This patch set adds common driver and mempool device driver for OCTEON TX2 SoC. There will be three more patch series in this release
to support ethdev, eventdev and cryptodev devices

More details about the OCTEON TX2 platform may found in [PATCH 15/27] doc: add Marvell OCTEON TX2 platform guide under doc/guides/platform/octeontx2.rst file.

This patches series also available at https://github.com/jerinjacobk/dpdk.git
for quick download and review.

# Note on check patch issues
1) The mailbox prototype is the same as Linux kernel.
https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/marvell/octeontx2/af/mbox.h#L123
In order to keep the base code intact, mailbox prototype expressed as macros with warnings
2) There are a few warnings from tooling about expected to add new symbols in the EXPERIMENTAL
section. Since these API will be called only by octeontx2 client drivers and prototype are not exported to the application, those warnings are not relevant, Discussion at http://patches.dpdk.org/patch/53590/

Jerin Jacob (22):
common/octeontx2: add build infrastructure and HW definition common/octeontx2: add IO handling APIs common/octeontx2: add mbox request and response definition common/octeontx2: add mailbox base support infra common/octeontx2: add runtime log infra common/octeontx2: add mailbox send and receive support common/octeontx2: introduce common device class common/octeontx2: introduce irq handling functions common/octeontx2: handle intra device operations common/octeontx2: add VF mailbox IRQ and msg handler
doc: add Marvell OCTEON TX2 platform guide mempool/octeontx2: add build infra and device probe
drivers: add init and fini on octeontx2 NPA object mempool/octeontx2: add NPA HW operations mempool/octeontx2: add NPA IRQ handler mempool/octeontx2: add context dump support mempool/octeontx2: add mempool alloc op mempool/octeontx2: add mempool free op mempool/octeontx2: add remaining slow path ops mempool/octeontx2: add fast path mempool ops mempool/octeontx2: add devargs for max pool selection
doc: add Marvell OCTEON TX2 mempool documentation

Nithin Dabilpuram (4):
common/octeontx2: add AF to PF mailbox IRQ and msg handlers common/octeontx2: add PF to VF mailbox IRQ and msg handlers common/octeontx2: add uplink message support common/octeontx2: add FLR IRQ handler

Pavan Nikhilesh (1):
mempool/octeontx2: add optimized dequeue operation for arm64

 MAINTAINERS                                   |   10 +
 config/common_base                            |    5 +
 doc/guides/mempool/index.rst                  |    1 +
 doc/guides/mempool/octeontx2.rst              |   90 +
 .../octeontx2_packet_flow_hw_accelerators.svg | 2804 +++++++++++++++++
 .../img/octeontx2_resource_virtualization.svg | 2418 ++++++++++++++
 doc/guides/platform/index.rst                 |    1 +
 doc/guides/platform/octeontx2.rst             |  237 ++
 doc/guides/rel_notes/release_19_08.rst        |    2 +
 drivers/common/Makefile                       |    5 +
 drivers/common/meson.build                    |    2 +-
 drivers/common/octeontx2/Makefile             |   37 +
 drivers/common/octeontx2/hw/otx2_nix.h        | 1376 ++++++++
 drivers/common/octeontx2/hw/otx2_npa.h        |  305 ++
 drivers/common/octeontx2/hw/otx2_npc.h        |  467 +++
 drivers/common/octeontx2/hw/otx2_rvu.h        |  212 ++
 drivers/common/octeontx2/hw/otx2_sso.h        |  209 ++
 drivers/common/octeontx2/hw/otx2_ssow.h       |   56 +
 drivers/common/octeontx2/hw/otx2_tim.h        |   34 +
 drivers/common/octeontx2/meson.build          |   25 +
 drivers/common/octeontx2/otx2_common.c        |  240 ++
 drivers/common/octeontx2/otx2_common.h        |  118 +
 drivers/common/octeontx2/otx2_dev.c           | 1052 +++++++
 drivers/common/octeontx2/otx2_dev.h           |   97 +
 drivers/common/octeontx2/otx2_io_arm64.h      |   95 +
 drivers/common/octeontx2/otx2_io_generic.h    |   63 +
 drivers/common/octeontx2/otx2_irq.c           |  254 ++
 drivers/common/octeontx2/otx2_irq.h           |   25 +
 drivers/common/octeontx2/otx2_mbox.c          |  416 +++
 drivers/common/octeontx2/otx2_mbox.h          | 1477 +++++++++
 .../rte_common_octeontx2_version.map          |   38 +
 drivers/mempool/Makefile                      |    1 +
 drivers/mempool/meson.build                   |    2 +-
 drivers/mempool/octeontx2/Makefile            |   39 +
 drivers/mempool/octeontx2/meson.build         |   23 +
 drivers/mempool/octeontx2/otx2_mempool.c      |  438 +++
 drivers/mempool/octeontx2/otx2_mempool.h      |  208 ++
 .../mempool/octeontx2/otx2_mempool_debug.c    |  135 +
 drivers/mempool/octeontx2/otx2_mempool_irq.c  |  308 ++
 drivers/mempool/octeontx2/otx2_mempool_ops.c  |  760 +++++
 .../rte_mempool_octeontx2_version.map         |    8 +
 mk/rte.app.mk                                 |    6 +
 42 files changed, 14097 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/mempool/octeontx2.rst
 create mode 100644 doc/guides/platform/img/octeontx2_packet_flow_hw_accelerators.svg
 create mode 100644 doc/guides/platform/img/octeontx2_resource_virtualization.svg
 create mode 100644 doc/guides/platform/octeontx2.rst
 create mode 100644 drivers/common/octeontx2/Makefile
 create mode 100644 drivers/common/octeontx2/hw/otx2_nix.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npa.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npc.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_rvu.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_sso.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_ssow.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_tim.h
 create mode 100644 drivers/common/octeontx2/meson.build
 create mode 100644 drivers/common/octeontx2/otx2_common.c
 create mode 100644 drivers/common/octeontx2/otx2_common.h
 create mode 100644 drivers/common/octeontx2/otx2_dev.c
 create mode 100644 drivers/common/octeontx2/otx2_dev.h
 create mode 100644 drivers/common/octeontx2/otx2_io_arm64.h
 create mode 100644 drivers/common/octeontx2/otx2_io_generic.h
 create mode 100644 drivers/common/octeontx2/otx2_irq.c
 create mode 100644 drivers/common/octeontx2/otx2_irq.h
 create mode 100644 drivers/common/octeontx2/otx2_mbox.c
 create mode 100644 drivers/common/octeontx2/otx2_mbox.h
 create mode 100644 drivers/common/octeontx2/rte_common_octeontx2_version.map
 create mode 100644 drivers/mempool/octeontx2/Makefile
 create mode 100644 drivers/mempool/octeontx2/meson.build
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool.c
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool.h
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_debug.c
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_irq.c
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_ops.c
 create mode 100644 drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/27 common/octeontx2: add build infrastructure and HW definition

From: Jerin Jacob <[email protected]>

Add the make and meson based build infrastructure along with HW definition header file.

This patch adds skeleton otx2_mbox.c file to make sure all header files are intact, subsequent patches add content to otx2_mbox.c

---
 drivers/common/Makefile                       |    2 +
 drivers/common/meson.build                    |    2 +-
 drivers/common/octeontx2/Makefile             |   32 +
 drivers/common/octeontx2/hw/otx2_nix.h        | 1376 +++++++++++++++++
 drivers/common/octeontx2/hw/otx2_npa.h        |  305 ++++
 drivers/common/octeontx2/hw/otx2_npc.h        |  467 ++++++
 drivers/common/octeontx2/hw/otx2_rvu.h        |  212 +++
 drivers/common/octeontx2/hw/otx2_sso.h        |  209 +++
 drivers/common/octeontx2/hw/otx2_ssow.h       |   56 +
 drivers/common/octeontx2/hw/otx2_tim.h        |   34 +
 drivers/common/octeontx2/meson.build          |   23 +
 drivers/common/octeontx2/otx2_common.h        |   34 +
 drivers/common/octeontx2/otx2_mbox.c          |    5 +
 drivers/common/octeontx2/otx2_mbox.h          |   10 +
 .../rte_common_octeontx2_version.map          |    4 +
 mk/rte.app.mk                                 |    2 +
 16 files changed, 2772 insertions(+), 1 deletion(-)
 create mode 100644 drivers/common/octeontx2/Makefile
 create mode 100644 drivers/common/octeontx2/hw/otx2_nix.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npa.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npc.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_rvu.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_sso.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_ssow.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_tim.h
 create mode 100644 drivers/common/octeontx2/meson.build
 create mode 100644 drivers/common/octeontx2/otx2_common.h
 create mode 100644 drivers/common/octeontx2/otx2_mbox.c
 create mode 100644 drivers/common/octeontx2/otx2_mbox.h
 create mode 100644 drivers/common/octeontx2/rte_common_octeontx2_version.map
drivers/common/Makefile +2 -0
index 87b8a59a4..e7abe210e 100644
@@ -23,4 +23,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y)
 DIRS-y += dpaax
 endif
 
+DIRS-y += octeontx2
+
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/common/meson.build +1 -1
index a50934108..7b5e566f3 100644
@@ -2,6 +2,6 @@
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['cpt', 'dpaax', 'mvep', 'octeontx', 'qat']
+drivers = ['cpt', 'dpaax', 'mvep', 'octeontx', 'octeontx2', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
drivers/common/octeontx2/Makefile new file +32 -0
new file mode 100644
index 000000000..e5737532a
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_common_octeontx2.a
+
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+
+ifneq ($(CONFIG_RTE_ARCH_64),y)
+CFLAGS += -Wno-int-to-pointer-cast
+CFLAGS += -Wno-pointer-to-int-cast
+endif
+
+EXPORT_MAP := rte_common_octeontx2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += otx2_mbox.c
+
+LDLIBS += -lrte_eal
+LDLIBS += -lrte_ethdev
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/common/octeontx2/hw/otx2_nix.h new file +1376 -0

1,376 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_npa.h new file +305 -0

305 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_npc.h new file +467 -0

467 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_rvu.h new file +212 -0

212 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_sso.h new file +209 -0

209 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_ssow.h new file +56 -0

56 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_tim.h new file +34 -0
new file mode 100644
index 000000000..41442ad0a
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_TIM_HW_H__
+#define __OTX2_TIM_HW_H__
+
+/* TIM */
+#define TIM_AF_CONST                    (0x90)
+#define TIM_PRIV_LFX_CFG(a)             (0x20000 | (a) << 3)
+#define TIM_PRIV_LFX_INT_CFG(a)         (0x24000 | (a) << 3)
+#define TIM_AF_RVU_LF_CFG_DEBUG         (0x30000)
+#define TIM_AF_BLK_RST                  (0x10)
+#define TIM_AF_LF_RST                   (0x20)
+#define TIM_AF_BLK_RST                  (0x10)
+#define TIM_AF_RINGX_GMCTL(a)           (0x2000 | (a) << 3)
+#define TIM_AF_RINGX_CTL0(a)            (0x4000 | (a) << 3)
+#define TIM_AF_RINGX_CTL1(a)            (0x6000 | (a) << 3)
+#define TIM_AF_RINGX_CTL2(a)            (0x8000 | (a) << 3)
+#define TIM_AF_FLAGS_REG                (0x80)
+#define TIM_AF_FLAGS_REG_ENA_TIM        BIT_ULL(0)
+#define TIM_AF_RINGX_CTL1_ENA           BIT_ULL(47)
+#define TIM_AF_RINGX_CTL1_RCF_BUSY      BIT_ULL(50)
+#define TIM_AF_RINGX_CLT1_CLK_10NS      (0)
+#define TIM_AF_RINGX_CLT1_CLK_GPIO      (1)
+#define TIM_AF_RINGX_CLT1_CLK_GTI       (2)
+#define TIM_AF_RINGX_CLT1_CLK_PTP       (3)
+
+/* ENUMS */
+
+#define TIM_LF_INT_VEC_NRSPERR_INT	(0x0ull)
+#define TIM_LF_INT_VEC_RAS_INT		(0x1ull)
+
+#endif /* __OTX2_TIM_HW_H__ */
drivers/common/octeontx2/meson.build new file +23 -0
new file mode 100644
index 000000000..34f8aaea7
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+sources= files(
+		'otx2_mbox.c',
+	       )
+
+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
+
+deps = ['eal', 'ethdev']
+includes += include_directories('../../common/octeontx2',
+		'../../bus/pci')
drivers/common/octeontx2/otx2_common.h new file +34 -0
new file mode 100644
index 000000000..b4e008b14
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_COMMON_H_
+#define _OTX2_COMMON_H_
+
+#include <rte_common.h>
+
+#include "hw/otx2_rvu.h"
+#include "hw/otx2_nix.h"
+#include "hw/otx2_npc.h"
+#include "hw/otx2_npa.h"
+#include "hw/otx2_sso.h"
+#include "hw/otx2_ssow.h"
+#include "hw/otx2_tim.h"
+
+/* Alignment */
+#define OTX2_ALIGN  128
+
+/* Bits manipulation */
+#ifndef BIT_ULL
+#define BIT_ULL(nr) (1ULL << (nr))
+#endif
+#ifndef BIT
+#define BIT(nr)     (1UL << (nr))
+#endif
+
+/* Compiler attributes */
+#ifndef __hot
+#define __hot   __attribute__((hot))
+#endif
+
+#endif /* _OTX2_COMMON_H_ */
drivers/common/octeontx2/otx2_mbox.c new file +5 -0
new file mode 100644
index 000000000..c9cdbdbbc
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#include "otx2_mbox.h"
drivers/common/octeontx2/otx2_mbox.h new file +10 -0
new file mode 100644
index 000000000..6d7b77ed9
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_MBOX_H__
+#define __OTX2_MBOX_H__
+
+#include <otx2_common.h>
+
+#endif /* __OTX2_MBOX_H__ */
drivers/common/octeontx2/rte_common_octeontx2_version.map new file +4 -0
new file mode 100644
index 000000000..fc8c95e91
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
mk/rte.app.mk +2 -0
index 7c9b4b538..1e9dcd5a1 100644
@@ -125,6 +125,8 @@ ifeq ($(CONFIG_RTE_LIBRTE_FSLMC_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX)   += -lrte_common_dpaax
 endif
 
+_LDLIBS-y += -lrte_common_octeontx2
+
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS)        += -lrte_bus_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS)       += -lrte_bus_vdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS)       += -lrte_bus_dpaa
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/27 common/octeontx2: add IO handling APIs

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Various octeontx2 drivers use IO handling API, added octeontx2 specific IO handling routines in the common code.

Since some of those implementations are based on arm64 instructions added the stub to compile the code on non arm64 ISA.
The non arm64 ISA stub is possible due to the fact that it is an integrated controller i.e runs only on Marvell HW.

---
 drivers/common/octeontx2/otx2_common.h     | 12 +++
 drivers/common/octeontx2/otx2_io_arm64.h   | 95 ++++++++++++++++++++++
 drivers/common/octeontx2/otx2_io_generic.h | 63 ++++++++++++++
 3 files changed, 170 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_io_arm64.h
 create mode 100644 drivers/common/octeontx2/otx2_io_generic.h
drivers/common/octeontx2/otx2_common.h +12 -0
index b4e008b14..b0c19266b 100644
@@ -6,6 +6,8 @@
 #define _OTX2_COMMON_H_
 
 #include <rte_common.h>
+#include <rte_io.h>
+#include <rte_memory.h>
 
 #include "hw/otx2_rvu.h"
 #include "hw/otx2_nix.h"
@@ -31,4 +33,14 @@
 #define __hot   __attribute__((hot))
 #endif
 
+/* IO Access */
+#define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
+#define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
+
+#if defined(RTE_ARCH_ARM64)
+#include "otx2_io_arm64.h"
+#else
+#include "otx2_io_generic.h"
+#endif
+
 #endif /* _OTX2_COMMON_H_ */
drivers/common/octeontx2/otx2_io_arm64.h new file +95 -0

95 lines not on this page · raw message

drivers/common/octeontx2/otx2_io_generic.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.21.0
#3 lore raw

PATCH 3/27 common/octeontx2: add mbox request and response definition

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The admin function driver sits in Linux kernel as mailbox server. The DPDK AF mailbox client, send the message to mailbox server to complete the administrative task such as get mac address.

This patch adds mailbox request and response definition of existing mailbox defined between AF driver and DPDK driver.

---
 drivers/common/octeontx2/otx2_mbox.h | 1320 ++++++++++++++++++++++++++
 1 file changed, 1320 insertions(+)
drivers/common/octeontx2/otx2_mbox.h +1320 -0
index 6d7b77ed9..cd95f4cb9 100644
@@ -5,6 +5,1326 @@
 #ifndef __OTX2_MBOX_H__
 #define __OTX2_MBOX_H__
 
+#include <errno.h>
+#include <stdbool.h>
+
+#include <rte_ether.h>
+#include <rte_spinlock.h>
+
 #include <otx2_common.h>
 
+#define SZ_64K			(64 * 1024)
+#define SZ_1K			(1 * 1024)
+#define MBOX_SIZE		SZ_64K
+
+/* AF/PF: PF initiated, PF/VF VF initiated */
+#define MBOX_DOWN_RX_START	0
+#define MBOX_DOWN_RX_SIZE	(46 * SZ_1K)
+#define MBOX_DOWN_TX_START	(MBOX_DOWN_RX_START + MBOX_DOWN_RX_SIZE)
+#define MBOX_DOWN_TX_SIZE	(16 * SZ_1K)
+/* AF/PF: AF initiated, PF/VF PF initiated */
+#define MBOX_UP_RX_START	(MBOX_DOWN_TX_START + MBOX_DOWN_TX_SIZE)
+#define MBOX_UP_RX_SIZE		SZ_1K
+#define MBOX_UP_TX_START	(MBOX_UP_RX_START + MBOX_UP_RX_SIZE)
+#define MBOX_UP_TX_SIZE		SZ_1K
+
+#if MBOX_UP_TX_SIZE + MBOX_UP_TX_START != MBOX_SIZE
+# error "Incorrect mailbox area sizes"
+#endif
+
+#define INTR_MASK(pfvfs) ((pfvfs < 64) ? (BIT_ULL(pfvfs) - 1) : (~0ull))
+
+#define MBOX_RSP_TIMEOUT	3000 /* Time to wait for mbox response in ms */
+
+#define MBOX_MSG_ALIGN		16  /* Align mbox msg start to 16bytes */
+
+/* Mailbox directions */
+#define MBOX_DIR_AFPF		0  /* AF replies to PF */
+#define MBOX_DIR_PFAF		1  /* PF sends messages to AF */
+#define MBOX_DIR_PFVF		2  /* PF replies to VF */
+#define MBOX_DIR_VFPF		3  /* VF sends messages to PF */
+#define MBOX_DIR_AFPF_UP	4  /* AF sends messages to PF */
+#define MBOX_DIR_PFAF_UP	5  /* PF replies to AF */
+#define MBOX_DIR_PFVF_UP	6  /* PF sends messages to VF */
+#define MBOX_DIR_VFPF_UP	7  /* VF replies to PF */
+
+/* Device memory does not support unaligned access, instruct compiler to
+ * not optimize the memory access when working with mailbox memory.
+ */
+#define __otx2_io volatile
+
+struct otx2_mbox_dev {
+	void	    *mbase;   /* This dev's mbox region */
+	rte_spinlock_t  mbox_lock;
+	uint16_t     msg_size; /* Total msg size to be sent */
+	uint16_t     rsp_size; /* Total rsp size to be sure the reply is ok */
+	uint16_t     num_msgs; /* No of msgs sent or waiting for response */
+	uint16_t     msgs_acked; /* No of msgs for which response is received */
+};
+
+struct otx2_mbox {
+	uintptr_t hwbase;  /* Mbox region advertised by HW */
+	uintptr_t reg_base;/* CSR base for this dev */
+	uint64_t trigger;  /* Trigger mbox notification */
+	uint16_t tr_shift; /* Mbox trigger shift */
+	uint64_t rx_start; /* Offset of Rx region in mbox memory */
+	uint64_t tx_start; /* Offset of Tx region in mbox memory */
+	uint16_t rx_size;  /* Size of Rx region */
+	uint16_t tx_size;  /* Size of Tx region */
+	uint16_t ndevs;    /* The number of peers */
+	struct otx2_mbox_dev *dev;
+};
+
+/* Header which precedes all mbox messages */
+struct mbox_hdr {
+	uint64_t __otx2_io msg_size;   /* Total msgs size embedded */
+	uint16_t __otx2_io num_msgs;   /* No of msgs embedded */
+};
+
+/* Header which precedes every msg and is also part of it */
+struct mbox_msghdr {
+	uint16_t __otx2_io pcifunc; /* Who's sending this msg */
+	uint16_t __otx2_io id;      /* Mbox message ID */
+#define OTX2_MBOX_REQ_SIG (0xdead)
+#define OTX2_MBOX_RSP_SIG (0xbeef)
+	/* Signature, for validating corrupted msgs */
+	uint16_t __otx2_io sig;
+#define OTX2_MBOX_VERSION (0x0001)
+	/* Version of msg's structure for this ID */
+	uint16_t __otx2_io ver;
+	/* Offset of next msg within mailbox region */
+	uint16_t __otx2_io next_msgoff;
+	int __otx2_io rc; /* Msg processed response code */
+};
+
+/* Mailbox message types */
+#define MBOX_MSG_MASK				0xFFFF
+#define MBOX_MSG_INVALID			0xFFFE
+#define MBOX_MSG_MAX				0xFFFF
+
+#define MBOX_MESSAGES							\
+/* Generic mbox IDs (range 0x000 - 0x1FF) */				\
+M(READY,		0x001, ready, msg_req, ready_msg_rsp)		\
+M(ATTACH_RESOURCES,	0x002, attach_resources, rsrc_attach_req, msg_rsp)\
+M(DETACH_RESOURCES,	0x003, detach_resources, rsrc_detach_req, msg_rsp)\
+M(FREE_RSRC_CNT,	0x004, free_rsrc_cnt, msg_req, free_rsrcs_rsp)	\
+M(MSIX_OFFSET,		0x005, msix_offset, msg_req, msix_offset_rsp)	\
+M(VF_FLR,		0x006, vf_flr, msg_req, msg_rsp)		\
+M(PTP_OP,		0x007, ptp_op, ptp_req, ptp_rsp)		\
+M(GET_HW_CAP,		0x008, get_hw_cap, msg_req, get_hw_cap_rsp)	\
+M(NDC_SYNC_OP,		0x009, ndc_sync_op, ndc_sync_op, msg_rsp)	\
+/* CGX mbox IDs (range 0x200 - 0x3FF) */				\
+M(CGX_START_RXTX,	0x200, cgx_start_rxtx, msg_req, msg_rsp)	\
+M(CGX_STOP_RXTX,	0x201, cgx_stop_rxtx, msg_req, msg_rsp)		\
+M(CGX_STATS,		0x202, cgx_stats, msg_req, cgx_stats_rsp)	\
+M(CGX_MAC_ADDR_SET,	0x203, cgx_mac_addr_set, cgx_mac_addr_set_or_get,\
+				cgx_mac_addr_set_or_get)		\
+M(CGX_MAC_ADDR_GET,	0x204, cgx_mac_addr_get, cgx_mac_addr_set_or_get,\
+				cgx_mac_addr_set_or_get)		\
+M(CGX_PROMISC_ENABLE,	0x205, cgx_promisc_enable, msg_req, msg_rsp)	\
+M(CGX_PROMISC_DISABLE,	0x206, cgx_promisc_disable, msg_req, msg_rsp)	\
+M(CGX_START_LINKEVENTS, 0x207, cgx_start_linkevents, msg_req, msg_rsp)	\
+M(CGX_STOP_LINKEVENTS,	0x208, cgx_stop_linkevents, msg_req, msg_rsp)	\
+M(CGX_GET_LINKINFO,	0x209, cgx_get_linkinfo, msg_req, cgx_link_info_msg)\
+M(CGX_INTLBK_ENABLE,	0x20A, cgx_intlbk_enable, msg_req, msg_rsp)	\
+M(CGX_INTLBK_DISABLE,	0x20B, cgx_intlbk_disable, msg_req, msg_rsp)	\
+M(CGX_PTP_RX_ENABLE,	0x20C, cgx_ptp_rx_enable, msg_req, msg_rsp)	\
+M(CGX_PTP_RX_DISABLE,	0x20D, cgx_ptp_rx_disable, msg_req, msg_rsp)	\
+M(CGX_CFG_PAUSE_FRM,	0x20E, cgx_cfg_pause_frm, cgx_pause_frm_cfg,	\
+				cgx_pause_frm_cfg)			\
+M(CGX_FW_DATA_GET,	0x20F, cgx_get_aux_link_info, msg_req, cgx_fw_data) \
+M(CGX_MAC_ADDR_ADD,     0x211, cgx_mac_addr_add, cgx_mac_addr_add_req,	\
+				cgx_mac_addr_add_rsp)			\
+M(CGX_MAC_ADDR_DEL,     0x212, cgx_mac_addr_del, cgx_mac_addr_del_req,	\
+				msg_rsp)				\
+M(CGX_MAC_MAX_ENTRIES_GET, 0x213, cgx_mac_max_entries_get, msg_req,	\
+				 cgx_max_dmac_entries_get_rsp)		\
+M(CGX_SET_LINK_STATE,	0x214, cgx_set_link_state,		\
+			cgx_set_link_state_msg, msg_rsp)		\
+/* NPA mbox IDs (range 0x400 - 0x5FF) */				\
+M(NPA_LF_ALLOC,		0x400, npa_lf_alloc, npa_lf_alloc_req,		\
+				npa_lf_alloc_rsp)			\
+M(NPA_LF_FREE,		0x401, npa_lf_free, msg_req, msg_rsp)		\
+M(NPA_AQ_ENQ,		0x402, npa_aq_enq, npa_aq_enq_req, npa_aq_enq_rsp)\
+M(NPA_HWCTX_DISABLE,	0x403, npa_hwctx_disable, hwctx_disable_req, msg_rsp)\
+/* SSO/SSOW mbox IDs (range 0x600 - 0x7FF) */				\
+M(SSO_LF_ALLOC,		0x600, sso_lf_alloc, sso_lf_alloc_req,		\
+				sso_lf_alloc_rsp)			\
+M(SSO_LF_FREE,		0x601, sso_lf_free, sso_lf_free_req, msg_rsp)	\
+M(SSOW_LF_ALLOC,	0x602, ssow_lf_alloc, ssow_lf_alloc_req, msg_rsp)\
+M(SSOW_LF_FREE,		0x603, ssow_lf_free, ssow_lf_free_req, msg_rsp)	\
+M(SSO_HW_SETCONFIG,	0x604, sso_hw_setconfig, sso_hw_setconfig,	\
+				msg_rsp)				\
+M(SSO_GRP_SET_PRIORITY,	0x605, sso_grp_set_priority, sso_grp_priority,	\
+				msg_rsp)				\
+M(SSO_GRP_GET_PRIORITY,	0x606, sso_grp_get_priority, sso_info_req,	\
+				sso_grp_priority)			\
+M(SSO_WS_CACHE_INV,	0x607, sso_ws_cache_inv, msg_req, msg_rsp)	\
+M(SSO_GRP_QOS_CONFIG,	0x608, sso_grp_qos_config, sso_grp_qos_cfg,	\
+				msg_rsp)				\
+M(SSO_GRP_GET_STATS,	0x609, sso_grp_get_stats, sso_info_req,		\
+				sso_grp_stats)				\
+M(SSO_HWS_GET_STATS,	0x610, sso_hws_get_stats, sso_info_req,		\
+				sso_hws_stats)				\
+/* TIM mbox IDs (range 0x800 - 0x9FF) */				\
+M(TIM_LF_ALLOC,		0x800, tim_lf_alloc, tim_lf_alloc_req,		\
+				tim_lf_alloc_rsp)			\
+M(TIM_LF_FREE,		0x801, tim_lf_free, tim_ring_req, msg_rsp)	\
+M(TIM_CONFIG_RING,	0x802, tim_config_ring, tim_config_req, msg_rsp)\
+M(TIM_ENABLE_RING,	0x803, tim_enable_ring, tim_ring_req,		\
+				tim_enable_rsp)				\
+M(TIM_DISABLE_RING,	0x804, tim_disable_ring, tim_ring_req, msg_rsp)	\
+/* CPT mbox IDs (range 0xA00 - 0xBFF) */				\
+M(CPT_RD_WR_REGISTER,	0xA02, cpt_rd_wr_register, cpt_rd_wr_reg_msg,	\
+			       cpt_rd_wr_reg_msg)			\
+M(CPT_INLINE_IPSEC_CFG, 0xA04, cpt_inline_ipsec_cfg,			\
+			       cpt_inline_ipsec_cfg_msg, msg_rsp)	\
+/* NPC mbox IDs (range 0x6000 - 0x7FFF) */				\
+M(NPC_MCAM_ALLOC_ENTRY,	0x6000, npc_mcam_alloc_entry,			\
+				npc_mcam_alloc_entry_req,		\
+				npc_mcam_alloc_entry_rsp)		\
+M(NPC_MCAM_FREE_ENTRY,	0x6001, npc_mcam_free_entry,			\
+				npc_mcam_free_entry_req, msg_rsp)	\
+M(NPC_MCAM_WRITE_ENTRY,	0x6002, npc_mcam_write_entry,			\
+				npc_mcam_write_entry_req, msg_rsp)	\
+M(NPC_MCAM_ENA_ENTRY,	0x6003, npc_mcam_ena_entry,			\
+				npc_mcam_ena_dis_entry_req, msg_rsp)	\
+M(NPC_MCAM_DIS_ENTRY,	0x6004, npc_mcam_dis_entry,			\
+				npc_mcam_ena_dis_entry_req, msg_rsp)	\
+M(NPC_MCAM_SHIFT_ENTRY,	0x6005, npc_mcam_shift_entry,			\
+				npc_mcam_shift_entry_req,		\
+				npc_mcam_shift_entry_rsp)		\
+M(NPC_MCAM_ALLOC_COUNTER,	0x6006, npc_mcam_alloc_counter,		\
+				npc_mcam_alloc_counter_req,		\
+				npc_mcam_alloc_counter_rsp)		\
+M(NPC_MCAM_FREE_COUNTER,	0x6007, npc_mcam_free_counter,		\
+				npc_mcam_oper_counter_req,		\
+				msg_rsp)				\
+M(NPC_MCAM_UNMAP_COUNTER,	0x6008, npc_mcam_unmap_counter,		\
+				npc_mcam_unmap_counter_req,		\
+				msg_rsp)				\
+M(NPC_MCAM_CLEAR_COUNTER,	0x6009, npc_mcam_clear_counter,		\
+				npc_mcam_oper_counter_req,		\
+				msg_rsp)				\
+M(NPC_MCAM_COUNTER_STATS,	0x600a, npc_mcam_counter_stats,		\
+				npc_mcam_oper_counter_req,		\
+				npc_mcam_oper_counter_rsp)		\
+M(NPC_MCAM_ALLOC_AND_WRITE_ENTRY, 0x600b, npc_mcam_alloc_and_write_entry,\
+				npc_mcam_alloc_and_write_entry_req,	\
+				npc_mcam_alloc_and_write_entry_rsp)	\
+M(NPC_GET_KEX_CFG,	  0x600c, npc_get_kex_cfg, msg_req,		\
+				npc_get_kex_cfg_rsp)			\
+/* NIX mbox IDs (range 0x8000 - 0xFFFF) */				\
+M(NIX_LF_ALLOC,		0x8000, nix_lf_alloc, nix_lf_alloc_req,		\
+				nix_lf_alloc_rsp)			\
+M(NIX_LF_FREE,		0x8001, nix_lf_free, msg_req, msg_rsp)		\
+M(NIX_AQ_ENQ,		0x8002, nix_aq_enq, nix_aq_enq_req,		\
+				nix_aq_enq_rsp)				\
+M(NIX_HWCTX_DISABLE,	0x8003, nix_hwctx_disable, hwctx_disable_req,	\
+				msg_rsp)				\
+M(NIX_TXSCH_ALLOC,	0x8004, nix_txsch_alloc, nix_txsch_alloc_req,	\
+				nix_txsch_alloc_rsp)			\
+M(NIX_TXSCH_FREE,	0x8005, nix_txsch_free,	nix_txsch_free_req,	\
+				msg_rsp)				\
+M(NIX_TXSCHQ_CFG,	0x8006, nix_txschq_cfg, nix_txschq_config,	\
+				msg_rsp)				\
+M(NIX_STATS_RST,	0x8007, nix_stats_rst, msg_req, msg_rsp)	\
+M(NIX_VTAG_CFG,		0x8008, nix_vtag_cfg, nix_vtag_config, msg_rsp)	\
+M(NIX_RSS_FLOWKEY_CFG,	0x8009, nix_rss_flowkey_cfg,			\
+				nix_rss_flowkey_cfg,			\
+				nix_rss_flowkey_cfg_rsp)		\
+M(NIX_SET_MAC_ADDR,	0x800a, nix_set_mac_addr, nix_set_mac_addr,	\
+				msg_rsp)				\
+M(NIX_SET_RX_MODE,	0x800b, nix_set_rx_mode, nix_rx_mode, msg_rsp)	\
+M(NIX_SET_HW_FRS,	0x800c, nix_set_hw_frs,	nix_frs_cfg, msg_rsp)	\
+M(NIX_LF_START_RX,	0x800d, nix_lf_start_rx, msg_req, msg_rsp)	\
+M(NIX_LF_STOP_RX,	0x800e, nix_lf_stop_rx,	msg_req, msg_rsp)	\
+M(NIX_MARK_FORMAT_CFG,	0x800f, nix_mark_format_cfg,			\
+				nix_mark_format_cfg,			\
+				nix_mark_format_cfg_rsp)		\
+M(NIX_LSO_FORMAT_CFG,	0x8011, nix_lso_format_cfg, nix_lso_format_cfg,	\
+				nix_lso_format_cfg_rsp)			\
+M(NIX_LF_PTP_TX_ENABLE,	0x8013, nix_lf_ptp_tx_enable, msg_req,		\
+				msg_rsp)				\
+M(NIX_LF_PTP_TX_DISABLE,	0x8014, nix_lf_ptp_tx_disable, msg_req,	\
+				msg_rsp)				\
+M(NIX_SET_VLAN_TPID,	0x8015, nix_set_vlan_tpid, nix_set_vlan_tpid,	\
+				msg_rsp)				\
+M(NIX_BP_ENABLE,	0x8016, nix_bp_enable, nix_bp_cfg_req,		\
+				nix_bp_cfg_rsp)				\
+M(NIX_BP_DISABLE,	0x8017, nix_bp_disable,	nix_bp_cfg_req, msg_rsp)\
+M(NIX_GET_MAC_ADDR,	0x8018, nix_get_mac_addr, msg_req,		\
+				nix_get_mac_addr_rsp)			\
+M(NIX_INLINE_IPSEC_CFG,	0x8019, nix_inline_ipsec_cfg,			\
+				nix_inline_ipsec_cfg, msg_rsp)		\
+M(NIX_INLINE_IPSEC_LF_CFG,						\
+			0x801a, nix_inline_ipsec_lf_cfg,		\
+				nix_inline_ipsec_lf_cfg, msg_rsp)
+
+/* Messages initiated by AF (range 0xC00 - 0xDFF) */
+#define MBOX_UP_CGX_MESSAGES						\
+M(CGX_LINK_EVENT,	0xC00, cgx_link_event, cgx_link_info_msg,	\
+				msg_rsp)				\
+M(CGX_PTP_RX_INFO,	0xC01, cgx_ptp_rx_info, cgx_ptp_rx_info_msg,	\
+				msg_rsp)
+
+enum {
+#define M(_name, _id, _1, _2, _3) MBOX_MSG_ ## _name = _id,
+MBOX_MESSAGES
+MBOX_UP_CGX_MESSAGES
+#undef M
+};
+
+/* Mailbox message formats */
+
+#define RVU_DEFAULT_PF_FUNC     0xFFFF
+
+/* Generic request msg used for those mbox messages which
+ * don't send any data in the request.
+ */
+struct msg_req {
+	struct mbox_msghdr hdr;
+};
+
+/* Generic response msg used a ack or response for those mbox
+ * messages which doesn't have a specific rsp msg format.
+ */
+struct msg_rsp {
+	struct mbox_msghdr hdr;
+};
+
+/* RVU mailbox error codes
+ * Range 256 - 300.
+ */
+enum rvu_af_status {
+	RVU_INVALID_VF_ID           = -256,
+};
+
+struct ready_msg_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io sclk_feq;	/* SCLK frequency */
+};
+
+/* Structure for requesting resource provisioning.
+ * 'modify' flag to be used when either requesting more
+ * or detach partial of a certain resource type.
+ * Rest of the fields specify how many of what type to
+ * be attached.
+ */
+struct rsrc_attach_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io modify:1;
+	uint8_t __otx2_io npalf:1;
+	uint8_t __otx2_io nixlf:1;
+	uint16_t __otx2_io sso;
+	uint16_t __otx2_io ssow;
+	uint16_t __otx2_io timlfs;
+	uint16_t __otx2_io cptlfs;
+};
+
+/* Structure for relinquishing resources.
+ * 'partial' flag to be used when relinquishing all resources
+ * but only of a certain type. If not set, all resources of all
+ * types provisioned to the RVU function will be detached.
+ */
+struct rsrc_detach_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io partial:1;
+	uint8_t __otx2_io npalf:1;
+	uint8_t __otx2_io nixlf:1;
+	uint8_t __otx2_io sso:1;
+	uint8_t __otx2_io ssow:1;
+	uint8_t __otx2_io timlfs:1;
+	uint8_t __otx2_io cptlfs:1;
+};
+
+/* NIX Transmit schedulers */
+#define	NIX_TXSCH_LVL_SMQ 0x0
+#define	NIX_TXSCH_LVL_MDQ 0x0
+#define	NIX_TXSCH_LVL_TL4 0x1
+#define	NIX_TXSCH_LVL_TL3 0x2
+#define	NIX_TXSCH_LVL_TL2 0x3
+#define	NIX_TXSCH_LVL_TL1 0x4
+#define	NIX_TXSCH_LVL_CNT 0x5
+
+/*
+ * Number of resources available to the caller.
+ * In reply to MBOX_MSG_FREE_RSRC_CNT.
+ */
+struct free_rsrcs_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT];
+	uint16_t __otx2_io sso;
+	uint16_t __otx2_io tim;
+	uint16_t __otx2_io ssow;
+	uint16_t __otx2_io cpt;
+	uint8_t __otx2_io npa;
+	uint8_t __otx2_io nix;
+};
+
+#define MSIX_VECTOR_INVALID	0xFFFF
+#define MAX_RVU_BLKLF_CNT	256
+
+struct msix_offset_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io npa_msixoff;
+	uint16_t __otx2_io nix_msixoff;
+	uint8_t __otx2_io sso;
+	uint8_t __otx2_io ssow;
+	uint8_t __otx2_io timlfs;
+	uint8_t __otx2_io cptlfs;
+	uint16_t __otx2_io sso_msixoff[MAX_RVU_BLKLF_CNT];
+	uint16_t __otx2_io ssow_msixoff[MAX_RVU_BLKLF_CNT];
+	uint16_t __otx2_io timlf_msixoff[MAX_RVU_BLKLF_CNT];
+	uint16_t __otx2_io cptlf_msixoff[MAX_RVU_BLKLF_CNT];
+};
+
+/* CGX mbox message formats */
+struct cgx_stats_rsp {
+	struct mbox_msghdr hdr;
+#define CGX_RX_STATS_COUNT	13
+#define CGX_TX_STATS_COUNT	18
+	uint64_t __otx2_io rx_stats[CGX_RX_STATS_COUNT];
+	uint64_t __otx2_io tx_stats[CGX_TX_STATS_COUNT];
+};
+
+/* Structure for requesting the operation for
+ * setting/getting mac address in the CGX interface
+ */
+struct cgx_mac_addr_set_or_get {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[ETHER_ADDR_LEN];
+};
+
+/* Structure for requesting the operation to
+ * add DMAC filter entry into CGX interface
+ */
+struct cgx_mac_addr_add_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[ETHER_ADDR_LEN];
+};
+
+/* Structure for response against the operation to
+ * add DMAC filter entry into CGX interface
+ */
+struct cgx_mac_addr_add_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io index;
+};
+
+/* Structure for requesting the operation to
+ * delete DMAC filter entry from CGX interface
+ */
+struct cgx_mac_addr_del_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io index;
+};
+
+/* Structure for response against the operation to
+ * get maximum supported DMAC filter entries
+ */
+struct cgx_max_dmac_entries_get_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io max_dmac_filters;
+};
+
+struct cgx_link_user_info {
+	uint64_t __otx2_io link_up:1;
+	uint64_t __otx2_io full_duplex:1;
+	uint64_t __otx2_io lmac_type_id:4;
+	uint64_t __otx2_io speed:20; /* speed in Mbps */
+#define LMACTYPE_STR_LEN 16
+	char lmac_type[LMACTYPE_STR_LEN];
+};
+
+struct cgx_link_info_msg {
+	struct mbox_msghdr hdr;
+	struct cgx_link_user_info link_info;
+};
+
+struct cgx_pause_frm_cfg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io set;
+	/* set = 1 if the request is to config pause frames */
+	/* set = 0 if the request is to fetch pause frames config */
+	uint8_t __otx2_io rx_pause;
+	uint8_t __otx2_io tx_pause;
+};
+
+struct cgx_ptp_rx_info_msg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io ptp_en;
+	uint8_t __otx2_io ptp_offset;
+};
+
+struct sfp_eeprom_s {
+#define SFP_EEPROM_SIZE 256
+	uint16_t __otx2_io sff_id;
+	uint8_t __otx2_io buf[SFP_EEPROM_SIZE];
+};
+
+struct cgx_lmac_fwdata_s {
+	uint16_t __otx2_io rw_valid;
+	uint64_t __otx2_io supported_fec;
+	uint64_t __otx2_io supported_an;
+	uint64_t __otx2_io supported_link_modes;
+	/* Only applicable if AN is supported */
+	uint64_t __otx2_io advertised_fec;
+	uint64_t __otx2_io advertised_link_modes;
+	/* Only applicable if SFP/QSFP slot is present */
+	struct sfp_eeprom_s sfp_eeprom;
+};
+
+struct cgx_fw_data {
+	struct mbox_msghdr hdr;
+	struct cgx_lmac_fwdata_s fwdata;
+};
+
+struct cgx_set_link_state_msg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io enable;
+};
+
+/* NPA mbox message formats */
+
+/* NPA mailbox error codes
+ * Range 301 - 400.
+ */
+enum npa_af_status {
+	NPA_AF_ERR_PARAM            = -301,
+	NPA_AF_ERR_AQ_FULL          = -302,
+	NPA_AF_ERR_AQ_ENQUEUE       = -303,
+	NPA_AF_ERR_AF_LF_INVALID    = -304,
+	NPA_AF_ERR_AF_LF_ALLOC      = -305,
+	NIX_AF_ERR_X2P_CALIBRATE    = -398,
+	NIX_AF_ERR_RAN_OUT_BPID     = -399,
+};
+
+#define NPA_AURA_SZ_0		0
+#define NPA_AURA_SZ_128		1
+#define	NPA_AURA_SZ_256		2
+#define	NPA_AURA_SZ_512		3
+#define	NPA_AURA_SZ_1K		4
+#define	NPA_AURA_SZ_2K		5
+#define	NPA_AURA_SZ_4K		6
+#define	NPA_AURA_SZ_8K		7
+#define	NPA_AURA_SZ_16K		8
+#define	NPA_AURA_SZ_32K		9
+#define	NPA_AURA_SZ_64K		10
+#define	NPA_AURA_SZ_128K	11
+#define	NPA_AURA_SZ_256K	12
+#define	NPA_AURA_SZ_512K	13
+#define	NPA_AURA_SZ_1M		14
+#define	NPA_AURA_SZ_MAX		15
+
+/* For NPA LF context alloc and init */
+struct npa_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	int __otx2_io aura_sz; /* No of auras. See NPA_AURA_SZ_* */
+	uint32_t __otx2_io nr_pools; /* No of pools */
+	uint64_t __otx2_io way_mask;
+};
+
+struct npa_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io stack_pg_ptrs;  /* No of ptrs per stack page */
+	uint32_t __otx2_io stack_pg_bytes; /* Size of stack page */
+	uint16_t __otx2_io qints; /* NPA_AF_CONST::QINTS */
+};
+
+/* NPA AQ enqueue msg */
+struct npa_aq_enq_req {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io aura_id;
+	uint8_t __otx2_io ctype;
+	uint8_t __otx2_io op;
+	union {
+		/* Valid when op == WRITE/INIT and ctype == AURA.
+		 * LF fills the pool_id in aura.pool_addr. AF will translate
+		 * the pool_id to pool context pointer.
+		 */
+		struct npa_aura_s aura;
+		/* Valid when op == WRITE/INIT and ctype == POOL */
+		struct npa_pool_s pool;
+	};
+	/* Mask data when op == WRITE (1=write, 0=don't write) */
+	union {
+		/* Valid when op == WRITE and ctype == AURA */
+		struct npa_aura_s aura_mask;
+		/* Valid when op == WRITE and ctype == POOL */
+		struct npa_pool_s pool_mask;
+	};
+};
+
+struct npa_aq_enq_rsp {
+	struct mbox_msghdr hdr;
+	union {
+		/* Valid when op == READ and ctype == AURA */
+		struct npa_aura_s aura;
+		/* Valid when op == READ and ctype == POOL */
+		struct npa_pool_s pool;
+	};
+};
+
+/* Disable all contexts of type 'ctype' */
+struct hwctx_disable_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io ctype;
+};
+
+/* NIX mbox message formats */
+/* NIX mailbox error codes
+ * Range 401 - 500.
+ */
+enum nix_af_status {
+	NIX_AF_ERR_PARAM            = -401,
+	NIX_AF_ERR_AQ_FULL          = -402,
+	NIX_AF_ERR_AQ_ENQUEUE       = -403,
+	NIX_AF_ERR_AF_LF_INVALID    = -404,
+	NIX_AF_ERR_AF_LF_ALLOC      = -405,
+	NIX_AF_ERR_TLX_ALLOC_FAIL   = -406,
+	NIX_AF_ERR_TLX_INVALID      = -407,
+	NIX_AF_ERR_RSS_SIZE_INVALID = -408,
+	NIX_AF_ERR_RSS_GRPS_INVALID = -409,
+	NIX_AF_ERR_FRS_INVALID      = -410,
+	NIX_AF_ERR_RX_LINK_INVALID  = -411,
+	NIX_AF_INVAL_TXSCHQ_CFG     = -412,
+	NIX_AF_SMQ_FLUSH_FAILED     = -413,
+	NIX_AF_MACADDR_SET_FAILED   = -414,
+	NIX_AF_RX_MODE_SET_FAILED   = -415,
+	NIX_AF_ERR_RSS_NOSPC_ALGO   = -416,
+	NIX_AF_ERR_RSS_NOSPC_FIELD  = -417,
+	NIX_AF_ERR_MARK_ALLOC_FAIL  = -418,
+	NIX_AF_ERR_LSOFMT_CFG_FAIL  = -419,
+};
+
+/* For NIX LF context alloc and init */
+struct nix_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint32_t __otx2_io rq_cnt;   /* No of receive queues */
+	uint32_t __otx2_io sq_cnt;   /* No of send queues */
+	uint32_t __otx2_io cq_cnt;   /* No of completion queues */
+	uint8_t __otx2_io xqe_sz;
+	uint16_t __otx2_io rss_sz;
+	uint8_t __otx2_io rss_grps;
+	uint16_t __otx2_io npa_func;
+	/* RVU_DEFAULT_PF_FUNC == default pf_func associated with lf */
+	uint16_t __otx2_io sso_func;
+	uint64_t __otx2_io rx_cfg;   /* See NIX_AF_LF(0..127)_RX_CFG */
+	uint64_t __otx2_io way_mask;
+};
+
+struct nix_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io sqb_size;
+	uint16_t __otx2_io rx_chan_base;
+	uint16_t __otx2_io tx_chan_base;
+	uint8_t __otx2_io rx_chan_cnt; /* Total number of RX channels */
+	uint8_t __otx2_io tx_chan_cnt; /* Total number of TX channels */
+	uint8_t __otx2_io lso_tsov4_idx;
+	uint8_t __otx2_io lso_tsov6_idx;
+	uint8_t __otx2_io mac_addr[ETHER_ADDR_LEN];
+	uint8_t __otx2_io lf_rx_stats; /* NIX_AF_CONST1::LF_RX_STATS */
+	uint8_t __otx2_io lf_tx_stats; /* NIX_AF_CONST1::LF_TX_STATS */
+	uint16_t __otx2_io cints; /* NIX_AF_CONST2::CINTS */
+	uint16_t __otx2_io qints; /* NIX_AF_CONST2::QINTS */
+	uint8_t __otx2_io ptp; /* boolean; true iff PTP block is supported */
+};
+
+/* NIX AQ enqueue msg */
+struct nix_aq_enq_req {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io qidx;
+	uint8_t __otx2_io ctype;
+	uint8_t __otx2_io op;
+	union {
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_RQ */
+		struct nix_rq_ctx_s rq;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_SQ */
+		struct nix_sq_ctx_s sq;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_CQ */
+		struct nix_cq_ctx_s cq;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_RSS */
+		struct nix_rsse_s rss;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_MCE */
+		struct nix_rx_mce_s mce;
+	};
+	/* Mask data when op == WRITE (1=write, 0=don't write) */
+	union {
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_RQ */
+		struct nix_rq_ctx_s rq_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_SQ */
+		struct nix_sq_ctx_s sq_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_CQ */
+		struct nix_cq_ctx_s cq_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_RSS */
+		struct nix_rsse_s rss_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_MCE */
+		struct nix_rx_mce_s mce_mask;
+	};
+};
+
+struct nix_aq_enq_rsp {
+	struct mbox_msghdr hdr;
+	union {
+		struct nix_rq_ctx_s rq;
+		struct nix_sq_ctx_s sq;
+		struct nix_cq_ctx_s cq;
+		struct nix_rsse_s   rss;
+		struct nix_rx_mce_s mce;
+	};
+};
+
+/* Tx scheduler/shaper mailbox messages */
+
+#define MAX_TXSCHQ_PER_FUNC	128
+
+struct nix_txsch_alloc_req {
+	struct mbox_msghdr hdr;
+	/* Scheduler queue count request at each level */
+	uint16_t __otx2_io schq_contig[NIX_TXSCH_LVL_CNT]; /* Contig. queues */
+	uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT]; /* Non-Contig. queues */
+};
+
+struct nix_txsch_alloc_rsp {
+	struct mbox_msghdr hdr;
+	/* Scheduler queue count allocated at each level */
+	uint16_t __otx2_io schq_contig[NIX_TXSCH_LVL_CNT]; /* Contig. queues */
+	uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT]; /* Non-Contig. queues */
+	/* Scheduler queue list allocated at each level */
+	uint16_t __otx2_io
+		schq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	uint16_t __otx2_io schq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	/* Traffic aggregation scheduler level */
+	uint8_t  __otx2_io aggr_level;
+	/* Aggregation lvl's RR_PRIO config */
+	uint8_t  __otx2_io aggr_lvl_rr_prio;
+	/* LINKX_CFG CSRs mapped to TL3 or TL2's index ? */
+	uint8_t  __otx2_io link_cfg_lvl;
+};
+
+struct nix_txsch_free_req {
+	struct mbox_msghdr hdr;
+#define TXSCHQ_FREE_ALL BIT_ULL(0)
+	uint16_t __otx2_io flags;
+	/* Scheduler queue level to be freed */
+	uint16_t __otx2_io schq_lvl;
+	/* List of scheduler queues to be freed */
+	uint16_t __otx2_io schq;
+};
+
+struct nix_txschq_config {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io lvl; /* SMQ/MDQ/TL4/TL3/TL2/TL1 */
+#define TXSCHQ_IDX_SHIFT 16
+#define TXSCHQ_IDX_MASK (BIT_ULL(10) - 1)
+#define TXSCHQ_IDX(reg, shift) (((reg) >> (shift)) & TXSCHQ_IDX_MASK)
+	uint8_t __otx2_io num_regs;
+#define MAX_REGS_PER_MBOX_MSG 20
+	uint64_t __otx2_io reg[MAX_REGS_PER_MBOX_MSG];
+	uint64_t __otx2_io regval[MAX_REGS_PER_MBOX_MSG];
+};
+
+struct nix_vtag_config {
+	struct mbox_msghdr hdr;
+	/* '0' for 4 octet VTAG, '1' for 8 octet VTAG */
+	uint8_t __otx2_io vtag_size;
+	/* cfg_type is '0' for tx vlan cfg
+	 * cfg_type is '1' for rx vlan cfg
+	 */
+	uint8_t __otx2_io cfg_type;
+	union {
+		/* Valid when cfg_type is '0' */
+		struct {
+			uint64_t __otx2_io vtag0;
+			uint64_t __otx2_io vtag1;
+
+			/* cfg_vtag0 & cfg_vtag1 fields are valid
+			 * when free_vtag0 & free_vtag1 are '0's.
+			 */
+			/* cfg_vtag0 = 1 to configure vtag0 */
+			uint8_t __otx2_io cfg_vtag0 :1;
+			/* cfg_vtag1 = 1 to configure vtag1 */
+			uint8_t __otx2_io cfg_vtag1 :1;
+
+			/* vtag0_idx & vtag1_idx are only valid when
+			 * both cfg_vtag0 & cfg_vtag1 are '0's,
+			 * these fields are used along with free_vtag0
+			 * & free_vtag1 to free the nix lf's tx_vlan
+			 * configuration.
+			 *
+			 * Denotes the indices of tx_vtag def registers
+			 * that needs to be cleared and freed.
+			 */
+			int __otx2_io vtag0_idx;
+			int __otx2_io vtag1_idx;
+
+			/* Free_vtag0 & free_vtag1 fields are valid
+			 * when cfg_vtag0 & cfg_vtag1 are '0's.
+			 */
+			/* Free_vtag0 = 1 clears vtag0 configuration
+			 * vtag0_idx denotes the index to be cleared.
+			 */
+			uint8_t __otx2_io free_vtag0 :1;
+			/* Free_vtag1 = 1 clears vtag1 configuration
+			 * vtag1_idx denotes the index to be cleared.
+			 */
+			uint8_t __otx2_io free_vtag1 :1;
+		} tx;
+
+		/* Valid when cfg_type is '1' */
+		struct {
+			/* Rx vtag type index, valid values are in 0..7 range */
+			uint8_t __otx2_io vtag_type;
+			/* Rx vtag strip */
+			uint8_t __otx2_io strip_vtag :1;
+			/* Rx vtag capture */
+			uint8_t __otx2_io capture_vtag :1;
+		} rx;
+	};
+};
+
+struct nix_vtag_config_rsp {
+	struct mbox_msghdr hdr;
+	/* Indices of tx_vtag def registers used to configure
+	 * tx vtag0 & vtag1 headers, these indices are valid
+	 * when nix_vtag_config mbox requested for vtag0 and/
+	 * or vtag1 configuration.
+	 */
+	int __otx2_io vtag0_idx;
+	int __otx2_io vtag1_idx;
+};
+
+struct nix_rss_flowkey_cfg {
+	struct mbox_msghdr hdr;
+	int __otx2_io mcam_index;  /* MCAM entry index to modify */
+	uint32_t __otx2_io flowkey_cfg; /* Flowkey types selected */
+#define FLOW_KEY_TYPE_PORT     BIT(0)
+#define FLOW_KEY_TYPE_IPV4     BIT(1)
+#define FLOW_KEY_TYPE_IPV6     BIT(2)
+#define FLOW_KEY_TYPE_TCP      BIT(3)
+#define FLOW_KEY_TYPE_UDP      BIT(4)
+#define FLOW_KEY_TYPE_SCTP     BIT(5)
+#define FLOW_KEY_TYPE_NVGRE    BIT(6)
+#define FLOW_KEY_TYPE_VXLAN    BIT(7)
+#define FLOW_KEY_TYPE_GENEVE   BIT(8)
+#define FLOW_KEY_TYPE_ETH_DMAC BIT(9)
+#define FLOW_KEY_TYPE_IPV6_EXT BIT(10)
+#define FLOW_KEY_TYPE_GTPU       BIT(11)
+#define FLOW_KEY_TYPE_UDP_VXLAN  BIT(12)
+#define FLOW_KEY_TYPE_UDP_GENEVE BIT(13)
+#define FLOW_KEY_TYPE_UDP_GTPU   BIT(14)
+#define FLOW_KEY_TYPE_INNR_IPV4     BIT(15)
+#define FLOW_KEY_TYPE_INNR_IPV6     BIT(16)
+#define FLOW_KEY_TYPE_INNR_TCP      BIT(17)
+#define FLOW_KEY_TYPE_INNR_UDP      BIT(18)
+#define FLOW_KEY_TYPE_INNR_SCTP     BIT(19)
+#define FLOW_KEY_TYPE_INNR_ETH_DMAC BIT(20)
+	uint8_t	group;       /* RSS context or group */
+};
+
+struct nix_rss_flowkey_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io alg_idx; /* Selected algo index */
+};
+
+struct nix_set_mac_addr {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[ETHER_ADDR_LEN];
+};
+
+struct nix_get_mac_addr_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[ETHER_ADDR_LEN];
+};
+
+struct nix_mark_format_cfg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io offset;
+	uint8_t __otx2_io y_mask;
+	uint8_t __otx2_io y_val;
+	uint8_t __otx2_io r_mask;
+	uint8_t __otx2_io r_val;
+};
+
+struct nix_mark_format_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mark_format_idx;
+};
+
+struct nix_lso_format_cfg {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io field_mask;
+#define NIX_LSO_FIELD_MAX	(8)
+	uint64_t __otx2_io fields[NIX_LSO_FIELD_MAX];
+};
+
+struct nix_lso_format_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io lso_format_idx;
+};
+
+struct nix_rx_mode {
+	struct mbox_msghdr hdr;
+#define NIX_RX_MODE_UCAST    BIT(0)
+#define NIX_RX_MODE_PROMISC  BIT(1)
+#define NIX_RX_MODE_ALLMULTI BIT(2)
+	uint16_t __otx2_io mode;
+};
+
+struct nix_frs_cfg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io update_smq;    /* Update SMQ's min/max lens */
+	uint8_t __otx2_io update_minlen; /* Set minlen also */
+	uint8_t __otx2_io sdp_link;      /* Set SDP RX link */
+	uint16_t __otx2_io maxlen;
+	uint16_t __otx2_io minlen;
+};
+
+struct nix_set_vlan_tpid {
+	struct mbox_msghdr hdr;
+#define NIX_VLAN_TYPE_INNER 0
+#define NIX_VLAN_TYPE_OUTER 1
+	uint8_t __otx2_io vlan_type;
+	uint16_t __otx2_io tpid;
+};
+
+struct nix_bp_cfg_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io chan_base; /* Starting channel number */
+	uint8_t __otx2_io chan_cnt; /* Number of channels */
+	uint8_t __otx2_io bpid_per_chan;
+	/* bpid_per_chan = 0  assigns single bp id for range of channels */
+	/* bpid_per_chan = 1 assigns separate bp id for each channel */
+};
+
+/* Global NIX inline IPSec configuration */
+struct nix_inline_ipsec_cfg {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io cpt_credit;
+	struct {
+		uint8_t __otx2_io egrp;
+		uint8_t __otx2_io opcode;
+	} gen_cfg;
+	struct {
+		uint16_t __otx2_io cpt_pf_func;
+		uint8_t __otx2_io cpt_slot;
+	} inst_qsel;
+	uint8_t __otx2_io enable;
+};
+
+/* Per NIX LF inline IPSec configuration */
+struct nix_inline_ipsec_lf_cfg {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io sa_base_addr;
+	struct {
+		uint32_t __otx2_io tag_const;
+		uint16_t __otx2_io lenm1_max;
+		uint8_t __otx2_io sa_pow2_size;
+		uint8_t __otx2_io tt;
+	} ipsec_cfg0;
+	struct {
+		uint32_t __otx2_io sa_idx_max;
+		uint8_t __otx2_io sa_idx_w;
+	} ipsec_cfg1;
+	uint8_t __otx2_io enable;
+};
+
+/* PF can be mapped to either CGX or LBK interface,
+ * so maximum 64 channels are possible.
+ */
+#define NIX_MAX_CHAN	64
+struct nix_bp_cfg_rsp {
+	struct mbox_msghdr hdr;
+	/* Channel and bpid mapping */
+	uint16_t __otx2_io chan_bpid[NIX_MAX_CHAN];
+	/* Number of channel for which bpids are assigned */
+	uint8_t __otx2_io chan_cnt;
+};
+
+/* SSO mailbox error codes
+ * Range 501 - 600.
+ */
+enum sso_af_status {
+	SSO_AF_ERR_PARAM	= -501,
+	SSO_AF_ERR_LF_INVALID	= -502,
+	SSO_AF_ERR_AF_LF_ALLOC	= -503,
+	SSO_AF_ERR_GRP_EBUSY	= -504,
+	SSO_AF_ERR_AF_LF_INVALID = -599,
+};
+
+struct sso_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hwgrps;
+};
+
+struct sso_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io xaq_buf_size;
+	uint32_t __otx2_io xaq_wq_entries;
+	uint32_t __otx2_io in_unit_entries;
+	uint16_t __otx2_io hwgrps;
+};
+
+struct sso_lf_free_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hwgrps;
+};
+
+/* SSOW mailbox error codes
+ * Range 601 - 700.
+ */
+enum ssow_af_status {
+	SSOW_AF_ERR_PARAM	= -601,
+	SSOW_AF_ERR_LF_INVALID	= -602,
+	SSOW_AF_ERR_AF_LF_ALLOC	= -603,
+};
+
+struct ssow_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hws;
+};
+
+struct ssow_lf_free_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hws;
+};
+
+struct sso_hw_setconfig {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io npa_aura_id;
+	uint16_t __otx2_io npa_pf_func;
+	uint16_t __otx2_io hwgrps;
+};
+
+struct sso_info_req {
+	struct mbox_msghdr hdr;
+	union {
+		uint16_t __otx2_io grp;
+		uint16_t __otx2_io hws;
+	};
+};
+
+struct sso_grp_priority {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io grp;
+	uint8_t __otx2_io priority;
+	uint8_t __otx2_io affinity;
+	uint8_t __otx2_io weight;
+};
+
+struct sso_grp_qos_cfg {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io grp;
+	uint32_t __otx2_io xaq_limit;
+	uint16_t __otx2_io taq_thr;
+	uint16_t __otx2_io iaq_thr;
+};
+
+struct sso_grp_stats {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io grp;
+	uint64_t __otx2_io ws_pc;
+	uint64_t __otx2_io ext_pc;
+	uint64_t __otx2_io wa_pc;
+	uint64_t __otx2_io ts_pc;
+	uint64_t __otx2_io ds_pc;
+	uint64_t __otx2_io dq_pc;
+	uint64_t __otx2_io aw_status;
+	uint64_t __otx2_io page_cnt;
+};
+
+struct sso_hws_stats {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io hws;
+	uint64_t __otx2_io arbitration;
+};
+
+/* CPT mbox message formats */
+
+struct cpt_rd_wr_reg_msg {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io reg_offset;
+	uint64_t __otx2_io *ret_val;
+	uint64_t __otx2_io val;
+	uint8_t __otx2_io is_write;
+};
+
+#define CPT_INLINE_INBOUND	0
+#define CPT_INLINE_OUTBOUND	1
+
+struct cpt_inline_ipsec_cfg_msg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io enable;
+	uint8_t __otx2_io slot;
+	uint8_t __otx2_io dir;
+	uint16_t __otx2_io sso_pf_func; /* Inbound path SSO_PF_FUNC */
+	uint16_t __otx2_io nix_pf_func; /* Outbound path NIX_PF_FUNC */
+};
+
+/* NPC mbox message structs */
+
+#define NPC_MCAM_ENTRY_INVALID	0xFFFF
+#define NPC_MCAM_INVALID_MAP	0xFFFF
+
+/* NPC mailbox error codes
+ * Range 701 - 800.
+ */
+enum npc_af_status {
+	NPC_MCAM_INVALID_REQ	= -701,
+	NPC_MCAM_ALLOC_DENIED	= -702,
+	NPC_MCAM_ALLOC_FAILED	= -703,
+	NPC_MCAM_PERM_DENIED	= -704,
+};
+
+struct npc_mcam_alloc_entry_req {
+	struct mbox_msghdr hdr;
+#define NPC_MAX_NONCONTIG_ENTRIES	256
+	uint8_t __otx2_io contig;   /* Contiguous entries ? */
+#define NPC_MCAM_ANY_PRIO		0
+#define NPC_MCAM_LOWER_PRIO		1
+#define NPC_MCAM_HIGHER_PRIO		2
+	uint8_t __otx2_io priority; /* Lower or higher w.r.t ref_entry */
+	uint16_t __otx2_io ref_entry;
+	uint16_t __otx2_io count;    /* Number of entries requested */
+};
+
+struct npc_mcam_alloc_entry_rsp {
+	struct mbox_msghdr hdr;
+	/* Entry alloc'ed or start index if contiguous.
+	 * Invalid in case of non-contiguous.
+	 */
+	uint16_t __otx2_io entry;
+	uint16_t __otx2_io count; /* Number of entries allocated */
+	uint16_t __otx2_io free_count; /* Number of entries available */
+	uint16_t __otx2_io entry_list[NPC_MAX_NONCONTIG_ENTRIES];
+};
+
+struct npc_mcam_free_entry_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io entry; /* Entry index to be freed */
+	uint8_t __otx2_io all;   /* Free all entries alloc'ed to this PFVF */
+};
+
+struct mcam_entry {
+#define NPC_MAX_KWS_IN_KEY	7 /* Number of keywords in max key width */
+	uint64_t __otx2_io kw[NPC_MAX_KWS_IN_KEY];
+	uint64_t __otx2_io kw_mask[NPC_MAX_KWS_IN_KEY];
+	uint64_t __otx2_io action;
+	uint64_t __otx2_io vtag_action;
+};
+
+struct npc_mcam_write_entry_req {
+	struct mbox_msghdr hdr;
+	struct mcam_entry entry_data;
+	uint16_t __otx2_io entry; /* MCAM entry to write this match key */
+	uint16_t __otx2_io cntr;	 /* Counter for this MCAM entry */
+	uint8_t __otx2_io intf;	 /* Rx or Tx interface */
+	uint8_t __otx2_io enable_entry;/* Enable this MCAM entry ? */
+	uint8_t __otx2_io set_cntr;    /* Set counter for this entry ? */
+};
+
+/* Enable/Disable a given entry */
+struct npc_mcam_ena_dis_entry_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io entry;
+};
+
+struct npc_mcam_shift_entry_req {
+	struct mbox_msghdr hdr;
+#define NPC_MCAM_MAX_SHIFTS	64
+	uint16_t __otx2_io curr_entry[NPC_MCAM_MAX_SHIFTS];
+	uint16_t __otx2_io new_entry[NPC_MCAM_MAX_SHIFTS];
+	uint16_t __otx2_io shift_count; /* Number of entries to shift */
+};
+
+struct npc_mcam_shift_entry_rsp {
+	struct mbox_msghdr hdr;
+	/* Index in 'curr_entry', not entry itself */
+	uint16_t __otx2_io failed_entry_idx;
+};
+
+struct npc_mcam_alloc_counter_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io contig;	/* Contiguous counters ? */
+#define NPC_MAX_NONCONTIG_COUNTERS 64
+	uint16_t __otx2_io count;	/* Number of counters requested */
+};
+
+struct npc_mcam_alloc_counter_rsp {
+	struct mbox_msghdr hdr;
+	/* Counter alloc'ed or start idx if contiguous.
+	 * Invalid incase of non-contiguous.
+	 */
+	uint16_t __otx2_io cntr;
+	uint16_t __otx2_io count; /* Number of counters allocated */
+	uint16_t __otx2_io cntr_list[NPC_MAX_NONCONTIG_COUNTERS];
+};
+
+struct npc_mcam_oper_counter_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io cntr; /* Free a counter or clear/fetch it's stats */
+};
+
+struct npc_mcam_oper_counter_rsp {
+	struct mbox_msghdr hdr;
+	/* valid only while fetching counter's stats */
+	uint64_t __otx2_io stat;
+};
+
+struct npc_mcam_unmap_counter_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io cntr;
+	uint16_t __otx2_io entry; /* Entry and counter to be unmapped */
+	uint8_t __otx2_io all;   /* Unmap all entries using this counter ? */
+};
+
+struct npc_mcam_alloc_and_write_entry_req {
+	struct mbox_msghdr hdr;
+	struct mcam_entry entry_data;
+	uint16_t __otx2_io ref_entry;
+	uint8_t __otx2_io priority;    /* Lower or higher w.r.t ref_entry */
+	uint8_t __otx2_io intf;	 /* Rx or Tx interface */
+	uint8_t __otx2_io enable_entry;/* Enable this MCAM entry ? */
+	uint8_t __otx2_io alloc_cntr;  /* Allocate counter and map ? */
+};
+
+struct npc_mcam_alloc_and_write_entry_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io entry;
+	uint16_t __otx2_io cntr;
+};
+
+struct npc_get_kex_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io rx_keyx_cfg;   /* NPC_AF_INTF(0)_KEX_CFG */
+	uint64_t __otx2_io tx_keyx_cfg;   /* NPC_AF_INTF(1)_KEX_CFG */
+#define NPC_MAX_INTF	2
+#define NPC_MAX_LID	8
+#define NPC_MAX_LT	16
+#define NPC_MAX_LD	2
+#define NPC_MAX_LFL	16
+	/* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */
+	uint64_t __otx2_io kex_ld_flags[NPC_MAX_LD];
+	/* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG */
+	uint64_t __otx2_io
+	intf_lid_lt_ld[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];
+	/* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG */
+	uint64_t __otx2_io
+	intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
+#define MKEX_NAME_LEN 128
+	uint8_t __otx2_io mkex_pfl_name[MKEX_NAME_LEN];
+};
+
+/* TIM mailbox error codes
+ * Range 801 - 900.
+ */
+enum tim_af_status {
+	TIM_AF_NO_RINGS_LEFT			= -801,
+	TIM_AF_INVALID_NPA_PF_FUNC		= -802,
+	TIM_AF_INVALID_SSO_PF_FUNC		= -803,
+	TIM_AF_RING_STILL_RUNNING		= -804,
+	TIM_AF_LF_INVALID			= -805,
+	TIM_AF_CSIZE_NOT_ALIGNED		= -806,
+	TIM_AF_CSIZE_TOO_SMALL			= -807,
+	TIM_AF_CSIZE_TOO_BIG			= -808,
+	TIM_AF_INTERVAL_TOO_SMALL		= -809,
+	TIM_AF_INVALID_BIG_ENDIAN_VALUE		= -810,
+	TIM_AF_INVALID_CLOCK_SOURCE		= -811,
+	TIM_AF_GPIO_CLK_SRC_NOT_ENABLED		= -812,
+	TIM_AF_INVALID_BSIZE			= -813,
+	TIM_AF_INVALID_ENABLE_PERIODIC		= -814,
+	TIM_AF_INVALID_ENABLE_DONTFREE		= -815,
+	TIM_AF_ENA_DONTFRE_NSET_PERIODIC	= -816,
+	TIM_AF_RING_ALREADY_DISABLED		= -817,
+};
+
+enum tim_clk_srcs {
+	TIM_CLK_SRCS_TENNS	= 0,
+	TIM_CLK_SRCS_GPIO	= 1,
+	TIM_CLK_SRCS_GTI	= 2,
+	TIM_CLK_SRCS_PTP	= 3,
+	TIM_CLK_SRSC_INVALID,
+};
+
+enum tim_gpio_edge {
+	TIM_GPIO_NO_EDGE		= 0,
+	TIM_GPIO_LTOH_TRANS		= 1,
+	TIM_GPIO_HTOL_TRANS		= 2,
+	TIM_GPIO_BOTH_TRANS		= 3,
+	TIM_GPIO_INVALID,
+};
+
+enum ptp_op {
+	PTP_OP_ADJFINE = 0, /* adjfine(req.scaled_ppm); */
+	PTP_OP_GET_CLOCK = 1, /* rsp.clk = get_clock() */
+};
+
+struct ptp_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io op;
+	int64_t __otx2_io scaled_ppm;
+};
+
+struct ptp_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io clk;
+};
+
+struct get_hw_cap_rsp {
+	struct mbox_msghdr hdr;
+	/* Schq mapping fixed or flexible */
+	uint8_t __otx2_io nix_fixed_txschq_mapping;
+	uint8_t __otx2_io nix_express_traffic; /* Are express links supported */
+	uint8_t __otx2_io nix_shaping; /* Is shaping and coloring supported */
+};
+
+struct ndc_sync_op {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io nix_lf_tx_sync;
+	uint8_t __otx2_io nix_lf_rx_sync;
+	uint8_t __otx2_io npa_lf_sync;
+};
+
+struct tim_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io ring;
+	uint16_t __otx2_io npa_pf_func;
+	uint16_t __otx2_io sso_pf_func;
+};
+
+struct tim_ring_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io ring;
+};
+
+struct tim_config_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io ring;
+	uint8_t __otx2_io bigendian;
+	uint8_t __otx2_io clocksource;
+	uint8_t __otx2_io enableperiodic;
+	uint8_t __otx2_io enabledontfreebuffer;
+	uint32_t __otx2_io bucketsize;
+	uint32_t __otx2_io chunksize;
+	uint32_t __otx2_io interval;
+};
+
+struct tim_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io tenns_clk;
+};
+
+struct tim_enable_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io timestarted;
+	uint32_t __otx2_io currentbucket;
+};
+
 #endif /* __OTX2_MBOX_H__ */
Signature · 1 line
2.21.0
#4 lore raw

PATCH 4/27 common/octeontx2: add mailbox base support infra

In reply to [email protected]

From: Jerin Jacob <[email protected]>

This patch adds mailbox init and fini support. Each RVU device has a dedicated 64KB mailbox region shared with its peer for communication. RVU AF has a separate mailbox region shared with each of RVU PFs and an RVU PF has a separate region shared with each of it's VF.

---
 drivers/common/octeontx2/otx2_mbox.c | 133 +++++++++++++++++++++++++++
 drivers/common/octeontx2/otx2_mbox.h |   5 +
 2 files changed, 138 insertions(+)
drivers/common/octeontx2/otx2_mbox.c +133 -0
index c9cdbdbbc..cb03f6503 100644
@@ -2,4 +2,137 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_atomic.h>
+#include <rte_cycles.h>
+
 #include "otx2_mbox.h"
+
+#define RVU_AF_AFPF_MBOX0	(0x02000)
+#define RVU_AF_AFPF_MBOX1	(0x02008)
+
+#define RVU_PF_PFAF_MBOX0	(0xC00)
+#define RVU_PF_PFAF_MBOX1	(0xC08)
+
+#define RVU_PF_VFX_PFVF_MBOX0	(0x0000)
+#define RVU_PF_VFX_PFVF_MBOX1	(0x0008)
+
+#define	RVU_VF_VFPF_MBOX0	(0x0000)
+#define	RVU_VF_VFPF_MBOX1	(0x0008)
+
+void
+otx2_mbox_fini(struct otx2_mbox *mbox)
+{
+	mbox->reg_base = 0;
+	mbox->hwbase = 0;
+	free(mbox->dev);
+	mbox->dev = NULL;
+}
+
+void
+otx2_mbox_reset(struct otx2_mbox *mbox, int devid)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_hdr *tx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->tx_start);
+	struct mbox_hdr *rx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+	mdev->msg_size = 0;
+	mdev->rsp_size = 0;
+	tx_hdr->msg_size = 0;
+	tx_hdr->num_msgs = 0;
+	rx_hdr->msg_size = 0;
+	rx_hdr->num_msgs = 0;
+	rte_spinlock_unlock(&mdev->mbox_lock);
+}
+
+int
+otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase,
+	       uintptr_t reg_base, int direction, int ndevs)
+{
+	struct otx2_mbox_dev *mdev;
+	int devid;
+
+	mbox->reg_base = reg_base;
+	mbox->hwbase = hwbase;
+
+	switch (direction) {
+	case MBOX_DIR_AFPF:
+	case MBOX_DIR_PFVF:
+		mbox->tx_start = MBOX_DOWN_TX_START;
+		mbox->rx_start = MBOX_DOWN_RX_START;
+		mbox->tx_size  = MBOX_DOWN_TX_SIZE;
+		mbox->rx_size  = MBOX_DOWN_RX_SIZE;
+		break;
+	case MBOX_DIR_PFAF:
+	case MBOX_DIR_VFPF:
+		mbox->tx_start = MBOX_DOWN_RX_START;
+		mbox->rx_start = MBOX_DOWN_TX_START;
+		mbox->tx_size  = MBOX_DOWN_RX_SIZE;
+		mbox->rx_size  = MBOX_DOWN_TX_SIZE;
+		break;
+	case MBOX_DIR_AFPF_UP:
+	case MBOX_DIR_PFVF_UP:
+		mbox->tx_start = MBOX_UP_TX_START;
+		mbox->rx_start = MBOX_UP_RX_START;
+		mbox->tx_size  = MBOX_UP_TX_SIZE;
+		mbox->rx_size  = MBOX_UP_RX_SIZE;
+		break;
+	case MBOX_DIR_PFAF_UP:
+	case MBOX_DIR_VFPF_UP:
+		mbox->tx_start = MBOX_UP_RX_START;
+		mbox->rx_start = MBOX_UP_TX_START;
+		mbox->tx_size  = MBOX_UP_RX_SIZE;
+		mbox->rx_size  = MBOX_UP_TX_SIZE;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	switch (direction) {
+	case MBOX_DIR_AFPF:
+	case MBOX_DIR_AFPF_UP:
+		mbox->trigger = RVU_AF_AFPF_MBOX0;
+		mbox->tr_shift = 4;
+		break;
+	case MBOX_DIR_PFAF:
+	case MBOX_DIR_PFAF_UP:
+		mbox->trigger = RVU_PF_PFAF_MBOX1;
+		mbox->tr_shift = 0;
+		break;
+	case MBOX_DIR_PFVF:
+	case MBOX_DIR_PFVF_UP:
+		mbox->trigger = RVU_PF_VFX_PFVF_MBOX0;
+		mbox->tr_shift = 12;
+		break;
+	case MBOX_DIR_VFPF:
+	case MBOX_DIR_VFPF_UP:
+		mbox->trigger = RVU_VF_VFPF_MBOX1;
+		mbox->tr_shift = 0;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev));
+	if (!mbox->dev) {
+		otx2_mbox_fini(mbox);
+		return -ENOMEM;
+	}
+	mbox->ndevs = ndevs;
+	for (devid = 0; devid < ndevs; devid++) {
+		mdev = &mbox->dev[devid];
+		mdev->mbase = (void *)(mbox->hwbase + (devid * MBOX_SIZE));
+		rte_spinlock_init(&mdev->mbox_lock);
+		/* Init header to reset value */
+		otx2_mbox_reset(mbox, devid);
+	}
+
+	return 0;
+}
drivers/common/octeontx2/otx2_mbox.h +5 -0
index cd95f4cb9..3a9c60313 100644
@@ -1327,4 +1327,9 @@ struct tim_enable_rsp {
 	uint32_t __otx2_io currentbucket;
 };
 
+void otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
+int otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase,
+		   uintptr_t reg_base, int direction, int ndevs);
+void otx2_mbox_fini(struct otx2_mbox *mbox);
+
 #endif /* __OTX2_MBOX_H__ */
Signature · 1 line
2.21.0
#5 lore raw

PATCH 5/27 common/octeontx2: add runtime log infra

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Various consumers of this common code need runtime logging infrastructure. This patch adds the same.

---
 drivers/common/octeontx2/Makefile             |  1 +
 drivers/common/octeontx2/meson.build          |  1 +
 drivers/common/octeontx2/otx2_common.c        | 77 +++++++++++++++++++
 drivers/common/octeontx2/otx2_common.h        | 34 ++++++++
 .../rte_common_octeontx2_version.map          | 10 +++
 5 files changed, 123 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_common.c
drivers/common/octeontx2/Makefile +1 -0
index e5737532a..3fd67f0ab 100644
@@ -25,6 +25,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-y += otx2_mbox.c
+SRCS-y += otx2_common.c
 
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_ethdev
drivers/common/octeontx2/meson.build +1 -0
index 34f8aaea7..4771b1942 100644
@@ -4,6 +4,7 @@
 
 sources= files(
 		'otx2_mbox.c',
+		'otx2_common.c',
 	       )
 
 extra_flags = []
drivers/common/octeontx2/otx2_common.c new file +77 -0

77 lines not on this page · raw message

drivers/common/octeontx2/otx2_common.h +34 -0
index b0c19266b..c000db296 100644
@@ -33,6 +33,40 @@
 #define __hot   __attribute__((hot))
 #endif
 
+/* Log */
+extern int otx2_logtype_base;
+extern int otx2_logtype_mbox;
+extern int otx2_logtype_npa;
+extern int otx2_logtype_nix;
+extern int otx2_logtype_sso;
+extern int otx2_logtype_npc;
+extern int otx2_logtype_tm;
+extern int otx2_logtype_tim;
+
+#define OTX2_CLNRM  "\x1b[0m"
+#define OTX2_CLRED  "\x1b[31m"
+
+#define otx2_err(fmt, args...)						\
+	RTE_LOG(ERR, PMD, ""OTX2_CLRED"%s():%u " fmt OTX2_CLNRM"\n",	\
+				__func__, __LINE__, ## args)
+
+#define otx2_info(fmt, args...)						\
+	RTE_LOG(INFO, PMD, fmt"\n", ## args)
+
+#define otx2_dbg(subsystem, fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx2_logtype_ ## subsystem,		\
+		"[%s] %s():%u " fmt "\n",				\
+		 #subsystem, __func__, __LINE__, ##args)
+
+#define otx2_base_dbg(fmt, ...) otx2_dbg(base, fmt, ##__VA_ARGS__)
+#define otx2_mbox_dbg(fmt, ...) otx2_dbg(mbox, fmt, ##__VA_ARGS__)
+#define otx2_npa_dbg(fmt, ...) otx2_dbg(npa, fmt, ##__VA_ARGS__)
+#define otx2_nix_dbg(fmt, ...) otx2_dbg(nix, fmt, ##__VA_ARGS__)
+#define otx2_sso_dbg(fmt, ...) otx2_dbg(sso, fmt, ##__VA_ARGS__)
+#define otx2_npc_dbg(fmt, ...) otx2_dbg(npc, fmt, ##__VA_ARGS__)
+#define otx2_tm_dbg(fmt, ...) otx2_dbg(tm, fmt, ##__VA_ARGS__)
+#define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
+
 /* IO Access */
 #define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
 #define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
drivers/common/octeontx2/rte_common_octeontx2_version.map +10 -0
index fc8c95e91..cd3ecbb9d 100644
@@ -1,4 +1,14 @@
 DPDK_19.05 {
+	global:
+
+	otx2_logtype_base;
+	otx2_logtype_mbox;
+	otx2_logtype_npa;
+	otx2_logtype_npc;
+	otx2_logtype_nix;
+	otx2_logtype_sso;
+	otx2_logtype_tm;
+	otx2_logtype_tim;
 
 	local: *;
 };
Signature · 1 line
2.21.0
#6 lore raw

PATCH 6/27 common/octeontx2: add mailbox send and receive support

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Each RVU device has a dedicated 64KB mailbox region shared with its peer for communication. RVU AF has a separate mailbox region shared with each of RVU PFs and an RVU PF has a separate region shared with each of it's VF.

This patch add use 64KB memory and implemented mailbox send and receive support.

These set of APIs are used by this driver (RVU AF) and other RVU PF/VF drivers eg ethdev, cryptodev e.t.c.

---
 drivers/common/octeontx2/otx2_mbox.c          | 278 ++++++++++++++++++
 drivers/common/octeontx2/otx2_mbox.h          | 142 +++++++++
 .../rte_common_octeontx2_version.map          |   7 +
 3 files changed, 427 insertions(+)
drivers/common/octeontx2/otx2_mbox.c +278 -0
index cb03f6503..86559fa98 100644
@@ -24,6 +24,12 @@
 #define	RVU_VF_VFPF_MBOX0	(0x0000)
 #define	RVU_VF_VFPF_MBOX1	(0x0008)
 
+static inline uint16_t
+msgs_offset(void)
+{
+	return RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+}
+
 void
 otx2_mbox_fini(struct otx2_mbox *mbox)
 {
@@ -136,3 +142,275 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase,
 
 	return 0;
 }
+
+/**
+ * @internal
+ * Allocate a message response
+ */
+struct mbox_msghdr *
+otx2_mbox_alloc_msg_rsp(struct otx2_mbox *mbox, int devid, int size,
+			int size_rsp)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_msghdr *msghdr = NULL;
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+	size = RTE_ALIGN(size, MBOX_MSG_ALIGN);
+	size_rsp = RTE_ALIGN(size_rsp, MBOX_MSG_ALIGN);
+	/* Check if there is space in mailbox */
+	if ((mdev->msg_size + size) > mbox->tx_size - msgs_offset())
+		goto exit;
+	if ((mdev->rsp_size + size_rsp) > mbox->rx_size - msgs_offset())
+		goto exit;
+	if (mdev->msg_size == 0)
+		mdev->num_msgs = 0;
+	mdev->num_msgs++;
+
+	msghdr = (struct mbox_msghdr *)(((uintptr_t)mdev->mbase +
+			mbox->tx_start + msgs_offset() + mdev->msg_size));
+
+	/* Clear the whole msg region */
+	otx2_mbox_memset(msghdr, 0, sizeof(*msghdr) + size);
+	/* Init message header with reset values */
+	msghdr->ver = OTX2_MBOX_VERSION;
+	mdev->msg_size += size;
+	mdev->rsp_size += size_rsp;
+	msghdr->next_msgoff = mdev->msg_size + msgs_offset();
+exit:
+	rte_spinlock_unlock(&mdev->mbox_lock);
+
+	return msghdr;
+}
+
+/**
+ * @internal
+ * Send a mailbox message
+ */
+void
+otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_hdr *tx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->tx_start);
+	struct mbox_hdr *rx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+
+	/* Reset header for next messages */
+	tx_hdr->msg_size = mdev->msg_size;
+	mdev->msg_size = 0;
+	mdev->rsp_size = 0;
+	mdev->msgs_acked = 0;
+
+	/* num_msgs != 0 signals to the peer that the buffer has a number of
+	 * messages. So this should be written after copying txmem
+	 */
+	tx_hdr->num_msgs = mdev->num_msgs;
+	rx_hdr->num_msgs = 0;
+
+	/* Sync mbox data into memory */
+	rte_wmb();
+
+	/* The interrupt should be fired after num_msgs is written
+	 * to the shared memory
+	 */
+	rte_write64(1, (volatile void *)(mbox->reg_base +
+		(mbox->trigger | (devid << mbox->tr_shift))));
+}
+
+/**
+ * @internal
+ * Wait and get mailbox response
+ */
+int
+otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid, void **msg)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_msghdr *msghdr;
+	uint64_t offset;
+	int rc;
+
+	rc = otx2_mbox_wait_for_rsp(mbox, devid);
+	if (rc != 1)
+		return -EIO;
+
+	rte_rmb();
+
+	offset = mbox->rx_start +
+		RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+	if (msg != NULL)
+		*msg = msghdr;
+
+	return msghdr->rc;
+}
+
+/**
+ * @internal
+ * Wait and get mailbox response with timeout
+ */
+int
+otx2_mbox_get_rsp_tmo(struct otx2_mbox *mbox, int devid, void **msg,
+		      uint32_t tmo)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_msghdr *msghdr;
+	uint64_t offset;
+	int rc;
+
+	rc = otx2_mbox_wait_for_rsp_tmo(mbox, devid, tmo);
+	if (rc != 1)
+		return -EIO;
+
+	rte_rmb();
+
+	offset = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+	if (msg != NULL)
+		*msg = msghdr;
+
+	return msghdr->rc;
+}
+
+static int
+mbox_wait(struct otx2_mbox *mbox, int devid, uint32_t rst_timo)
+{
+	volatile struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	uint32_t timeout = 0, sleep = 1;
+
+	while (mdev->num_msgs > mdev->msgs_acked) {
+		rte_delay_ms(sleep);
+		timeout += sleep;
+		if (timeout >= rst_timo) {
+			struct mbox_hdr *tx_hdr =
+				(struct mbox_hdr *)((uintptr_t)mdev->mbase +
+							mbox->tx_start);
+			struct mbox_hdr *rx_hdr =
+				(struct mbox_hdr *)((uintptr_t)mdev->mbase +
+							mbox->rx_start);
+
+			otx2_err("MBOX[devid: %d] message wait timeout %d, "
+				 "num_msgs: %d, msgs_acked: %d "
+				 "(tx/rx num_msgs: %d/%d), msg_size: %d, "
+				 "rsp_size: %d",
+				 devid, timeout, mdev->num_msgs,
+				 mdev->msgs_acked, tx_hdr->num_msgs,
+				 rx_hdr->num_msgs, mdev->msg_size,
+				 mdev->rsp_size);
+
+			return -EIO;
+		}
+		rte_rmb();
+	}
+	return 0;
+}
+
+int
+otx2_mbox_wait_for_rsp_tmo(struct otx2_mbox *mbox, int devid, uint32_t tmo)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	int rc = 0;
+
+	/* Sync with mbox region */
+	rte_rmb();
+
+	if (mbox->trigger == RVU_PF_VFX_PFVF_MBOX1 ||
+		mbox->trigger == RVU_PF_VFX_PFVF_MBOX0) {
+		/* In case of VF, Wait a bit more to account round trip delay */
+		tmo = tmo * 2;
+	}
+
+	/* Wait message */
+	rc = mbox_wait(mbox, devid, tmo);
+	if (rc)
+		return rc;
+
+	return mdev->msgs_acked;
+}
+
+/**
+ * @internal
+ * Wait for the mailbox response
+ */
+int
+otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid)
+{
+	return otx2_mbox_wait_for_rsp_tmo(mbox, devid, MBOX_RSP_TIMEOUT);
+}
+
+int
+otx2_mbox_get_availmem(struct otx2_mbox *mbox, int devid)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	int avail;
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+	avail = mbox->tx_size - mdev->msg_size - msgs_offset();
+	rte_spinlock_unlock(&mdev->mbox_lock);
+
+	return avail;
+}
+
+int
+otx2_send_ready_msg(struct otx2_mbox *mbox, uint16_t *pcifunc)
+{
+	struct ready_msg_rsp *rsp;
+	int rc;
+
+	otx2_mbox_alloc_msg_ready(mbox);
+
+	otx2_mbox_msg_send(mbox, 0);
+	rc = otx2_mbox_get_rsp(mbox, 0, (void *)&rsp);
+	if (rc)
+		return rc;
+
+	if (pcifunc)
+		*pcifunc = rsp->hdr.pcifunc;
+
+	return 0;
+}
+
+int
+otx2_reply_invalid_msg(struct otx2_mbox *mbox, int devid, uint16_t pcifunc,
+		       uint16_t id)
+{
+	struct msg_rsp *rsp;
+
+	rsp = (struct msg_rsp *)otx2_mbox_alloc_msg(mbox, devid, sizeof(*rsp));
+	if (!rsp)
+		return -ENOMEM;
+	rsp->hdr.id = id;
+	rsp->hdr.sig = OTX2_MBOX_RSP_SIG;
+	rsp->hdr.rc = MBOX_MSG_INVALID;
+	rsp->hdr.pcifunc = pcifunc;
+
+	return 0;
+}
+
+/**
+ * @internal
+ * Convert mail box ID to name
+ */
+const char *otx2_mbox_id2name(uint16_t id)
+{
+	switch (id) {
+#define M(_name, _id, _1, _2, _3) case _id: return # _name;
+	MBOX_MESSAGES
+	MBOX_UP_CGX_MESSAGES
+#undef M
+	default :
+		return "INVALID ID";
+	}
+}
+
+int otx2_mbox_id2size(uint16_t id)
+{
+	switch (id) {
+#define M(_1, _id, _2, _req_type, _3) case _id: return sizeof(struct _req_type);
+	MBOX_MESSAGES
+	MBOX_UP_CGX_MESSAGES
+#undef M
+	default :
+		return 0;
+	}
+}
drivers/common/octeontx2/otx2_mbox.h +142 -0

151 lines not on this page · raw message

drivers/common/octeontx2/rte_common_octeontx2_version.map +7 -0
index cd3ecbb9d..7d2cfc70e 100644
@@ -10,5 +10,12 @@ DPDK_19.05 {
 	otx2_logtype_tm;
 	otx2_logtype_tim;
 
+	otx2_mbox_alloc_msg_rsp;
+	otx2_mbox_get_rsp;
+	otx2_mbox_get_rsp_tmo;
+	otx2_mbox_id2name;
+	otx2_mbox_msg_send;
+	otx2_mbox_wait_for_rsp;
+
 	local: *;
 };
Signature · 1 line
2.21.0
#7 lore raw

PATCH 7/27 common/octeontx2: introduce common device class

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Introduce otx2_dev class to hold octeontx2 PCIe device specific information and operations.

All PCIe drivers(ethdev, mempool, cryptodev and eventdev) in octeontx2, inherits this base object to avail the common functionalities such as mailbox creation, interrupt registration, etc of the PCIe device.

---
 drivers/common/octeontx2/Makefile             |   2 +
 drivers/common/octeontx2/meson.build          |   4 +-
 drivers/common/octeontx2/otx2_common.h        |  13 ++
 drivers/common/octeontx2/otx2_dev.c           | 197 ++++++++++++++++++
 drivers/common/octeontx2/otx2_dev.h           |  84 ++++++++
 drivers/common/octeontx2/otx2_irq.h           |  19 ++
 .../rte_common_octeontx2_version.map          |   3 +
 7 files changed, 320 insertions(+), 2 deletions(-)
 create mode 100644 drivers/common/octeontx2/otx2_dev.c
 create mode 100644 drivers/common/octeontx2/otx2_dev.h
 create mode 100644 drivers/common/octeontx2/otx2_irq.h
drivers/common/octeontx2/Makefile +2 -0
index 3fd67f0ab..a6f94553d 100644
@@ -11,6 +11,7 @@ LIB = librte_common_octeontx2.a
 
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/bus/pci
 
 ifneq ($(CONFIG_RTE_ARCH_64),y)
 CFLAGS += -Wno-int-to-pointer-cast
@@ -24,6 +25,7 @@ LIBABIVER := 1
 #
 # all source are stored in SRCS-y
 #
+SRCS-y += otx2_dev.c
 SRCS-y += otx2_mbox.c
 SRCS-y += otx2_common.c
 
drivers/common/octeontx2/meson.build +2 -2
index 4771b1942..feaf75d92 100644
@@ -2,7 +2,7 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
-sources= files(
+sources= files('otx2_dev.c',
 		'otx2_mbox.c',
 		'otx2_common.c',
 	       )
@@ -19,6 +19,6 @@ foreach flag: extra_flags
 	endif
 endforeach
 
-deps = ['eal', 'ethdev']
+deps = ['eal', 'pci', 'ethdev']
 includes += include_directories('../../common/octeontx2',
 		'../../bus/pci')
drivers/common/octeontx2/otx2_common.h +13 -0
index c000db296..0750cdd14 100644
@@ -67,6 +67,19 @@ extern int otx2_logtype_tim;
 #define otx2_tm_dbg(fmt, ...) otx2_dbg(tm, fmt, ##__VA_ARGS__)
 #define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
 
+/* PCI IDs */
+#define PCI_VENDOR_ID_CAVIUM			0x177D
+#define PCI_DEVID_OCTEONTX2_RVU_PF              0xA063
+#define PCI_DEVID_OCTEONTX2_RVU_VF		0xA064
+#define PCI_DEVID_OCTEONTX2_RVU_AF		0xA065
+#define PCI_DEVID_OCTEONTX2_RVU_SSO_TIM_PF	0xA0F9
+#define PCI_DEVID_OCTEONTX2_RVU_SSO_TIM_VF	0xA0FA
+#define PCI_DEVID_OCTEONTX2_RVU_NPA_PF		0xA0FB
+#define PCI_DEVID_OCTEONTX2_RVU_NPA_VF		0xA0FC
+#define PCI_DEVID_OCTEONTX2_RVU_CPT_PF		0xA0FD
+#define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
+#define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
+
 /* IO Access */
 #define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
 #define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
drivers/common/octeontx2/otx2_dev.c new file +197 -0

197 lines not on this page · raw message

drivers/common/octeontx2/otx2_dev.h new file +84 -0

84 lines not on this page · raw message

drivers/common/octeontx2/otx2_irq.h new file +19 -0
new file mode 100644
index 000000000..df44ddfba
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_IRQ_H_
+#define _OTX2_IRQ_H_
+
+#include <rte_pci.h>
+#include <rte_interrupts.h>
+
+#include "otx2_common.h"
+
+typedef struct {
+/* 128 devices translate to two 64 bits dwords */
+#define MAX_VFPF_DWORD_BITS 2
+	uint64_t bits[MAX_VFPF_DWORD_BITS];
+} otx2_intr_t;
+
+#endif /* _OTX2_IRQ_H_ */
drivers/common/octeontx2/rte_common_octeontx2_version.map +3 -0
index 7d2cfc70e..34a6ffb93 100644
@@ -1,6 +1,9 @@
 DPDK_19.05 {
 	global:
 
+	otx2_dev_fini;
+	otx2_dev_init;
+
 	otx2_logtype_base;
 	otx2_logtype_mbox;
 	otx2_logtype_npa;
Signature · 1 line
2.21.0
#8 lore raw

PATCH 8/27 common/octeontx2: introduce irq handling functions

In reply to [email protected]

From: Jerin Jacob <[email protected]>

All PCIe drivers(ethdev, mempool, cryptodev and eventdev) in octeontx2, needs to handle interrupt for mailbox and error handling. Create a helper function over rte interrupt API to register, unregister, disable interrupts.

---
 drivers/common/octeontx2/Makefile             |   1 +
 drivers/common/octeontx2/meson.build          |   1 +
 drivers/common/octeontx2/otx2_irq.c           | 254 ++++++++++++++++++
 drivers/common/octeontx2/otx2_irq.h           |   6 +
 .../rte_common_octeontx2_version.map          |   4 +
 5 files changed, 266 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_irq.c
drivers/common/octeontx2/Makefile +1 -0
index a6f94553d..78243e555 100644
@@ -26,6 +26,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-y += otx2_dev.c
+SRCS-y += otx2_irq.c
 SRCS-y += otx2_mbox.c
 SRCS-y += otx2_common.c
 
drivers/common/octeontx2/meson.build +1 -0
index feaf75d92..44ac90085 100644
@@ -3,6 +3,7 @@
 #
 
 sources= files('otx2_dev.c',
+		'otx2_irq.c',
 		'otx2_mbox.c',
 		'otx2_common.c',
 	       )
drivers/common/octeontx2/otx2_irq.c new file +254 -0

254 lines not on this page · raw message

drivers/common/octeontx2/otx2_irq.h +6 -0
index df44ddfba..9d326276e 100644
@@ -16,4 +16,10 @@ typedef struct {
 	uint64_t bits[MAX_VFPF_DWORD_BITS];
 } otx2_intr_t;
 
+int otx2_register_irq(struct rte_intr_handle *intr_handle,
+		      rte_intr_callback_fn cb, void *data, unsigned int vec);
+void otx2_unregister_irq(struct rte_intr_handle *intr_handle,
+			 rte_intr_callback_fn cb, void *data, unsigned int vec);
+int otx2_disable_irqs(struct rte_intr_handle *intr_handle);
+
 #endif /* _OTX2_IRQ_H_ */
drivers/common/octeontx2/rte_common_octeontx2_version.map +4 -0
index 34a6ffb93..2fda35aad 100644
@@ -20,5 +20,9 @@ DPDK_19.05 {
 	otx2_mbox_msg_send;
 	otx2_mbox_wait_for_rsp;
 
+	otx2_disable_irqs;
+	otx2_unregister_irq;
+	otx2_register_irq;
+
 	local: *;
 };
Signature · 1 line
2.21.0
#9 lore raw

PATCH 9/27 common/octeontx2: handle intra device operations

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The mempool device(NPA) may be provisioned as a standalone device or it can be part of ethdev/eventdev device. In order to address mempool as standalone or integrated with ethdev/eventdev device, An intra device structure being introduced.

When the _first_ ethdev/eventdev PCIe device or standalone mempool(NPA) devices get probed by the eal PCI subsystem,
The NPA object(struct otx2_npa_lf) stored in otx2_dev base class. Once it is accomplished, the other consumer drivers like ethdev driver or eventdev driver use otx2_npa_* API to operate on shared NPA object.

The similar concept followed for SSO object, Which needs to share between PCIe devices.

---
 drivers/common/octeontx2/otx2_common.c        | 163 ++++++++++++++++++
 drivers/common/octeontx2/otx2_common.h        |  32 +++-
 drivers/common/octeontx2/otx2_dev.c           |   6 +
 drivers/common/octeontx2/otx2_dev.h           |   1 +
 .../rte_common_octeontx2_version.map          |   9 +
 5 files changed, 210 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_common.c +163 -0
index 544828825..18d28e82a 100644
@@ -2,9 +2,172 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_atomic.h>
+#include <rte_malloc.h>
 #include <rte_log.h>
 
 #include "otx2_common.h"
+#include "otx2_dev.h"
+#include "otx2_mbox.h"
+
+/**
+ * @internal
+ * Set default NPA configuration.
+ */
+void
+otx2_npa_set_defaults(struct otx2_idev_cfg *idev)
+{
+	idev->npa_pf_func = 0;
+	rte_atomic16_set(&idev->npa_refcnt, 0);
+}
+
+/**
+ * @internal
+ * Get intra device config structure.
+ */
+struct otx2_idev_cfg *
+otx2_intra_dev_get_cfg(void)
+{
+	const char name[] = "octeontx2_intra_device_conf";
+	const struct rte_memzone *mz;
+	struct otx2_idev_cfg *idev;
+
+	mz = rte_memzone_lookup(name);
+	if (mz != NULL)
+		return mz->addr;
+
+	/* Request for the first time */
+	mz = rte_memzone_reserve_aligned(name, sizeof(struct otx2_idev_cfg),
+					 SOCKET_ID_ANY, 0, OTX2_ALIGN);
+	if (mz != NULL) {
+		idev = mz->addr;
+		idev->sso_pf_func = 0;
+		idev->npa_lf = NULL;
+		otx2_npa_set_defaults(idev);
+		return idev;
+	}
+	return NULL;
+}
+
+/**
+ * @internal
+ * Get SSO PF_FUNC.
+ */
+uint16_t
+otx2_sso_pf_func_get(void)
+{
+	struct otx2_idev_cfg *idev;
+	uint16_t sso_pf_func;
+
+	sso_pf_func = 0;
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL)
+		sso_pf_func = idev->sso_pf_func;
+
+	return sso_pf_func;
+}
+
+/**
+ * @internal
+ * Set SSO PF_FUNC.
+ */
+void
+otx2_sso_pf_func_set(uint16_t sso_pf_func)
+{
+	struct otx2_idev_cfg *idev;
+
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL) {
+		idev->sso_pf_func = sso_pf_func;
+		rte_smp_wmb();
+	}
+}
+
+/**
+ * @internal
+ * Get NPA PF_FUNC.
+ */
+uint16_t
+otx2_npa_pf_func_get(void)
+{
+	struct otx2_idev_cfg *idev;
+	uint16_t npa_pf_func;
+
+	npa_pf_func = 0;
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL)
+		npa_pf_func = idev->npa_pf_func;
+
+	return npa_pf_func;
+}
+
+/**
+ * @internal
+ * Get NPA lf object.
+ */
+struct otx2_npa_lf *
+otx2_npa_lf_obj_get(void)
+{
+	struct otx2_idev_cfg *idev;
+
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL && rte_atomic16_read(&idev->npa_refcnt))
+		return idev->npa_lf;
+
+	return NULL;
+}
+
+/**
+ * @internal
+ * Is NPA lf active for the given device?.
+ */
+int
+otx2_npa_lf_active(void *otx2_dev)
+{
+	struct otx2_dev *dev = otx2_dev;
+	struct otx2_idev_cfg *idev;
+
+	/* Check if npalf is actively used on this dev */
+	idev = otx2_intra_dev_get_cfg();
+	if (!idev || !idev->npa_lf || idev->npa_lf->mbox != dev->mbox)
+		return 0;
+
+	return rte_atomic16_read(&idev->npa_refcnt);
+}
+
+/*
+ * @internal
+ * Gets reference only to existing NPA LF object.
+ */
+int otx2_npa_lf_obj_ref(void)
+{
+	struct otx2_idev_cfg *idev;
+	uint16_t cnt;
+	int rc;
+
+	idev = otx2_intra_dev_get_cfg();
+
+	/* Check if ref not possible */
+	if (idev == NULL)
+		return -EINVAL;
+
+
+	/* Get ref only if > 0 */
+	cnt = rte_atomic16_read(&idev->npa_refcnt);
+	while (cnt != 0) {
+		rc = rte_atomic16_cmpset(&idev->npa_refcnt_u16, cnt, cnt + 1);
+		if (rc)
+			break;
+
+		cnt = rte_atomic16_read(&idev->npa_refcnt);
+	}
+
+	return cnt ? 0 : -EINVAL;
+}
 
 /**
  * @internal
drivers/common/octeontx2/otx2_common.h +31 -1
index 0750cdd14..d4bc2f59c 100644
@@ -5,9 +5,12 @@
 #ifndef _OTX2_COMMON_H_
 #define _OTX2_COMMON_H_
 
+#include <rte_atomic.h>
 #include <rte_common.h>
-#include <rte_io.h>
+#include <rte_cycles.h>
 #include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_io.h>
 
 #include "hw/otx2_rvu.h"
 #include "hw/otx2_nix.h"
@@ -33,6 +36,33 @@
 #define __hot   __attribute__((hot))
 #endif
 
+/* Intra device related functions */
+struct otx2_npa_lf {
+	struct otx2_mbox *mbox;
+	struct rte_pci_device *pci_dev;
+	struct rte_intr_handle *intr_handle;
+};
+
+struct otx2_idev_cfg {
+	uint16_t sso_pf_func;
+	uint16_t npa_pf_func;
+	struct otx2_npa_lf *npa_lf;
+	RTE_STD_C11
+	union {
+		rte_atomic16_t npa_refcnt;
+		uint16_t npa_refcnt_u16;
+	};
+};
+
+struct otx2_idev_cfg *otx2_intra_dev_get_cfg(void);
+void otx2_sso_pf_func_set(uint16_t sso_pf_func);
+uint16_t otx2_sso_pf_func_get(void);
+uint16_t otx2_npa_pf_func_get(void);
+struct otx2_npa_lf *otx2_npa_lf_obj_get(void);
+void otx2_npa_set_defaults(struct otx2_idev_cfg *idev);
+int otx2_npa_lf_active(void *dev);
+int otx2_npa_lf_obj_ref(void);
+
 /* Log */
 extern int otx2_logtype_base;
 extern int otx2_logtype_mbox;
drivers/common/octeontx2/otx2_dev.c +6 -0
index ccdb2df78..59bd988d1 100644
@@ -177,8 +177,14 @@ void
 otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 {
 	struct otx2_dev *dev = otx2_dev;
+	struct otx2_idev_cfg *idev;
 	struct otx2_mbox *mbox;
 
+	/* Clear references to this pci dev */
+	idev = otx2_intra_dev_get_cfg();
+	if (idev->npa_lf && idev->npa_lf->pci_dev == pci_dev)
+		idev->npa_lf = NULL;
+
 	/* Release PF - VF */
 	mbox = &dev->mbox_vfpf;
 	if (mbox->hwbase && mbox->dev)
drivers/common/octeontx2/otx2_dev.h +1 -0
index a89570b62..70104dfa2 100644
@@ -40,6 +40,7 @@ struct otx2_dev;
 	otx2_intr_t intr;				\
 	int timer_set;	/* ~0 : no alarm handling */	\
 	uint64_t hwcap;					\
+	struct otx2_npa_lf npalf;			\
 	struct otx2_mbox *mbox;				\
 	uint16_t maxvf;					\
 	const struct otx2_dev_ops *ops
drivers/common/octeontx2/rte_common_octeontx2_version.map +9 -0
index 2fda35aad..b151ce6e2 100644
@@ -20,6 +20,15 @@ DPDK_19.05 {
 	otx2_mbox_msg_send;
 	otx2_mbox_wait_for_rsp;
 
+	otx2_intra_dev_get_cfg;
+	otx2_npa_lf_active;
+	otx2_npa_lf_obj_get;
+	otx2_npa_lf_obj_ref;
+	otx2_npa_pf_func_get;
+	otx2_npa_set_defaults;
+	otx2_sso_pf_func_get;
+	otx2_sso_pf_func_set;
+
 	otx2_disable_irqs;
 	otx2_unregister_irq;
 	otx2_register_irq;
Signature · 1 line
2.21.0
#10 lore raw

PATCH 10/27 common/octeontx2: add AF to PF mailbox IRQ and msg handlers

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

This patch adds support for AF to PF mailbox interrupt and message handling. PF writes the message on mapped mailbox region followed by writing the mailbox doorbell register. Upon receiving, the mailbox request in AF(In Linux kernel), It processes the messages and update the counter memory and update the AF mbox doorbell register. That would trigger a VFIO interrupt to userspace and otx2_process_msgs() will handle it.

---
 drivers/common/octeontx2/otx2_dev.c | 120 +++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_dev.c +119 -1
index 59bd988d1..ba4fd9547 100644
@@ -14,6 +14,9 @@
 #include "otx2_dev.h"
 #include "otx2_mbox.h"
 
+#define RVU_MAX_VF		64 /* RVU_PF_VFPF_MBOX_INT(0..1) */
+#define RVU_MAX_INT_RETRY	3
+
 /* PF/VF message handling timer */
 #define VF_PF_MBOX_TIMER_MS	(20 * 1000)
 
@@ -47,6 +50,108 @@ mbox_mem_unmap(void *va, size_t size)
 		munmap(va, size);
 }
 
+static void
+otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	int msgs_acked = 0;
+	int offset;
+	uint16_t i;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs == 0)
+		return;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+
+		msgs_acked++;
+		otx2_base_dbg("Message 0x%x (%s) pf:%d/vf:%d",
+			      msg->id, otx2_mbox_id2name(msg->id),
+			      otx2_get_pf(msg->pcifunc),
+			      otx2_get_vf(msg->pcifunc));
+
+		switch (msg->id) {
+			/* Add message id's that are handled here */
+		case MBOX_MSG_READY:
+			/* Get our identity */
+			dev->pf_func = msg->pcifunc;
+			break;
+
+		default:
+			if (msg->rc)
+				otx2_err("Message (%s) response has err=%d",
+					 otx2_mbox_id2name(msg->id), msg->rc);
+			break;
+		}
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+
+	otx2_mbox_reset(mbox, 0);
+	/* Update acked if someone is waiting a message */
+	mdev->msgs_acked = msgs_acked;
+	rte_wmb();
+}
+
+static void
+otx2_af_pf_mbox_irq(void *param)
+{
+	struct otx2_dev *dev = param;
+	uint64_t intr;
+
+	intr = otx2_read64(dev->bar2 + RVU_PF_INT);
+	if (intr == 0)
+		return;
+
+	otx2_write64(intr, dev->bar2 + RVU_PF_INT);
+
+	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
+	if (intr)
+		/* First process all configuration messages */
+		otx2_process_msgs(dev, dev->mbox);
+}
+
+static int
+mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int rc;
+
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	dev->timer_set = 0;
+
+	/* MBOX interrupt AF <-> PF */
+	rc = otx2_register_irq(intr_handle, otx2_af_pf_mbox_irq,
+			       dev, RVU_PF_INT_VEC_AFPF_MBOX);
+	if (rc) {
+		otx2_err("Fail to register AF<->PF mbox irq");
+		return rc;
+	}
+
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT);
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
+
+	return rc;
+}
+
+static void
+mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	dev->timer_set = 0;
+
+	/* MBOX interrupt AF <-> PF */
+	otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev,
+			    RVU_PF_INT_VEC_AFPF_MBOX);
+}
+
 static void
 otx2_update_pass_hwcap(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
@@ -120,10 +225,15 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 	if (rc)
 		goto error;
 
+	/* Register mbox interrupts */
+	rc = mbox_register_irq(pci_dev, dev);
+	if (rc)
+		goto mbox_fini;
+
 	/* Check the readiness of PF/VF */
 	rc = otx2_send_ready_msg(dev->mbox, &dev->pf_func);
 	if (rc)
-		goto mbox_fini;
+		goto mbox_unregister;
 
 	dev->pf = otx2_get_pf(dev->pf_func);
 	dev->vf = otx2_get_vf(dev->pf_func);
@@ -162,6 +272,8 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 
 iounmap:
 	mbox_mem_unmap(hwbase, MBOX_SIZE * pci_dev->max_vfs);
+mbox_unregister:
+	mbox_unregister_irq(pci_dev, dev);
 mbox_fini:
 	otx2_mbox_fini(dev->mbox);
 	otx2_mbox_fini(&dev->mbox_up);
@@ -176,6 +288,7 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 void
 otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 {
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct otx2_dev *dev = otx2_dev;
 	struct otx2_idev_cfg *idev;
 	struct otx2_mbox *mbox;
@@ -185,6 +298,8 @@ otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 	if (idev->npa_lf && idev->npa_lf->pci_dev == pci_dev)
 		idev->npa_lf = NULL;
 
+	mbox_unregister_irq(pci_dev, dev);
+
 	/* Release PF - VF */
 	mbox = &dev->mbox_vfpf;
 	if (mbox->hwbase && mbox->dev)
@@ -200,4 +315,7 @@ otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 	mbox = &dev->mbox_up;
 	otx2_mbox_fini(mbox);
 	dev->mbox_active = 0;
+
+	/* Disable MSIX vectors */
+	otx2_disable_irqs(intr_handle);
 }
Signature · 1 line
2.21.0
#11 lore raw

PATCH 11/27 common/octeontx2: add PF to VF mailbox IRQ and msg handlers

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

PF has additional responsibility being server for VF messages and forward to AF and once AF process it then forward the response back to VF.
otx2_vf_pf_mbox_irq() will process the VF mailbox request and af_pf_wait_msg() will until getting a response back from AF.

---
 drivers/common/octeontx2/otx2_dev.c | 240 +++++++++++++++++++++++++++-
 1 file changed, 239 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_dev.c +239 -1
index ba4fd9547..09b551819 100644
@@ -7,6 +7,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <rte_alarm.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_memcpy.h>
@@ -50,6 +51,200 @@ mbox_mem_unmap(void *va, size_t size)
 		munmap(va, size);
 }
 
+static int
+af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
+{
+	uint32_t timeout = 0, sleep = 1; struct otx2_mbox *mbox = dev->mbox;
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	volatile uint64_t int_status;
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	struct mbox_msghdr *rsp;
+	uint64_t offset;
+	size_t size;
+	int i;
+
+	/* We need to disable PF interrupts. We are in timer interrupt */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	/* Send message */
+	otx2_mbox_msg_send(mbox, 0);
+
+	do {
+		rte_delay_ms(sleep);
+		timeout++;
+		if (timeout >= MBOX_RSP_TIMEOUT) {
+			otx2_err("Routed messages %d timeout: %dms",
+				 num_msg, MBOX_RSP_TIMEOUT);
+			break;
+		}
+		int_status = otx2_read64(dev->bar2 + RVU_PF_INT);
+	} while ((int_status & 0x1) != 0x1);
+
+	/* Clear */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT);
+
+	/* Enable interrupts */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs != num_msg)
+		otx2_err("Routed messages: %d received: %d", num_msg,
+			 req_hdr->num_msgs);
+
+	/* Get messages from mbox */
+	offset = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+		size = mbox->rx_start + msg->next_msgoff - offset;
+
+		/* Reserve PF/VF mbox message */
+		size = RTE_ALIGN(size, MBOX_MSG_ALIGN);
+		rsp = otx2_mbox_alloc_msg(&dev->mbox_vfpf, vf, size);
+		otx2_mbox_rsp_init(msg->id, rsp);
+
+		/* Copy message from AF<->PF mbox to PF<->VF mbox */
+		otx2_mbox_memcpy((uint8_t *)rsp + sizeof(struct mbox_msghdr),
+				 (uint8_t *)msg + sizeof(struct mbox_msghdr),
+				 size - sizeof(struct mbox_msghdr));
+
+		/* Set status and sender pf_func data */
+		rsp->rc = msg->rc;
+		rsp->pcifunc = msg->pcifunc;
+
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+	rte_spinlock_unlock(&mdev->mbox_lock);
+
+	return req_hdr->num_msgs;
+}
+
+static int
+vf_pf_process_msgs(struct otx2_dev *dev, uint16_t vf)
+{
+	int offset, routed = 0; struct otx2_mbox *mbox = &dev->mbox_vfpf;
+	struct otx2_mbox_dev *mdev = &mbox->dev[vf];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	size_t size;
+	uint16_t i;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (!req_hdr->num_msgs)
+		return 0;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+		size = mbox->rx_start + msg->next_msgoff - offset;
+
+		/* RVU_PF_FUNC_S */
+		msg->pcifunc = otx2_pfvf_func(dev->pf, vf);
+
+		if (msg->id == MBOX_MSG_READY) {
+			struct ready_msg_rsp *rsp;
+			uint16_t max_bits = sizeof(dev->active_vfs[0]) * 8;
+
+			/* Handle READY message in PF */
+			dev->active_vfs[vf / max_bits] |=
+						BIT_ULL(vf % max_bits);
+			rsp = (struct ready_msg_rsp *)
+			       otx2_mbox_alloc_msg(mbox, vf, sizeof(*rsp));
+			otx2_mbox_rsp_init(msg->id, rsp);
+
+			/* PF/VF function ID */
+			rsp->hdr.pcifunc = msg->pcifunc;
+			rsp->hdr.rc = 0;
+		} else {
+			struct mbox_msghdr *af_req;
+			/* Reserve AF/PF mbox message */
+			size = RTE_ALIGN(size, MBOX_MSG_ALIGN);
+			af_req = otx2_mbox_alloc_msg(dev->mbox, 0, size);
+			otx2_mbox_req_init(msg->id, af_req);
+
+			/* Copy message from VF<->PF mbox to PF<->AF mbox */
+			otx2_mbox_memcpy((uint8_t *)af_req +
+				   sizeof(struct mbox_msghdr),
+				   (uint8_t *)msg + sizeof(struct mbox_msghdr),
+				   size - sizeof(struct mbox_msghdr));
+			af_req->pcifunc = msg->pcifunc;
+			routed++;
+		}
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+
+	if (routed > 0) {
+		otx2_base_dbg("pf:%d routed %d messages from vf:%d to AF",
+			      dev->pf, routed, vf);
+		af_pf_wait_msg(dev, vf, routed);
+		otx2_mbox_reset(dev->mbox, 0);
+	}
+
+	/* Send mbox responses to VF */
+	if (mdev->num_msgs) {
+		otx2_base_dbg("pf:%d reply %d messages to vf:%d",
+			      dev->pf, mdev->num_msgs, vf);
+		otx2_mbox_msg_send(mbox, vf);
+	}
+
+	return i;
+}
+
+static void
+otx2_vf_pf_mbox_handle_msg(void *param)
+{
+	uint16_t vf, max_vf, max_bits;
+	struct otx2_dev *dev = param;
+
+	max_bits = sizeof(dev->intr.bits[0]) * sizeof(uint64_t);
+	max_vf = max_bits * MAX_VFPF_DWORD_BITS;
+
+	for (vf = 0; vf < max_vf; vf++) {
+		if (dev->intr.bits[vf/max_bits] & BIT_ULL(vf%max_bits)) {
+			otx2_base_dbg("Process vf:%d request (pf:%d, vf:%d)",
+				       vf, dev->pf, dev->vf);
+			vf_pf_process_msgs(dev, vf);
+			dev->intr.bits[vf/max_bits] &= ~(BIT_ULL(vf%max_bits));
+		}
+	}
+	dev->timer_set = 0;
+}
+
+static void
+otx2_vf_pf_mbox_irq(void *param)
+{
+	struct otx2_dev *dev = param;
+	bool alarm_set = false;
+	uint64_t intr;
+	int vfpf;
+
+	for (vfpf = 0; vfpf < MAX_VFPF_DWORD_BITS; ++vfpf) {
+		intr = otx2_read64(dev->bar2 + RVU_PF_VFPF_MBOX_INTX(vfpf));
+		if (!intr)
+			continue;
+
+		otx2_base_dbg("vfpf: %d intr: 0x%" PRIx64 " (pf:%d, vf:%d)",
+			      vfpf, intr, dev->pf, dev->vf);
+
+		/* Save and clear intr bits */
+		dev->intr.bits[vfpf] |= intr;
+		otx2_write64(intr, dev->bar2 + RVU_PF_VFPF_MBOX_INTX(vfpf));
+		alarm_set = true;
+	}
+
+	if (!dev->timer_set && alarm_set) {
+		dev->timer_set = 1;
+		/* Start timer to handle messages */
+		rte_eal_alarm_set(VF_PF_MBOX_TIMER_MS,
+				  otx2_vf_pf_mbox_handle_msg, dev);
+	}
+}
+
 static void
 otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
 {
@@ -118,12 +313,33 @@ static int
 mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
-	int rc;
+	int i, rc;
+
+	/* HW clear irq */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i)
+		otx2_write64(~0ull, dev->bar2 +
+			     RVU_PF_VFPF_MBOX_INT_ENA_W1CX(i));
 
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
 
 	dev->timer_set = 0;
 
+	/* MBOX interrupt for VF(0...63) <-> PF */
+	rc = otx2_register_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			       RVU_PF_INT_VEC_VFPF_MBOX0);
+
+	if (rc) {
+		otx2_err("Fail to register PF(VF0-63) mbox irq");
+		return rc;
+	}
+	/* MBOX interrupt for VF(64...128) <-> PF */
+	rc = otx2_register_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			       RVU_PF_INT_VEC_VFPF_MBOX1);
+
+	if (rc) {
+		otx2_err("Fail to register PF(VF64-128) mbox irq");
+		return rc;
+	}
 	/* MBOX interrupt AF <-> PF */
 	rc = otx2_register_irq(intr_handle, otx2_af_pf_mbox_irq,
 			       dev, RVU_PF_INT_VEC_AFPF_MBOX);
@@ -132,6 +348,11 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 		return rc;
 	}
 
+	/* HW enable intr */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i)
+		otx2_write64(~0ull, dev->bar2 +
+			RVU_PF_VFPF_MBOX_INT_ENA_W1SX(i));
+
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT);
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
 
@@ -142,11 +363,28 @@ static void
 mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int i;
+
+	/* HW clear irq */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i)
+		otx2_write64(~0ull, dev->bar2 +
+			     RVU_PF_VFPF_MBOX_INT_ENA_W1CX(i));
 
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
 
 	dev->timer_set = 0;
 
+	rte_eal_alarm_cancel(otx2_vf_pf_mbox_handle_msg, dev);
+
+	/* Unregister the interrupt handler for each vectors */
+	/* MBOX interrupt for VF(0...63) <-> PF */
+	otx2_unregister_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			    RVU_PF_INT_VEC_VFPF_MBOX0);
+
+	/* MBOX interrupt for VF(64...128) <-> PF */
+	otx2_unregister_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			    RVU_PF_INT_VEC_VFPF_MBOX1);
+
 	/* MBOX interrupt AF <-> PF */
 	otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev,
 			    RVU_PF_INT_VEC_AFPF_MBOX);
Signature · 1 line
2.21.0
#12 lore raw

PATCH 12/27 common/octeontx2: add VF mailbox IRQ and msg handler

In reply to [email protected]

From: Jerin Jacob <[email protected]>

This patch adds support for PF <-> VF mailbox interrupt mailbox message interrupt handling.

---
 drivers/common/octeontx2/otx2_dev.c | 78 ++++++++++++++++++++++++++++-
 1 file changed, 76 insertions(+), 2 deletions(-)
drivers/common/octeontx2/otx2_dev.c +76 -2
index 09b551819..fc6dca624 100644
@@ -291,6 +291,24 @@ otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
 	rte_wmb();
 }
 
+static void
+otx2_pf_vf_mbox_irq(void *param)
+{
+	struct otx2_dev *dev = param;
+	uint64_t intr;
+
+	intr = otx2_read64(dev->bar2 + RVU_VF_INT);
+	if (intr == 0)
+		return;
+
+	otx2_write64(intr, dev->bar2 + RVU_VF_INT);
+	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
+	if (intr)
+		/* First process all configuration messages */
+		otx2_process_msgs(dev, dev->mbox);
+
+}
+
 static void
 otx2_af_pf_mbox_irq(void *param)
 {
@@ -310,7 +328,7 @@ otx2_af_pf_mbox_irq(void *param)
 }
 
 static int
-mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+mbox_register_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i, rc;
@@ -359,8 +377,41 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 	return rc;
 }
 
+static int
+mbox_register_vf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int rc;
+
+	/* Clear irq */
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1C);
+
+	/* MBOX interrupt PF <-> VF */
+	rc = otx2_register_irq(intr_handle, otx2_pf_vf_mbox_irq,
+			       dev, RVU_VF_INT_VEC_MBOX);
+	if (rc) {
+		otx2_err("Fail to register PF<->VF mbox irq");
+		return rc;
+	}
+
+	/* HW enable intr */
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT);
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1S);
+
+	return rc;
+}
+
+static int
+mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	if (otx2_dev_is_vf(dev))
+		return mbox_register_vf_irq(pci_dev, dev);
+	else
+		return mbox_register_pf_irq(pci_dev, dev);
+}
+
 static void
-mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+mbox_unregister_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i;
@@ -388,6 +439,29 @@ mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 	/* MBOX interrupt AF <-> PF */
 	otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev,
 			    RVU_PF_INT_VEC_AFPF_MBOX);
+
+}
+
+static void
+mbox_unregister_vf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+
+	/* Clear irq */
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1C);
+
+	/* Unregister the interrupt handler */
+	otx2_unregister_irq(intr_handle, otx2_pf_vf_mbox_irq, dev,
+			    RVU_VF_INT_VEC_MBOX);
+}
+
+static void
+mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	if (otx2_dev_is_vf(dev))
+		return mbox_unregister_vf_irq(pci_dev, dev);
+	else
+		return mbox_unregister_pf_irq(pci_dev, dev);
 }
 
 static void
Signature · 1 line
2.21.0
#13 lore raw

PATCH 13/27 common/octeontx2: add uplink message support

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

The events like PHY link status change by AF or PHY configuration change by PF would call for the uplink message.
The AF initiated uplink would land it in PF and PF would further forward to VF(if it is intended for that specific VF)

The PF initiated uplink would be distributed to all active VFs. This patch adds support for the same.

---
 drivers/common/octeontx2/otx2_dev.c | 243 +++++++++++++++++++++++++++-
 drivers/common/octeontx2/otx2_dev.h |  11 ++
 2 files changed, 252 insertions(+), 2 deletions(-)
drivers/common/octeontx2/otx2_dev.c +241 -2
index fc6dca624..3522a1783 100644
@@ -195,6 +195,57 @@ vf_pf_process_msgs(struct otx2_dev *dev, uint16_t vf)
 	return i;
 }
 
+static int
+vf_pf_process_up_msgs(struct otx2_dev *dev, uint16_t vf)
+{
+	struct otx2_mbox *mbox = &dev->mbox_vfpf_up;
+	struct otx2_mbox_dev *mdev = &mbox->dev[vf];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	int msgs_acked = 0;
+	int offset;
+	uint16_t i;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs == 0)
+		return 0;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+
+		msgs_acked++;
+		/* RVU_PF_FUNC_S */
+		msg->pcifunc = otx2_pfvf_func(dev->pf, vf);
+
+		switch (msg->id) {
+		case MBOX_MSG_CGX_LINK_EVENT:
+			otx2_base_dbg("PF: Msg 0x%x (%s) fn:0x%x (pf:%d,vf:%d)",
+				      msg->id, otx2_mbox_id2name(msg->id),
+				      msg->pcifunc, otx2_get_pf(msg->pcifunc),
+				      otx2_get_vf(msg->pcifunc));
+			break;
+		case MBOX_MSG_CGX_PTP_RX_INFO:
+			otx2_base_dbg("PF: Msg 0x%x (%s) fn:0x%x (pf:%d,vf:%d)",
+				      msg->id, otx2_mbox_id2name(msg->id),
+				      msg->pcifunc, otx2_get_pf(msg->pcifunc),
+				      otx2_get_vf(msg->pcifunc));
+			break;
+		default:
+			otx2_err("Not handled UP msg 0x%x (%s) func:0x%x",
+				 msg->id, otx2_mbox_id2name(msg->id),
+				 msg->pcifunc);
+		}
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+	otx2_mbox_reset(mbox, vf);
+	mdev->msgs_acked = msgs_acked;
+	rte_wmb();
+
+	return i;
+}
+
 static void
 otx2_vf_pf_mbox_handle_msg(void *param)
 {
@@ -209,6 +260,8 @@ otx2_vf_pf_mbox_handle_msg(void *param)
 			otx2_base_dbg("Process vf:%d request (pf:%d, vf:%d)",
 				       vf, dev->pf, dev->vf);
 			vf_pf_process_msgs(dev, vf);
+			/* UP messages */
+			vf_pf_process_up_msgs(dev, vf);
 			dev->intr.bits[vf/max_bits] &= ~(BIT_ULL(vf%max_bits));
 		}
 	}
@@ -291,6 +344,185 @@ otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
 	rte_wmb();
 }
 
+/* Copies the message received from AF and sends it to VF */
+static void
+pf_vf_mbox_send_up_msg(struct otx2_dev *dev, void *rec_msg)
+{
+	uint16_t max_bits = sizeof(dev->active_vfs[0]) * sizeof(uint64_t);
+	struct otx2_mbox *vf_mbox = &dev->mbox_vfpf_up;
+	struct msg_req *msg = rec_msg;
+	struct mbox_msghdr *vf_msg;
+	uint16_t vf;
+	size_t size;
+
+	size = RTE_ALIGN(otx2_mbox_id2size(msg->hdr.id), MBOX_MSG_ALIGN);
+	/* Send UP message to all VF's */
+	for (vf = 0; vf < vf_mbox->ndevs; vf++) {
+		/* VF active */
+		if (!(dev->active_vfs[vf / max_bits] & (BIT_ULL(vf))))
+			continue;
+
+		otx2_base_dbg("(%s) size: %zx to VF: %d",
+			      otx2_mbox_id2name(msg->hdr.id), size, vf);
+
+		/* Reserve PF/VF mbox message */
+		vf_msg = otx2_mbox_alloc_msg(vf_mbox, vf, size);
+		if (!vf_msg) {
+			otx2_err("Failed to alloc VF%d UP message", vf);
+			continue;
+		}
+		otx2_mbox_req_init(msg->hdr.id, vf_msg);
+
+		/*
+		 * Copy message from AF<->PF UP mbox
+		 * to PF<->VF UP mbox
+		 */
+		otx2_mbox_memcpy((uint8_t *)vf_msg +
+				 sizeof(struct mbox_msghdr), (uint8_t *)msg
+				 + sizeof(struct mbox_msghdr), size -
+				 sizeof(struct mbox_msghdr));
+
+		vf_msg->rc = msg->hdr.rc;
+		/* Set PF to be a sender */
+		vf_msg->pcifunc = dev->pf_func;
+
+		/* Send to VF */
+		otx2_mbox_msg_send(vf_mbox, vf);
+	}
+}
+
+static int
+otx2_mbox_up_handler_cgx_link_event(struct otx2_dev *dev,
+				    struct cgx_link_info_msg *msg,
+				    struct msg_rsp *rsp)
+{
+	struct cgx_link_user_info *linfo = &msg->link_info;
+
+	otx2_base_dbg("pf:%d/vf:%d NIC Link %s --> 0x%x (%s) from: pf:%d/vf:%d",
+		      otx2_get_pf(dev->pf_func), otx2_get_vf(dev->pf_func),
+		      linfo->link_up ? "UP" : "DOWN", msg->hdr.id,
+		      otx2_mbox_id2name(msg->hdr.id),
+		      otx2_get_pf(msg->hdr.pcifunc),
+		      otx2_get_vf(msg->hdr.pcifunc));
+
+	/* PF gets link notification from AF */
+	if (otx2_get_pf(msg->hdr.pcifunc) == 0) {
+		if (dev->ops && dev->ops->link_status_update)
+			dev->ops->link_status_update(dev, linfo);
+
+		/* Forward the same message as received from AF to VF */
+		pf_vf_mbox_send_up_msg(dev, msg);
+	} else {
+		/* VF gets link up notification */
+		if (dev->ops && dev->ops->link_status_update)
+			dev->ops->link_status_update(dev, linfo);
+	}
+
+	rsp->hdr.rc = 0;
+	return 0;
+}
+
+static int
+otx2_mbox_up_handler_cgx_ptp_rx_info(struct otx2_dev *dev,
+				     struct cgx_ptp_rx_info_msg *msg,
+				     struct msg_rsp *rsp)
+{
+	otx2_nix_dbg("pf:%d/vf:%d PTP mode %s --> 0x%x (%s) from: pf:%d/vf:%d",
+		 otx2_get_pf(dev->pf_func),
+		 otx2_get_vf(dev->pf_func),
+		 msg->ptp_en ? "ENABLED" : "DISABLED",
+		 msg->hdr.id, otx2_mbox_id2name(msg->hdr.id),
+		 otx2_get_pf(msg->hdr.pcifunc),
+		 otx2_get_vf(msg->hdr.pcifunc));
+
+	/* PF gets PTP notification from AF */
+	if (otx2_get_pf(msg->hdr.pcifunc) == 0) {
+		if (dev->ops && dev->ops->ptp_info_update)
+			dev->ops->ptp_info_update(dev, msg->ptp_en);
+
+		/* Forward the same message as received from AF to VF */
+		pf_vf_mbox_send_up_msg(dev, msg);
+	} else {
+		/* VF gets PTP notification */
+		if (dev->ops && dev->ops->ptp_info_update)
+			dev->ops->ptp_info_update(dev, msg->ptp_en);
+	}
+
+	rsp->hdr.rc = 0;
+	return 0;
+}
+
+static int
+mbox_process_msgs_up(struct otx2_dev *dev, struct mbox_msghdr *req)
+{
+	/* Check if valid, if not reply with a invalid msg */
+	if (req->sig != OTX2_MBOX_REQ_SIG)
+		return -EIO;
+
+	switch (req->id) {
+#define M(_name, _id, _fn_name, _req_type, _rsp_type)		\
+	case _id: {						\
+		struct _rsp_type *rsp;				\
+		int err;					\
+								\
+		rsp = (struct _rsp_type *)otx2_mbox_alloc_msg(	\
+			&dev->mbox_up, 0,			\
+			sizeof(struct _rsp_type));		\
+		if (!rsp)					\
+			return -ENOMEM;				\
+								\
+		rsp->hdr.id = _id;				\
+		rsp->hdr.sig = OTX2_MBOX_RSP_SIG;		\
+		rsp->hdr.pcifunc = dev->pf_func;		\
+		rsp->hdr.rc = 0;				\
+								\
+		err = otx2_mbox_up_handler_ ## _fn_name(	\
+			dev, (struct _req_type *)req, rsp);	\
+		return err;					\
+	}
+MBOX_UP_CGX_MESSAGES
+#undef M
+
+	default :
+		otx2_reply_invalid_msg(&dev->mbox_up, 0, 0, req->id);
+	}
+
+	return -ENODEV;
+}
+
+static void
+otx2_process_msgs_up(struct otx2_dev *dev, struct otx2_mbox *mbox)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	int i, err, offset;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs == 0)
+		return;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+
+		otx2_base_dbg("Message 0x%x (%s) pf:%d/vf:%d",
+				msg->id, otx2_mbox_id2name(msg->id),
+				otx2_get_pf(msg->pcifunc),
+				otx2_get_vf(msg->pcifunc));
+		err = mbox_process_msgs_up(dev, msg);
+		if (err)
+			otx2_err("Error %d handling 0x%x (%s)",
+				 err, msg->id, otx2_mbox_id2name(msg->id));
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+	/* Send mbox responses */
+	if (mdev->num_msgs) {
+		otx2_base_dbg("Reply num_msgs:%d", mdev->num_msgs);
+		otx2_mbox_msg_send(mbox, 0);
+	}
+}
+
 static void
 otx2_pf_vf_mbox_irq(void *param)
 {
@@ -303,10 +535,13 @@ otx2_pf_vf_mbox_irq(void *param)
 
 	otx2_write64(intr, dev->bar2 + RVU_VF_INT);
 	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
-	if (intr)
+	if (intr) {
 		/* First process all configuration messages */
 		otx2_process_msgs(dev, dev->mbox);
 
+		/* Process Uplink messages */
+		otx2_process_msgs_up(dev, &dev->mbox_up);
+	}
 }
 
 static void
@@ -322,9 +557,13 @@ otx2_af_pf_mbox_irq(void *param)
 	otx2_write64(intr, dev->bar2 + RVU_PF_INT);
 
 	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
-	if (intr)
+	if (intr) {
 		/* First process all configuration messages */
 		otx2_process_msgs(dev, dev->mbox);
+
+		/* Process Uplink messages */
+		otx2_process_msgs_up(dev, &dev->mbox_up);
+	}
 }
 
 static int
drivers/common/octeontx2/otx2_dev.h +11 -0
index 70104dfa2..8fa5f32d2 100644
@@ -23,6 +23,17 @@
 
 struct otx2_dev;
 
+/* Link status callback */
+typedef void (*otx2_link_status_t)(struct otx2_dev *dev,
+				   struct cgx_link_user_info *link);
+/* PTP info callback */
+typedef int (*otx2_ptp_info_t)(struct otx2_dev *dev, bool ptp_en);
+
+struct otx2_dev_ops {
+	otx2_link_status_t link_status_update;
+	otx2_ptp_info_t ptp_info_update;
+};
+
 #define OTX2_DEV					\
 	int node __rte_cache_aligned;			\
 	uint16_t pf;					\
Signature · 1 line
2.21.0
#14 lore raw

PATCH 14/27 common/octeontx2: add FLR IRQ handler

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Upon receiving FLR request from VF, It is PF responsibly forward to AF and enable FLR for VFs.

This patch adds support for VF FLR support in PF.

This patch also add otx2_dev_active_vfs() API to find the number of active VF for given PF.

---
 drivers/common/octeontx2/otx2_dev.c           | 180 ++++++++++++++++++
 .../rte_common_octeontx2_version.map          |   1 +
 2 files changed, 181 insertions(+)
drivers/common/octeontx2/otx2_dev.c +180 -0
index 3522a1783..a75f79101 100644
@@ -51,6 +51,52 @@ mbox_mem_unmap(void *va, size_t size)
 		munmap(va, size);
 }
 
+static int
+pf_af_sync_msg(struct otx2_dev *dev, struct mbox_msghdr **rsp)
+{
+	uint32_t timeout = 0, sleep = 1; struct otx2_mbox *mbox = dev->mbox;
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	volatile uint64_t int_status;
+	struct mbox_msghdr *msghdr;
+	uint64_t off;
+	int rc = 0;
+
+	/* We need to disable PF interrupts. We are in timer interrupt */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	/* Send message */
+	otx2_mbox_msg_send(mbox, 0);
+
+	do {
+		rte_delay_ms(sleep);
+		timeout += sleep;
+		if (timeout >= MBOX_RSP_TIMEOUT) {
+			otx2_err("Message timeout: %dms", MBOX_RSP_TIMEOUT);
+			rc = -EIO;
+			break;
+		}
+		int_status = otx2_read64(dev->bar2 + RVU_PF_INT);
+	} while ((int_status & 0x1) != 0x1);
+
+	/* Clear */
+	otx2_write64(int_status, dev->bar2 + RVU_PF_INT);
+
+	/* Enable interrupts */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
+
+	if (rc == 0) {
+		/* Get message */
+		off = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+		msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + off);
+		if (rsp)
+			*rsp = msghdr;
+		rc = msghdr->rc;
+	}
+
+	return rc;
+}
+
 static int
 af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
 {
@@ -703,6 +749,132 @@ mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 		return mbox_unregister_pf_irq(pci_dev, dev);
 }
 
+static int
+vf_flr_send_msg(struct otx2_dev *dev, uint16_t vf)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+	struct msg_req *req;
+	int rc;
+
+	req = otx2_mbox_alloc_msg_vf_flr(mbox);
+	/* Overwrite pcifunc to indicate VF */
+	req->hdr.pcifunc = otx2_pfvf_func(dev->pf, vf);
+
+	/* Sync message in interrupt context */
+	rc = pf_af_sync_msg(dev, NULL);
+	if (rc)
+		otx2_err("Failed to send VF FLR mbox msg, rc=%d", rc);
+
+	return rc;
+}
+
+static void
+otx2_pf_vf_flr_irq(void *param)
+{
+	struct otx2_dev *dev = (struct otx2_dev *)param;
+	uint16_t max_vf = 64, vf;
+	uintptr_t bar2;
+	uint64_t intr;
+	int i;
+
+	max_vf = (dev->maxvf > 0) ? dev->maxvf : 64;
+	bar2 = dev->bar2;
+
+	otx2_base_dbg("FLR VF interrupt: max_vf: %d", max_vf);
+
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i) {
+		intr = otx2_read64(bar2 + RVU_PF_VFFLR_INTX(i));
+		if (!intr)
+			continue;
+
+		for (vf = 0; vf < max_vf; vf++) {
+			if (!(intr & (1ULL << vf)))
+				continue;
+
+			vf = 64 * i + vf;
+			otx2_base_dbg("FLR: i :%d intr: 0x%" PRIx64 ", vf-%d",
+				      i, intr, vf);
+			/* Clear interrupt */
+			otx2_write64(BIT_ULL(vf), bar2 + RVU_PF_VFFLR_INTX(i));
+			/* Disable the interrupt */
+			otx2_write64(BIT_ULL(vf),
+				     bar2 + RVU_PF_VFFLR_INT_ENA_W1CX(i));
+			/* Inform AF about VF reset */
+			vf_flr_send_msg(dev, vf);
+
+			/* Signal FLR finish */
+			otx2_write64(BIT_ULL(vf), bar2 + RVU_PF_VFTRPENDX(i));
+			/* Enable interrupt */
+			otx2_write64(~0ull,
+				     bar2 + RVU_PF_VFFLR_INT_ENA_W1SX(i));
+		}
+	}
+}
+
+static int
+vf_flr_unregister_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int i;
+
+	otx2_base_dbg("Unregister VF FLR interrupts for %s", pci_dev->name);
+
+	/* HW clear irq */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; i++)
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFFLR_INT_ENA_W1CX(i));
+
+	otx2_unregister_irq(intr_handle, otx2_pf_vf_flr_irq, dev,
+			    RVU_PF_INT_VEC_VFFLR0);
+
+	otx2_unregister_irq(intr_handle, otx2_pf_vf_flr_irq, dev,
+			    RVU_PF_INT_VEC_VFFLR1);
+
+	return 0;
+}
+
+static int
+vf_flr_register_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *handle = &pci_dev->intr_handle;
+	int i, rc;
+
+	otx2_base_dbg("Register VF FLR interrupts for %s", pci_dev->name);
+
+	rc = otx2_register_irq(handle, otx2_pf_vf_flr_irq, dev,
+			       RVU_PF_INT_VEC_VFFLR0);
+	if (rc)
+		otx2_err("Failed to init RVU_PF_INT_VEC_VFFLR0 rc=%d", rc);
+
+	rc = otx2_register_irq(handle, otx2_pf_vf_flr_irq, dev,
+			       RVU_PF_INT_VEC_VFFLR1);
+	if (rc)
+		otx2_err("Failed to init RVU_PF_INT_VEC_VFFLR1 rc=%d", rc);
+
+	/* Enable HW interrupt */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i) {
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFFLR_INTX(i));
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFTRPENDX(i));
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFFLR_INT_ENA_W1SX(i));
+	}
+	return 0;
+}
+
+/**
+ * @internal
+ * Get number of active VFs for the given PF device.
+ */
+int
+otx2_dev_active_vfs(void *otx2_dev)
+{
+	struct otx2_dev *dev = otx2_dev;
+	int i, count = 0;
+
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; i++)
+		count += __builtin_popcount(dev->active_vfs[i]);
+
+	return count;
+}
+
 static void
 otx2_update_pass_hwcap(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
@@ -818,6 +990,12 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 			goto mbox_fini;
 	}
 
+	/* Register VF-FLR irq handlers */
+	if (otx2_dev_is_pf(dev)) {
+		rc = vf_flr_register_irqs(pci_dev, dev);
+		if (rc)
+			goto iounmap;
+	}
 	dev->mbox_active = 1;
 	return rc;
 
@@ -851,6 +1029,8 @@ otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 
 	mbox_unregister_irq(pci_dev, dev);
 
+	if (otx2_dev_is_pf(dev))
+		vf_flr_unregister_irqs(pci_dev, dev);
 	/* Release PF - VF */
 	mbox = &dev->mbox_vfpf;
 	if (mbox->hwbase && mbox->dev)
drivers/common/octeontx2/rte_common_octeontx2_version.map +1 -0
index b151ce6e2..243a199d7 100644
@@ -1,6 +1,7 @@
 DPDK_19.05 {
 	global:
 
+	otx2_dev_active_vfs;
 	otx2_dev_fini;
 	otx2_dev_init;
 
Signature · 1 line
2.21.0
#15 lore raw

PATCH 15/27 doc: add Marvell OCTEON TX2 platform guide

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Platform specific guide for Marvell OCTEON TX2 SoC is added.

Cc John McNamara <[email protected]>
---
 .../octeontx2_packet_flow_hw_accelerators.svg | 2804 +++++++++++++++++
 .../img/octeontx2_resource_virtualization.svg | 2418 ++++++++++++++
 doc/guides/platform/index.rst                 |    1 +
 doc/guides/platform/octeontx2.rst             |  235 ++
 4 files changed, 5458 insertions(+)
 create mode 100644 doc/guides/platform/img/octeontx2_packet_flow_hw_accelerators.svg
 create mode 100644 doc/guides/platform/img/octeontx2_resource_virtualization.svg
 create mode 100644 doc/guides/platform/octeontx2.rst
doc/guides/platform/img/octeontx2_packet_flow_hw_accelerators.svg new file +2804 -0
new file mode 100644
index 000000000..ecd575947
@@ -0,0 +1,2804 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<!--
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Marvell International Ltd.
+#
+-->
+
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="631.91431"
+   height="288.34286"
+   id="svg3868"
+   version="1.1"
+   inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
+   sodipodi:docname="octeontx2_packet_flow_hw_accelerators.svg"
+   sodipodi:version="0.32"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape">
+  <defs
+     id="defs3870">
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible;"
+       id="marker18508"
+       refX="0.0"
+       refY="0.0"
+       orient="auto"
+       inkscape:stockid="Arrow1Send">
+      <path
+         transform="scale(0.2) rotate(180) translate(6,0)"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         id="path18506" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Sstart"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="marker18096"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path18094"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         transform="scale(0.2) translate(6,0)" />
+    </marker>
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible"
+       id="marker17550"
+       refX="0.0"
+       refY="0.0"
+       orient="auto"
+       inkscape:stockid="Arrow1Sstart"
+       inkscape:collect="always">
+      <path
+         transform="scale(0.2) translate(6,0)"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         id="path17548" />
+    </marker>
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible;"
+       id="marker17156"
+       refX="0.0"
+       refY="0.0"
+       orient="auto"
+       inkscape:stockid="Arrow1Send">
+      <path
+         transform="scale(0.2) rotate(180) translate(6,0)"
+         style="fill-rule:evenodd;stroke:#00db00;stroke-width:1pt;stroke-opacity:1;fill:#00db00;fill-opacity:1"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         id="path17154" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient13962">
+      <stop
+         style="stop-color:#fc0000;stop-opacity:1;"
+         offset="0"
+         id="stop13958" />
+      <stop
+         style="stop-color:#fc0000;stop-opacity:0;"
+         offset="1"
+         id="stop13960" />
+    </linearGradient>
+    <marker
+       inkscape:stockid="Arrow1Send"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Send"
+       style="overflow:visible;"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         id="path6218"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         transform="scale(0.2) rotate(180) translate(6,0)" />
+    </marker>
+    <linearGradient
+       id="linearGradient13170"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#ff0000;stop-opacity:1;"
+         offset="0"
+         id="stop13168" />
+    </linearGradient>
+    <marker
+       inkscape:stockid="Arrow2Mend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="marker12747"
+       style="overflow:visible;"
+       inkscape:isstock="true">
+      <path
+         id="path12745"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#ff0000;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         transform="scale(0.6) rotate(180) translate(0,0)" />
+    </marker>
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible;"
+       id="marker10821"
+       refX="0.0"
+       refY="0.0"
+       orient="auto"
+       inkscape:stockid="Arrow2Mend"
+       inkscape:collect="always">
+      <path
+         transform="scale(0.6) rotate(180) translate(0,0)"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#fe0000;stroke-opacity:1;fill:#fe0000;fill-opacity:1"
+         id="path10819" />
+    </marker>
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible;"
+       id="marker10463"
+       refX="0.0"
+       refY="0.0"
+       orient="auto"
+       inkscape:stockid="Arrow2Mend">
+      <path
+         transform="scale(0.6) rotate(180) translate(0,0)"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#fe0000;stroke-opacity:1;fill:#fe0000;fill-opacity:1"
+         id="path10461" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Mend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow2Mend"
+       style="overflow:visible;"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         id="path6230"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#fe0000;stroke-opacity:1;fill:#fe0000;fill-opacity:1"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         transform="scale(0.6) rotate(180) translate(0,0)" />
+    </marker>
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible"
+       id="marker9807"
+       refX="0.0"
+       refY="0.0"
+       orient="auto"
+       inkscape:stockid="TriangleOutS">
+      <path
+         transform="scale(0.2)"
+         style="fill-rule:evenodd;stroke:#fe0000;stroke-width:1pt;stroke-opacity:1;fill:#fe0000;fill-opacity:1"
+         d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+         id="path9805" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="TriangleOutS"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         id="path6351"
+         d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+         style="fill-rule:evenodd;stroke:#fe0000;stroke-width:1pt;stroke-opacity:1;fill:#fe0000;fill-opacity:1"
+         transform="scale(0.2)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Sstart"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Sstart"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         id="path6215"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         transform="scale(0.2) translate(6,0)" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4340">
+      <stop
+         style="stop-color:#d7eef4;stop-opacity:1;"
+         offset="0"
+         id="stop4336" />
+      <stop
+         style="stop-color:#d7eef4;stop-opacity:0;"
+         offset="1"
+         id="stop4338" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4330">
+      <stop
+         style="stop-color:#d7eef4;stop-opacity:1;"
+         offset="0"
+         id="stop4326" />
+      <stop
+         style="stop-color:#d7eef4;stop-opacity:0;"
+         offset="1"
+         id="stop4328" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3596">
+      <stop
+         style="stop-color:#6ba6fd;stop-opacity:1;"
+         offset="0"
+         id="stop3592" />
+      <stop
+         style="stop-color:#6ba6fd;stop-opacity:0;"
+         offset="1"
+         id="stop3594" />
+    </linearGradient>
+    <marker
+       inkscape:stockid="Arrow1Lstart"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="marker9460"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path9458"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         transform="scale(0.8) translate(12.5,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lstart"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="marker7396"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path7133"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         transform="scale(0.8) translate(12.5,0)" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient5474">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop5470" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop5472" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient6545"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#ffa600;stop-opacity:1;"
+         offset="0"
+         id="stop6543" />
+    </linearGradient>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3302"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3294"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3290"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3286"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3228"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3188"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3184"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3180"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3176"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3172"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3168"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3164"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3160"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3120"
+       is_visible="true" />
+    <linearGradient
+       id="linearGradient3114"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#00f900;stop-opacity:1;"
+         offset="0"
+         id="stop3112" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3088"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#00f900;stop-opacity:1;"
+         offset="0"
+         id="stop3086" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3058"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#00f900;stop-opacity:1;"
+         offset="0"
+         id="stop3056" />
+    </linearGradient>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3054"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3050"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3046"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3042"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3038"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3034"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3030"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3008"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3004"
+       is_visible="true" />
+    <linearGradient
+       id="linearGradient2975"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#ff2200;stop-opacity:1;"
+         offset="0"
+         id="stop2973" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2969"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#69ff72;stop-opacity:1;"
+         offset="0"
+         id="stop2967" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2963"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop2961" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2929"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#ff2d00;stop-opacity:1;"
+         offset="0"
+         id="stop2927" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient4610"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#00ffff;stop-opacity:1;"
+         offset="0"
+         id="stop4608" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3993"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#6ba6fd;stop-opacity:1;"
+         offset="0"
+         id="stop3991" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3808"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#6ba6fd;stop-opacity:1;"
+         offset="0"
+         id="stop3806" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3776"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#fc0000;stop-opacity:1;"
+         offset="0"
+         id="stop3774" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3438"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#b8e132;stop-opacity:1;"
+         offset="0"
+         id="stop3436" />
+    </linearGradient>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3408"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3404"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3400"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3392"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3376"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3044"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3040"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3036"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3032"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3028"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3024"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3020"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect2858"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect2854"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect2844"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <linearGradient
+       id="linearGradient2828"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#ff0000;stop-opacity:1;"
+         offset="0"
+         id="stop2826" />
+    </linearGradient>
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect329"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart"
+       style="overflow:visible">
+      <path
+         id="path4530"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend"
+       style="overflow:visible">
+      <path
+         id="path4533"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <linearGradient
+       id="linearGradient4513">
+      <stop
+         style="stop-color:#fdffdb;stop-opacity:1;"
+         offset="0"
+         id="stop4515" />
+      <stop
+         style="stop-color:#dfe2d8;stop-opacity:0;"
+         offset="1"
+         id="stop4517" />
+    </linearGradient>
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective3876" />
+    <inkscape:perspective
+       id="perspective3886"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Lend"
+       style="overflow:visible">
+      <path
+         id="path3211"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker3892"
+       style="overflow:visible">
+      <path
+         id="path3894"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker3896"
+       style="overflow:visible">
+      <path
+         id="path3898"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Lstart"
+       style="overflow:visible">
+      <path
+         id="path3208"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(0.8,0,0,0.8,10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker3902"
+       style="overflow:visible">
+      <path
+         id="path3904"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker3906"
+       style="overflow:visible">
+      <path
+         id="path3908"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(0.8,0,0,0.8,10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker3910"
+       style="overflow:visible">
+      <path
+         id="path3912"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:perspective
+       id="perspective4086"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective4113"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective5195"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-4"
+       style="overflow:visible">
+      <path
+         id="path4533-7"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:perspective
+       id="perspective5272"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-4"
+       style="overflow:visible">
+      <path
+         id="path4530-5"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-0"
+       style="overflow:visible">
+      <path
+         id="path4533-3"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:perspective
+       id="perspective5317"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-3"
+       style="overflow:visible">
+      <path
+         id="path4530-2"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-06"
+       style="overflow:visible">
+      <path
+         id="path4533-1"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-8"
+       style="overflow:visible">
+      <path
+         id="path4530-7"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-9"
+       style="overflow:visible">
+      <path
+         id="path4533-2"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect2858-0"
+       is_visible="true" />
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-3"
+       style="overflow:visible">
+      <path
+         id="path4533-75"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3044-9"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-3-2"
+       style="overflow:visible">
+      <path
+         id="path4533-75-8"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:path-effect
+       effect="bspline"
+       id="path-effect3044-9-9"
+       is_visible="true"
+       weight="33.333333"
+       steps="2"
+       helper_size="0"
+       apply_no_weight="true"
+       apply_with_weight="true"
+       only_selected="false" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3008-3"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3120-7"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect3120-7-3"
+       is_visible="true" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5474"
+       id="linearGradient5695"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.62723639,0,0,1.0109144,206.76869,3.9208776)"
+       x1="-89.501146"
+       y1="363.57419"
+       x2="-30.959395"
+       y2="363.57419" />
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-34"
+       style="overflow:visible">
+      <path
+         id="path4530-3"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-45"
+       style="overflow:visible">
+      <path
+         id="path4533-16"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-7"
+       style="overflow:visible">
+      <path
+         id="path4530-58"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-1"
+       style="overflow:visible">
+      <path
+         id="path4533-6"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-7-6"
+       style="overflow:visible">
+      <path
+         id="path4530-58-4"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-1-9"
+       style="overflow:visible">
+      <path
+         id="path4533-6-3"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-7-2"
+       style="overflow:visible">
+      <path
+         id="path4530-58-46"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-1-1"
+       style="overflow:visible">
+      <path
+         id="path4533-6-4"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-7-2-6"
+       style="overflow:visible">
+      <path
+         id="path4530-58-46-8"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-1-1-9"
+       style="overflow:visible">
+      <path
+         id="path4533-6-4-9"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#grad0-40"
+       id="linearGradient5917"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(8.8786147,-0.0235964,-0.00460261,1.50035,-400.25558,-2006.3745)"
+       x1="-0.12893644"
+       y1="1717.1688"
+       x2="28.140806"
+       y2="1717.1688" />
+    <linearGradient
+       id="grad0-40"
+       x1="0"
+       y1="0"
+       x2="1"
+       y2="0"
+       gradientTransform="rotate(60,0.5,0.5)">
+      <stop
+         offset="0"
+         stop-color="#f3f6fa"
+         stop-opacity="1"
+         id="stop3419" />
+      <stop
+         offset="0.24"
+         stop-color="#f9fafc"
+         stop-opacity="1"
+         id="stop3421" />
+      <stop
+         offset="0.54"
+         stop-color="#feffff"
+         stop-opacity="1"
+         id="stop3423" />
+    </linearGradient>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-30"
+       style="overflow:visible">
+      <path
+         id="path4530-0"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-6"
+       style="overflow:visible">
+      <path
+         id="path4533-19"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-30-0"
+       style="overflow:visible">
+      <path
+         id="path4530-0-6"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-6-8"
+       style="overflow:visible">
+      <path
+         id="path4533-19-6"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-30-0-9"
+       style="overflow:visible">
+      <path
+         id="path4530-0-6-4"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-6-8-3"
+       style="overflow:visible">
+      <path
+         id="path4533-19-6-1"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5474"
+       id="linearGradient6997-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.62723639,0,0,1.0109144,321.82147,-1.8659026)"
+       x1="-89.501144"
+       y1="363.57419"
+       x2="-30.959394"
+       y2="363.57419" />
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-81"
+       style="overflow:visible">
+      <path
+         id="path4530-9"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-5"
+       style="overflow:visible">
+      <path
+         id="path4533-72"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-1"
+       style="overflow:visible">
+      <path
+         id="path4530-6"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker9714"
+       style="overflow:visible">
+      <path
+         id="path9712"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-48"
+       style="overflow:visible">
+      <path
+         id="path4530-4"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker10117"
+       style="overflow:visible">
+      <path
+         id="path10115"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-48-6"
+       style="overflow:visible">
+      <path
+         id="path4530-4-0"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker11186"
+       style="overflow:visible">
+      <path
+         id="path11184"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mstart-30-0-9-0"
+       style="overflow:visible">
+      <path
+         id="path4530-0-6-4-1"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(0.4,0,0,0.4,4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-6-8-3-7"
+       style="overflow:visible">
+      <path
+         id="path4533-19-6-1-5"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3602"
+       x1="113.62777"
+       y1="238.35289"
+       x2="178.07406"
+       y2="238.35289"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(4,-22)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3604"
+       x1="106.04746"
+       y1="231.17514"
+       x2="170.49375"
+       y2="231.17514"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(4,-22)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3606"
+       x1="97.456466"
+       y1="223.48468"
+       x2="161.90276"
+       y2="223.48468"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(4,-22)" />
+    <linearGradient
+       gradientTransform="matrix(1.2309135,0,0,0.9993652,112.21043,-29.394096)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-4"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="matrix(1.2419105,0,0,0.99933655,110.714,51.863352)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-4-8"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="matrix(1.3078944,0,0,0.99916717,224.87462,63.380078)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-4-8-7"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="matrix(1.2309135,0,0,0.9993652,359.82239,-48.56566)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-4-9"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(-35.122992,139.17627)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(32.977515,139.08289)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(100.97751,139.08289)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9-1"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(168.97751,139.08289)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9-1-5"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(236.97751,139.08289)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9-1-5-7"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(516.30192,138.74331)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9-1-5-73"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(448.30192,138.74331)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9-1-59"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(380.30193,138.74331)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-9-8"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientTransform="translate(312.20142,138.83669)"
+       inkscape:collect="always"
+       xlink:href="#linearGradient3596"
+       id="linearGradient3608-8"
+       x1="88.739166"
+       y1="215.40981"
+       x2="153.18546"
+       y2="215.40981"
+       gradientUnits="userSpaceOnUse" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4330"
+       id="radialGradient4334"
+       cx="222.02666"
+       cy="354.61401"
+       fx="222.02666"
+       fy="354.61401"
+       r="171.25233"
+       gradientTransform="matrix(1,0,0,0.15767701,0,298.69953)"
+       gradientUnits="userSpaceOnUse" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4340"
+       id="radialGradient4342"
+       cx="535.05641"
+       cy="353.56737"
+       fx="535.05641"
+       fy="353.56737"
+       r="136.95767"
+       gradientTransform="matrix(1.0000096,0,0,0.19866251,-0.00515595,284.82679)"
+       gradientUnits="userSpaceOnUse" />
+    <marker
+       inkscape:isstock="true"
+       style="overflow:visible"
+       id="marker28236"
+       refX="0"
+       refY="0"
+       orient="auto"
+       inkscape:stockid="Arrow2Mstart">
+      <path
+         inkscape:connector-curvature="0"
+         transform="scale(0.6)"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+         id="path28234" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker3706"
+       style="overflow:visible">
+      <path
+         id="path3704"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect14461"
+       is_visible="true" />
+    <marker
+       inkscape:stockid="Arrow2Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Mend-3"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         inkscape:connector-curvature="0"
+         id="path6230-9"
+         style="fill:#fe0000;fill-opacity:1;fill-rule:evenodd;stroke:#fe0000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="scale(-0.6)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Mend-3-1"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         inkscape:connector-curvature="0"
+         id="path6230-9-8"
+         style="fill:#fe0000;fill-opacity:1;fill-rule:evenodd;stroke:#fe0000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="scale(-0.6)" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient13962"
+       id="linearGradient14808"
+       x1="447.95767"
+       y1="176.3018"
+       x2="576.27008"
+       y2="176.3018"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(0,-8)" />
+    <marker
+       inkscape:stockid="Arrow2Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Mend-3-1-6"
+       style="overflow:visible"
+       inkscape:isstock="true"
+       inkscape:collect="always">
+      <path
+         inkscape:connector-curvature="0"
+         id="path6230-9-8-5"
+         style="fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:#808080;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="scale(-0.6)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-53"
+       style="overflow:visible">
+      <path
+         id="path4533-35"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend-99"
+       style="overflow:visible">
+      <path
+         id="path4533-8"
+         d="M 0,0 5,-5 -12.5,0 5,5 Z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;marker-start:none"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.8101934"
+     inkscape:cx="434.42776"
+     inkscape:cy="99.90063"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1057"
+     inkscape:window-x="-8"
+     inkscape:window-y="-8"
+     inkscape:window-maximized="1"
+     fit-margin-top="0.1"
+     fit-margin-left="0.1"
+     fit-margin-right="0.1"
+     fit-margin-bottom="0.1"
+     inkscape:measure-start="-29.078,219.858"
+     inkscape:measure-end="346.809,219.858"
+     showguides="true"
+     inkscape:snap-page="true"
+     inkscape:snap-others="false"
+     inkscape:snap-nodes="false"
+     inkscape:snap-bbox="true"
+     inkscape:lockguides="false"
+     inkscape:guide-bbox="true">
+    <sodipodi:guide
+       position="-120.20815,574.17069"
+       orientation="0,1"
+       id="guide7077"
+       inkscape:locked="false" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata3873">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-46.542857,-100.33361)">
+    <rect
+       style="fill:#aaffcc;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.26491222;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-7"
+       width="64.18129"
+       height="45.550591"
+       x="575.72662"
+       y="144.79553" />
+    <rect
+       style="fill:#aaffcc;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.26491222;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-8-5"
+       width="64.18129"
+       height="45.550591"
+       x="584.44391"
+       y="152.87041" />
+    <rect
+       style="fill:#aaffcc;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.26491222;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-42-0"
+       width="64.18129"
+       height="45.550591"
+       x="593.03491"
+       y="160.56087" />
+    <rect
+       style="fill:#aaffcc;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.26491222;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-0-3"
+       width="64.18129"
+       height="45.550591"
+       x="600.61523"
+       y="167.73862" />
+    <rect
+       style="fill:#aaffcc;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.26491222;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-46-4"
+       width="64.18129"
+       height="45.550591"
+       x="608.70087"
+       y="175.42906" />
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot1853-7"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#aaffcc;fill-opacity:1;stroke:none"
+       transform="matrix(0.71467688,0,0,0.72506311,529.61388,101.41825)"><flowRegion
+         id="flowRegion1855-0"
+         style="fill:#aaffcc"><rect
+           id="rect1857-5"
+           width="67.17514"
+           height="33.941124"
+           x="120.20815"
+           y="120.75856"
+           style="fill:#aaffcc" /></flowRegion><flowPara
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#aaffcc"
+         id="flowPara1976" /></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot5313"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;letter-spacing:0px;word-spacing:0px"><flowRegion
+         id="flowRegion5315"><rect
+           id="rect5317"
+           width="120.91525"
+           height="96.873627"
+           x="-192.33304"
+           y="-87.130829" /></flowRegion><flowPara
+         id="flowPara5319" /></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot8331"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1.25;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'sans-serif, Normal';font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"><flowRegion
+         id="flowRegion8333"><rect
+           id="rect8335"
+           width="48.5"
+           height="28"
+           x="252.5"
+           y="208.34286" /></flowRegion><flowPara
+         id="flowPara8337" /></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot11473"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       transform="translate(46.542857,100.33361)"><flowRegion
+         id="flowRegion11475"><rect
+           id="rect11477"
+           width="90"
+           height="14.5"
+           x="426"
+           y="26.342873" /></flowRegion><flowPara
+         id="flowPara11479">DDDpk</flowPara></flowRoot>    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="533.54285"
+       y="158.17648"
+       id="text11489"><tspan
+         sodipodi:role="line"
+         id="tspan11487"
+         x="533.54285"
+         y="170.34088" /></text>
+    <rect
+       style="fill:#f4d7d7;fill-opacity:1;stroke:url(#linearGradient3606);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-8"
+       width="64.18129"
+       height="45.550591"
+       x="101.58897"
+       y="178.70938" />
+    <rect
+       style="fill:#f4d7d7;fill-opacity:1;stroke:url(#linearGradient3604);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-42"
+       width="64.18129"
+       height="45.550591"
+       x="110.17996"
+       y="186.39984" />
+    <rect
+       style="fill:#f4d7d7;fill-opacity:1;stroke:url(#linearGradient3602);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-0"
+       width="64.18129"
+       height="45.550591"
+       x="117.76027"
+       y="193.57759" />
+    <rect
+       style="fill:#f4d7d7;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-46"
+       width="64.18129"
+       height="45.550591"
+       x="125.84592"
+       y="201.26804" />
+    <rect
+       style="fill:#d7f4e3;fill-opacity:1;stroke:url(#linearGradient3608-4);stroke-width:0.293915;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-86"
+       width="79.001617"
+       height="45.521675"
+       x="221.60374"
+       y="163.11812" />
+    <rect
+       style="fill:#d7f4e3;fill-opacity:1;stroke:url(#linearGradient3608-4-8);stroke-width:0.29522076;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-86-5"
+       width="79.70742"
+       height="45.52037"
+       x="221.08463"
+       y="244.37004" />
+    <rect
+       style="opacity:1;fill:#d7eef4;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.31139579;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718"
+       width="125.8186"
+       height="100.36277"
+       x="321.87323"
+       y="112.72702" />
+    <rect
+       style="fill:#ffd5d5;fill-opacity:1;stroke:url(#linearGradient3608-4-8-7);stroke-width:0.30293623;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-86-5-3"
+       width="83.942352"
+       height="45.512653"
+       x="341.10928"
+       y="255.85414" />
+    <rect
+       style="fill:#ffb380;fill-opacity:1;stroke:url(#linearGradient3608-4-9);stroke-width:0.293915;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-86-2"
+       width="79.001617"
+       height="45.521675"
+       x="469.21576"
+       y="143.94656" />
+    <rect
+       style="opacity:1;fill:url(#radialGradient4334);fill-opacity:1;stroke:#6ba6fd;stroke-width:0.32037571;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3783"
+       width="342.1843"
+       height="53.684738"
+       x="50.934502"
+       y="327.77164" />
+    <rect
+       style="fill:#e9ddaf;fill-opacity:1;stroke:url(#linearGradient3608);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1"
+       width="64.18129"
+       height="45.550591"
+       x="53.748672"
+       y="331.81079" />
+    <rect
+       style="fill:#e9ddaf;fill-opacity:1;stroke:url(#linearGradient3608-9);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3"
+       width="64.18129"
+       height="45.550591"
+       x="121.84918"
+       y="331.71741" />
+    <rect
+       style="fill:#e9ddaf;fill-opacity:1;stroke:url(#linearGradient3608-9-1);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3-6"
+       width="64.18129"
+       height="45.550591"
+       x="189.84918"
+       y="331.71741" />
+    <rect
+       style="fill:#e9ddaf;fill-opacity:1;stroke:url(#linearGradient3608-9-1-5);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3-6-4"
+       width="64.18129"
+       height="45.550591"
+       x="257.84918"
+       y="331.71741" />
+    <rect
+       style="fill:#e9ddaf;fill-opacity:1;stroke:url(#linearGradient3608-9-1-5-7);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3-6-4-9"
+       width="64.18129"
+       height="45.550591"
+       x="325.84918"
+       y="331.71741" />
+    <rect
+       style="opacity:1;fill:url(#radialGradient4342);fill-opacity:1;stroke:#6ba6fd;stroke-width:0.28768006;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3783-8"
+       width="273.62766"
+       height="54.131645"
+       x="398.24258"
+       y="328.00156" />
+    <rect
+       style="fill:#dde9af;fill-opacity:1;stroke:url(#linearGradient3608-8);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-5"
+       width="64.18129"
+       height="45.550591"
+       x="401.07309"
+       y="331.47122" />
+    <rect
+       style="fill:#dde9af;fill-opacity:1;stroke:url(#linearGradient3608-9-8);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3-0"
+       width="64.18129"
+       height="45.550591"
+       x="469.17358"
+       y="331.37781" />
+    <rect
+       style="fill:#dde9af;fill-opacity:1;stroke:url(#linearGradient3608-9-1-59);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3-6-3"
+       width="64.18129"
+       height="45.550591"
+       x="537.17358"
+       y="331.37781" />
+    <rect
+       style="fill:#dde9af;fill-opacity:1;stroke:url(#linearGradient3608-9-1-5-73);stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect5066-1-3-6-4-6"
+       width="64.18129"
+       height="45.550591"
+       x="605.17358"
+       y="331.37781" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3"
+       width="27.798103"
+       height="21.434149"
+       x="325.80197"
+       y="117.21037" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8"
+       width="27.798103"
+       height="21.434149"
+       x="325.2959"
+       y="140.20857" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9"
+       width="27.798103"
+       height="21.434149"
+       x="325.2959"
+       y="164.20857" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-5"
+       width="27.798103"
+       height="21.434149"
+       x="356.37054"
+       y="117.39072" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-1"
+       width="27.798103"
+       height="21.434149"
+       x="355.86447"
+       y="140.38893" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2"
+       width="27.798103"
+       height="21.434149"
+       x="355.86447"
+       y="164.38893" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-5-5"
+       width="27.798103"
+       height="21.434149"
+       x="386.37054"
+       y="117.39072" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-1-9"
+       width="27.798103"
+       height="21.434149"
+       x="385.86447"
+       y="140.38895" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6"
+       width="27.798103"
+       height="21.434149"
+       x="385.86447"
+       y="164.38895" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-5-5-9"
+       width="27.798103"
+       height="21.434149"
+       x="416.37054"
+       y="117.39072" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-1-9-3"
+       width="27.798103"
+       height="21.434149"
+       x="415.86447"
+       y="140.38895" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-8"
+       width="27.798103"
+       height="21.434149"
+       x="415.86447"
+       y="164.38896" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-5"
+       width="27.798103"
+       height="21.434149"
+       x="324.61139"
+       y="187.85849" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-0"
+       width="27.798103"
+       height="21.434149"
+       x="355.17996"
+       y="188.03886" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-0"
+       width="27.798103"
+       height="21.434149"
+       x="385.17996"
+       y="188.03888" />
+    <rect
+       style="opacity:1;fill:#ffeeaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-8-4"
+       width="27.798103"
+       height="21.434149"
+       x="415.17996"
+       y="188.03889" />
+    <rect
+       style="opacity:1;fill:#d7eef4;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.31139579;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-5"
+       width="125.8186"
+       height="100.36277"
+       x="452.24075"
+       y="208.56764" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-9"
+       width="27.798103"
+       height="21.434149"
+       x="456.16949"
+       y="213.05098" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-8"
+       width="27.798103"
+       height="21.434149"
+       x="455.66342"
+       y="236.04919" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-55"
+       width="27.798103"
+       height="21.434149"
+       x="455.66342"
+       y="260.04919" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-5-7"
+       width="27.798103"
+       height="21.434149"
+       x="486.73807"
+       y="213.23134" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-1-5"
+       width="27.798103"
+       height="21.434149"
+       x="486.23199"
+       y="236.22954" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-3"
+       width="27.798103"
+       height="21.434149"
+       x="486.23199"
+       y="260.22955" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-5-5-2"
+       width="27.798103"
+       height="21.434149"
+       x="516.73804"
+       y="213.23134" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-1-9-5"
+       width="27.798103"
+       height="21.434149"
+       x="516.23199"
+       y="236.22955" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-1"
+       width="27.798103"
+       height="21.434149"
+       x="516.23199"
+       y="260.22955" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-5-5-9-6"
+       width="27.798103"
+       height="21.434149"
+       x="546.73804"
+       y="213.23134" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-1-9-3-1"
+       width="27.798103"
+       height="21.434149"
+       x="546.23199"
+       y="236.22955" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-8-7"
+       width="27.798103"
+       height="21.434149"
+       x="546.23199"
+       y="260.22955" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-5-1"
+       width="27.798103"
+       height="21.434149"
+       x="454.97891"
+       y="283.6991" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-0-6"
+       width="27.798103"
+       height="21.434149"
+       x="485.54749"
+       y="283.87946" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-0-7"
+       width="27.798103"
+       height="21.434149"
+       x="515.54749"
+       y="283.87949" />
+    <rect
+       style="opacity:1;fill:#ffccaa;fill-opacity:1;stroke:#6ba6fd;stroke-width:0.837071;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect3718-3-8-9-2-6-8-4-2"
+       width="27.798103"
+       height="21.434149"
+       x="545.54749"
+       y="283.87952" />
+    <g
+       id="g5089"
+       transform="matrix(0.7206312,0,0,1.0073979,12.37404,-312.02679)"
+       style="fill:#ff8080">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 64.439519,501.23542 v 5.43455 h 45.917801 v -5.43455 z"
+         style="opacity:1;fill:#ff8080;fill-opacity:1;stroke:#6ba6fd;stroke-width:1.09656608;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
+         id="rect4455" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path5083"
+         d="m 108.30535,494.82846 c 13.96414,8.6951 13.96414,8.40526 13.96414,8.40526 l -12.46798,9.85445 z"
+         style="fill:#ff8080;stroke:#000000;stroke-width:0.53767502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+    </g>
+    <g
+       id="g5089-4"
+       transform="matrix(-0.6745281,0,0,0.97266112,143.12774,-266.3349)"
+       style="fill:#000080;fill-opacity:1">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 64.439519,501.23542 v 5.43455 h 45.917801 v -5.43455 z"
+         style="opacity:1;fill:#000080;fill-opacity:1;stroke:#6ba6fd;stroke-width:1.09656608;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
+         id="rect4455-9" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path5083-2"
+         d="m 108.30535,494.82846 c 13.96414,8.6951 13.96414,8.40526 13.96414,8.40526 l -12.46798,9.85445 z"
+         style="fill:#000080;stroke:#000000;stroke-width:0.53767502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" />
+    </g>
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot5112"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       transform="translate(52.199711,162.55901)"><flowRegion
+         id="flowRegion5114"><rect
+           id="rect5116"
+           width="28.991377"
+           height="19.79899"
+           x="22.627417"
+           y="64.897125" /></flowRegion><flowPara
+         id="flowPara5118">Tx</flowPara></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot5112-8"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       transform="translate(49.878465,112.26812)"><flowRegion
+         id="flowRegion5114-7"><rect
+           id="rect5116-7"
+           width="28.991377"
+           height="19.79899"
+           x="22.627417"
+           y="64.897125" /></flowRegion><flowPara
+         id="flowPara5118-5">Rx</flowPara></flowRoot>    <path
+       style="fill:none;stroke:#f60300;stroke-width:0.783;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:0.783, 0.78300000000000003;stroke-dashoffset:0;marker-start:url(#Arrow1Sstart);marker-end:url(#TriangleOutS)"
+       d="m 116.81066,179.28348 v -11.31903 l -0.37893,-12.93605 0.37893,-5.25526 3.03134,-5.25526 4.16811,-2.82976 8.3362,-1.61701 h 7.19945 l 7.19946,2.02126 3.03135,2.02126 0.37892,2.02125 -0.37892,3.23401 -0.37892,7.27652 -0.37892,8.48927 -0.37892,14.55304"
+       id="path8433"
+       inkscape:connector-curvature="0" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="104.04285"
+       y="144.86398"
+       id="text9071"><tspan
+         sodipodi:role="line"
+         id="tspan9069"
+         x="104.04285"
+         y="144.86398"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333333px;font-family:monospace;-inkscape-font-specification:monospace;fill:#0000ff">HW loop back device</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="59.542858"
+       y="53.676483"
+       id="text9621"><tspan
+         sodipodi:role="line"
+         id="tspan9619"
+         x="59.542858"
+         y="65.840889" /></text>
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot1853-7-2-7-8-7-2-4-3-9-0-2-9-5-6-7-7"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       transform="matrix(0.57822568,0,0,0.72506311,454.1297,247.6848)"><flowRegion
+         id="flowRegion1855-0-1-3-66-99-9-2-5-4-1-1-1-4-0-5-4"><rect
+           id="rect1857-5-1-5-2-6-1-4-9-3-8-1-8-5-7-9-1"
+           width="162.09244"
+           height="78.764809"
+           x="120.20815"
+           y="120.75856" /></flowRegion><flowPara
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#5500d4"
+         id="flowPara9723" /></flowRoot>    <path
+       style="fill:none;stroke:#fe0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;marker-end:url(#Arrow2Mend)"
+       d="m 181.60025,194.22211 12.72792,-7.07106 14.14214,-2.82843 12.02081,0.70711 h 1.41422 v 0"
+       id="path9797"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#fe0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;marker-end:url(#marker10821)"
+       d="m 179.47893,193.51501 3.53554,-14.14214 5.65685,-12.72792 16.97056,-9.19239 8.48528,-9.19238 14.84924,-7.77818 24.04163,-8.48528 18.38478,-6.36396 38.89087,-2.82843 h 12.02082 l -2.12132,-0.7071"
+       id="path10453"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#fe0000;stroke-width:0.70021206;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.70021208, 0.70021208;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Mend-3)"
+       d="m 299.68795,188.0612 7.97521,-5.53298 8.86135,-2.2132 7.53214,0.5533 h 0.88614 v 0"
+       id="path9797-9"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#fe0000;stroke-width:0.96708673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.96708673, 0.96708673;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Mend-3-1)"
+       d="m 300.49277,174.25976 7.49033,-11.23756 8.32259,-4.49504 7.07419,1.12376 h 0.83227 v 0"
+       id="path9797-9-7"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#ff0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;marker-end:url(#marker12747)"
+       d="m 299.68708,196.34344 9.19239,7.77817 7.07107,1.41421 h 4.94974 v 0"
+       id="path12737"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:url(#linearGradient14808);stroke-width:4.66056013;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4.66056002, 4.66056002;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Send)"
+       d="m 447.95767,168.30181 c 119.99171,0 119.99171,0 119.99171,0"
+       id="path13236"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#808080;stroke-width:0.96708673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.96708673, 0.96708673000000001;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Mend-3-1-6)"
+       d="m 529.56098,142.71226 7.49033,-11.23756 8.32259,-4.49504 7.07419,1.12376 h 0.83227 v 0"
+       id="path9797-9-7-3"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00ffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;marker-end:url(#Arrow1Mend)"
+       d="m 612.93538,222.50639 -5.65686,12.72792 -14.84924,3.53553 -14.14213,0.70711"
+       id="path16128"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00ffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       d="m 624.95619,220.38507 -3.53553,13.43502 -12.72792,14.84925 -9.19239,5.65685 -19.09188,2.82843 -1.41422,-0.70711 h -1.41421"
+       id="path16130"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00ffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       d="m 635.56279,221.09217 -7.77817,33.94113 -4.24264,6.36396 -8.48528,3.53553 -10.6066,4.94975 -19.09189,5.65685 -6.36396,3.53554"
+       id="path16132"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00ffff;stroke-width:1.01083219;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.01083222, 1.01083221999999995;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-53)"
+       d="m 456.03282,270.85761 -4.96024,14.83162 -13.02062,4.11988 -12.40058,0.82399"
+       id="path16128-3"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00ffff;stroke-width:0.80101544;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.80101541, 0.80101540999999998;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow1Mend-99)"
+       d="m 341.29831,266.70565 -6.88826,6.70663 -18.08168,1.86296 -17.22065,0.37258"
+       id="path16128-6"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00faf5;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;marker-end:url(#Arrow1Mend)"
+       d="m 219.78402,264.93279 -6.36396,-9.89949 -3.53554,-16.26346 -7.77817,-8.48528 -8.48528,-4.94975 -4.94975,-2.82842"
+       id="path17144"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#00db00;stroke-width:1.4;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1.4, 1.39999999999999991;stroke-dashoffset:0;marker-end:url(#marker17156);marker-start:url(#marker17550)"
+       d="m 651.11914,221.09217 -7.07107,31.81981 -17.67766,34.64823 -21.21321,26.87005 -80.61017,1.41422 -86.97413,1.41421 -79.90306,-3.53553 -52.3259,1.41421 -24.04163,10.6066 -2.82843,1.41422"
+       id="path17146"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1.3, 1.30000000000000004;stroke-dashoffset:0;marker-start:url(#marker18096);marker-end:url(#marker18508)"
+       d="M 659.60442,221.09217 C 656.776,327.86529 656.776,328.5724 656.776,328.5724"
+       id="path18086"
+       inkscape:connector-curvature="0" />
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot1853-7-2-7-8-7-2"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       transform="matrix(0.57822568,0,0,0.72506311,137.7802,161.1139)"><flowRegion
+         id="flowRegion1855-0-1-3-66-99-9"><rect
+           id="rect1857-5-1-5-2-6-1"
+           width="174.19844"
+           height="91.867104"
+           x="120.20815"
+           y="120.75856" /></flowRegion><flowPara
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#5500d4"
+         id="flowPara9188-8-4" /></flowRoot>    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
+       x="155.96185"
+       y="220.07472"
+       id="text9071-6"><tspan
+         sodipodi:role="line"
+         x="158.29518"
+         y="220.07472"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle"
+         id="tspan2100"> <tspan
+   style="fill:#0000ff"
+   id="tspan2327">Ethdev Ports </tspan></tspan><tspan
+         sodipodi:role="line"
+         x="155.96185"
+         y="236.74139"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2104">(NIX)</tspan></text>
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot2106"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1.25;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'sans-serif, Normal';font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"><flowRegion
+         id="flowRegion2108"><rect
+           id="rect2110"
+           width="42.1875"
+           height="28.125"
+           x="178.125"
+           y="71.155365" /></flowRegion><flowPara
+         id="flowPara2112" /></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot2114"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1.25;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'sans-serif, Normal';font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"><flowRegion
+         id="flowRegion2116"><rect
+           id="rect2118"
+           width="38.28125"
+           height="28.90625"
+           x="196.09375"
+           y="74.280365" /></flowRegion><flowPara
+         id="flowPara2120" /></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot2122"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1.25;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'sans-serif, Normal';font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"><flowRegion
+         id="flowRegion2124"><rect
+           id="rect2126"
+           width="39.0625"
+           height="23.4375"
+           x="186.71875"
+           y="153.96786" /></flowRegion><flowPara
+         id="flowPara2128" /></flowRoot>    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
+       x="262.1366"
+       y="172.08614"
+       id="text9071-6-4"><tspan
+         sodipodi:role="line"
+         x="264.46994"
+         y="172.08614"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2104-0">Ingress  </tspan><tspan
+         sodipodi:role="line"
+         x="262.1366"
+         y="188.75281"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2176">Classification</tspan><tspan
+         sodipodi:role="line"
+         x="262.1366"
+         y="205.41946"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2180">(NPC)</tspan><tspan
+         sodipodi:role="line"
+         x="262.1366"
+         y="222.08614"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2178" /><tspan
+         sodipodi:role="line"
+         x="262.1366"
+         y="238.75281"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2174" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
+       x="261.26727"
+       y="254.46307"
+       id="text9071-6-4-9"><tspan
+         sodipodi:role="line"
+         x="263.60062"
+         y="254.46307"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2104-0-0">Egress  </tspan><tspan
+         sodipodi:role="line"
+         x="261.26727"
+         y="271.12973"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2176-8">Classification</tspan><tspan
+         sodipodi:role="line"
+         x="261.26727"
+         y="287.79642"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2180-9">(NPC)</tspan><tspan
+         sodipodi:role="line"
+         x="261.26727"
+         y="304.46307"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2178-3" /><tspan
+         sodipodi:role="line"
+         x="261.26727"
+         y="321.12973"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle"
+         id="tspan2174-7" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="362.7016"
+       y="111.81297"
+       id="text9071-4"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8"
+         x="362.7016"
+         y="111.81297"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;fill:#0000ff">Rx Queues</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="488.21777"
+       y="207.21898"
+       id="text9071-4-3"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-8"
+         x="488.21777"
+         y="207.21898"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;fill:#0000ff">Tx Queues</tspan></text>
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot2311"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1.25;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'sans-serif, Normal';font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"><flowRegion
+         id="flowRegion2313"><rect
+           id="rect2315"
+           width="49.21875"
+           height="41.40625"
+           x="195.3125"
+           y="68.811615" /></flowRegion><flowPara
+         id="flowPara2317" /></flowRoot>    <flowRoot
+       xml:space="preserve"
+       id="flowRoot2319"
+       style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:13.33333333px;line-height:1.25;letter-spacing:0px;word-spacing:0px;-inkscape-font-specification:'sans-serif, Normal';font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"><flowRegion
+         id="flowRegion2321"><rect
+           id="rect2323"
+           width="40.625"
+           height="39.0625"
+           x="196.09375"
+           y="69.592865" /></flowRegion><flowPara
+         id="flowPara2325" /></flowRoot>    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
+       x="382.20477"
+       y="263.74432"
+       id="text9071-6-4-6"><tspan
+         sodipodi:role="line"
+         x="382.20477"
+         y="263.74432"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2104-0-9">Egress</tspan><tspan
+         sodipodi:role="line"
+         x="382.20477"
+         y="280.41098"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2176-3">Traffic Manager</tspan><tspan
+         sodipodi:role="line"
+         x="382.20477"
+         y="297.07767"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2180-1">(NIX)</tspan><tspan
+         sodipodi:role="line"
+         x="382.20477"
+         y="313.74432"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2178-6" /><tspan
+         sodipodi:role="line"
+         x="382.20477"
+         y="330.41098"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2174-8" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
+       x="500.98602"
+       y="154.02556"
+       id="text9071-6-4-0"><tspan
+         sodipodi:role="line"
+         x="503.31937"
+         y="154.02556"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2104-0-97">Scheduler </tspan><tspan
+         sodipodi:role="line"
+         x="500.98602"
+         y="170.69223"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2389" /><tspan
+         sodipodi:role="line"
+         x="500.98602"
+         y="187.35889"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2391">SSO</tspan><tspan
+         sodipodi:role="line"
+         x="500.98602"
+         y="204.02556"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2178-60" /><tspan
+         sodipodi:role="line"
+         x="500.98602"
+         y="220.69223"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2174-3" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="571.61627"
+       y="119.24016"
+       id="text9071-4-2"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-82"
+         x="571.61627"
+         y="119.24016"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff">Supports both poll mode and/or event mode</tspan><tspan
+         sodipodi:role="line"
+         x="571.61627"
+         y="135.90683"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2416">by configuring scheduler</tspan><tspan
+         sodipodi:role="line"
+         x="571.61627"
+         y="152.57349"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2418" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none"
+       x="638.14227"
+       y="192.46773"
+       id="text9071-6-4-9-2"><tspan
+         sodipodi:role="line"
+         x="638.14227"
+         y="192.46773"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2178-3-2">ARMv8</tspan><tspan
+         sodipodi:role="line"
+         x="638.14227"
+         y="209.1344"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2499">Cores</tspan><tspan
+         sodipodi:role="line"
+         x="638.14227"
+         y="225.80106"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle"
+         id="tspan2174-7-8" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="180.24902"
+       y="325.09399"
+       id="text9071-4-1"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-7"
+         x="180.24902"
+         y="325.09399"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;fill:#0000ff">Hardware Libraries</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="487.8916"
+       y="325.91599"
+       id="text9071-4-1-1"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-7-1"
+         x="487.8916"
+         y="325.91599"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;fill:#0000ff">Software Libraries</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="81.178604"
+       y="350.03149"
+       id="text9071-4-18"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-83"
+         x="81.178604"
+         y="350.03149"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff">Mempool</tspan><tspan
+         sodipodi:role="line"
+         x="81.178604"
+         y="366.69815"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555">(NPA)</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="151.09518"
+       y="348.77365"
+       id="text9071-4-18-9"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-83-3"
+         x="151.09518"
+         y="348.77365"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff">Timer</tspan><tspan
+         sodipodi:role="line"
+         x="151.09518"
+         y="365.44031"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555-9">(TIM)</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="222.56393"
+       y="347.1174"
+       id="text9071-4-18-0"><tspan
+         sodipodi:role="line"
+         x="222.56393"
+         y="347.1174"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555-90">Crypto</tspan><tspan
+         sodipodi:role="line"
+         x="222.56393"
+         y="363.78406"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2601">(CPT)</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="289.00229"
+       y="347.69473"
+       id="text9071-4-18-0-5"><tspan
+         sodipodi:role="line"
+         x="289.00229"
+         y="347.69473"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555-90-9">Compress</tspan><tspan
+         sodipodi:role="line"
+         x="289.00229"
+         y="364.36139"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2601-6">(ZIP)</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="355.50653"
+       y="348.60098"
+       id="text9071-4-18-0-5-6"><tspan
+         sodipodi:role="line"
+         x="355.50653"
+         y="348.60098"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555-90-9-5">Shared</tspan><tspan
+         sodipodi:role="line"
+         x="355.50653"
+         y="365.26764"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2645">Memory</tspan><tspan
+         sodipodi:role="line"
+         x="355.50653"
+         y="381.93433"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2601-6-1" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="430.31393"
+       y="356.4924"
+       id="text9071-4-18-1"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-83-35"
+         x="430.31393"
+         y="356.4924"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff">SW Ring</tspan><tspan
+         sodipodi:role="line"
+         x="430.31393"
+         y="373.15906"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555-6" /></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="569.37646"
+       y="341.1799"
+       id="text9071-4-18-2"><tspan
+         sodipodi:role="line"
+         id="tspan9069-8-83-4"
+         x="569.37646"
+         y="341.1799"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff">HASH</tspan><tspan
+         sodipodi:role="line"
+         x="569.37646"
+         y="357.84656"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2742">LPM</tspan><tspan
+         sodipodi:role="line"
+         x="569.37646"
+         y="374.51324"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2555-2">ACL</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="503.75143"
+       y="355.02365"
+       id="text9071-4-18-2-3"><tspan
+         sodipodi:role="line"
+         x="503.75143"
+         y="355.02365"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2733">Mbuf</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+       x="639.34521"
+       y="355.6174"
+       id="text9071-4-18-19"><tspan
+         sodipodi:role="line"
+         x="639.34521"
+         y="355.6174"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.33333302px;font-family:monospace;-inkscape-font-specification:monospace;text-align:center;text-anchor:middle;fill:#0000ff"
+         id="tspan2771">De(Frag)</tspan></text>
+  </g>
+</svg>
doc/guides/platform/img/octeontx2_resource_virtualization.svg new file +2418 -0

196 lines not on this page · raw message

doc/guides/platform/index.rst +1 -0
index a17de2efb..f454ef877 100644

Lines of this file are not shown. View the raw message.

doc/guides/platform/octeontx2.rst new file +235 -0

235 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.21.0

Part of the diff is not shown here. View the raw message.

#16 lore raw

PATCH 16/27 mempool/octeontx2: add build infra and device probe

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add the make and meson based build infrastructure along with the mempool(NPA) device probe.

---
 config/common_base                            |  5 ++
 drivers/common/Makefile                       |  3 +
 drivers/mempool/Makefile                      |  1 +
 drivers/mempool/meson.build                   |  2 +-
 drivers/mempool/octeontx2/Makefile            | 36 ++++++++++++
 drivers/mempool/octeontx2/meson.build         | 20 +++++++
 drivers/mempool/octeontx2/otx2_mempool.c      | 57 +++++++++++++++++++
 .../rte_mempool_octeontx2_version.map         |  4 ++
 mk/rte.app.mk                                 |  4 ++
 9 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mempool/octeontx2/Makefile
 create mode 100644 drivers/mempool/octeontx2/meson.build
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool.c
 create mode 100644 drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map
config/common_base +5 -0
index 6b96e0e80..5c090b5ec 100644
@@ -771,6 +771,11 @@ CONFIG_RTE_DRIVER_MEMPOOL_STACK=y
 #
 CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL=y
 
+#
+# Compile PMD for octeontx2 npa mempool device
+#
+CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL=y
+
 #
 # Compile librte_mbuf
 #
drivers/common/Makefile +3 -0
index e7abe210e..05d75568f 100644
@@ -23,6 +23,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y)
 DIRS-y += dpaax
 endif
 
+OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+ifeq ($(findstring y,$(OCTEONTX2-y)),y)
 DIRS-y += octeontx2
+endif
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/mempool/Makefile +1 -0
index 28c2e8360..29ef73bf4 100644
@@ -13,5 +13,6 @@ endif
 DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += ring
 DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_STACK) += stack
 DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx
+DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += octeontx2
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/mempool/meson.build +1 -1
index 4527d9806..7520e489f 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'ring', 'stack']
+drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'octeontx2', 'ring', 'stack']
 std_deps = ['mempool']
 config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL'
 driver_name_fmt = 'rte_mempool_@0@'
drivers/mempool/octeontx2/Makefile new file +36 -0
new file mode 100644
index 000000000..6fbb6e291
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_mempool_octeontx2.a
+
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/bus/pci
+CFLAGS += -O3
+
+ifneq ($(CONFIG_RTE_ARCH_64),y)
+CFLAGS += -Wno-int-to-pointer-cast
+CFLAGS += -Wno-pointer-to-int-cast
+endif
+
+EXPORT_MAP := rte_mempool_octeontx2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += \
+	otx2_mempool.c
+
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf
+LDLIBS += -lrte_common_octeontx2 -lrte_kvargs -lrte_bus_pci
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/mempool/octeontx2/meson.build new file +20 -0
new file mode 100644
index 000000000..ec3c59eef
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+sources = files('otx2_mempool.c',
+		)
+
+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
+
+deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_octeontx2', 'mempool']
drivers/mempool/octeontx2/otx2_mempool.c new file +57 -0

57 lines not on this page · raw message

drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map new file +4 -0
new file mode 100644
index 000000000..fc8c95e91
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
mk/rte.app.mk +4 -0
index 1e9dcd5a1..cd89ccfd5 100644
@@ -91,6 +91,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)          += -lrte_timer
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)        += -lrte_mempool
 _LDLIBS-$(CONFIG_RTE_LIBRTE_STACK)          += -lrte_stack
 _LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING)   += -lrte_mempool_ring
+_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += -lrte_mempool_octeontx2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_RING)           += -lrte_ring
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI)            += -lrte_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL)            += -lrte_eal
@@ -125,7 +126,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_FSLMC_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX)   += -lrte_common_dpaax
 endif
 
+OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL)
+ifeq ($(findstring y,$(OCTEONTX2-y)),y)
 _LDLIBS-y += -lrte_common_octeontx2
+endif
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS)        += -lrte_bus_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS)       += -lrte_bus_vdev
Signature · 1 line
2.21.0
#17 lore raw

PATCH 17/27 drivers: add init and fini on octeontx2 NPA object

In reply to [email protected]

From: Jerin Jacob <[email protected]>

NPA object needs to initialize memory for queue interrupts context, pool resource management, etc. This patch adds support for initializing and finalizing the NPA object.

This patch also updates the otx2_npa_lf definition to meet the init/fini requirements.

---
 drivers/common/octeontx2/Makefile             |   1 +
 drivers/common/octeontx2/meson.build          |   2 +-
 drivers/common/octeontx2/otx2_common.h        |   7 +-
 drivers/common/octeontx2/otx2_dev.h           |   1 +
 drivers/mempool/octeontx2/otx2_mempool.c      | 344 +++++++++++++++++-
 drivers/mempool/octeontx2/otx2_mempool.h      |  55 +++
 .../rte_mempool_octeontx2_version.map         |   4 +
 7 files changed, 403 insertions(+), 11 deletions(-)
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool.h
drivers/common/octeontx2/Makefile +1 -0
index 78243e555..fabc32537 100644
@@ -11,6 +11,7 @@ LIB = librte_common_octeontx2.a
 
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2
 CFLAGS += -I$(RTE_SDK)/drivers/bus/pci
 
 ifneq ($(CONFIG_RTE_ARCH_64),y)
drivers/common/octeontx2/meson.build +1 -1
index 44ac90085..b79145788 100644
@@ -22,4 +22,4 @@ endforeach
 
 deps = ['eal', 'pci', 'ethdev']
 includes += include_directories('../../common/octeontx2',
-		'../../bus/pci')
+		'../../mempool/octeontx2', '../../bus/pci')
drivers/common/octeontx2/otx2_common.h +1 -6
index d4bc2f59c..dd35360d0 100644
@@ -37,12 +37,7 @@
 #endif
 
 /* Intra device related functions */
-struct otx2_npa_lf {
-	struct otx2_mbox *mbox;
-	struct rte_pci_device *pci_dev;
-	struct rte_intr_handle *intr_handle;
-};
-
+struct otx2_npa_lf;
 struct otx2_idev_cfg {
 	uint16_t sso_pf_func;
 	uint16_t npa_pf_func;
drivers/common/octeontx2/otx2_dev.h +1 -0
index 8fa5f32d2..be862ad1b 100644
@@ -10,6 +10,7 @@
 #include "otx2_common.h"
 #include "otx2_irq.h"
 #include "otx2_mbox.h"
+#include "otx2_mempool.h"
 
 /* Common HWCAP flags. Use from LSB bits */
 #define OTX2_HWCAP_F_VF		BIT_ULL(0) /* VF device */
drivers/mempool/octeontx2/otx2_mempool.c +340 -4

368 lines not on this page · raw message

drivers/mempool/octeontx2/otx2_mempool.h new file +55 -0

55 lines not on this page · raw message

drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map +4 -0
index fc8c95e91..44d084ea0 100644
@@ -1,4 +1,8 @@
 DPDK_19.05 {
+	global:
+
+	otx2_npa_lf_init;
+	otx2_npa_lf_fini;
 
 	local: *;
 };
Signature · 1 line
2.21.0
#18 lore raw

PATCH 18/27 mempool/octeontx2: add NPA HW operations

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Implement the low-level NPA HW operations such as
alloc, free memory, etc.

---
 drivers/mempool/octeontx2/otx2_mempool.h | 146 +++++++++++++++++++++++
 1 file changed, 146 insertions(+)
drivers/mempool/octeontx2/otx2_mempool.h +146 -0
index e1c255c60..871b45870 100644
@@ -48,6 +48,152 @@ struct otx2_npa_lf {
 
 #define AURA_ID_MASK  (BIT_ULL(16) - 1)
 
+/*
+ * Generate 64bit handle to have optimized alloc and free aura operation.
+ * 0 - AURA_ID_MASK for storing the aura_id.
+ * AURA_ID_MASK+1 - (2^64 - 1) for storing the lf base address.
+ * This scheme is valid when OS can give AURA_ID_MASK
+ * aligned address for lf base address.
+ */
+static inline uint64_t
+npa_lf_aura_handle_gen(uint32_t aura_id, uintptr_t addr)
+{
+	uint64_t val;
+
+	val = aura_id & AURA_ID_MASK;
+	return (uint64_t)addr | val;
+}
+
+static inline uint64_t
+npa_lf_aura_handle_to_aura(uint64_t aura_handle)
+{
+	return aura_handle & AURA_ID_MASK;
+}
+
+static inline uintptr_t
+npa_lf_aura_handle_to_base(uint64_t aura_handle)
+{
+	return (uintptr_t)(aura_handle & ~AURA_ID_MASK);
+}
+
+static inline uint64_t
+npa_lf_aura_op_alloc(uint64_t aura_handle, const int drop)
+{
+	uint64_t wdata = npa_lf_aura_handle_to_aura(aura_handle);
+
+	if (drop)
+		wdata |= BIT_ULL(63); /* DROP */
+
+	return otx2_atomic64_add_nosync(wdata,
+		(int64_t *)(npa_lf_aura_handle_to_base(aura_handle) +
+		NPA_LF_AURA_OP_ALLOCX(0)));
+}
+
+static inline void
+npa_lf_aura_op_free(uint64_t aura_handle, const int fabs, uint64_t iova)
+{
+	uint64_t reg = npa_lf_aura_handle_to_aura(aura_handle);
+
+	if (fabs)
+		reg |= BIT_ULL(63); /* FABS */
+
+	otx2_store_pair(iova, reg,
+		npa_lf_aura_handle_to_base(aura_handle) + NPA_LF_AURA_OP_FREE0);
+}
+
+static inline uint64_t
+npa_lf_aura_op_cnt_get(uint64_t aura_handle)
+{
+	uint64_t wdata;
+	uint64_t reg;
+
+	wdata = npa_lf_aura_handle_to_aura(aura_handle) << 44;
+
+	reg = otx2_atomic64_add_nosync(wdata,
+			(int64_t *)(npa_lf_aura_handle_to_base(aura_handle) +
+			 NPA_LF_AURA_OP_CNT));
+
+	if (reg & BIT_ULL(42) /* OP_ERR */)
+		return 0;
+	else
+		return reg & 0xFFFFFFFFF;
+}
+
+static inline void
+npa_lf_aura_op_cnt_set(uint64_t aura_handle, const int sign, uint64_t count)
+{
+	uint64_t reg = count & (BIT_ULL(36) - 1);
+
+	if (sign)
+		reg |= BIT_ULL(43); /* CNT_ADD */
+
+	reg |= (npa_lf_aura_handle_to_aura(aura_handle) << 44);
+
+	otx2_write64(reg,
+		npa_lf_aura_handle_to_base(aura_handle) + NPA_LF_AURA_OP_CNT);
+}
+
+static inline uint64_t
+npa_lf_aura_op_limit_get(uint64_t aura_handle)
+{
+	uint64_t wdata;
+	uint64_t reg;
+
+	wdata = npa_lf_aura_handle_to_aura(aura_handle) << 44;
+
+	reg = otx2_atomic64_add_nosync(wdata,
+			(int64_t *)(npa_lf_aura_handle_to_base(aura_handle) +
+			 NPA_LF_AURA_OP_LIMIT));
+
+	if (reg & BIT_ULL(42) /* OP_ERR */)
+		return 0;
+	else
+		return reg & 0xFFFFFFFFF;
+}
+
+static inline void
+npa_lf_aura_op_limit_set(uint64_t aura_handle, uint64_t limit)
+{
+	uint64_t reg = limit & (BIT_ULL(36) - 1);
+
+	reg |= (npa_lf_aura_handle_to_aura(aura_handle) << 44);
+
+	otx2_write64(reg,
+		npa_lf_aura_handle_to_base(aura_handle) + NPA_LF_AURA_OP_LIMIT);
+}
+
+static inline uint64_t
+npa_lf_aura_op_available(uint64_t aura_handle)
+{
+	uint64_t wdata;
+	uint64_t reg;
+
+	wdata = npa_lf_aura_handle_to_aura(aura_handle) << 44;
+
+	reg = otx2_atomic64_add_nosync(wdata,
+			    (int64_t *)(npa_lf_aura_handle_to_base(
+			     aura_handle) + NPA_LF_POOL_OP_AVAILABLE));
+
+	if (reg & BIT_ULL(42) /* OP_ERR */)
+		return 0;
+	else
+		return reg & 0xFFFFFFFFF;
+}
+
+static inline void
+npa_lf_aura_op_range_set(uint64_t aura_handle, uint64_t start_iova,
+				uint64_t end_iova)
+{
+	uint64_t reg = npa_lf_aura_handle_to_aura(aura_handle);
+
+	otx2_store_pair(start_iova, reg,
+			npa_lf_aura_handle_to_base(aura_handle) +
+			NPA_LF_POOL_OP_PTR_START0);
+	otx2_store_pair(end_iova, reg,
+			npa_lf_aura_handle_to_base(aura_handle) +
+			NPA_LF_POOL_OP_PTR_END0);
+}
+
 /* NPA LF */
 int otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev);
 int otx2_npa_lf_fini(void);
Signature · 1 line
2.21.0
#19 lore raw

PATCH 19/27 mempool/octeontx2: add NPA IRQ handler

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Register and implement NPA IRQ handler for RAS and all type of error interrupts to get the fatal errors from HW.

---
 drivers/mempool/octeontx2/Makefile           |   3 +-
 drivers/mempool/octeontx2/meson.build        |   1 +
 drivers/mempool/octeontx2/otx2_mempool.c     |   6 +
 drivers/mempool/octeontx2/otx2_mempool.h     |   4 +
 drivers/mempool/octeontx2/otx2_mempool_irq.c | 307 +++++++++++++++++++
 5 files changed, 320 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_irq.c
drivers/mempool/octeontx2/Makefile +2 -1
index 6fbb6e291..86950b270 100644
@@ -28,7 +28,8 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += \
-	otx2_mempool.c
+	otx2_mempool.c 		\
+	otx2_mempool_irq.c
 
 LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf
 LDLIBS += -lrte_common_octeontx2 -lrte_kvargs -lrte_bus_pci
drivers/mempool/octeontx2/meson.build +1 -0
index ec3c59eef..3f93b509d 100644
@@ -3,6 +3,7 @@
 #
 
 sources = files('otx2_mempool.c',
+		'otx2_mempool_irq.c',
 		)
 
 extra_flags = []
drivers/mempool/octeontx2/otx2_mempool.c +6 -0
index fa74b7532..1bcb86cf4 100644
@@ -195,6 +195,7 @@ otx2_npa_lf_fini(void)
 		return -ENOMEM;
 
 	if (rte_atomic16_add_return(&idev->npa_refcnt, -1) == 0) {
+		otx2_npa_unregister_irqs(idev->npa_lf);
 		rc |= npa_lf_fini(idev->npa_lf);
 		rc |= npa_lf_detach(idev->npa_lf->mbox);
 		otx2_npa_set_defaults(idev);
@@ -251,6 +252,9 @@ otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 		idev->npa_pf_func = dev->pf_func;
 		idev->npa_lf = lf;
 		rte_smp_wmb();
+		rc = otx2_npa_register_irqs(lf);
+		if (rc)
+			goto npa_fini;
 
 		rte_mbuf_set_platform_mempool_ops("octeontx2_npa");
 		otx2_npa_dbg("npa_lf=%p pools=%d sz=%d pf_func=0x%x msix=0x%x",
@@ -259,6 +263,8 @@ otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 
 	return 0;
 
+npa_fini:
+	npa_lf_fini(idev->npa_lf);
 npa_detach:
 	npa_lf_detach(dev->mbox);
 fail:
drivers/mempool/octeontx2/otx2_mempool.h +4 -0
index 871b45870..41542cf89 100644
@@ -198,4 +198,8 @@ npa_lf_aura_op_range_set(uint64_t aura_handle, uint64_t start_iova,
 int otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev);
 int otx2_npa_lf_fini(void);
 
+/* IRQ */
+int otx2_npa_register_irqs(struct otx2_npa_lf *lf);
+void otx2_npa_unregister_irqs(struct otx2_npa_lf *lf);
+
 #endif /* __OTX2_MEMPOOL_H__ */
drivers/mempool/octeontx2/otx2_mempool_irq.c new file +307 -0

307 lines not on this page · raw message

Signature · 1 line
2.21.0
#20 lore raw

PATCH 20/27 mempool/octeontx2: add context dump support

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add a helper function to dump aura and pool context for NPA debugging.

---
 drivers/mempool/octeontx2/Makefile            |   3 +-
 drivers/mempool/octeontx2/meson.build         |   1 +
 drivers/mempool/octeontx2/otx2_mempool.h      |   3 +
 .../mempool/octeontx2/otx2_mempool_debug.c    | 135 ++++++++++++++++++
 drivers/mempool/octeontx2/otx2_mempool_irq.c  |   1 +
 5 files changed, 142 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_debug.c
drivers/mempool/octeontx2/Makefile +2 -1
index 86950b270..b86d469f4 100644
@@ -29,7 +29,8 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += \
 	otx2_mempool.c 		\
-	otx2_mempool_irq.c
+	otx2_mempool_irq.c	\
+	otx2_mempool_debug.c
 
 LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf
 LDLIBS += -lrte_common_octeontx2 -lrte_kvargs -lrte_bus_pci
drivers/mempool/octeontx2/meson.build +1 -0
index 3f93b509d..ab306b729 100644
@@ -4,6 +4,7 @@
 
 sources = files('otx2_mempool.c',
 		'otx2_mempool_irq.c',
+		'otx2_mempool_debug.c'
 		)
 
 extra_flags = []
drivers/mempool/octeontx2/otx2_mempool.h +3 -0
index 41542cf89..efaa308b3 100644
@@ -202,4 +202,7 @@ int otx2_npa_lf_fini(void);
 int otx2_npa_register_irqs(struct otx2_npa_lf *lf);
 void otx2_npa_unregister_irqs(struct otx2_npa_lf *lf);
 
+/* Debug */
+int otx2_mempool_ctx_dump(struct otx2_npa_lf *lf);
+
 #endif /* __OTX2_MEMPOOL_H__ */
drivers/mempool/octeontx2/otx2_mempool_debug.c new file +135 -0

135 lines not on this page · raw message

drivers/mempool/octeontx2/otx2_mempool_irq.c +1 -0
index 510d3e994..f8a01a696 100644
@@ -203,6 +203,7 @@ npa_lf_q_irq(void *param)
 
 	/* Clear interrupt */
 	otx2_write64(intr, lf->base + NPA_LF_QINTX_INT(qintx));
+	otx2_mempool_ctx_dump(lf);
 	rte_panic("npa_lf_q_interrupt\n");
 }
 
Signature · 1 line
2.21.0
#21 lore raw

PATCH 21/27 mempool/octeontx2: add mempool alloc op

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The DPDK mempool allocation reserves a single HW AURA
and POOL in 1:1 map mode. Upon reservation, SW programs the slow path operations such as allocate stack memory for DMA and
bunch HW configurations to respective HW blocks.

Cc Olivier Matz <[email protected]>
---
 drivers/mempool/octeontx2/Makefile           |   1 +
 drivers/mempool/octeontx2/meson.build        |   3 +-
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 246 +++++++++++++++++++
 3 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_ops.c
drivers/mempool/octeontx2/Makefile +1 -0
index b86d469f4..b3568443e 100644
@@ -28,6 +28,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += \
+	otx2_mempool_ops.c	\
 	otx2_mempool.c 		\
 	otx2_mempool_irq.c	\
 	otx2_mempool_debug.c
drivers/mempool/octeontx2/meson.build +2 -1
index ab306b729..9fde40f0e 100644
@@ -2,7 +2,8 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
-sources = files('otx2_mempool.c',
+sources = files('otx2_mempool_ops.c',
+		'otx2_mempool.c',
 		'otx2_mempool_irq.c',
 		'otx2_mempool_debug.c'
 		)
drivers/mempool/octeontx2/otx2_mempool_ops.c new file +246 -0

246 lines not on this page · raw message

Signature · 1 line
2.21.0
#22 lore raw

PATCH 22/27 mempool/octeontx2: add mempool free op

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The DPDK mempool free operation frees HW AURA
and POOL reserved in alloc operation. In addition to that it free all the memory resources allocated in mempool alloc operations.

Cc Olivier Matz <[email protected]>
---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 104 +++++++++++++++++++
 1 file changed, 104 insertions(+)
drivers/mempool/octeontx2/otx2_mempool_ops.c +104 -0
index 0e7b7a77c..94570319a 100644
@@ -47,6 +47,62 @@ npa_lf_aura_pool_init(struct otx2_mbox *mbox, uint32_t aura_id,
 		return NPA_LF_ERR_AURA_POOL_INIT;
 }
 
+static int
+npa_lf_aura_pool_fini(struct otx2_mbox *mbox,
+		      uint32_t aura_id,
+		      uint64_t aura_handle)
+{
+	struct npa_aq_enq_req *aura_req, *pool_req;
+	struct npa_aq_enq_rsp *aura_rsp, *pool_rsp;
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	struct ndc_sync_op *ndc_req;
+	int rc, off;
+
+	/* Procedure for disabling an aura/pool */
+	rte_delay_us(10);
+	npa_lf_aura_op_alloc(aura_handle, 0);
+
+	pool_req = otx2_mbox_alloc_msg_npa_aq_enq(mbox);
+	pool_req->aura_id = aura_id;
+	pool_req->ctype = NPA_AQ_CTYPE_POOL;
+	pool_req->op = NPA_AQ_INSTOP_WRITE;
+	pool_req->pool.ena = 0;
+	pool_req->pool_mask.ena = ~pool_req->pool_mask.ena;
+
+	aura_req = otx2_mbox_alloc_msg_npa_aq_enq(mbox);
+	aura_req->aura_id = aura_id;
+	aura_req->ctype = NPA_AQ_CTYPE_AURA;
+	aura_req->op = NPA_AQ_INSTOP_WRITE;
+	aura_req->aura.ena = 0;
+	aura_req->aura_mask.ena = ~aura_req->aura_mask.ena;
+
+	otx2_mbox_msg_send(mbox, 0);
+	rc = otx2_mbox_wait_for_rsp(mbox, 0);
+	if (rc < 0)
+		return rc;
+
+	off = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	pool_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase + off);
+
+	off = mbox->rx_start + pool_rsp->hdr.next_msgoff;
+	aura_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase + off);
+
+	if (rc != 2 || aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0)
+		return NPA_LF_ERR_AURA_POOL_FINI;
+
+	/* Sync NDC-NPA for LF */
+	ndc_req = otx2_mbox_alloc_msg_ndc_sync_op(mbox);
+	ndc_req->npa_lf_sync = 1;
+
+	rc = otx2_mbox_process(mbox);
+	if (rc) {
+		otx2_err("Error on NDC-NPA LF sync, rc %d", rc);
+		return NPA_LF_ERR_AURA_POOL_FINI;
+	}
+	return 0;
+}
+
 static inline char*
 npa_lf_stack_memzone_name(struct otx2_npa_lf *lf, int pool_id, char *name)
 {
@@ -65,6 +121,18 @@ npa_lf_stack_dma_alloc(struct otx2_npa_lf *lf, char *name,
 			RTE_MEMZONE_IOVA_CONTIG, OTX2_ALIGN);
 }
 
+static inline int
+npa_lf_stack_dma_free(struct otx2_npa_lf *lf, char *name, int pool_id)
+{
+	const struct rte_memzone *mz;
+
+	mz = rte_memzone_lookup(npa_lf_stack_memzone_name(lf, pool_id, name));
+	if (mz == NULL)
+		return -EINVAL;
+
+	return rte_memzone_free(mz);
+}
+
 static inline int
 bitmap_ctzll(uint64_t slab)
 {
@@ -179,6 +247,24 @@ npa_lf_aura_pool_pair_alloc(struct otx2_npa_lf *lf, const uint32_t block_size,
 	return rc;
 }
 
+static int
+npa_lf_aura_pool_pair_free(struct otx2_npa_lf *lf, uint64_t aura_handle)
+{
+	char name[RTE_MEMZONE_NAMESIZE];
+	int aura_id, pool_id, rc;
+
+	if (!lf || !aura_handle)
+		return NPA_LF_ERR_PARAM;
+
+	aura_id = pool_id = npa_lf_aura_handle_to_aura(aura_handle);
+	rc = npa_lf_aura_pool_fini(lf->mbox, aura_id, aura_handle);
+	rc |= npa_lf_stack_dma_free(lf, name, pool_id);
+
+	rte_bitmap_set(lf->npa_bmp, aura_id);
+
+	return rc;
+}
+
 static int
 otx2_npa_alloc(struct rte_mempool *mp)
 {
@@ -238,9 +324,27 @@ otx2_npa_alloc(struct rte_mempool *mp)
 	return rc;
 }
 
+static void
+otx2_npa_free(struct rte_mempool *mp)
+{
+	struct otx2_npa_lf *lf = otx2_npa_lf_obj_get();
+	int rc = 0;
+
+	otx2_npa_dbg("lf=%p aura_handle=0x%"PRIx64, lf, mp->pool_id);
+	if (lf != NULL)
+		rc = npa_lf_aura_pool_pair_free(lf, mp->pool_id);
+
+	if (rc)
+		otx2_err("Failed to free pool or aura rc=%d", rc);
+
+	/* Release the reference of npalf */
+	otx2_npa_lf_fini();
+}
+
 static struct rte_mempool_ops otx2_npa_ops = {
 	.name = "octeontx2_npa",
 	.alloc = otx2_npa_alloc,
+	.free = otx2_npa_free,
 };
 
 MEMPOOL_REGISTER_OPS(otx2_npa_ops);
Signature · 1 line
2.21.0
#23 lore raw

PATCH 23/27 mempool/octeontx2: add remaining slow path ops

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add remaining get_count(), calc_mem_size() and populate() slow path mempool operations.

---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 62 ++++++++++++++++++++
 1 file changed, 62 insertions(+)
drivers/mempool/octeontx2/otx2_mempool_ops.c +62 -0
index 94570319a..966b7d7f1 100644
@@ -7,6 +7,12 @@
 
 #include "otx2_mempool.h"
 
+static unsigned int
+otx2_npa_get_count(const struct rte_mempool *mp)
+{
+	return (unsigned int)npa_lf_aura_op_available(mp->pool_id);
+}
+
 static int
 npa_lf_aura_pool_init(struct otx2_mbox *mbox, uint32_t aura_id,
 		      struct npa_aura_s *aura, struct npa_pool_s *pool)
@@ -341,10 +347,66 @@ otx2_npa_free(struct rte_mempool *mp)
 	otx2_npa_lf_fini();
 }
 
+static ssize_t
+otx2_npa_calc_mem_size(const struct rte_mempool *mp, uint32_t obj_num,
+		       uint32_t pg_shift, size_t *min_chunk_size, size_t *align)
+{
+	ssize_t mem_size;
+
+	/*
+	 * Simply need space for one more object to be able to
+	 * fulfill alignment requirements.
+	 */
+	mem_size = rte_mempool_op_calc_mem_size_default(mp, obj_num + 1,
+							pg_shift,
+							min_chunk_size, align);
+	if (mem_size >= 0) {
+		/*
+		 * Memory area which contains objects must be physically
+		 * contiguous.
+		 */
+		*min_chunk_size = mem_size;
+	}
+
+	return mem_size;
+}
+
+static int
+otx2_npa_populate(struct rte_mempool *mp, unsigned int max_objs, void *vaddr,
+		  rte_iova_t iova, size_t len,
+		  rte_mempool_populate_obj_cb_t *obj_cb, void *obj_cb_arg)
+{
+	size_t total_elt_sz;
+	size_t off;
+
+	if (iova == RTE_BAD_IOVA)
+		return -EINVAL;
+
+	total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
+
+	/* Align object start address to a multiple of total_elt_sz */
+	off = total_elt_sz - ((uintptr_t)vaddr % total_elt_sz);
+
+	if (len < off)
+		return -EINVAL;
+
+	vaddr = (char *)vaddr + off;
+	iova += off;
+	len -= off;
+
+	npa_lf_aura_op_range_set(mp->pool_id, iova, iova + len);
+
+	return rte_mempool_op_populate_default(mp, max_objs, vaddr, iova, len,
+					       obj_cb, obj_cb_arg);
+}
+
 static struct rte_mempool_ops otx2_npa_ops = {
 	.name = "octeontx2_npa",
 	.alloc = otx2_npa_alloc,
 	.free = otx2_npa_free,
+	.get_count = otx2_npa_get_count,
+	.calc_mem_size = otx2_npa_calc_mem_size,
+	.populate = otx2_npa_populate,
 };
 
 MEMPOOL_REGISTER_OPS(otx2_npa_ops);
Signature · 1 line
2.21.0
#24 lore raw

PATCH 24/27 mempool/octeontx2: add fast path mempool ops

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add enqueue and dequeue mempool fastpath operations.

Cc Olivier Matz <[email protected]>
---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 57 ++++++++++++++++++++
 1 file changed, 57 insertions(+)
drivers/mempool/octeontx2/otx2_mempool_ops.c +57 -0
index 966b7d7f1..c59bd73c0 100644
@@ -7,6 +7,61 @@
 
 #include "otx2_mempool.h"
 
+static int __hot
+otx2_npa_enq(struct rte_mempool *mp, void * const *obj_table, unsigned int n)
+{
+	unsigned int index; const uint64_t aura_handle = mp->pool_id;
+	const uint64_t reg = npa_lf_aura_handle_to_aura(aura_handle);
+	const uint64_t addr = npa_lf_aura_handle_to_base(aura_handle) +
+				 NPA_LF_AURA_OP_FREE0;
+
+	for (index = 0; index < n; index++)
+		otx2_store_pair((uint64_t)obj_table[index], reg, addr);
+
+	return 0;
+}
+
+static __rte_noinline int
+npa_lf_aura_op_alloc_one(const int64_t wdata, int64_t * const addr,
+			 void **obj_table, uint8_t i)
+{
+	uint8_t retry = 4;
+
+	do {
+		obj_table[i] = (void *)otx2_atomic64_add_nosync(wdata, addr);
+		if (obj_table[i] != NULL)
+			return 0;
+
+	} while (retry--);
+
+	return -ENOENT;
+}
+
+static inline int __hot
+otx2_npa_deq(struct rte_mempool *mp, void **obj_table, unsigned int n)
+{
+	const int64_t wdata = npa_lf_aura_handle_to_aura(mp->pool_id);
+	unsigned int index;
+	uint64_t obj;
+
+	int64_t * const addr = (int64_t * const)
+			(npa_lf_aura_handle_to_base(mp->pool_id) +
+				NPA_LF_AURA_OP_ALLOCX(0));
+	for (index = 0; index < n; index++, obj_table++) {
+		obj = npa_lf_aura_op_alloc_one(wdata, addr, obj_table, 0);
+		if (obj == 0) {
+			for (; index > 0; index--) {
+				obj_table--;
+				otx2_npa_enq(mp, obj_table, 1);
+			}
+			return -ENOENT;
+		}
+		*obj_table = (void *)obj;
+	}
+
+	return 0;
+}
+
 static unsigned int
 otx2_npa_get_count(const struct rte_mempool *mp)
 {
@@ -404,9 +459,11 @@ static struct rte_mempool_ops otx2_npa_ops = {
 	.name = "octeontx2_npa",
 	.alloc = otx2_npa_alloc,
 	.free = otx2_npa_free,
+	.enqueue = otx2_npa_enq,
 	.get_count = otx2_npa_get_count,
 	.calc_mem_size = otx2_npa_calc_mem_size,
 	.populate = otx2_npa_populate,
+	.dequeue = otx2_npa_deq,
 };
 
 MEMPOOL_REGISTER_OPS(otx2_npa_ops);
Signature · 1 line
2.21.0
#25 lore raw

PATCH 25/27 mempool/octeontx2: add optimized dequeue operation for arm64

In reply to [email protected]

From: Pavan Nikhilesh <[email protected]>

This patch adds an optimized arm64 instruction based routine to leverage CPU pipeline characteristics of octeontx2. The theme is to fill the pipeline with CASP operations as much HW can do so that HW can do alloc() HW ops in full throttle.

Cc Olivier Matz <[email protected]>
---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 291 +++++++++++++++++++
 1 file changed, 291 insertions(+)
drivers/mempool/octeontx2/otx2_mempool_ops.c +291 -0
index c59bd73c0..ebe90d122 100644
@@ -37,6 +37,293 @@ npa_lf_aura_op_alloc_one(const int64_t wdata, int64_t * const addr,
 	return -ENOENT;
 }
 
+#if defined(RTE_ARCH_ARM64)
+static __rte_noinline int
+npa_lf_aura_op_search_alloc(const int64_t wdata, int64_t * const addr,
+		void **obj_table, unsigned int n)
+{
+	uint8_t i;
+
+	for (i = 0; i < n; i++) {
+		if (obj_table[i] != NULL)
+			continue;
+		if (npa_lf_aura_op_alloc_one(wdata, addr, obj_table, i))
+			return -ENOENT;
+	}
+
+	return 0;
+}
+
+static  __attribute__((optimize("-O3"))) __rte_noinline int __hot
+npa_lf_aura_op_alloc_bulk(const int64_t wdata, int64_t * const addr,
+			  unsigned int n, void **obj_table)
+{
+	const __uint128_t wdata128 = ((__uint128_t)wdata << 64) | wdata;
+	uint64x2_t failed = vdupq_n_u64(~0);
+
+	switch (n) {
+	case 32:
+	{
+		__uint128_t t0, t1, t2, t3, t4, t5, t6, t7, t8, t9;
+		__uint128_t t10, t11;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t4], %H[t4], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t5], %H[t5], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t6], %H[t6], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t7], %H[t7], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t8], %H[t8], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t9], %H[t9], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t10], %H[t10], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t11], %H[t11], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d18, %[t2]\n"
+		"fmov v18.D[1], %H[t2]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d19, %[t3]\n"
+		"fmov v19.D[1], %H[t3]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"fmov d20, %[t4]\n"
+		"fmov v20.D[1], %H[t4]\n"
+		"fmov d21, %[t5]\n"
+		"fmov v21.D[1], %H[t5]\n"
+		"fmov d22, %[t6]\n"
+		"fmov v22.D[1], %H[t6]\n"
+		"fmov d23, %[t7]\n"
+		"fmov v23.D[1], %H[t7]\n"
+		"and %[failed].16B, %[failed].16B, v20.16B\n"
+		"and %[failed].16B, %[failed].16B, v21.16B\n"
+		"and %[failed].16B, %[failed].16B, v22.16B\n"
+		"and %[failed].16B, %[failed].16B, v23.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		"st1 { v20.2d, v21.2d, v22.2d, v23.2d}, [%[dst]], 64\n"
+		"fmov d16, %[t8]\n"
+		"fmov v16.D[1], %H[t8]\n"
+		"fmov d17, %[t9]\n"
+		"fmov v17.D[1], %H[t9]\n"
+		"fmov d18, %[t10]\n"
+		"fmov v18.D[1], %H[t10]\n"
+		"fmov d19, %[t11]\n"
+		"fmov v19.D[1], %H[t11]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"fmov d20, %[t0]\n"
+		"fmov v20.D[1], %H[t0]\n"
+		"fmov d21, %[t1]\n"
+		"fmov v21.D[1], %H[t1]\n"
+		"fmov d22, %[t2]\n"
+		"fmov v22.D[1], %H[t2]\n"
+		"fmov d23, %[t3]\n"
+		"fmov v23.D[1], %H[t3]\n"
+		"and %[failed].16B, %[failed].16B, v20.16B\n"
+		"and %[failed].16B, %[failed].16B, v21.16B\n"
+		"and %[failed].16B, %[failed].16B, v22.16B\n"
+		"and %[failed].16B, %[failed].16B, v23.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		"st1 { v20.2d, v21.2d, v22.2d, v23.2d}, [%[dst]], 64\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1), [t2] "=&r" (t2),
+		[t3] "=&r" (t3), [t4] "=&r" (t4), [t5] "=&r" (t5),
+		[t6] "=&r" (t6), [t7] "=&r" (t7), [t8] "=&r" (t8),
+		[t9] "=&r" (t9), [t10] "=&r" (t10), [t11] "=&r" (t11)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17", "v18",
+		"v19", "v20", "v21", "v22", "v23"
+		);
+		break;
+	}
+	case 16:
+	{
+		__uint128_t t0, t1, t2, t3, t4, t5, t6, t7;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t4], %H[t4], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t5], %H[t5], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t6], %H[t6], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t7], %H[t7], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"fmov d18, %[t2]\n"
+		"fmov v18.D[1], %H[t2]\n"
+		"fmov d19, %[t3]\n"
+		"fmov v19.D[1], %H[t3]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"fmov d20, %[t4]\n"
+		"fmov v20.D[1], %H[t4]\n"
+		"fmov d21, %[t5]\n"
+		"fmov v21.D[1], %H[t5]\n"
+		"fmov d22, %[t6]\n"
+		"fmov v22.D[1], %H[t6]\n"
+		"fmov d23, %[t7]\n"
+		"fmov v23.D[1], %H[t7]\n"
+		"and %[failed].16B, %[failed].16B, v20.16B\n"
+		"and %[failed].16B, %[failed].16B, v21.16B\n"
+		"and %[failed].16B, %[failed].16B, v22.16B\n"
+		"and %[failed].16B, %[failed].16B, v23.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		"st1 { v20.2d, v21.2d, v22.2d, v23.2d}, [%[dst]], 64\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1), [t2] "=&r" (t2),
+		[t3] "=&r" (t3), [t4] "=&r" (t4), [t5] "=&r" (t5),
+		[t6] "=&r" (t6), [t7] "=&r" (t7)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17", "v18", "v19",
+		  "v20", "v21", "v22", "v23"
+		);
+		break;
+	}
+	case 8:
+	{
+		__uint128_t t0, t1, t2, t3;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"fmov d18, %[t2]\n"
+		"fmov v18.D[1], %H[t2]\n"
+		"fmov d19, %[t3]\n"
+		"fmov v19.D[1], %H[t3]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1), [t2] "=&r" (t2),
+		[t3] "=&r" (t3)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17", "v18", "v19"
+		);
+		break;
+	}
+	case 4:
+	{
+		__uint128_t t0, t1;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"st1 { v16.2d, v17.2d}, [%[dst]], 32\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17"
+		);
+		break;
+	}
+	case 2:
+	{
+		__uint128_t t0;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"st1 { v16.2d}, [%[dst]], 16\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16"
+		);
+		break;
+	}
+	case 1:
+		return npa_lf_aura_op_alloc_one(wdata, addr, obj_table, 0);
+	}
+
+	if (unlikely(!(((uint64_t *) &failed)[0] & ((uint64_t *) &failed)[1])))
+		return npa_lf_aura_op_search_alloc(wdata, addr, (void **)
+			((char *)obj_table - (sizeof(uint64_t) * n)), n);
+
+	return 0;
+}
+
+static __rte_noinline void
+otx2_npa_clear_alloc(struct rte_mempool *mp, void **obj_table, unsigned int n)
+{
+	unsigned int i;
+
+	for (i = 0; i < n; i++) {
+		if (obj_table[i] != NULL) {
+			otx2_npa_enq(mp, &obj_table[i], 1);
+			obj_table[i] = NULL;
+		}
+	}
+}
+
+static inline int __hot
+otx2_npa_deq_arm64(struct rte_mempool *mp, void **obj_table, unsigned int n)
+{
+	const int64_t wdata = npa_lf_aura_handle_to_aura(mp->pool_id);
+	void **obj_table_bak = obj_table;
+	const unsigned int nfree = n;
+	unsigned int parts;
+
+	int64_t * const addr = (int64_t * const)
+			(npa_lf_aura_handle_to_base(mp->pool_id) +
+				NPA_LF_AURA_OP_ALLOCX(0));
+	while (n) {
+		parts = n > 31 ? 32 : rte_align32prevpow2(n);
+		n -= parts;
+		if (unlikely(npa_lf_aura_op_alloc_bulk(wdata, addr,
+				parts, obj_table))) {
+			otx2_npa_clear_alloc(mp, obj_table_bak, nfree - n);
+			return -ENOENT;
+		}
+		obj_table += parts;
+	}
+
+	return 0;
+}
+#endif
+
 static inline int __hot
 otx2_npa_deq(struct rte_mempool *mp, void **obj_table, unsigned int n)
 {
@@ -463,7 +750,11 @@ static struct rte_mempool_ops otx2_npa_ops = {
 	.get_count = otx2_npa_get_count,
 	.calc_mem_size = otx2_npa_calc_mem_size,
 	.populate = otx2_npa_populate,
+#if defined(RTE_ARCH_ARM64)
+	.dequeue = otx2_npa_deq_arm64,
+#else
 	.dequeue = otx2_npa_deq,
+#endif
 };
 
 MEMPOOL_REGISTER_OPS(otx2_npa_ops);
Signature · 1 line
2.21.0
#26 lore raw

Re: [dpdk-dev] [PATCH v1 25/27] mempool/octeontx2: add optimized dequeue operation for arm64

Quoted 258 lines · <[email protected]> writes:

From: Pavan Nikhilesh <[email protected]>

This patch adds an optimized arm64 instruction based routine to leverage CPU pipeline characteristics of octeontx2. The theme is to fill the pipeline with CASP operations as much HW can do so that HW can do alloc() HW ops in full throttle.

Cc Olivier Matz <[email protected]>
---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 291 +++++++++++++++++++
 1 file changed, 291 insertions(+)
drivers/mempool/octeontx2/otx2_mempool_ops.c +234 -0
index c59bd73c0..ebe90d122 100644
@@ -37,6 +37,293 @@ npa_lf_aura_op_alloc_one(const int64_t wdata, int64_t * const addr,
 	return -ENOENT;
 }
 
+#if defined(RTE_ARCH_ARM64)
+static __rte_noinline int
+npa_lf_aura_op_search_alloc(const int64_t wdata, int64_t * const addr,
+		void **obj_table, unsigned int n)
+{
+	uint8_t i;
+
+	for (i = 0; i < n; i++) {
+		if (obj_table[i] != NULL)
+			continue;
+		if (npa_lf_aura_op_alloc_one(wdata, addr, obj_table, i))
+			return -ENOENT;
+	}
+
+	return 0;
+}
+
+static  __attribute__((optimize("-O3"))) __rte_noinline int __hot
+npa_lf_aura_op_alloc_bulk(const int64_t wdata, int64_t * const addr,
+			  unsigned int n, void **obj_table)
+{
+	const __uint128_t wdata128 = ((__uint128_t)wdata << 64) | wdata;
+	uint64x2_t failed = vdupq_n_u64(~0);
+
+	switch (n) {
+	case 32:
+	{
+		__uint128_t t0, t1, t2, t3, t4, t5, t6, t7, t8, t9;
+		__uint128_t t10, t11;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t4], %H[t4], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t5], %H[t5], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t6], %H[t6], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t7], %H[t7], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t8], %H[t8], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t9], %H[t9], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t10], %H[t10], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t11], %H[t11], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d18, %[t2]\n"
+		"fmov v18.D[1], %H[t2]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d19, %[t3]\n"
+		"fmov v19.D[1], %H[t3]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"fmov d20, %[t4]\n"
+		"fmov v20.D[1], %H[t4]\n"
+		"fmov d21, %[t5]\n"
+		"fmov v21.D[1], %H[t5]\n"
+		"fmov d22, %[t6]\n"
+		"fmov v22.D[1], %H[t6]\n"
+		"fmov d23, %[t7]\n"
+		"fmov v23.D[1], %H[t7]\n"
+		"and %[failed].16B, %[failed].16B, v20.16B\n"
+		"and %[failed].16B, %[failed].16B, v21.16B\n"
+		"and %[failed].16B, %[failed].16B, v22.16B\n"
+		"and %[failed].16B, %[failed].16B, v23.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		"st1 { v20.2d, v21.2d, v22.2d, v23.2d}, [%[dst]], 64\n"
+		"fmov d16, %[t8]\n"
+		"fmov v16.D[1], %H[t8]\n"
+		"fmov d17, %[t9]\n"
+		"fmov v17.D[1], %H[t9]\n"
+		"fmov d18, %[t10]\n"
+		"fmov v18.D[1], %H[t10]\n"
+		"fmov d19, %[t11]\n"
+		"fmov v19.D[1], %H[t11]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"fmov d20, %[t0]\n"
+		"fmov v20.D[1], %H[t0]\n"
+		"fmov d21, %[t1]\n"
+		"fmov v21.D[1], %H[t1]\n"
+		"fmov d22, %[t2]\n"
+		"fmov v22.D[1], %H[t2]\n"
+		"fmov d23, %[t3]\n"
+		"fmov v23.D[1], %H[t3]\n"
+		"and %[failed].16B, %[failed].16B, v20.16B\n"
+		"and %[failed].16B, %[failed].16B, v21.16B\n"
+		"and %[failed].16B, %[failed].16B, v22.16B\n"
+		"and %[failed].16B, %[failed].16B, v23.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		"st1 { v20.2d, v21.2d, v22.2d, v23.2d}, [%[dst]], 64\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1), [t2] "=&r" (t2),
+		[t3] "=&r" (t3), [t4] "=&r" (t4), [t5] "=&r" (t5),
+		[t6] "=&r" (t6), [t7] "=&r" (t7), [t8] "=&r" (t8),
+		[t9] "=&r" (t9), [t10] "=&r" (t10), [t11] "=&r" (t11)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17", "v18",
+		"v19", "v20", "v21", "v22", "v23"
+		);
+		break;
+	}
+	case 16:
+	{
+		__uint128_t t0, t1, t2, t3, t4, t5, t6, t7;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t4], %H[t4], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t5], %H[t5], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t6], %H[t6], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t7], %H[t7], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"fmov d18, %[t2]\n"
+		"fmov v18.D[1], %H[t2]\n"
+		"fmov d19, %[t3]\n"
+		"fmov v19.D[1], %H[t3]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"fmov d20, %[t4]\n"
+		"fmov v20.D[1], %H[t4]\n"
+		"fmov d21, %[t5]\n"
+		"fmov v21.D[1], %H[t5]\n"
+		"fmov d22, %[t6]\n"
+		"fmov v22.D[1], %H[t6]\n"
+		"fmov d23, %[t7]\n"
+		"fmov v23.D[1], %H[t7]\n"
+		"and %[failed].16B, %[failed].16B, v20.16B\n"
+		"and %[failed].16B, %[failed].16B, v21.16B\n"
+		"and %[failed].16B, %[failed].16B, v22.16B\n"
+		"and %[failed].16B, %[failed].16B, v23.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		"st1 { v20.2d, v21.2d, v22.2d, v23.2d}, [%[dst]], 64\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1), [t2] "=&r" (t2),
+		[t3] "=&r" (t3), [t4] "=&r" (t4), [t5] "=&r" (t5),
+		[t6] "=&r" (t6), [t7] "=&r" (t7)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17", "v18", "v19",
+		  "v20", "v21", "v22", "v23"
+		);
+		break;
+	}
+	case 8:
+	{
+		__uint128_t t0, t1, t2, t3;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t2], %H[t2], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t3], %H[t3], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"fmov d18, %[t2]\n"
+		"fmov v18.D[1], %H[t2]\n"
+		"fmov d19, %[t3]\n"
+		"fmov v19.D[1], %H[t3]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"and %[failed].16B, %[failed].16B, v18.16B\n"
+		"and %[failed].16B, %[failed].16B, v19.16B\n"
+		"st1 { v16.2d, v17.2d, v18.2d, v19.2d}, [%[dst]], 64\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1), [t2] "=&r" (t2),
+		[t3] "=&r" (t3)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17", "v18", "v19"
+		);
+		break;
+	}
+	case 4:
+	{
+		__uint128_t t0, t1;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"casp %[t1], %H[t1], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"fmov d17, %[t1]\n"
+		"fmov v17.D[1], %H[t1]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"and %[failed].16B, %[failed].16B, v17.16B\n"
+		"st1 { v16.2d, v17.2d}, [%[dst]], 32\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0), [t1] "=&r" (t1)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16", "v17"
+		);
+		break;
+	}
+	case 2:
+	{
+		__uint128_t t0;
+
+		asm volatile (
+		".cpu  generic+lse\n"
+		"casp %[t0], %H[t0], %[wdata], %H[wdata], [%[loc]]\n"
+		"fmov d16, %[t0]\n"
+		"fmov v16.D[1], %H[t0]\n"
+		"and %[failed].16B, %[failed].16B, v16.16B\n"
+		"st1 { v16.2d}, [%[dst]], 16\n"
+		: "+Q" (*addr), [failed] "=&w" (failed),
+		[t0] "=&r" (t0)
+		: [wdata] "r" (wdata128), [dst] "r" (obj_table),
+		[loc] "r" (addr)
+		: "memory", "v16"

drivers/mempool/octeontx2/otx2_mempool_ops.c npa_lf_aura_op_alloc_one(const int64_t wdata, int64_t * const addr, · line 283

Quoted 10 lines
drivers/mempool/octeontx2/otx2_mempool_ops.c +10 -0
+		);
+		break;
+	}
+	case 1:
+		return npa_lf_aura_op_alloc_one(wdata, addr, obj_table, 0);
+	}
+
+	if (unlikely(!(((uint64_t *) &failed)[0] & ((uint64_t *) &failed)[1])))
+		return npa_lf_aura_op_search_alloc(wdata, addr, (void **)
+			((char *)obj_table - (sizeof(uint64_t) * n)), n);

I think this is causing an error for some arm64 builds with the following warning;

../drivers/mempool/octeontx2/otx2_mempool_ops.c: In function ‘npa_lf_aura_op_alloc_bulk’:
../drivers/mempool/octeontx2/otx2_mempool_ops.c:281:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
if (unlikely(!(((uint64_t *) &failed)[0] & ((uint64_t *) &failed)[1])))
^

This is only tested with gcc, though.

See example travis build here:

https://travis-ci.com/ovsrobot/dpdk/builds/112894377

Thanks!

Quoted 58 lines
drivers/mempool/octeontx2/otx2_mempool_ops.c +47 -0
+
+	return 0;
+}
+
+static __rte_noinline void
+otx2_npa_clear_alloc(struct rte_mempool *mp, void **obj_table, unsigned int n)
+{
+	unsigned int i;
+
+	for (i = 0; i < n; i++) {
+		if (obj_table[i] != NULL) {
+			otx2_npa_enq(mp, &obj_table[i], 1);
+			obj_table[i] = NULL;
+		}
+	}
+}
+
+static inline int __hot
+otx2_npa_deq_arm64(struct rte_mempool *mp, void **obj_table, unsigned int n)
+{
+	const int64_t wdata = npa_lf_aura_handle_to_aura(mp->pool_id);
+	void **obj_table_bak = obj_table;
+	const unsigned int nfree = n;
+	unsigned int parts;
+
+	int64_t * const addr = (int64_t * const)
+			(npa_lf_aura_handle_to_base(mp->pool_id) +
+				NPA_LF_AURA_OP_ALLOCX(0));
+	while (n) {
+		parts = n > 31 ? 32 : rte_align32prevpow2(n);
+		n -= parts;
+		if (unlikely(npa_lf_aura_op_alloc_bulk(wdata, addr,
+				parts, obj_table))) {
+			otx2_npa_clear_alloc(mp, obj_table_bak, nfree - n);
+			return -ENOENT;
+		}
+		obj_table += parts;
+	}
+
+	return 0;
+}
+#endif
+
 static inline int __hot
 otx2_npa_deq(struct rte_mempool *mp, void **obj_table, unsigned int n)
 {
@@ -463,7 +750,11 @@ static struct rte_mempool_ops otx2_npa_ops = {
 	.get_count = otx2_npa_get_count,
 	.calc_mem_size = otx2_npa_calc_mem_size,
 	.populate = otx2_npa_populate,
+#if defined(RTE_ARCH_ARM64)
+	.dequeue = otx2_npa_deq_arm64,
+#else
 	.dequeue = otx2_npa_deq,
+#endif
 };
 
 MEMPOOL_REGISTER_OPS(otx2_npa_ops);
#27 lore raw

Re: [dpdk-dev] [PATCH v1 25/27] mempool/octeontx2: add optimized dequeue operation for arm64

Quoted 55 lines

-----Original Message-----
From: Aaron Conole <[email protected]>
Sent: Friday, May 24, 2019 7:03 PM
To: Jerin Jacob Kollanukkaran <[email protected]>
Cc: [email protected]; [email protected]; Pavan Nikhilesh Bhagavatula <[email protected]>; Olivier Matz <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 25/27] mempool/octeontx2: add optimized dequeue operation for arm64

drivers/mempool/octeontx2/otx2_mempool_ops.c npa_lf_aura_op_alloc_one(const int64_t wdata,

Quoted 23 lines · <[email protected]> writes:

From: Pavan Nikhilesh <[email protected]>

This patch adds an optimized arm64 instruction based routine to leverage CPU pipeline characteristics of octeontx2. The theme is to fill the pipeline with CASP operations as much HW can do so that HW can do alloc() HW ops in full throttle.

Cc Olivier Matz <[email protected]>
---
 drivers/mempool/octeontx2/otx2_mempool_ops.c | 291
+++++++++++++++++++
 1 file changed, 291 insertions(+)
drivers/mempool/octeontx2/otx2_mempool_ops.c +0 -0
index c59bd73c0..ebe90d122 100644
@@ -37,6 +37,293 @@ npa_lf_aura_op_alloc_one(const int64_t wdata,

int64_t * const addr,

drivers/mempool/octeontx2/otx2_mempool_ops.c npa_lf_aura_op_alloc_one(const int64_t wdata, int64_t * const addr,

Quoted 8 lines
drivers/mempool/octeontx2/otx2_mempool_ops.c +5 -0
 	return -ENOENT;
 }
 
+	}
+
+	if (unlikely(!(((uint64_t *) &failed)[0] & ((uint64_t *) &failed)[1])))
+		return npa_lf_aura_op_search_alloc(wdata, addr, (void **)
+			((char *)obj_table - (sizeof(uint64_t) * n)), n);

I think this is causing an error for some arm64 builds with the following warning;

../drivers/mempool/octeontx2/otx2_mempool_ops.c: In function ‘npa_lf_aura_op_alloc_bulk’:
../drivers/mempool/octeontx2/otx2_mempool_ops.c:281:2: error:
dereferencing type-punned pointer will break strict-aliasing rules [- Werror=strict-aliasing]
if (unlikely(!(((uint64_t *) &failed)[0] & ((uint64_t *) &failed)[1]))) ^

Quoted 1 line

This is only tested with gcc, though.

Some reason this error is not seen with armv8 gcc 8.2. Could reproduce the issues with gcc 5.3. Will fix it in v2. Thanks for reporting the issue.

Quoted 6 lines

See example travis build here:

https://travis-ci.com/ovsrobot/dpdk/builds/112894377

Thanks!

#28 lore raw

PATCH 26/27 mempool/octeontx2: add devargs for max pool selection

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The maximum number of mempools per application needs to be configured on HW during mempool driver initialization. HW can support up to 1M mempools, Since each mempool costs set of HW resources, the max_pools devargs parameter is being introduced to configure the number of mempools required for the application.
For example:

-w 0002:02:00.0,max_pools=512

With the above configuration, the driver will set up only 512 mempools for the given application to save HW resources.

---
 drivers/mempool/octeontx2/otx2_mempool.c | 41 +++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
drivers/mempool/octeontx2/otx2_mempool.c +40 -1
index 1bcb86cf4..ff7fcac85 100644
@@ -7,6 +7,7 @@
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_io.h>
+#include <rte_kvargs.h>
 #include <rte_malloc.h>
 #include <rte_mbuf_pool_ops.h>
 #include <rte_pci.h>
@@ -142,6 +143,42 @@ otx2_aura_size_to_u32(uint8_t val)
 	return 1 << (val + 6);
 }
 
+static int
+parse_max_pools(const char *key, const char *value, void *extra_args)
+{
+	RTE_SET_USED(key);
+	uint32_t val;
+
+	val = atoi(value);
+	if (val < otx2_aura_size_to_u32(NPA_AURA_SZ_128))
+		val = 128;
+	if (val > otx2_aura_size_to_u32(NPA_AURA_SZ_1M))
+		val = BIT_ULL(20);
+
+	*(uint8_t *)extra_args = rte_log2_u32(val) - 6;
+	return 0;
+}
+
+#define OTX2_MAX_POOLS "max_pools"
+
+static uint8_t
+otx2_parse_aura_size(struct rte_devargs *devargs)
+{
+	uint8_t aura_sz = NPA_AURA_SZ_128;
+	struct rte_kvargs *kvlist;
+
+	if (devargs == NULL)
+		goto exit;
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
+	if (kvlist == NULL)
+		goto exit;
+
+	rte_kvargs_process(kvlist, OTX2_MAX_POOLS, &parse_max_pools, &aura_sz);
+	rte_kvargs_free(kvlist);
+exit:
+	return aura_sz;
+}
+
 static inline int
 npa_lf_attach(struct otx2_mbox *mbox)
 {
@@ -234,7 +271,7 @@ otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 		if (rc)
 			goto npa_detach;
 
-		aura_sz = NPA_AURA_SZ_128;
+		aura_sz = otx2_parse_aura_size(pci_dev->device.devargs);
 		nr_pools = otx2_aura_size_to_u32(aura_sz);
 
 		lf = &dev->npalf;
@@ -397,3 +434,5 @@ static struct rte_pci_driver pci_npa = {
 RTE_PMD_REGISTER_PCI(mempool_octeontx2, pci_npa);
 RTE_PMD_REGISTER_PCI_TABLE(mempool_octeontx2, pci_npa_map);
 RTE_PMD_REGISTER_KMOD_DEP(mempool_octeontx2, "vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(mempool_octeontx2,
+			      OTX2_MAX_POOLS "=<128-1048576>");
Signature · 1 line
2.21.0
#29 lore raw

PATCH 27/27 doc: add Marvell OCTEON TX2 mempool documentation

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Add Marvell OCTEON TX2 mempool documentation.

This patch also updates the MAINTAINERS file and updates shared library versions in release_19_08.rst.

Cc John McNamara <[email protected]>
Cc Thomas Monjalon <[email protected]>
---
 MAINTAINERS                            | 10 +++
 doc/guides/mempool/index.rst           |  1 +
 doc/guides/mempool/octeontx2.rst       | 90 ++++++++++++++++++++++++++
 doc/guides/platform/octeontx2.rst      |  2 +
 doc/guides/rel_notes/release_19_08.rst |  2 +
 5 files changed, 105 insertions(+)
 create mode 100644 doc/guides/mempool/octeontx2.rst
MAINTAINERS +10 -0
index 15d0829c5..74ac6d41f 100644
@@ -444,6 +444,16 @@ M: Artem V. Andreev <[email protected]>
 M: Andrew Rybchenko <[email protected]>
 F: drivers/mempool/bucket/
 
+Marvell OCTEON TX2
+M: Jerin Jacob <[email protected]>
+M: Nithin Dabilpuram <[email protected]>
+M: Vamsi Attunuru <[email protected]>
+F: drivers/common/octeontx2/
+F: drivers/mempool/octeontx2/
+F: doc/guides/platform/img/octeontx2_*
+F: doc/guides/platform/octeontx2.rst
+F: doc/guides/mempool/octeontx2.rst
+
 
 Bus Drivers
 -----------
doc/guides/mempool/index.rst +1 -0
index 2ccf91633..756610264 100644
@@ -12,3 +12,4 @@ application through the mempool API.
     :numbered:
 
     octeontx
+    octeontx2
doc/guides/mempool/octeontx2.rst new file +90 -0

90 lines not on this page · raw message

doc/guides/platform/octeontx2.rst +2 -0
index fdff8319f..a876cbfdd 100644
@@ -98,6 +98,8 @@ HW Offload Drivers
 
 This section lists dataplane H/W block(s) available in OCTEON TX2 SoC.
 
+#. **Mempool Driver**
+   See :doc:`../mempool/octeontx2` for NPA mempool driver information.
 
 Procedure to Setup Platform
 ---------------------------
doc/guides/rel_notes/release_19_08.rst +2 -0
index b9510f93a..925ce839b 100644
@@ -130,6 +130,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_cfgfile.so.2
      librte_cmdline.so.2
      librte_compressdev.so.1
+   + librte_common_octeontx2.so.1
      librte_cryptodev.so.7
      librte_distributor.so.1
      librte_eal.so.10
@@ -150,6 +151,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_mbuf.so.5
      librte_member.so.1
      librte_mempool.so.5
+   + librte_mempool_octeontx2.so.1
      librte_meter.so.3
      librte_metrics.so.1
      librte_net.so.1
Signature · 1 line
2.21.0
#30 lore raw

v2 cover OCTEON TX2 common and mempool driver

In reply to [email protected]

From: Jerin Jacob <[email protected]>

This patch set adds initial driver support for OCTEON TX2 SoC.

OCTEON TX2 is an armv8.2 SoC with integrated HW based mempool, ethdev, cryptodev, compressdev, and eventdev devices.

This patch set adds common driver and mempool device driver for OCTEON TX2 SoC. There will be three more patch series in this release
to support ethdev, eventdev and cryptodev devices

More details about the OCTEON TX2 platform may found in [PATCH 15/27] doc: add Marvell OCTEON TX2 platform guide under doc/guides/platform/octeontx2.rst file.

This patches series also available at https://github.com/jerinjacobk/dpdk.git
for quick download and review.

# Note on check patch issues
1) The mailbox prototype is the same as Linux kernel.
https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/marvell/octeontx2/af/mbox.h#L123
In order to keep the base code intact, mailbox prototype expressed as macros with warnings
2) There are a few warnings from tooling about expected to add new symbols in the EXPERIMENTAL
section. Since these API will be called only by octeontx2 client drivers and prototype are not exported to the application, those warnings are not relevant, Discussion at http://patches.dpdk.org/patch/53590/

v2:

1) Added CONFIG_RTE_MAX_VFIO_GROUPS for octeontx2 config in patch 1
2) Rebased to master to accommodate latest rename like ETHER_ADDR_LEN to RTE_ETHER_ADDR_LEN
3) Added pmd.raw.octeontx2.dpi log message in patch 5
4) Update platform guide with debugfs documentation in patch 15
5) Fix arm64 build issue with patch 25(Aaron Conole)
"mempool/octeontx2: add optimized dequeue operation for arm64"

Jerin Jacob (22):
common/octeontx2: add build infrastructure and HW definition common/octeontx2: add IO handling APIs common/octeontx2: add mbox request and response definition common/octeontx2: add mailbox base support infra common/octeontx2: add runtime log infra common/octeontx2: add mailbox send and receive support common/octeontx2: introduce common device class common/octeontx2: introduce irq handling functions common/octeontx2: handle intra device operations common/octeontx2: add VF mailbox IRQ and msg handler
doc: add Marvell OCTEON TX2 platform guide mempool/octeontx2: add build infra and device probe
drivers: add init and fini on octeontx2 NPA object mempool/octeontx2: add NPA HW operations mempool/octeontx2: add NPA IRQ handler mempool/octeontx2: add context dump support mempool/octeontx2: add mempool alloc op mempool/octeontx2: add mempool free op mempool/octeontx2: add remaining slow path ops mempool/octeontx2: add fast path mempool ops mempool/octeontx2: add devargs for max pool selection
doc: add Marvell OCTEON TX2 mempool documentation

Nithin Dabilpuram (4):
common/octeontx2: add AF to PF mailbox IRQ and msg handlers common/octeontx2: add PF to VF mailbox IRQ and msg handlers common/octeontx2: add uplink message support common/octeontx2: add FLR IRQ handler

Pavan Nikhilesh (1):
mempool/octeontx2: add optimized dequeue operation for arm64

 MAINTAINERS                                   |   10 +
 config/common_base                            |    5 +
 config/defconfig_arm64-octeontx2-linuxapp-gcc |    3 +
 doc/guides/mempool/index.rst                  |    1 +
 doc/guides/mempool/octeontx2.rst              |   90 +
 .../octeontx2_packet_flow_hw_accelerators.svg | 2804 +++++++++++++++++
 .../img/octeontx2_resource_virtualization.svg | 2418 ++++++++++++++
 doc/guides/platform/index.rst                 |    1 +
 doc/guides/platform/octeontx2.rst             |  496 +++
 doc/guides/rel_notes/release_19_08.rst        |    2 +
 drivers/common/Makefile                       |    5 +
 drivers/common/meson.build                    |    2 +-
 drivers/common/octeontx2/Makefile             |   37 +
 drivers/common/octeontx2/hw/otx2_nix.h        | 1376 ++++++++
 drivers/common/octeontx2/hw/otx2_npa.h        |  305 ++
 drivers/common/octeontx2/hw/otx2_npc.h        |  467 +++
 drivers/common/octeontx2/hw/otx2_rvu.h        |  212 ++
 drivers/common/octeontx2/hw/otx2_sso.h        |  209 ++
 drivers/common/octeontx2/hw/otx2_ssow.h       |   56 +
 drivers/common/octeontx2/hw/otx2_tim.h        |   34 +
 drivers/common/octeontx2/meson.build          |   25 +
 drivers/common/octeontx2/otx2_common.c        |  248 ++
 drivers/common/octeontx2/otx2_common.h        |  121 +
 drivers/common/octeontx2/otx2_dev.c           | 1052 +++++++
 drivers/common/octeontx2/otx2_dev.h           |   97 +
 drivers/common/octeontx2/otx2_io_arm64.h      |   95 +
 drivers/common/octeontx2/otx2_io_generic.h    |   63 +
 drivers/common/octeontx2/otx2_irq.c           |  254 ++
 drivers/common/octeontx2/otx2_irq.h           |   25 +
 drivers/common/octeontx2/otx2_mbox.c          |  416 +++
 drivers/common/octeontx2/otx2_mbox.h          | 1483 +++++++++
 .../rte_common_octeontx2_version.map          |   39 +
 drivers/mempool/Makefile                      |    1 +
 drivers/mempool/meson.build                   |    2 +-
 drivers/mempool/octeontx2/Makefile            |   39 +
 drivers/mempool/octeontx2/meson.build         |   23 +
 drivers/mempool/octeontx2/otx2_mempool.c      |  438 +++
 drivers/mempool/octeontx2/otx2_mempool.h      |  208 ++
 .../mempool/octeontx2/otx2_mempool_debug.c    |  135 +
 drivers/mempool/octeontx2/otx2_mempool_irq.c  |  308 ++
 drivers/mempool/octeontx2/otx2_mempool_ops.c  |  760 +++++
 .../rte_mempool_octeontx2_version.map         |    8 +
 mk/rte.app.mk                                 |    6 +
 43 files changed, 14377 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/mempool/octeontx2.rst
 create mode 100644 doc/guides/platform/img/octeontx2_packet_flow_hw_accelerators.svg
 create mode 100644 doc/guides/platform/img/octeontx2_resource_virtualization.svg
 create mode 100644 doc/guides/platform/octeontx2.rst
 create mode 100644 drivers/common/octeontx2/Makefile
 create mode 100644 drivers/common/octeontx2/hw/otx2_nix.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npa.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npc.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_rvu.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_sso.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_ssow.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_tim.h
 create mode 100644 drivers/common/octeontx2/meson.build
 create mode 100644 drivers/common/octeontx2/otx2_common.c
 create mode 100644 drivers/common/octeontx2/otx2_common.h
 create mode 100644 drivers/common/octeontx2/otx2_dev.c
 create mode 100644 drivers/common/octeontx2/otx2_dev.h
 create mode 100644 drivers/common/octeontx2/otx2_io_arm64.h
 create mode 100644 drivers/common/octeontx2/otx2_io_generic.h
 create mode 100644 drivers/common/octeontx2/otx2_irq.c
 create mode 100644 drivers/common/octeontx2/otx2_irq.h
 create mode 100644 drivers/common/octeontx2/otx2_mbox.c
 create mode 100644 drivers/common/octeontx2/otx2_mbox.h
 create mode 100644 drivers/common/octeontx2/rte_common_octeontx2_version.map
 create mode 100644 drivers/mempool/octeontx2/Makefile
 create mode 100644 drivers/mempool/octeontx2/meson.build
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool.c
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool.h
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_debug.c
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_irq.c
 create mode 100644 drivers/mempool/octeontx2/otx2_mempool_ops.c
 create mode 100644 drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map
Signature · 1 line
2.21.0
#31 lore raw

PATCH v2 1/27 common/octeontx2: add build infrastructure and HW definition

From: Jerin Jacob <[email protected]>

Add the make and meson based build infrastructure along with HW definition header file.

This patch adds skeleton otx2_mbox.c file to make sure all header files are intact, subsequent patches add content to otx2_mbox.c

This patch also updates CONFIG_RTE_MAX_VFIO_GROUPS value to 128 as the system can have up to 128 PFs/VFs. For octeontx2 meson build target, CONFIG_RTE_MAX_VFIO_GROUPS defined as 128 so no additional changes required.

---
 config/defconfig_arm64-octeontx2-linuxapp-gcc |    3 +
 drivers/common/Makefile                       |    2 +
 drivers/common/meson.build                    |    2 +-
 drivers/common/octeontx2/Makefile             |   32 +
 drivers/common/octeontx2/hw/otx2_nix.h        | 1376 +++++++++++++++++
 drivers/common/octeontx2/hw/otx2_npa.h        |  305 ++++
 drivers/common/octeontx2/hw/otx2_npc.h        |  467 ++++++
 drivers/common/octeontx2/hw/otx2_rvu.h        |  212 +++
 drivers/common/octeontx2/hw/otx2_sso.h        |  209 +++
 drivers/common/octeontx2/hw/otx2_ssow.h       |   56 +
 drivers/common/octeontx2/hw/otx2_tim.h        |   34 +
 drivers/common/octeontx2/meson.build          |   23 +
 drivers/common/octeontx2/otx2_common.h        |   34 +
 drivers/common/octeontx2/otx2_mbox.c          |    5 +
 drivers/common/octeontx2/otx2_mbox.h          |   10 +
 .../rte_common_octeontx2_version.map          |    4 +
 mk/rte.app.mk                                 |    2 +
 17 files changed, 2775 insertions(+), 1 deletion(-)
 create mode 100644 drivers/common/octeontx2/Makefile
 create mode 100644 drivers/common/octeontx2/hw/otx2_nix.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npa.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_npc.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_rvu.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_sso.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_ssow.h
 create mode 100644 drivers/common/octeontx2/hw/otx2_tim.h
 create mode 100644 drivers/common/octeontx2/meson.build
 create mode 100644 drivers/common/octeontx2/otx2_common.h
 create mode 100644 drivers/common/octeontx2/otx2_mbox.c
 create mode 100644 drivers/common/octeontx2/otx2_mbox.h
 create mode 100644 drivers/common/octeontx2/rte_common_octeontx2_version.map
config/defconfig_arm64-octeontx2-linuxapp-gcc +3 -0
index 9eae84538..f20da2442 100644
@@ -16,3 +16,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 
 # Recommend to use VFIO as co-processors needs SMMU/IOMMU
 CONFIG_RTE_EAL_IGB_UIO=n
+
+# Max supported NIX LFs
+CONFIG_RTE_MAX_VFIO_GROUPS=128
drivers/common/Makefile +2 -0
index 87b8a59a4..e7abe210e 100644
@@ -23,4 +23,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y)
 DIRS-y += dpaax
 endif
 
+DIRS-y += octeontx2
+
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/common/meson.build +1 -1
index a50934108..7b5e566f3 100644
@@ -2,6 +2,6 @@
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['cpt', 'dpaax', 'mvep', 'octeontx', 'qat']
+drivers = ['cpt', 'dpaax', 'mvep', 'octeontx', 'octeontx2', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
drivers/common/octeontx2/Makefile new file +32 -0
new file mode 100644
index 000000000..e5737532a
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_common_octeontx2.a
+
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+
+ifneq ($(CONFIG_RTE_ARCH_64),y)
+CFLAGS += -Wno-int-to-pointer-cast
+CFLAGS += -Wno-pointer-to-int-cast
+endif
+
+EXPORT_MAP := rte_common_octeontx2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += otx2_mbox.c
+
+LDLIBS += -lrte_eal
+LDLIBS += -lrte_ethdev
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/common/octeontx2/hw/otx2_nix.h new file +1376 -0

1,376 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_npa.h new file +305 -0

305 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_npc.h new file +467 -0

467 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_rvu.h new file +212 -0

212 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_sso.h new file +209 -0

209 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_ssow.h new file +56 -0

56 lines not on this page · raw message

drivers/common/octeontx2/hw/otx2_tim.h new file +34 -0
new file mode 100644
index 000000000..41442ad0a
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_TIM_HW_H__
+#define __OTX2_TIM_HW_H__
+
+/* TIM */
+#define TIM_AF_CONST                    (0x90)
+#define TIM_PRIV_LFX_CFG(a)             (0x20000 | (a) << 3)
+#define TIM_PRIV_LFX_INT_CFG(a)         (0x24000 | (a) << 3)
+#define TIM_AF_RVU_LF_CFG_DEBUG         (0x30000)
+#define TIM_AF_BLK_RST                  (0x10)
+#define TIM_AF_LF_RST                   (0x20)
+#define TIM_AF_BLK_RST                  (0x10)
+#define TIM_AF_RINGX_GMCTL(a)           (0x2000 | (a) << 3)
+#define TIM_AF_RINGX_CTL0(a)            (0x4000 | (a) << 3)
+#define TIM_AF_RINGX_CTL1(a)            (0x6000 | (a) << 3)
+#define TIM_AF_RINGX_CTL2(a)            (0x8000 | (a) << 3)
+#define TIM_AF_FLAGS_REG                (0x80)
+#define TIM_AF_FLAGS_REG_ENA_TIM        BIT_ULL(0)
+#define TIM_AF_RINGX_CTL1_ENA           BIT_ULL(47)
+#define TIM_AF_RINGX_CTL1_RCF_BUSY      BIT_ULL(50)
+#define TIM_AF_RINGX_CLT1_CLK_10NS      (0)
+#define TIM_AF_RINGX_CLT1_CLK_GPIO      (1)
+#define TIM_AF_RINGX_CLT1_CLK_GTI       (2)
+#define TIM_AF_RINGX_CLT1_CLK_PTP       (3)
+
+/* ENUMS */
+
+#define TIM_LF_INT_VEC_NRSPERR_INT	(0x0ull)
+#define TIM_LF_INT_VEC_RAS_INT		(0x1ull)
+
+#endif /* __OTX2_TIM_HW_H__ */
drivers/common/octeontx2/meson.build new file +23 -0
new file mode 100644
index 000000000..34f8aaea7
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+#
+
+sources= files(
+		'otx2_mbox.c',
+	       )
+
+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
+
+deps = ['eal', 'ethdev']
+includes += include_directories('../../common/octeontx2',
+		'../../bus/pci')
drivers/common/octeontx2/otx2_common.h new file +34 -0
new file mode 100644
index 000000000..b4e008b14
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_COMMON_H_
+#define _OTX2_COMMON_H_
+
+#include <rte_common.h>
+
+#include "hw/otx2_rvu.h"
+#include "hw/otx2_nix.h"
+#include "hw/otx2_npc.h"
+#include "hw/otx2_npa.h"
+#include "hw/otx2_sso.h"
+#include "hw/otx2_ssow.h"
+#include "hw/otx2_tim.h"
+
+/* Alignment */
+#define OTX2_ALIGN  128
+
+/* Bits manipulation */
+#ifndef BIT_ULL
+#define BIT_ULL(nr) (1ULL << (nr))
+#endif
+#ifndef BIT
+#define BIT(nr)     (1UL << (nr))
+#endif
+
+/* Compiler attributes */
+#ifndef __hot
+#define __hot   __attribute__((hot))
+#endif
+
+#endif /* _OTX2_COMMON_H_ */
drivers/common/octeontx2/otx2_mbox.c new file +5 -0
new file mode 100644
index 000000000..c9cdbdbbc
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#include "otx2_mbox.h"
drivers/common/octeontx2/otx2_mbox.h new file +10 -0
new file mode 100644
index 000000000..6d7b77ed9
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_MBOX_H__
+#define __OTX2_MBOX_H__
+
+#include <otx2_common.h>
+
+#endif /* __OTX2_MBOX_H__ */
drivers/common/octeontx2/rte_common_octeontx2_version.map new file +4 -0
new file mode 100644
index 000000000..fc8c95e91
@@ -0,0 +1,4 @@
+DPDK_19.05 {
+
+	local: *;
+};
mk/rte.app.mk +2 -0
index 7c9b4b538..1e9dcd5a1 100644
@@ -125,6 +125,8 @@ ifeq ($(CONFIG_RTE_LIBRTE_FSLMC_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX)   += -lrte_common_dpaax
 endif
 
+_LDLIBS-y += -lrte_common_octeontx2
+
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS)        += -lrte_bus_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS)       += -lrte_bus_vdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS)       += -lrte_bus_dpaa
Signature · 1 line
2.21.0
#32 lore raw

PATCH v2 2/27 common/octeontx2: add IO handling APIs

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Various octeontx2 drivers use IO handling API, added octeontx2 specific IO handling routines in the common code.

Since some of those implementations are based on arm64 instructions added the stub to compile the code on non arm64 ISA.
The non arm64 ISA stub is possible due to the fact that it is an integrated controller i.e runs only on Marvell HW.

---
 drivers/common/octeontx2/otx2_common.h     | 12 +++
 drivers/common/octeontx2/otx2_io_arm64.h   | 95 ++++++++++++++++++++++
 drivers/common/octeontx2/otx2_io_generic.h | 63 ++++++++++++++
 3 files changed, 170 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_io_arm64.h
 create mode 100644 drivers/common/octeontx2/otx2_io_generic.h
drivers/common/octeontx2/otx2_common.h +12 -0
index b4e008b14..b0c19266b 100644
@@ -6,6 +6,8 @@
 #define _OTX2_COMMON_H_
 
 #include <rte_common.h>
+#include <rte_io.h>
+#include <rte_memory.h>
 
 #include "hw/otx2_rvu.h"
 #include "hw/otx2_nix.h"
@@ -31,4 +33,14 @@
 #define __hot   __attribute__((hot))
 #endif
 
+/* IO Access */
+#define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
+#define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
+
+#if defined(RTE_ARCH_ARM64)
+#include "otx2_io_arm64.h"
+#else
+#include "otx2_io_generic.h"
+#endif
+
 #endif /* _OTX2_COMMON_H_ */
drivers/common/octeontx2/otx2_io_arm64.h new file +95 -0

95 lines not on this page · raw message

drivers/common/octeontx2/otx2_io_generic.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.21.0
#33 lore raw

PATCH v2 3/27 common/octeontx2: add mbox request and response definition

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The admin function driver sits in Linux kernel as mailbox server. The DPDK AF mailbox client, send the message to mailbox server to complete the administrative task such as get mac address.

This patch adds mailbox request and response definition of existing mailbox defined between AF driver and DPDK driver.

---
 drivers/common/octeontx2/otx2_mbox.h | 1326 ++++++++++++++++++++++++++
 1 file changed, 1326 insertions(+)
drivers/common/octeontx2/otx2_mbox.h +1326 -0
index 6d7b77ed9..e2d79c070 100644
@@ -5,6 +5,1332 @@
 #ifndef __OTX2_MBOX_H__
 #define __OTX2_MBOX_H__
 
+#include <errno.h>
+#include <stdbool.h>
+
+#include <rte_ether.h>
+#include <rte_spinlock.h>
+
 #include <otx2_common.h>
 
+#define SZ_64K			(64 * 1024)
+#define SZ_1K			(1 * 1024)
+#define MBOX_SIZE		SZ_64K
+
+/* AF/PF: PF initiated, PF/VF VF initiated */
+#define MBOX_DOWN_RX_START	0
+#define MBOX_DOWN_RX_SIZE	(46 * SZ_1K)
+#define MBOX_DOWN_TX_START	(MBOX_DOWN_RX_START + MBOX_DOWN_RX_SIZE)
+#define MBOX_DOWN_TX_SIZE	(16 * SZ_1K)
+/* AF/PF: AF initiated, PF/VF PF initiated */
+#define MBOX_UP_RX_START	(MBOX_DOWN_TX_START + MBOX_DOWN_TX_SIZE)
+#define MBOX_UP_RX_SIZE		SZ_1K
+#define MBOX_UP_TX_START	(MBOX_UP_RX_START + MBOX_UP_RX_SIZE)
+#define MBOX_UP_TX_SIZE		SZ_1K
+
+#if MBOX_UP_TX_SIZE + MBOX_UP_TX_START != MBOX_SIZE
+# error "Incorrect mailbox area sizes"
+#endif
+
+#define INTR_MASK(pfvfs) ((pfvfs < 64) ? (BIT_ULL(pfvfs) - 1) : (~0ull))
+
+#define MBOX_RSP_TIMEOUT	3000 /* Time to wait for mbox response in ms */
+
+#define MBOX_MSG_ALIGN		16  /* Align mbox msg start to 16bytes */
+
+/* Mailbox directions */
+#define MBOX_DIR_AFPF		0  /* AF replies to PF */
+#define MBOX_DIR_PFAF		1  /* PF sends messages to AF */
+#define MBOX_DIR_PFVF		2  /* PF replies to VF */
+#define MBOX_DIR_VFPF		3  /* VF sends messages to PF */
+#define MBOX_DIR_AFPF_UP	4  /* AF sends messages to PF */
+#define MBOX_DIR_PFAF_UP	5  /* PF replies to AF */
+#define MBOX_DIR_PFVF_UP	6  /* PF sends messages to VF */
+#define MBOX_DIR_VFPF_UP	7  /* VF replies to PF */
+
+/* Device memory does not support unaligned access, instruct compiler to
+ * not optimize the memory access when working with mailbox memory.
+ */
+#define __otx2_io volatile
+
+struct otx2_mbox_dev {
+	void	    *mbase;   /* This dev's mbox region */
+	rte_spinlock_t  mbox_lock;
+	uint16_t     msg_size; /* Total msg size to be sent */
+	uint16_t     rsp_size; /* Total rsp size to be sure the reply is ok */
+	uint16_t     num_msgs; /* No of msgs sent or waiting for response */
+	uint16_t     msgs_acked; /* No of msgs for which response is received */
+};
+
+struct otx2_mbox {
+	uintptr_t hwbase;  /* Mbox region advertised by HW */
+	uintptr_t reg_base;/* CSR base for this dev */
+	uint64_t trigger;  /* Trigger mbox notification */
+	uint16_t tr_shift; /* Mbox trigger shift */
+	uint64_t rx_start; /* Offset of Rx region in mbox memory */
+	uint64_t tx_start; /* Offset of Tx region in mbox memory */
+	uint16_t rx_size;  /* Size of Rx region */
+	uint16_t tx_size;  /* Size of Tx region */
+	uint16_t ndevs;    /* The number of peers */
+	struct otx2_mbox_dev *dev;
+};
+
+/* Header which precedes all mbox messages */
+struct mbox_hdr {
+	uint64_t __otx2_io msg_size;   /* Total msgs size embedded */
+	uint16_t __otx2_io num_msgs;   /* No of msgs embedded */
+};
+
+/* Header which precedes every msg and is also part of it */
+struct mbox_msghdr {
+	uint16_t __otx2_io pcifunc; /* Who's sending this msg */
+	uint16_t __otx2_io id;      /* Mbox message ID */
+#define OTX2_MBOX_REQ_SIG (0xdead)
+#define OTX2_MBOX_RSP_SIG (0xbeef)
+	/* Signature, for validating corrupted msgs */
+	uint16_t __otx2_io sig;
+#define OTX2_MBOX_VERSION (0x0001)
+	/* Version of msg's structure for this ID */
+	uint16_t __otx2_io ver;
+	/* Offset of next msg within mailbox region */
+	uint16_t __otx2_io next_msgoff;
+	int __otx2_io rc; /* Msg processed response code */
+};
+
+/* Mailbox message types */
+#define MBOX_MSG_MASK				0xFFFF
+#define MBOX_MSG_INVALID			0xFFFE
+#define MBOX_MSG_MAX				0xFFFF
+
+#define MBOX_MESSAGES							\
+/* Generic mbox IDs (range 0x000 - 0x1FF) */				\
+M(READY,		0x001, ready, msg_req, ready_msg_rsp)		\
+M(ATTACH_RESOURCES,	0x002, attach_resources, rsrc_attach_req, msg_rsp)\
+M(DETACH_RESOURCES,	0x003, detach_resources, rsrc_detach_req, msg_rsp)\
+M(FREE_RSRC_CNT,	0x004, free_rsrc_cnt, msg_req, free_rsrcs_rsp)	\
+M(MSIX_OFFSET,		0x005, msix_offset, msg_req, msix_offset_rsp)	\
+M(VF_FLR,		0x006, vf_flr, msg_req, msg_rsp)		\
+M(PTP_OP,		0x007, ptp_op, ptp_req, ptp_rsp)		\
+M(GET_HW_CAP,		0x008, get_hw_cap, msg_req, get_hw_cap_rsp)	\
+M(NDC_SYNC_OP,		0x009, ndc_sync_op, ndc_sync_op, msg_rsp)	\
+/* CGX mbox IDs (range 0x200 - 0x3FF) */				\
+M(CGX_START_RXTX,	0x200, cgx_start_rxtx, msg_req, msg_rsp)	\
+M(CGX_STOP_RXTX,	0x201, cgx_stop_rxtx, msg_req, msg_rsp)		\
+M(CGX_STATS,		0x202, cgx_stats, msg_req, cgx_stats_rsp)	\
+M(CGX_MAC_ADDR_SET,	0x203, cgx_mac_addr_set, cgx_mac_addr_set_or_get,\
+				cgx_mac_addr_set_or_get)		\
+M(CGX_MAC_ADDR_GET,	0x204, cgx_mac_addr_get, cgx_mac_addr_set_or_get,\
+				cgx_mac_addr_set_or_get)		\
+M(CGX_PROMISC_ENABLE,	0x205, cgx_promisc_enable, msg_req, msg_rsp)	\
+M(CGX_PROMISC_DISABLE,	0x206, cgx_promisc_disable, msg_req, msg_rsp)	\
+M(CGX_START_LINKEVENTS, 0x207, cgx_start_linkevents, msg_req, msg_rsp)	\
+M(CGX_STOP_LINKEVENTS,	0x208, cgx_stop_linkevents, msg_req, msg_rsp)	\
+M(CGX_GET_LINKINFO,	0x209, cgx_get_linkinfo, msg_req, cgx_link_info_msg)\
+M(CGX_INTLBK_ENABLE,	0x20A, cgx_intlbk_enable, msg_req, msg_rsp)	\
+M(CGX_INTLBK_DISABLE,	0x20B, cgx_intlbk_disable, msg_req, msg_rsp)	\
+M(CGX_PTP_RX_ENABLE,	0x20C, cgx_ptp_rx_enable, msg_req, msg_rsp)	\
+M(CGX_PTP_RX_DISABLE,	0x20D, cgx_ptp_rx_disable, msg_req, msg_rsp)	\
+M(CGX_CFG_PAUSE_FRM,	0x20E, cgx_cfg_pause_frm, cgx_pause_frm_cfg,	\
+				cgx_pause_frm_cfg)			\
+M(CGX_FW_DATA_GET,	0x20F, cgx_get_aux_link_info, msg_req, cgx_fw_data) \
+M(CGX_MAC_ADDR_ADD,     0x211, cgx_mac_addr_add, cgx_mac_addr_add_req,	\
+				cgx_mac_addr_add_rsp)			\
+M(CGX_MAC_ADDR_DEL,     0x212, cgx_mac_addr_del, cgx_mac_addr_del_req,	\
+				msg_rsp)				\
+M(CGX_MAC_MAX_ENTRIES_GET, 0x213, cgx_mac_max_entries_get, msg_req,	\
+				 cgx_max_dmac_entries_get_rsp)		\
+M(CGX_SET_LINK_STATE,	0x214, cgx_set_link_state,		\
+			cgx_set_link_state_msg, msg_rsp)		\
+/* NPA mbox IDs (range 0x400 - 0x5FF) */				\
+M(NPA_LF_ALLOC,		0x400, npa_lf_alloc, npa_lf_alloc_req,		\
+				npa_lf_alloc_rsp)			\
+M(NPA_LF_FREE,		0x401, npa_lf_free, msg_req, msg_rsp)		\
+M(NPA_AQ_ENQ,		0x402, npa_aq_enq, npa_aq_enq_req, npa_aq_enq_rsp)\
+M(NPA_HWCTX_DISABLE,	0x403, npa_hwctx_disable, hwctx_disable_req, msg_rsp)\
+/* SSO/SSOW mbox IDs (range 0x600 - 0x7FF) */				\
+M(SSO_LF_ALLOC,		0x600, sso_lf_alloc, sso_lf_alloc_req,		\
+				sso_lf_alloc_rsp)			\
+M(SSO_LF_FREE,		0x601, sso_lf_free, sso_lf_free_req, msg_rsp)	\
+M(SSOW_LF_ALLOC,	0x602, ssow_lf_alloc, ssow_lf_alloc_req, msg_rsp)\
+M(SSOW_LF_FREE,		0x603, ssow_lf_free, ssow_lf_free_req, msg_rsp)	\
+M(SSO_HW_SETCONFIG,	0x604, sso_hw_setconfig, sso_hw_setconfig,	\
+				msg_rsp)				\
+M(SSO_GRP_SET_PRIORITY,	0x605, sso_grp_set_priority, sso_grp_priority,	\
+				msg_rsp)				\
+M(SSO_GRP_GET_PRIORITY,	0x606, sso_grp_get_priority, sso_info_req,	\
+				sso_grp_priority)			\
+M(SSO_WS_CACHE_INV,	0x607, sso_ws_cache_inv, msg_req, msg_rsp)	\
+M(SSO_GRP_QOS_CONFIG,	0x608, sso_grp_qos_config, sso_grp_qos_cfg,	\
+				msg_rsp)				\
+M(SSO_GRP_GET_STATS,	0x609, sso_grp_get_stats, sso_info_req,		\
+				sso_grp_stats)				\
+M(SSO_HWS_GET_STATS,	0x610, sso_hws_get_stats, sso_info_req,		\
+				sso_hws_stats)				\
+/* TIM mbox IDs (range 0x800 - 0x9FF) */				\
+M(TIM_LF_ALLOC,		0x800, tim_lf_alloc, tim_lf_alloc_req,		\
+				tim_lf_alloc_rsp)			\
+M(TIM_LF_FREE,		0x801, tim_lf_free, tim_ring_req, msg_rsp)	\
+M(TIM_CONFIG_RING,	0x802, tim_config_ring, tim_config_req, msg_rsp)\
+M(TIM_ENABLE_RING,	0x803, tim_enable_ring, tim_ring_req,		\
+				tim_enable_rsp)				\
+M(TIM_DISABLE_RING,	0x804, tim_disable_ring, tim_ring_req, msg_rsp)	\
+/* CPT mbox IDs (range 0xA00 - 0xBFF) */				\
+M(CPT_RD_WR_REGISTER,	0xA02, cpt_rd_wr_register, cpt_rd_wr_reg_msg,	\
+			       cpt_rd_wr_reg_msg)			\
+M(CPT_INLINE_IPSEC_CFG, 0xA04, cpt_inline_ipsec_cfg,			\
+			       cpt_inline_ipsec_cfg_msg, msg_rsp)	\
+/* NPC mbox IDs (range 0x6000 - 0x7FFF) */				\
+M(NPC_MCAM_ALLOC_ENTRY,	0x6000, npc_mcam_alloc_entry,			\
+				npc_mcam_alloc_entry_req,		\
+				npc_mcam_alloc_entry_rsp)		\
+M(NPC_MCAM_FREE_ENTRY,	0x6001, npc_mcam_free_entry,			\
+				npc_mcam_free_entry_req, msg_rsp)	\
+M(NPC_MCAM_WRITE_ENTRY,	0x6002, npc_mcam_write_entry,			\
+				npc_mcam_write_entry_req, msg_rsp)	\
+M(NPC_MCAM_ENA_ENTRY,	0x6003, npc_mcam_ena_entry,			\
+				npc_mcam_ena_dis_entry_req, msg_rsp)	\
+M(NPC_MCAM_DIS_ENTRY,	0x6004, npc_mcam_dis_entry,			\
+				npc_mcam_ena_dis_entry_req, msg_rsp)	\
+M(NPC_MCAM_SHIFT_ENTRY,	0x6005, npc_mcam_shift_entry,			\
+				npc_mcam_shift_entry_req,		\
+				npc_mcam_shift_entry_rsp)		\
+M(NPC_MCAM_ALLOC_COUNTER,	0x6006, npc_mcam_alloc_counter,		\
+				npc_mcam_alloc_counter_req,		\
+				npc_mcam_alloc_counter_rsp)		\
+M(NPC_MCAM_FREE_COUNTER,	0x6007, npc_mcam_free_counter,		\
+				npc_mcam_oper_counter_req,		\
+				msg_rsp)				\
+M(NPC_MCAM_UNMAP_COUNTER,	0x6008, npc_mcam_unmap_counter,		\
+				npc_mcam_unmap_counter_req,		\
+				msg_rsp)				\
+M(NPC_MCAM_CLEAR_COUNTER,	0x6009, npc_mcam_clear_counter,		\
+				npc_mcam_oper_counter_req,		\
+				msg_rsp)				\
+M(NPC_MCAM_COUNTER_STATS,	0x600a, npc_mcam_counter_stats,		\
+				npc_mcam_oper_counter_req,		\
+				npc_mcam_oper_counter_rsp)		\
+M(NPC_MCAM_ALLOC_AND_WRITE_ENTRY, 0x600b, npc_mcam_alloc_and_write_entry,\
+				npc_mcam_alloc_and_write_entry_req,	\
+				npc_mcam_alloc_and_write_entry_rsp)	\
+M(NPC_GET_KEX_CFG,	  0x600c, npc_get_kex_cfg, msg_req,		\
+				npc_get_kex_cfg_rsp)			\
+/* NIX mbox IDs (range 0x8000 - 0xFFFF) */				\
+M(NIX_LF_ALLOC,		0x8000, nix_lf_alloc, nix_lf_alloc_req,		\
+				nix_lf_alloc_rsp)			\
+M(NIX_LF_FREE,		0x8001, nix_lf_free, nix_lf_free_req, msg_rsp)	\
+M(NIX_AQ_ENQ,		0x8002, nix_aq_enq, nix_aq_enq_req,		\
+				nix_aq_enq_rsp)				\
+M(NIX_HWCTX_DISABLE,	0x8003, nix_hwctx_disable, hwctx_disable_req,	\
+				msg_rsp)				\
+M(NIX_TXSCH_ALLOC,	0x8004, nix_txsch_alloc, nix_txsch_alloc_req,	\
+				nix_txsch_alloc_rsp)			\
+M(NIX_TXSCH_FREE,	0x8005, nix_txsch_free,	nix_txsch_free_req,	\
+				msg_rsp)				\
+M(NIX_TXSCHQ_CFG,	0x8006, nix_txschq_cfg, nix_txschq_config,	\
+				msg_rsp)				\
+M(NIX_STATS_RST,	0x8007, nix_stats_rst, msg_req, msg_rsp)	\
+M(NIX_VTAG_CFG,		0x8008, nix_vtag_cfg, nix_vtag_config, msg_rsp)	\
+M(NIX_RSS_FLOWKEY_CFG,	0x8009, nix_rss_flowkey_cfg,			\
+				nix_rss_flowkey_cfg,			\
+				nix_rss_flowkey_cfg_rsp)		\
+M(NIX_SET_MAC_ADDR,	0x800a, nix_set_mac_addr, nix_set_mac_addr,	\
+				msg_rsp)				\
+M(NIX_SET_RX_MODE,	0x800b, nix_set_rx_mode, nix_rx_mode, msg_rsp)	\
+M(NIX_SET_HW_FRS,	0x800c, nix_set_hw_frs,	nix_frs_cfg, msg_rsp)	\
+M(NIX_LF_START_RX,	0x800d, nix_lf_start_rx, msg_req, msg_rsp)	\
+M(NIX_LF_STOP_RX,	0x800e, nix_lf_stop_rx,	msg_req, msg_rsp)	\
+M(NIX_MARK_FORMAT_CFG,	0x800f, nix_mark_format_cfg,			\
+				nix_mark_format_cfg,			\
+				nix_mark_format_cfg_rsp)		\
+M(NIX_LSO_FORMAT_CFG,	0x8011, nix_lso_format_cfg, nix_lso_format_cfg,	\
+				nix_lso_format_cfg_rsp)			\
+M(NIX_LF_PTP_TX_ENABLE,	0x8013, nix_lf_ptp_tx_enable, msg_req,		\
+				msg_rsp)				\
+M(NIX_LF_PTP_TX_DISABLE,	0x8014, nix_lf_ptp_tx_disable, msg_req,	\
+				msg_rsp)				\
+M(NIX_SET_VLAN_TPID,	0x8015, nix_set_vlan_tpid, nix_set_vlan_tpid,	\
+				msg_rsp)				\
+M(NIX_BP_ENABLE,	0x8016, nix_bp_enable, nix_bp_cfg_req,		\
+				nix_bp_cfg_rsp)				\
+M(NIX_BP_DISABLE,	0x8017, nix_bp_disable,	nix_bp_cfg_req, msg_rsp)\
+M(NIX_GET_MAC_ADDR,	0x8018, nix_get_mac_addr, msg_req,		\
+				nix_get_mac_addr_rsp)			\
+M(NIX_INLINE_IPSEC_CFG,	0x8019, nix_inline_ipsec_cfg,			\
+				nix_inline_ipsec_cfg, msg_rsp)		\
+M(NIX_INLINE_IPSEC_LF_CFG,						\
+			0x801a, nix_inline_ipsec_lf_cfg,		\
+				nix_inline_ipsec_lf_cfg, msg_rsp)
+
+/* Messages initiated by AF (range 0xC00 - 0xDFF) */
+#define MBOX_UP_CGX_MESSAGES						\
+M(CGX_LINK_EVENT,	0xC00, cgx_link_event, cgx_link_info_msg,	\
+				msg_rsp)				\
+M(CGX_PTP_RX_INFO,	0xC01, cgx_ptp_rx_info, cgx_ptp_rx_info_msg,	\
+				msg_rsp)
+
+enum {
+#define M(_name, _id, _1, _2, _3) MBOX_MSG_ ## _name = _id,
+MBOX_MESSAGES
+MBOX_UP_CGX_MESSAGES
+#undef M
+};
+
+/* Mailbox message formats */
+
+#define RVU_DEFAULT_PF_FUNC     0xFFFF
+
+/* Generic request msg used for those mbox messages which
+ * don't send any data in the request.
+ */
+struct msg_req {
+	struct mbox_msghdr hdr;
+};
+
+/* Generic response msg used a ack or response for those mbox
+ * messages which doesn't have a specific rsp msg format.
+ */
+struct msg_rsp {
+	struct mbox_msghdr hdr;
+};
+
+/* RVU mailbox error codes
+ * Range 256 - 300.
+ */
+enum rvu_af_status {
+	RVU_INVALID_VF_ID           = -256,
+};
+
+struct ready_msg_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io sclk_feq;	/* SCLK frequency */
+};
+
+/* Structure for requesting resource provisioning.
+ * 'modify' flag to be used when either requesting more
+ * or detach partial of a certain resource type.
+ * Rest of the fields specify how many of what type to
+ * be attached.
+ */
+struct rsrc_attach_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io modify:1;
+	uint8_t __otx2_io npalf:1;
+	uint8_t __otx2_io nixlf:1;
+	uint16_t __otx2_io sso;
+	uint16_t __otx2_io ssow;
+	uint16_t __otx2_io timlfs;
+	uint16_t __otx2_io cptlfs;
+};
+
+/* Structure for relinquishing resources.
+ * 'partial' flag to be used when relinquishing all resources
+ * but only of a certain type. If not set, all resources of all
+ * types provisioned to the RVU function will be detached.
+ */
+struct rsrc_detach_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io partial:1;
+	uint8_t __otx2_io npalf:1;
+	uint8_t __otx2_io nixlf:1;
+	uint8_t __otx2_io sso:1;
+	uint8_t __otx2_io ssow:1;
+	uint8_t __otx2_io timlfs:1;
+	uint8_t __otx2_io cptlfs:1;
+};
+
+/* NIX Transmit schedulers */
+#define	NIX_TXSCH_LVL_SMQ 0x0
+#define	NIX_TXSCH_LVL_MDQ 0x0
+#define	NIX_TXSCH_LVL_TL4 0x1
+#define	NIX_TXSCH_LVL_TL3 0x2
+#define	NIX_TXSCH_LVL_TL2 0x3
+#define	NIX_TXSCH_LVL_TL1 0x4
+#define	NIX_TXSCH_LVL_CNT 0x5
+
+/*
+ * Number of resources available to the caller.
+ * In reply to MBOX_MSG_FREE_RSRC_CNT.
+ */
+struct free_rsrcs_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT];
+	uint16_t __otx2_io sso;
+	uint16_t __otx2_io tim;
+	uint16_t __otx2_io ssow;
+	uint16_t __otx2_io cpt;
+	uint8_t __otx2_io npa;
+	uint8_t __otx2_io nix;
+};
+
+#define MSIX_VECTOR_INVALID	0xFFFF
+#define MAX_RVU_BLKLF_CNT	256
+
+struct msix_offset_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io npa_msixoff;
+	uint16_t __otx2_io nix_msixoff;
+	uint8_t __otx2_io sso;
+	uint8_t __otx2_io ssow;
+	uint8_t __otx2_io timlfs;
+	uint8_t __otx2_io cptlfs;
+	uint16_t __otx2_io sso_msixoff[MAX_RVU_BLKLF_CNT];
+	uint16_t __otx2_io ssow_msixoff[MAX_RVU_BLKLF_CNT];
+	uint16_t __otx2_io timlf_msixoff[MAX_RVU_BLKLF_CNT];
+	uint16_t __otx2_io cptlf_msixoff[MAX_RVU_BLKLF_CNT];
+};
+
+/* CGX mbox message formats */
+struct cgx_stats_rsp {
+	struct mbox_msghdr hdr;
+#define CGX_RX_STATS_COUNT	13
+#define CGX_TX_STATS_COUNT	18
+	uint64_t __otx2_io rx_stats[CGX_RX_STATS_COUNT];
+	uint64_t __otx2_io tx_stats[CGX_TX_STATS_COUNT];
+};
+
+/* Structure for requesting the operation for
+ * setting/getting mac address in the CGX interface
+ */
+struct cgx_mac_addr_set_or_get {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
+/* Structure for requesting the operation to
+ * add DMAC filter entry into CGX interface
+ */
+struct cgx_mac_addr_add_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
+/* Structure for response against the operation to
+ * add DMAC filter entry into CGX interface
+ */
+struct cgx_mac_addr_add_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io index;
+};
+
+/* Structure for requesting the operation to
+ * delete DMAC filter entry from CGX interface
+ */
+struct cgx_mac_addr_del_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io index;
+};
+
+/* Structure for response against the operation to
+ * get maximum supported DMAC filter entries
+ */
+struct cgx_max_dmac_entries_get_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io max_dmac_filters;
+};
+
+struct cgx_link_user_info {
+	uint64_t __otx2_io link_up:1;
+	uint64_t __otx2_io full_duplex:1;
+	uint64_t __otx2_io lmac_type_id:4;
+	uint64_t __otx2_io speed:20; /* speed in Mbps */
+#define LMACTYPE_STR_LEN 16
+	char lmac_type[LMACTYPE_STR_LEN];
+};
+
+struct cgx_link_info_msg {
+	struct mbox_msghdr hdr;
+	struct cgx_link_user_info link_info;
+};
+
+struct cgx_pause_frm_cfg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io set;
+	/* set = 1 if the request is to config pause frames */
+	/* set = 0 if the request is to fetch pause frames config */
+	uint8_t __otx2_io rx_pause;
+	uint8_t __otx2_io tx_pause;
+};
+
+struct cgx_ptp_rx_info_msg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io ptp_en;
+	uint8_t __otx2_io ptp_offset;
+};
+
+struct sfp_eeprom_s {
+#define SFP_EEPROM_SIZE 256
+	uint16_t __otx2_io sff_id;
+	uint8_t __otx2_io buf[SFP_EEPROM_SIZE];
+};
+
+struct cgx_lmac_fwdata_s {
+	uint16_t __otx2_io rw_valid;
+	uint64_t __otx2_io supported_fec;
+	uint64_t __otx2_io supported_an;
+	uint64_t __otx2_io supported_link_modes;
+	/* Only applicable if AN is supported */
+	uint64_t __otx2_io advertised_fec;
+	uint64_t __otx2_io advertised_link_modes;
+	/* Only applicable if SFP/QSFP slot is present */
+	struct sfp_eeprom_s sfp_eeprom;
+};
+
+struct cgx_fw_data {
+	struct mbox_msghdr hdr;
+	struct cgx_lmac_fwdata_s fwdata;
+};
+
+struct cgx_set_link_state_msg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io enable;
+};
+
+/* NPA mbox message formats */
+
+/* NPA mailbox error codes
+ * Range 301 - 400.
+ */
+enum npa_af_status {
+	NPA_AF_ERR_PARAM            = -301,
+	NPA_AF_ERR_AQ_FULL          = -302,
+	NPA_AF_ERR_AQ_ENQUEUE       = -303,
+	NPA_AF_ERR_AF_LF_INVALID    = -304,
+	NPA_AF_ERR_AF_LF_ALLOC      = -305,
+	NIX_AF_ERR_X2P_CALIBRATE    = -398,
+	NIX_AF_ERR_RAN_OUT_BPID     = -399,
+};
+
+#define NPA_AURA_SZ_0		0
+#define NPA_AURA_SZ_128		1
+#define	NPA_AURA_SZ_256		2
+#define	NPA_AURA_SZ_512		3
+#define	NPA_AURA_SZ_1K		4
+#define	NPA_AURA_SZ_2K		5
+#define	NPA_AURA_SZ_4K		6
+#define	NPA_AURA_SZ_8K		7
+#define	NPA_AURA_SZ_16K		8
+#define	NPA_AURA_SZ_32K		9
+#define	NPA_AURA_SZ_64K		10
+#define	NPA_AURA_SZ_128K	11
+#define	NPA_AURA_SZ_256K	12
+#define	NPA_AURA_SZ_512K	13
+#define	NPA_AURA_SZ_1M		14
+#define	NPA_AURA_SZ_MAX		15
+
+/* For NPA LF context alloc and init */
+struct npa_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	int __otx2_io aura_sz; /* No of auras. See NPA_AURA_SZ_* */
+	uint32_t __otx2_io nr_pools; /* No of pools */
+	uint64_t __otx2_io way_mask;
+};
+
+struct npa_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io stack_pg_ptrs;  /* No of ptrs per stack page */
+	uint32_t __otx2_io stack_pg_bytes; /* Size of stack page */
+	uint16_t __otx2_io qints; /* NPA_AF_CONST::QINTS */
+};
+
+/* NPA AQ enqueue msg */
+struct npa_aq_enq_req {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io aura_id;
+	uint8_t __otx2_io ctype;
+	uint8_t __otx2_io op;
+	union {
+		/* Valid when op == WRITE/INIT and ctype == AURA.
+		 * LF fills the pool_id in aura.pool_addr. AF will translate
+		 * the pool_id to pool context pointer.
+		 */
+		struct npa_aura_s aura;
+		/* Valid when op == WRITE/INIT and ctype == POOL */
+		struct npa_pool_s pool;
+	};
+	/* Mask data when op == WRITE (1=write, 0=don't write) */
+	union {
+		/* Valid when op == WRITE and ctype == AURA */
+		struct npa_aura_s aura_mask;
+		/* Valid when op == WRITE and ctype == POOL */
+		struct npa_pool_s pool_mask;
+	};
+};
+
+struct npa_aq_enq_rsp {
+	struct mbox_msghdr hdr;
+	union {
+		/* Valid when op == READ and ctype == AURA */
+		struct npa_aura_s aura;
+		/* Valid when op == READ and ctype == POOL */
+		struct npa_pool_s pool;
+	};
+};
+
+/* Disable all contexts of type 'ctype' */
+struct hwctx_disable_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io ctype;
+};
+
+/* NIX mbox message formats */
+/* NIX mailbox error codes
+ * Range 401 - 500.
+ */
+enum nix_af_status {
+	NIX_AF_ERR_PARAM            = -401,
+	NIX_AF_ERR_AQ_FULL          = -402,
+	NIX_AF_ERR_AQ_ENQUEUE       = -403,
+	NIX_AF_ERR_AF_LF_INVALID    = -404,
+	NIX_AF_ERR_AF_LF_ALLOC      = -405,
+	NIX_AF_ERR_TLX_ALLOC_FAIL   = -406,
+	NIX_AF_ERR_TLX_INVALID      = -407,
+	NIX_AF_ERR_RSS_SIZE_INVALID = -408,
+	NIX_AF_ERR_RSS_GRPS_INVALID = -409,
+	NIX_AF_ERR_FRS_INVALID      = -410,
+	NIX_AF_ERR_RX_LINK_INVALID  = -411,
+	NIX_AF_INVAL_TXSCHQ_CFG     = -412,
+	NIX_AF_SMQ_FLUSH_FAILED     = -413,
+	NIX_AF_MACADDR_SET_FAILED   = -414,
+	NIX_AF_RX_MODE_SET_FAILED   = -415,
+	NIX_AF_ERR_RSS_NOSPC_ALGO   = -416,
+	NIX_AF_ERR_RSS_NOSPC_FIELD  = -417,
+	NIX_AF_ERR_MARK_ALLOC_FAIL  = -418,
+	NIX_AF_ERR_LSOFMT_CFG_FAIL  = -419,
+};
+
+/* For NIX LF context alloc and init */
+struct nix_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint32_t __otx2_io rq_cnt;   /* No of receive queues */
+	uint32_t __otx2_io sq_cnt;   /* No of send queues */
+	uint32_t __otx2_io cq_cnt;   /* No of completion queues */
+	uint8_t __otx2_io xqe_sz;
+	uint16_t __otx2_io rss_sz;
+	uint8_t __otx2_io rss_grps;
+	uint16_t __otx2_io npa_func;
+	/* RVU_DEFAULT_PF_FUNC == default pf_func associated with lf */
+	uint16_t __otx2_io sso_func;
+	uint64_t __otx2_io rx_cfg;   /* See NIX_AF_LF(0..127)_RX_CFG */
+	uint64_t __otx2_io way_mask;
+};
+
+struct nix_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io sqb_size;
+	uint16_t __otx2_io rx_chan_base;
+	uint16_t __otx2_io tx_chan_base;
+	uint8_t __otx2_io rx_chan_cnt; /* Total number of RX channels */
+	uint8_t __otx2_io tx_chan_cnt; /* Total number of TX channels */
+	uint8_t __otx2_io lso_tsov4_idx;
+	uint8_t __otx2_io lso_tsov6_idx;
+	uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
+	uint8_t __otx2_io lf_rx_stats; /* NIX_AF_CONST1::LF_RX_STATS */
+	uint8_t __otx2_io lf_tx_stats; /* NIX_AF_CONST1::LF_TX_STATS */
+	uint16_t __otx2_io cints; /* NIX_AF_CONST2::CINTS */
+	uint16_t __otx2_io qints; /* NIX_AF_CONST2::QINTS */
+	uint8_t __otx2_io ptp; /* boolean; true iff PTP block is supported */
+};
+
+struct nix_lf_free_req {
+	struct mbox_msghdr hdr;
+#define NIX_LF_DISABLE_FLOWS   0x1
+	uint64_t __otx2_io flags;
+};
+
+/* NIX AQ enqueue msg */
+struct nix_aq_enq_req {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io qidx;
+	uint8_t __otx2_io ctype;
+	uint8_t __otx2_io op;
+	union {
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_RQ */
+		struct nix_rq_ctx_s rq;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_SQ */
+		struct nix_sq_ctx_s sq;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_CQ */
+		struct nix_cq_ctx_s cq;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_RSS */
+		struct nix_rsse_s rss;
+		/* Valid when op == WRITE/INIT and ctype == NIX_AQ_CTYPE_MCE */
+		struct nix_rx_mce_s mce;
+	};
+	/* Mask data when op == WRITE (1=write, 0=don't write) */
+	union {
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_RQ */
+		struct nix_rq_ctx_s rq_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_SQ */
+		struct nix_sq_ctx_s sq_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_CQ */
+		struct nix_cq_ctx_s cq_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_RSS */
+		struct nix_rsse_s rss_mask;
+		/* Valid when op == WRITE and ctype == NIX_AQ_CTYPE_MCE */
+		struct nix_rx_mce_s mce_mask;
+	};
+};
+
+struct nix_aq_enq_rsp {
+	struct mbox_msghdr hdr;
+	union {
+		struct nix_rq_ctx_s rq;
+		struct nix_sq_ctx_s sq;
+		struct nix_cq_ctx_s cq;
+		struct nix_rsse_s   rss;
+		struct nix_rx_mce_s mce;
+	};
+};
+
+/* Tx scheduler/shaper mailbox messages */
+
+#define MAX_TXSCHQ_PER_FUNC	128
+
+struct nix_txsch_alloc_req {
+	struct mbox_msghdr hdr;
+	/* Scheduler queue count request at each level */
+	uint16_t __otx2_io schq_contig[NIX_TXSCH_LVL_CNT]; /* Contig. queues */
+	uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT]; /* Non-Contig. queues */
+};
+
+struct nix_txsch_alloc_rsp {
+	struct mbox_msghdr hdr;
+	/* Scheduler queue count allocated at each level */
+	uint16_t __otx2_io schq_contig[NIX_TXSCH_LVL_CNT]; /* Contig. queues */
+	uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT]; /* Non-Contig. queues */
+	/* Scheduler queue list allocated at each level */
+	uint16_t __otx2_io
+		schq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	uint16_t __otx2_io schq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
+	/* Traffic aggregation scheduler level */
+	uint8_t  __otx2_io aggr_level;
+	/* Aggregation lvl's RR_PRIO config */
+	uint8_t  __otx2_io aggr_lvl_rr_prio;
+	/* LINKX_CFG CSRs mapped to TL3 or TL2's index ? */
+	uint8_t  __otx2_io link_cfg_lvl;
+};
+
+struct nix_txsch_free_req {
+	struct mbox_msghdr hdr;
+#define TXSCHQ_FREE_ALL BIT_ULL(0)
+	uint16_t __otx2_io flags;
+	/* Scheduler queue level to be freed */
+	uint16_t __otx2_io schq_lvl;
+	/* List of scheduler queues to be freed */
+	uint16_t __otx2_io schq;
+};
+
+struct nix_txschq_config {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io lvl; /* SMQ/MDQ/TL4/TL3/TL2/TL1 */
+#define TXSCHQ_IDX_SHIFT 16
+#define TXSCHQ_IDX_MASK (BIT_ULL(10) - 1)
+#define TXSCHQ_IDX(reg, shift) (((reg) >> (shift)) & TXSCHQ_IDX_MASK)
+	uint8_t __otx2_io num_regs;
+#define MAX_REGS_PER_MBOX_MSG 20
+	uint64_t __otx2_io reg[MAX_REGS_PER_MBOX_MSG];
+	uint64_t __otx2_io regval[MAX_REGS_PER_MBOX_MSG];
+};
+
+struct nix_vtag_config {
+	struct mbox_msghdr hdr;
+	/* '0' for 4 octet VTAG, '1' for 8 octet VTAG */
+	uint8_t __otx2_io vtag_size;
+	/* cfg_type is '0' for tx vlan cfg
+	 * cfg_type is '1' for rx vlan cfg
+	 */
+	uint8_t __otx2_io cfg_type;
+	union {
+		/* Valid when cfg_type is '0' */
+		struct {
+			uint64_t __otx2_io vtag0;
+			uint64_t __otx2_io vtag1;
+
+			/* cfg_vtag0 & cfg_vtag1 fields are valid
+			 * when free_vtag0 & free_vtag1 are '0's.
+			 */
+			/* cfg_vtag0 = 1 to configure vtag0 */
+			uint8_t __otx2_io cfg_vtag0 :1;
+			/* cfg_vtag1 = 1 to configure vtag1 */
+			uint8_t __otx2_io cfg_vtag1 :1;
+
+			/* vtag0_idx & vtag1_idx are only valid when
+			 * both cfg_vtag0 & cfg_vtag1 are '0's,
+			 * these fields are used along with free_vtag0
+			 * & free_vtag1 to free the nix lf's tx_vlan
+			 * configuration.
+			 *
+			 * Denotes the indices of tx_vtag def registers
+			 * that needs to be cleared and freed.
+			 */
+			int __otx2_io vtag0_idx;
+			int __otx2_io vtag1_idx;
+
+			/* Free_vtag0 & free_vtag1 fields are valid
+			 * when cfg_vtag0 & cfg_vtag1 are '0's.
+			 */
+			/* Free_vtag0 = 1 clears vtag0 configuration
+			 * vtag0_idx denotes the index to be cleared.
+			 */
+			uint8_t __otx2_io free_vtag0 :1;
+			/* Free_vtag1 = 1 clears vtag1 configuration
+			 * vtag1_idx denotes the index to be cleared.
+			 */
+			uint8_t __otx2_io free_vtag1 :1;
+		} tx;
+
+		/* Valid when cfg_type is '1' */
+		struct {
+			/* Rx vtag type index, valid values are in 0..7 range */
+			uint8_t __otx2_io vtag_type;
+			/* Rx vtag strip */
+			uint8_t __otx2_io strip_vtag :1;
+			/* Rx vtag capture */
+			uint8_t __otx2_io capture_vtag :1;
+		} rx;
+	};
+};
+
+struct nix_vtag_config_rsp {
+	struct mbox_msghdr hdr;
+	/* Indices of tx_vtag def registers used to configure
+	 * tx vtag0 & vtag1 headers, these indices are valid
+	 * when nix_vtag_config mbox requested for vtag0 and/
+	 * or vtag1 configuration.
+	 */
+	int __otx2_io vtag0_idx;
+	int __otx2_io vtag1_idx;
+};
+
+struct nix_rss_flowkey_cfg {
+	struct mbox_msghdr hdr;
+	int __otx2_io mcam_index;  /* MCAM entry index to modify */
+	uint32_t __otx2_io flowkey_cfg; /* Flowkey types selected */
+#define FLOW_KEY_TYPE_PORT     BIT(0)
+#define FLOW_KEY_TYPE_IPV4     BIT(1)
+#define FLOW_KEY_TYPE_IPV6     BIT(2)
+#define FLOW_KEY_TYPE_TCP      BIT(3)
+#define FLOW_KEY_TYPE_UDP      BIT(4)
+#define FLOW_KEY_TYPE_SCTP     BIT(5)
+#define FLOW_KEY_TYPE_NVGRE    BIT(6)
+#define FLOW_KEY_TYPE_VXLAN    BIT(7)
+#define FLOW_KEY_TYPE_GENEVE   BIT(8)
+#define FLOW_KEY_TYPE_ETH_DMAC BIT(9)
+#define FLOW_KEY_TYPE_IPV6_EXT BIT(10)
+#define FLOW_KEY_TYPE_GTPU       BIT(11)
+#define FLOW_KEY_TYPE_UDP_VXLAN  BIT(12)
+#define FLOW_KEY_TYPE_UDP_GENEVE BIT(13)
+#define FLOW_KEY_TYPE_UDP_GTPU   BIT(14)
+#define FLOW_KEY_TYPE_INNR_IPV4     BIT(15)
+#define FLOW_KEY_TYPE_INNR_IPV6     BIT(16)
+#define FLOW_KEY_TYPE_INNR_TCP      BIT(17)
+#define FLOW_KEY_TYPE_INNR_UDP      BIT(18)
+#define FLOW_KEY_TYPE_INNR_SCTP     BIT(19)
+#define FLOW_KEY_TYPE_INNR_ETH_DMAC BIT(20)
+	uint8_t	group;       /* RSS context or group */
+};
+
+struct nix_rss_flowkey_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io alg_idx; /* Selected algo index */
+};
+
+struct nix_set_mac_addr {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
+struct nix_get_mac_addr_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
+struct nix_mark_format_cfg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io offset;
+	uint8_t __otx2_io y_mask;
+	uint8_t __otx2_io y_val;
+	uint8_t __otx2_io r_mask;
+	uint8_t __otx2_io r_val;
+};
+
+struct nix_mark_format_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io mark_format_idx;
+};
+
+struct nix_lso_format_cfg {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io field_mask;
+#define NIX_LSO_FIELD_MAX	(8)
+	uint64_t __otx2_io fields[NIX_LSO_FIELD_MAX];
+};
+
+struct nix_lso_format_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io lso_format_idx;
+};
+
+struct nix_rx_mode {
+	struct mbox_msghdr hdr;
+#define NIX_RX_MODE_UCAST    BIT(0)
+#define NIX_RX_MODE_PROMISC  BIT(1)
+#define NIX_RX_MODE_ALLMULTI BIT(2)
+	uint16_t __otx2_io mode;
+};
+
+struct nix_frs_cfg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io update_smq;    /* Update SMQ's min/max lens */
+	uint8_t __otx2_io update_minlen; /* Set minlen also */
+	uint8_t __otx2_io sdp_link;      /* Set SDP RX link */
+	uint16_t __otx2_io maxlen;
+	uint16_t __otx2_io minlen;
+};
+
+struct nix_set_vlan_tpid {
+	struct mbox_msghdr hdr;
+#define NIX_VLAN_TYPE_INNER 0
+#define NIX_VLAN_TYPE_OUTER 1
+	uint8_t __otx2_io vlan_type;
+	uint16_t __otx2_io tpid;
+};
+
+struct nix_bp_cfg_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io chan_base; /* Starting channel number */
+	uint8_t __otx2_io chan_cnt; /* Number of channels */
+	uint8_t __otx2_io bpid_per_chan;
+	/* bpid_per_chan = 0  assigns single bp id for range of channels */
+	/* bpid_per_chan = 1 assigns separate bp id for each channel */
+};
+
+/* Global NIX inline IPSec configuration */
+struct nix_inline_ipsec_cfg {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io cpt_credit;
+	struct {
+		uint8_t __otx2_io egrp;
+		uint8_t __otx2_io opcode;
+	} gen_cfg;
+	struct {
+		uint16_t __otx2_io cpt_pf_func;
+		uint8_t __otx2_io cpt_slot;
+	} inst_qsel;
+	uint8_t __otx2_io enable;
+};
+
+/* Per NIX LF inline IPSec configuration */
+struct nix_inline_ipsec_lf_cfg {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io sa_base_addr;
+	struct {
+		uint32_t __otx2_io tag_const;
+		uint16_t __otx2_io lenm1_max;
+		uint8_t __otx2_io sa_pow2_size;
+		uint8_t __otx2_io tt;
+	} ipsec_cfg0;
+	struct {
+		uint32_t __otx2_io sa_idx_max;
+		uint8_t __otx2_io sa_idx_w;
+	} ipsec_cfg1;
+	uint8_t __otx2_io enable;
+};
+
+/* PF can be mapped to either CGX or LBK interface,
+ * so maximum 64 channels are possible.
+ */
+#define NIX_MAX_CHAN	64
+struct nix_bp_cfg_rsp {
+	struct mbox_msghdr hdr;
+	/* Channel and bpid mapping */
+	uint16_t __otx2_io chan_bpid[NIX_MAX_CHAN];
+	/* Number of channel for which bpids are assigned */
+	uint8_t __otx2_io chan_cnt;
+};
+
+/* SSO mailbox error codes
+ * Range 501 - 600.
+ */
+enum sso_af_status {
+	SSO_AF_ERR_PARAM	= -501,
+	SSO_AF_ERR_LF_INVALID	= -502,
+	SSO_AF_ERR_AF_LF_ALLOC	= -503,
+	SSO_AF_ERR_GRP_EBUSY	= -504,
+	SSO_AF_ERR_AF_LF_INVALID = -599,
+};
+
+struct sso_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hwgrps;
+};
+
+struct sso_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io xaq_buf_size;
+	uint32_t __otx2_io xaq_wq_entries;
+	uint32_t __otx2_io in_unit_entries;
+	uint16_t __otx2_io hwgrps;
+};
+
+struct sso_lf_free_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hwgrps;
+};
+
+/* SSOW mailbox error codes
+ * Range 601 - 700.
+ */
+enum ssow_af_status {
+	SSOW_AF_ERR_PARAM	= -601,
+	SSOW_AF_ERR_LF_INVALID	= -602,
+	SSOW_AF_ERR_AF_LF_ALLOC	= -603,
+};
+
+struct ssow_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hws;
+};
+
+struct ssow_lf_free_req {
+	struct mbox_msghdr hdr;
+	int __otx2_io node;
+	uint16_t __otx2_io hws;
+};
+
+struct sso_hw_setconfig {
+	struct mbox_msghdr hdr;
+	uint32_t __otx2_io npa_aura_id;
+	uint16_t __otx2_io npa_pf_func;
+	uint16_t __otx2_io hwgrps;
+};
+
+struct sso_info_req {
+	struct mbox_msghdr hdr;
+	union {
+		uint16_t __otx2_io grp;
+		uint16_t __otx2_io hws;
+	};
+};
+
+struct sso_grp_priority {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io grp;
+	uint8_t __otx2_io priority;
+	uint8_t __otx2_io affinity;
+	uint8_t __otx2_io weight;
+};
+
+struct sso_grp_qos_cfg {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io grp;
+	uint32_t __otx2_io xaq_limit;
+	uint16_t __otx2_io taq_thr;
+	uint16_t __otx2_io iaq_thr;
+};
+
+struct sso_grp_stats {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io grp;
+	uint64_t __otx2_io ws_pc;
+	uint64_t __otx2_io ext_pc;
+	uint64_t __otx2_io wa_pc;
+	uint64_t __otx2_io ts_pc;
+	uint64_t __otx2_io ds_pc;
+	uint64_t __otx2_io dq_pc;
+	uint64_t __otx2_io aw_status;
+	uint64_t __otx2_io page_cnt;
+};
+
+struct sso_hws_stats {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io hws;
+	uint64_t __otx2_io arbitration;
+};
+
+/* CPT mbox message formats */
+
+struct cpt_rd_wr_reg_msg {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io reg_offset;
+	uint64_t __otx2_io *ret_val;
+	uint64_t __otx2_io val;
+	uint8_t __otx2_io is_write;
+};
+
+#define CPT_INLINE_INBOUND	0
+#define CPT_INLINE_OUTBOUND	1
+
+struct cpt_inline_ipsec_cfg_msg {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io enable;
+	uint8_t __otx2_io slot;
+	uint8_t __otx2_io dir;
+	uint16_t __otx2_io sso_pf_func; /* Inbound path SSO_PF_FUNC */
+	uint16_t __otx2_io nix_pf_func; /* Outbound path NIX_PF_FUNC */
+};
+
+/* NPC mbox message structs */
+
+#define NPC_MCAM_ENTRY_INVALID	0xFFFF
+#define NPC_MCAM_INVALID_MAP	0xFFFF
+
+/* NPC mailbox error codes
+ * Range 701 - 800.
+ */
+enum npc_af_status {
+	NPC_MCAM_INVALID_REQ	= -701,
+	NPC_MCAM_ALLOC_DENIED	= -702,
+	NPC_MCAM_ALLOC_FAILED	= -703,
+	NPC_MCAM_PERM_DENIED	= -704,
+};
+
+struct npc_mcam_alloc_entry_req {
+	struct mbox_msghdr hdr;
+#define NPC_MAX_NONCONTIG_ENTRIES	256
+	uint8_t __otx2_io contig;   /* Contiguous entries ? */
+#define NPC_MCAM_ANY_PRIO		0
+#define NPC_MCAM_LOWER_PRIO		1
+#define NPC_MCAM_HIGHER_PRIO		2
+	uint8_t __otx2_io priority; /* Lower or higher w.r.t ref_entry */
+	uint16_t __otx2_io ref_entry;
+	uint16_t __otx2_io count;    /* Number of entries requested */
+};
+
+struct npc_mcam_alloc_entry_rsp {
+	struct mbox_msghdr hdr;
+	/* Entry alloc'ed or start index if contiguous.
+	 * Invalid in case of non-contiguous.
+	 */
+	uint16_t __otx2_io entry;
+	uint16_t __otx2_io count; /* Number of entries allocated */
+	uint16_t __otx2_io free_count; /* Number of entries available */
+	uint16_t __otx2_io entry_list[NPC_MAX_NONCONTIG_ENTRIES];
+};
+
+struct npc_mcam_free_entry_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io entry; /* Entry index to be freed */
+	uint8_t __otx2_io all;   /* Free all entries alloc'ed to this PFVF */
+};
+
+struct mcam_entry {
+#define NPC_MAX_KWS_IN_KEY	7 /* Number of keywords in max key width */
+	uint64_t __otx2_io kw[NPC_MAX_KWS_IN_KEY];
+	uint64_t __otx2_io kw_mask[NPC_MAX_KWS_IN_KEY];
+	uint64_t __otx2_io action;
+	uint64_t __otx2_io vtag_action;
+};
+
+struct npc_mcam_write_entry_req {
+	struct mbox_msghdr hdr;
+	struct mcam_entry entry_data;
+	uint16_t __otx2_io entry; /* MCAM entry to write this match key */
+	uint16_t __otx2_io cntr;	 /* Counter for this MCAM entry */
+	uint8_t __otx2_io intf;	 /* Rx or Tx interface */
+	uint8_t __otx2_io enable_entry;/* Enable this MCAM entry ? */
+	uint8_t __otx2_io set_cntr;    /* Set counter for this entry ? */
+};
+
+/* Enable/Disable a given entry */
+struct npc_mcam_ena_dis_entry_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io entry;
+};
+
+struct npc_mcam_shift_entry_req {
+	struct mbox_msghdr hdr;
+#define NPC_MCAM_MAX_SHIFTS	64
+	uint16_t __otx2_io curr_entry[NPC_MCAM_MAX_SHIFTS];
+	uint16_t __otx2_io new_entry[NPC_MCAM_MAX_SHIFTS];
+	uint16_t __otx2_io shift_count; /* Number of entries to shift */
+};
+
+struct npc_mcam_shift_entry_rsp {
+	struct mbox_msghdr hdr;
+	/* Index in 'curr_entry', not entry itself */
+	uint16_t __otx2_io failed_entry_idx;
+};
+
+struct npc_mcam_alloc_counter_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io contig;	/* Contiguous counters ? */
+#define NPC_MAX_NONCONTIG_COUNTERS 64
+	uint16_t __otx2_io count;	/* Number of counters requested */
+};
+
+struct npc_mcam_alloc_counter_rsp {
+	struct mbox_msghdr hdr;
+	/* Counter alloc'ed or start idx if contiguous.
+	 * Invalid incase of non-contiguous.
+	 */
+	uint16_t __otx2_io cntr;
+	uint16_t __otx2_io count; /* Number of counters allocated */
+	uint16_t __otx2_io cntr_list[NPC_MAX_NONCONTIG_COUNTERS];
+};
+
+struct npc_mcam_oper_counter_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io cntr; /* Free a counter or clear/fetch it's stats */
+};
+
+struct npc_mcam_oper_counter_rsp {
+	struct mbox_msghdr hdr;
+	/* valid only while fetching counter's stats */
+	uint64_t __otx2_io stat;
+};
+
+struct npc_mcam_unmap_counter_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io cntr;
+	uint16_t __otx2_io entry; /* Entry and counter to be unmapped */
+	uint8_t __otx2_io all;   /* Unmap all entries using this counter ? */
+};
+
+struct npc_mcam_alloc_and_write_entry_req {
+	struct mbox_msghdr hdr;
+	struct mcam_entry entry_data;
+	uint16_t __otx2_io ref_entry;
+	uint8_t __otx2_io priority;    /* Lower or higher w.r.t ref_entry */
+	uint8_t __otx2_io intf;	 /* Rx or Tx interface */
+	uint8_t __otx2_io enable_entry;/* Enable this MCAM entry ? */
+	uint8_t __otx2_io alloc_cntr;  /* Allocate counter and map ? */
+};
+
+struct npc_mcam_alloc_and_write_entry_rsp {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io entry;
+	uint16_t __otx2_io cntr;
+};
+
+struct npc_get_kex_cfg_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io rx_keyx_cfg;   /* NPC_AF_INTF(0)_KEX_CFG */
+	uint64_t __otx2_io tx_keyx_cfg;   /* NPC_AF_INTF(1)_KEX_CFG */
+#define NPC_MAX_INTF	2
+#define NPC_MAX_LID	8
+#define NPC_MAX_LT	16
+#define NPC_MAX_LD	2
+#define NPC_MAX_LFL	16
+	/* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */
+	uint64_t __otx2_io kex_ld_flags[NPC_MAX_LD];
+	/* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG */
+	uint64_t __otx2_io
+	intf_lid_lt_ld[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];
+	/* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG */
+	uint64_t __otx2_io
+	intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
+#define MKEX_NAME_LEN 128
+	uint8_t __otx2_io mkex_pfl_name[MKEX_NAME_LEN];
+};
+
+/* TIM mailbox error codes
+ * Range 801 - 900.
+ */
+enum tim_af_status {
+	TIM_AF_NO_RINGS_LEFT			= -801,
+	TIM_AF_INVALID_NPA_PF_FUNC		= -802,
+	TIM_AF_INVALID_SSO_PF_FUNC		= -803,
+	TIM_AF_RING_STILL_RUNNING		= -804,
+	TIM_AF_LF_INVALID			= -805,
+	TIM_AF_CSIZE_NOT_ALIGNED		= -806,
+	TIM_AF_CSIZE_TOO_SMALL			= -807,
+	TIM_AF_CSIZE_TOO_BIG			= -808,
+	TIM_AF_INTERVAL_TOO_SMALL		= -809,
+	TIM_AF_INVALID_BIG_ENDIAN_VALUE		= -810,
+	TIM_AF_INVALID_CLOCK_SOURCE		= -811,
+	TIM_AF_GPIO_CLK_SRC_NOT_ENABLED		= -812,
+	TIM_AF_INVALID_BSIZE			= -813,
+	TIM_AF_INVALID_ENABLE_PERIODIC		= -814,
+	TIM_AF_INVALID_ENABLE_DONTFREE		= -815,
+	TIM_AF_ENA_DONTFRE_NSET_PERIODIC	= -816,
+	TIM_AF_RING_ALREADY_DISABLED		= -817,
+};
+
+enum tim_clk_srcs {
+	TIM_CLK_SRCS_TENNS	= 0,
+	TIM_CLK_SRCS_GPIO	= 1,
+	TIM_CLK_SRCS_GTI	= 2,
+	TIM_CLK_SRCS_PTP	= 3,
+	TIM_CLK_SRSC_INVALID,
+};
+
+enum tim_gpio_edge {
+	TIM_GPIO_NO_EDGE		= 0,
+	TIM_GPIO_LTOH_TRANS		= 1,
+	TIM_GPIO_HTOL_TRANS		= 2,
+	TIM_GPIO_BOTH_TRANS		= 3,
+	TIM_GPIO_INVALID,
+};
+
+enum ptp_op {
+	PTP_OP_ADJFINE = 0, /* adjfine(req.scaled_ppm); */
+	PTP_OP_GET_CLOCK = 1, /* rsp.clk = get_clock() */
+};
+
+struct ptp_req {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io op;
+	int64_t __otx2_io scaled_ppm;
+};
+
+struct ptp_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io clk;
+};
+
+struct get_hw_cap_rsp {
+	struct mbox_msghdr hdr;
+	/* Schq mapping fixed or flexible */
+	uint8_t __otx2_io nix_fixed_txschq_mapping;
+	uint8_t __otx2_io nix_express_traffic; /* Are express links supported */
+	uint8_t __otx2_io nix_shaping; /* Is shaping and coloring supported */
+};
+
+struct ndc_sync_op {
+	struct mbox_msghdr hdr;
+	uint8_t __otx2_io nix_lf_tx_sync;
+	uint8_t __otx2_io nix_lf_rx_sync;
+	uint8_t __otx2_io npa_lf_sync;
+};
+
+struct tim_lf_alloc_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io ring;
+	uint16_t __otx2_io npa_pf_func;
+	uint16_t __otx2_io sso_pf_func;
+};
+
+struct tim_ring_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io ring;
+};
+
+struct tim_config_req {
+	struct mbox_msghdr hdr;
+	uint16_t __otx2_io ring;
+	uint8_t __otx2_io bigendian;
+	uint8_t __otx2_io clocksource;
+	uint8_t __otx2_io enableperiodic;
+	uint8_t __otx2_io enabledontfreebuffer;
+	uint32_t __otx2_io bucketsize;
+	uint32_t __otx2_io chunksize;
+	uint32_t __otx2_io interval;
+};
+
+struct tim_lf_alloc_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io tenns_clk;
+};
+
+struct tim_enable_rsp {
+	struct mbox_msghdr hdr;
+	uint64_t __otx2_io timestarted;
+	uint32_t __otx2_io currentbucket;
+};
+
 #endif /* __OTX2_MBOX_H__ */
Signature · 1 line
2.21.0
#34 lore raw

PATCH v2 4/27 common/octeontx2: add mailbox base support infra

In reply to [email protected]

From: Jerin Jacob <[email protected]>

This patch adds mailbox init and fini support. Each RVU device has a dedicated 64KB mailbox region shared with its peer for communication. RVU AF has a separate mailbox region shared with each of RVU PFs and an RVU PF has a separate region shared with each of it's VF.

---
 drivers/common/octeontx2/otx2_mbox.c | 133 +++++++++++++++++++++++++++
 drivers/common/octeontx2/otx2_mbox.h |   5 +
 2 files changed, 138 insertions(+)
drivers/common/octeontx2/otx2_mbox.c +133 -0
index c9cdbdbbc..cb03f6503 100644
@@ -2,4 +2,137 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_atomic.h>
+#include <rte_cycles.h>
+
 #include "otx2_mbox.h"
+
+#define RVU_AF_AFPF_MBOX0	(0x02000)
+#define RVU_AF_AFPF_MBOX1	(0x02008)
+
+#define RVU_PF_PFAF_MBOX0	(0xC00)
+#define RVU_PF_PFAF_MBOX1	(0xC08)
+
+#define RVU_PF_VFX_PFVF_MBOX0	(0x0000)
+#define RVU_PF_VFX_PFVF_MBOX1	(0x0008)
+
+#define	RVU_VF_VFPF_MBOX0	(0x0000)
+#define	RVU_VF_VFPF_MBOX1	(0x0008)
+
+void
+otx2_mbox_fini(struct otx2_mbox *mbox)
+{
+	mbox->reg_base = 0;
+	mbox->hwbase = 0;
+	free(mbox->dev);
+	mbox->dev = NULL;
+}
+
+void
+otx2_mbox_reset(struct otx2_mbox *mbox, int devid)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_hdr *tx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->tx_start);
+	struct mbox_hdr *rx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+	mdev->msg_size = 0;
+	mdev->rsp_size = 0;
+	tx_hdr->msg_size = 0;
+	tx_hdr->num_msgs = 0;
+	rx_hdr->msg_size = 0;
+	rx_hdr->num_msgs = 0;
+	rte_spinlock_unlock(&mdev->mbox_lock);
+}
+
+int
+otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase,
+	       uintptr_t reg_base, int direction, int ndevs)
+{
+	struct otx2_mbox_dev *mdev;
+	int devid;
+
+	mbox->reg_base = reg_base;
+	mbox->hwbase = hwbase;
+
+	switch (direction) {
+	case MBOX_DIR_AFPF:
+	case MBOX_DIR_PFVF:
+		mbox->tx_start = MBOX_DOWN_TX_START;
+		mbox->rx_start = MBOX_DOWN_RX_START;
+		mbox->tx_size  = MBOX_DOWN_TX_SIZE;
+		mbox->rx_size  = MBOX_DOWN_RX_SIZE;
+		break;
+	case MBOX_DIR_PFAF:
+	case MBOX_DIR_VFPF:
+		mbox->tx_start = MBOX_DOWN_RX_START;
+		mbox->rx_start = MBOX_DOWN_TX_START;
+		mbox->tx_size  = MBOX_DOWN_RX_SIZE;
+		mbox->rx_size  = MBOX_DOWN_TX_SIZE;
+		break;
+	case MBOX_DIR_AFPF_UP:
+	case MBOX_DIR_PFVF_UP:
+		mbox->tx_start = MBOX_UP_TX_START;
+		mbox->rx_start = MBOX_UP_RX_START;
+		mbox->tx_size  = MBOX_UP_TX_SIZE;
+		mbox->rx_size  = MBOX_UP_RX_SIZE;
+		break;
+	case MBOX_DIR_PFAF_UP:
+	case MBOX_DIR_VFPF_UP:
+		mbox->tx_start = MBOX_UP_RX_START;
+		mbox->rx_start = MBOX_UP_TX_START;
+		mbox->tx_size  = MBOX_UP_RX_SIZE;
+		mbox->rx_size  = MBOX_UP_TX_SIZE;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	switch (direction) {
+	case MBOX_DIR_AFPF:
+	case MBOX_DIR_AFPF_UP:
+		mbox->trigger = RVU_AF_AFPF_MBOX0;
+		mbox->tr_shift = 4;
+		break;
+	case MBOX_DIR_PFAF:
+	case MBOX_DIR_PFAF_UP:
+		mbox->trigger = RVU_PF_PFAF_MBOX1;
+		mbox->tr_shift = 0;
+		break;
+	case MBOX_DIR_PFVF:
+	case MBOX_DIR_PFVF_UP:
+		mbox->trigger = RVU_PF_VFX_PFVF_MBOX0;
+		mbox->tr_shift = 12;
+		break;
+	case MBOX_DIR_VFPF:
+	case MBOX_DIR_VFPF_UP:
+		mbox->trigger = RVU_VF_VFPF_MBOX1;
+		mbox->tr_shift = 0;
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev));
+	if (!mbox->dev) {
+		otx2_mbox_fini(mbox);
+		return -ENOMEM;
+	}
+	mbox->ndevs = ndevs;
+	for (devid = 0; devid < ndevs; devid++) {
+		mdev = &mbox->dev[devid];
+		mdev->mbase = (void *)(mbox->hwbase + (devid * MBOX_SIZE));
+		rte_spinlock_init(&mdev->mbox_lock);
+		/* Init header to reset value */
+		otx2_mbox_reset(mbox, devid);
+	}
+
+	return 0;
+}
drivers/common/octeontx2/otx2_mbox.h +5 -0
index e2d79c070..ac7de788f 100644
@@ -1333,4 +1333,9 @@ struct tim_enable_rsp {
 	uint32_t __otx2_io currentbucket;
 };
 
+void otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
+int otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase,
+		   uintptr_t reg_base, int direction, int ndevs);
+void otx2_mbox_fini(struct otx2_mbox *mbox);
+
 #endif /* __OTX2_MBOX_H__ */
Signature · 1 line
2.21.0
#35 lore raw

PATCH v2 5/27 common/octeontx2: add runtime log infra

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Various consumers of this common code need runtime logging infrastructure. This patch adds the same.

---
 drivers/common/octeontx2/Makefile             |  1 +
 drivers/common/octeontx2/meson.build          |  1 +
 drivers/common/octeontx2/otx2_common.c        | 85 +++++++++++++++++++
 drivers/common/octeontx2/otx2_common.h        | 36 ++++++++
 .../rte_common_octeontx2_version.map          | 11 +++
 5 files changed, 134 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_common.c
drivers/common/octeontx2/Makefile +1 -0
index e5737532a..3fd67f0ab 100644
@@ -25,6 +25,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-y += otx2_mbox.c
+SRCS-y += otx2_common.c
 
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_ethdev
drivers/common/octeontx2/meson.build +1 -0
index 34f8aaea7..4771b1942 100644
@@ -4,6 +4,7 @@
 
 sources= files(
 		'otx2_mbox.c',
+		'otx2_common.c',
 	       )
 
 extra_flags = []
drivers/common/octeontx2/otx2_common.c new file +85 -0

85 lines not on this page · raw message

drivers/common/octeontx2/otx2_common.h +36 -0
index b0c19266b..58fcf5a41 100644
@@ -33,6 +33,42 @@
 #define __hot   __attribute__((hot))
 #endif
 
+/* Log */
+extern int otx2_logtype_base;
+extern int otx2_logtype_mbox;
+extern int otx2_logtype_npa;
+extern int otx2_logtype_nix;
+extern int otx2_logtype_sso;
+extern int otx2_logtype_npc;
+extern int otx2_logtype_tm;
+extern int otx2_logtype_tim;
+extern int otx2_logtype_dpi;
+
+#define OTX2_CLNRM  "\x1b[0m"
+#define OTX2_CLRED  "\x1b[31m"
+
+#define otx2_err(fmt, args...)						\
+	RTE_LOG(ERR, PMD, ""OTX2_CLRED"%s():%u " fmt OTX2_CLNRM"\n",	\
+				__func__, __LINE__, ## args)
+
+#define otx2_info(fmt, args...)						\
+	RTE_LOG(INFO, PMD, fmt"\n", ## args)
+
+#define otx2_dbg(subsystem, fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx2_logtype_ ## subsystem,		\
+		"[%s] %s():%u " fmt "\n",				\
+		 #subsystem, __func__, __LINE__, ##args)
+
+#define otx2_base_dbg(fmt, ...) otx2_dbg(base, fmt, ##__VA_ARGS__)
+#define otx2_mbox_dbg(fmt, ...) otx2_dbg(mbox, fmt, ##__VA_ARGS__)
+#define otx2_npa_dbg(fmt, ...) otx2_dbg(npa, fmt, ##__VA_ARGS__)
+#define otx2_nix_dbg(fmt, ...) otx2_dbg(nix, fmt, ##__VA_ARGS__)
+#define otx2_sso_dbg(fmt, ...) otx2_dbg(sso, fmt, ##__VA_ARGS__)
+#define otx2_npc_dbg(fmt, ...) otx2_dbg(npc, fmt, ##__VA_ARGS__)
+#define otx2_tm_dbg(fmt, ...) otx2_dbg(tm, fmt, ##__VA_ARGS__)
+#define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
+#define otx2_dpi_dbg(fmt, ...) otx2_dbg(dpi, fmt, ##__VA_ARGS__)
+
 /* IO Access */
 #define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
 #define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
drivers/common/octeontx2/rte_common_octeontx2_version.map +11 -0
index fc8c95e91..26683e98b 100644
@@ -1,4 +1,15 @@
 DPDK_19.05 {
+	global:
+
+	otx2_logtype_base;
+	otx2_logtype_dpi;
+	otx2_logtype_mbox;
+	otx2_logtype_npa;
+	otx2_logtype_npc;
+	otx2_logtype_nix;
+	otx2_logtype_sso;
+	otx2_logtype_tm;
+	otx2_logtype_tim;
 
 	local: *;
 };
Signature · 1 line
2.21.0
#36 lore raw

PATCH v2 6/27 common/octeontx2: add mailbox send and receive support

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Each RVU device has a dedicated 64KB mailbox region shared with its peer for communication. RVU AF has a separate mailbox region shared with each of RVU PFs and an RVU PF has a separate region shared with each of it's VF.

This patch add use 64KB memory and implemented mailbox send and receive support.

These set of APIs are used by this driver (RVU AF) and other RVU PF/VF drivers eg ethdev, cryptodev e.t.c.

---
 drivers/common/octeontx2/otx2_mbox.c          | 278 ++++++++++++++++++
 drivers/common/octeontx2/otx2_mbox.h          | 142 +++++++++
 .../rte_common_octeontx2_version.map          |   7 +
 3 files changed, 427 insertions(+)
drivers/common/octeontx2/otx2_mbox.c +278 -0
index cb03f6503..86559fa98 100644
@@ -24,6 +24,12 @@
 #define	RVU_VF_VFPF_MBOX0	(0x0000)
 #define	RVU_VF_VFPF_MBOX1	(0x0008)
 
+static inline uint16_t
+msgs_offset(void)
+{
+	return RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+}
+
 void
 otx2_mbox_fini(struct otx2_mbox *mbox)
 {
@@ -136,3 +142,275 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase,
 
 	return 0;
 }
+
+/**
+ * @internal
+ * Allocate a message response
+ */
+struct mbox_msghdr *
+otx2_mbox_alloc_msg_rsp(struct otx2_mbox *mbox, int devid, int size,
+			int size_rsp)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_msghdr *msghdr = NULL;
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+	size = RTE_ALIGN(size, MBOX_MSG_ALIGN);
+	size_rsp = RTE_ALIGN(size_rsp, MBOX_MSG_ALIGN);
+	/* Check if there is space in mailbox */
+	if ((mdev->msg_size + size) > mbox->tx_size - msgs_offset())
+		goto exit;
+	if ((mdev->rsp_size + size_rsp) > mbox->rx_size - msgs_offset())
+		goto exit;
+	if (mdev->msg_size == 0)
+		mdev->num_msgs = 0;
+	mdev->num_msgs++;
+
+	msghdr = (struct mbox_msghdr *)(((uintptr_t)mdev->mbase +
+			mbox->tx_start + msgs_offset() + mdev->msg_size));
+
+	/* Clear the whole msg region */
+	otx2_mbox_memset(msghdr, 0, sizeof(*msghdr) + size);
+	/* Init message header with reset values */
+	msghdr->ver = OTX2_MBOX_VERSION;
+	mdev->msg_size += size;
+	mdev->rsp_size += size_rsp;
+	msghdr->next_msgoff = mdev->msg_size + msgs_offset();
+exit:
+	rte_spinlock_unlock(&mdev->mbox_lock);
+
+	return msghdr;
+}
+
+/**
+ * @internal
+ * Send a mailbox message
+ */
+void
+otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_hdr *tx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->tx_start);
+	struct mbox_hdr *rx_hdr =
+		(struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+
+	/* Reset header for next messages */
+	tx_hdr->msg_size = mdev->msg_size;
+	mdev->msg_size = 0;
+	mdev->rsp_size = 0;
+	mdev->msgs_acked = 0;
+
+	/* num_msgs != 0 signals to the peer that the buffer has a number of
+	 * messages. So this should be written after copying txmem
+	 */
+	tx_hdr->num_msgs = mdev->num_msgs;
+	rx_hdr->num_msgs = 0;
+
+	/* Sync mbox data into memory */
+	rte_wmb();
+
+	/* The interrupt should be fired after num_msgs is written
+	 * to the shared memory
+	 */
+	rte_write64(1, (volatile void *)(mbox->reg_base +
+		(mbox->trigger | (devid << mbox->tr_shift))));
+}
+
+/**
+ * @internal
+ * Wait and get mailbox response
+ */
+int
+otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid, void **msg)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_msghdr *msghdr;
+	uint64_t offset;
+	int rc;
+
+	rc = otx2_mbox_wait_for_rsp(mbox, devid);
+	if (rc != 1)
+		return -EIO;
+
+	rte_rmb();
+
+	offset = mbox->rx_start +
+		RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+	if (msg != NULL)
+		*msg = msghdr;
+
+	return msghdr->rc;
+}
+
+/**
+ * @internal
+ * Wait and get mailbox response with timeout
+ */
+int
+otx2_mbox_get_rsp_tmo(struct otx2_mbox *mbox, int devid, void **msg,
+		      uint32_t tmo)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	struct mbox_msghdr *msghdr;
+	uint64_t offset;
+	int rc;
+
+	rc = otx2_mbox_wait_for_rsp_tmo(mbox, devid, tmo);
+	if (rc != 1)
+		return -EIO;
+
+	rte_rmb();
+
+	offset = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+	if (msg != NULL)
+		*msg = msghdr;
+
+	return msghdr->rc;
+}
+
+static int
+mbox_wait(struct otx2_mbox *mbox, int devid, uint32_t rst_timo)
+{
+	volatile struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	uint32_t timeout = 0, sleep = 1;
+
+	while (mdev->num_msgs > mdev->msgs_acked) {
+		rte_delay_ms(sleep);
+		timeout += sleep;
+		if (timeout >= rst_timo) {
+			struct mbox_hdr *tx_hdr =
+				(struct mbox_hdr *)((uintptr_t)mdev->mbase +
+							mbox->tx_start);
+			struct mbox_hdr *rx_hdr =
+				(struct mbox_hdr *)((uintptr_t)mdev->mbase +
+							mbox->rx_start);
+
+			otx2_err("MBOX[devid: %d] message wait timeout %d, "
+				 "num_msgs: %d, msgs_acked: %d "
+				 "(tx/rx num_msgs: %d/%d), msg_size: %d, "
+				 "rsp_size: %d",
+				 devid, timeout, mdev->num_msgs,
+				 mdev->msgs_acked, tx_hdr->num_msgs,
+				 rx_hdr->num_msgs, mdev->msg_size,
+				 mdev->rsp_size);
+
+			return -EIO;
+		}
+		rte_rmb();
+	}
+	return 0;
+}
+
+int
+otx2_mbox_wait_for_rsp_tmo(struct otx2_mbox *mbox, int devid, uint32_t tmo)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	int rc = 0;
+
+	/* Sync with mbox region */
+	rte_rmb();
+
+	if (mbox->trigger == RVU_PF_VFX_PFVF_MBOX1 ||
+		mbox->trigger == RVU_PF_VFX_PFVF_MBOX0) {
+		/* In case of VF, Wait a bit more to account round trip delay */
+		tmo = tmo * 2;
+	}
+
+	/* Wait message */
+	rc = mbox_wait(mbox, devid, tmo);
+	if (rc)
+		return rc;
+
+	return mdev->msgs_acked;
+}
+
+/**
+ * @internal
+ * Wait for the mailbox response
+ */
+int
+otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid)
+{
+	return otx2_mbox_wait_for_rsp_tmo(mbox, devid, MBOX_RSP_TIMEOUT);
+}
+
+int
+otx2_mbox_get_availmem(struct otx2_mbox *mbox, int devid)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
+	int avail;
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+	avail = mbox->tx_size - mdev->msg_size - msgs_offset();
+	rte_spinlock_unlock(&mdev->mbox_lock);
+
+	return avail;
+}
+
+int
+otx2_send_ready_msg(struct otx2_mbox *mbox, uint16_t *pcifunc)
+{
+	struct ready_msg_rsp *rsp;
+	int rc;
+
+	otx2_mbox_alloc_msg_ready(mbox);
+
+	otx2_mbox_msg_send(mbox, 0);
+	rc = otx2_mbox_get_rsp(mbox, 0, (void *)&rsp);
+	if (rc)
+		return rc;
+
+	if (pcifunc)
+		*pcifunc = rsp->hdr.pcifunc;
+
+	return 0;
+}
+
+int
+otx2_reply_invalid_msg(struct otx2_mbox *mbox, int devid, uint16_t pcifunc,
+		       uint16_t id)
+{
+	struct msg_rsp *rsp;
+
+	rsp = (struct msg_rsp *)otx2_mbox_alloc_msg(mbox, devid, sizeof(*rsp));
+	if (!rsp)
+		return -ENOMEM;
+	rsp->hdr.id = id;
+	rsp->hdr.sig = OTX2_MBOX_RSP_SIG;
+	rsp->hdr.rc = MBOX_MSG_INVALID;
+	rsp->hdr.pcifunc = pcifunc;
+
+	return 0;
+}
+
+/**
+ * @internal
+ * Convert mail box ID to name
+ */
+const char *otx2_mbox_id2name(uint16_t id)
+{
+	switch (id) {
+#define M(_name, _id, _1, _2, _3) case _id: return # _name;
+	MBOX_MESSAGES
+	MBOX_UP_CGX_MESSAGES
+#undef M
+	default :
+		return "INVALID ID";
+	}
+}
+
+int otx2_mbox_id2size(uint16_t id)
+{
+	switch (id) {
+#define M(_1, _id, _2, _req_type, _3) case _id: return sizeof(struct _req_type);
+	MBOX_MESSAGES
+	MBOX_UP_CGX_MESSAGES
+#undef M
+	default :
+		return 0;
+	}
+}
drivers/common/octeontx2/otx2_mbox.h +142 -0

151 lines not on this page · raw message

drivers/common/octeontx2/rte_common_octeontx2_version.map +7 -0
index 26683e98b..4502088f2 100644
@@ -11,5 +11,12 @@ DPDK_19.05 {
 	otx2_logtype_tm;
 	otx2_logtype_tim;
 
+	otx2_mbox_alloc_msg_rsp;
+	otx2_mbox_get_rsp;
+	otx2_mbox_get_rsp_tmo;
+	otx2_mbox_id2name;
+	otx2_mbox_msg_send;
+	otx2_mbox_wait_for_rsp;
+
 	local: *;
 };
Signature · 1 line
2.21.0
#37 lore raw

PATCH v2 7/27 common/octeontx2: introduce common device class

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Introduce otx2_dev class to hold octeontx2 PCIe device specific information and operations.

All PCIe drivers(ethdev, mempool, cryptodev and eventdev) in octeontx2, inherits this base object to avail the common functionalities such as mailbox creation, interrupt registration, etc of the PCIe device.

---
 drivers/common/octeontx2/Makefile             |   2 +
 drivers/common/octeontx2/meson.build          |   4 +-
 drivers/common/octeontx2/otx2_common.h        |  14 ++
 drivers/common/octeontx2/otx2_dev.c           | 197 ++++++++++++++++++
 drivers/common/octeontx2/otx2_dev.h           |  84 ++++++++
 drivers/common/octeontx2/otx2_irq.h           |  19 ++
 .../rte_common_octeontx2_version.map          |   3 +
 7 files changed, 321 insertions(+), 2 deletions(-)
 create mode 100644 drivers/common/octeontx2/otx2_dev.c
 create mode 100644 drivers/common/octeontx2/otx2_dev.h
 create mode 100644 drivers/common/octeontx2/otx2_irq.h
drivers/common/octeontx2/Makefile +2 -0
index 3fd67f0ab..a6f94553d 100644
@@ -11,6 +11,7 @@ LIB = librte_common_octeontx2.a
 
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2
+CFLAGS += -I$(RTE_SDK)/drivers/bus/pci
 
 ifneq ($(CONFIG_RTE_ARCH_64),y)
 CFLAGS += -Wno-int-to-pointer-cast
@@ -24,6 +25,7 @@ LIBABIVER := 1
 #
 # all source are stored in SRCS-y
 #
+SRCS-y += otx2_dev.c
 SRCS-y += otx2_mbox.c
 SRCS-y += otx2_common.c
 
drivers/common/octeontx2/meson.build +2 -2
index 4771b1942..feaf75d92 100644
@@ -2,7 +2,7 @@
 # Copyright(C) 2019 Marvell International Ltd.
 #
 
-sources= files(
+sources= files('otx2_dev.c',
 		'otx2_mbox.c',
 		'otx2_common.c',
 	       )
@@ -19,6 +19,6 @@ foreach flag: extra_flags
 	endif
 endforeach
 
-deps = ['eal', 'ethdev']
+deps = ['eal', 'pci', 'ethdev']
 includes += include_directories('../../common/octeontx2',
 		'../../bus/pci')
drivers/common/octeontx2/otx2_common.h +14 -0
index 58fcf5a41..b9e7a7f8d 100644
@@ -69,6 +69,20 @@ extern int otx2_logtype_dpi;
 #define otx2_tim_dbg(fmt, ...) otx2_dbg(tim, fmt, ##__VA_ARGS__)
 #define otx2_dpi_dbg(fmt, ...) otx2_dbg(dpi, fmt, ##__VA_ARGS__)
 
+/* PCI IDs */
+#define PCI_VENDOR_ID_CAVIUM			0x177D
+#define PCI_DEVID_OCTEONTX2_RVU_PF              0xA063
+#define PCI_DEVID_OCTEONTX2_RVU_VF		0xA064
+#define PCI_DEVID_OCTEONTX2_RVU_AF		0xA065
+#define PCI_DEVID_OCTEONTX2_RVU_SSO_TIM_PF	0xA0F9
+#define PCI_DEVID_OCTEONTX2_RVU_SSO_TIM_VF	0xA0FA
+#define PCI_DEVID_OCTEONTX2_RVU_NPA_PF		0xA0FB
+#define PCI_DEVID_OCTEONTX2_RVU_NPA_VF		0xA0FC
+#define PCI_DEVID_OCTEONTX2_RVU_CPT_PF		0xA0FD
+#define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
+#define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
+#define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
+
 /* IO Access */
 #define otx2_read64(addr) rte_read64_relaxed((void *)(addr))
 #define otx2_write64(val, addr) rte_write64_relaxed((val), (void *)(addr))
drivers/common/octeontx2/otx2_dev.c new file +197 -0

197 lines not on this page · raw message

drivers/common/octeontx2/otx2_dev.h new file +84 -0

84 lines not on this page · raw message

drivers/common/octeontx2/otx2_irq.h new file +19 -0
new file mode 100644
index 000000000..df44ddfba
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_IRQ_H_
+#define _OTX2_IRQ_H_
+
+#include <rte_pci.h>
+#include <rte_interrupts.h>
+
+#include "otx2_common.h"
+
+typedef struct {
+/* 128 devices translate to two 64 bits dwords */
+#define MAX_VFPF_DWORD_BITS 2
+	uint64_t bits[MAX_VFPF_DWORD_BITS];
+} otx2_intr_t;
+
+#endif /* _OTX2_IRQ_H_ */
drivers/common/octeontx2/rte_common_octeontx2_version.map +3 -0
index 4502088f2..f4b49fb74 100644
@@ -1,6 +1,9 @@
 DPDK_19.05 {
 	global:
 
+	otx2_dev_fini;
+	otx2_dev_init;
+
 	otx2_logtype_base;
 	otx2_logtype_dpi;
 	otx2_logtype_mbox;
Signature · 1 line
2.21.0
#38 lore raw

PATCH v2 8/27 common/octeontx2: introduce irq handling functions

In reply to [email protected]

From: Jerin Jacob <[email protected]>

All PCIe drivers(ethdev, mempool, cryptodev and eventdev) in octeontx2, needs to handle interrupt for mailbox and error handling. Create a helper function over rte interrupt API to register, unregister, disable interrupts.

---
 drivers/common/octeontx2/Makefile             |   1 +
 drivers/common/octeontx2/meson.build          |   1 +
 drivers/common/octeontx2/otx2_irq.c           | 254 ++++++++++++++++++
 drivers/common/octeontx2/otx2_irq.h           |   6 +
 .../rte_common_octeontx2_version.map          |   4 +
 5 files changed, 266 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_irq.c
drivers/common/octeontx2/Makefile +1 -0
index a6f94553d..78243e555 100644
@@ -26,6 +26,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-y += otx2_dev.c
+SRCS-y += otx2_irq.c
 SRCS-y += otx2_mbox.c
 SRCS-y += otx2_common.c
 
drivers/common/octeontx2/meson.build +1 -0
index feaf75d92..44ac90085 100644
@@ -3,6 +3,7 @@
 #
 
 sources= files('otx2_dev.c',
+		'otx2_irq.c',
 		'otx2_mbox.c',
 		'otx2_common.c',
 	       )
drivers/common/octeontx2/otx2_irq.c new file +254 -0

254 lines not on this page · raw message

drivers/common/octeontx2/otx2_irq.h +6 -0
index df44ddfba..9d326276e 100644
@@ -16,4 +16,10 @@ typedef struct {
 	uint64_t bits[MAX_VFPF_DWORD_BITS];
 } otx2_intr_t;
 
+int otx2_register_irq(struct rte_intr_handle *intr_handle,
+		      rte_intr_callback_fn cb, void *data, unsigned int vec);
+void otx2_unregister_irq(struct rte_intr_handle *intr_handle,
+			 rte_intr_callback_fn cb, void *data, unsigned int vec);
+int otx2_disable_irqs(struct rte_intr_handle *intr_handle);
+
 #endif /* _OTX2_IRQ_H_ */
drivers/common/octeontx2/rte_common_octeontx2_version.map +4 -0
index f4b49fb74..2f8a607ee 100644
@@ -21,5 +21,9 @@ DPDK_19.05 {
 	otx2_mbox_msg_send;
 	otx2_mbox_wait_for_rsp;
 
+	otx2_disable_irqs;
+	otx2_unregister_irq;
+	otx2_register_irq;
+
 	local: *;
 };
Signature · 1 line
2.21.0
#39 lore raw

PATCH v2 9/27 common/octeontx2: handle intra device operations

In reply to [email protected]

From: Jerin Jacob <[email protected]>

The mempool device(NPA) may be provisioned as a standalone device or it can be part of ethdev/eventdev device. In order to address mempool as standalone or integrated with ethdev/eventdev device, An intra device structure being introduced.

When the _first_ ethdev/eventdev PCIe device or standalone mempool(NPA) devices get probed by the eal PCI subsystem,
The NPA object(struct otx2_npa_lf) stored in otx2_dev base class. Once it is accomplished, the other consumer drivers like ethdev driver or eventdev driver use otx2_npa_* API to operate on shared NPA object.

The similar concept followed for SSO object, Which needs to share between PCIe devices.

---
 drivers/common/octeontx2/otx2_common.c        | 163 ++++++++++++++++++
 drivers/common/octeontx2/otx2_common.h        |  32 +++-
 drivers/common/octeontx2/otx2_dev.c           |   6 +
 drivers/common/octeontx2/otx2_dev.h           |   1 +
 .../rte_common_octeontx2_version.map          |   9 +
 5 files changed, 210 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_common.c +163 -0
index a4b91b4f1..7e4536639 100644
@@ -2,9 +2,172 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_atomic.h>
+#include <rte_malloc.h>
 #include <rte_log.h>
 
 #include "otx2_common.h"
+#include "otx2_dev.h"
+#include "otx2_mbox.h"
+
+/**
+ * @internal
+ * Set default NPA configuration.
+ */
+void
+otx2_npa_set_defaults(struct otx2_idev_cfg *idev)
+{
+	idev->npa_pf_func = 0;
+	rte_atomic16_set(&idev->npa_refcnt, 0);
+}
+
+/**
+ * @internal
+ * Get intra device config structure.
+ */
+struct otx2_idev_cfg *
+otx2_intra_dev_get_cfg(void)
+{
+	const char name[] = "octeontx2_intra_device_conf";
+	const struct rte_memzone *mz;
+	struct otx2_idev_cfg *idev;
+
+	mz = rte_memzone_lookup(name);
+	if (mz != NULL)
+		return mz->addr;
+
+	/* Request for the first time */
+	mz = rte_memzone_reserve_aligned(name, sizeof(struct otx2_idev_cfg),
+					 SOCKET_ID_ANY, 0, OTX2_ALIGN);
+	if (mz != NULL) {
+		idev = mz->addr;
+		idev->sso_pf_func = 0;
+		idev->npa_lf = NULL;
+		otx2_npa_set_defaults(idev);
+		return idev;
+	}
+	return NULL;
+}
+
+/**
+ * @internal
+ * Get SSO PF_FUNC.
+ */
+uint16_t
+otx2_sso_pf_func_get(void)
+{
+	struct otx2_idev_cfg *idev;
+	uint16_t sso_pf_func;
+
+	sso_pf_func = 0;
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL)
+		sso_pf_func = idev->sso_pf_func;
+
+	return sso_pf_func;
+}
+
+/**
+ * @internal
+ * Set SSO PF_FUNC.
+ */
+void
+otx2_sso_pf_func_set(uint16_t sso_pf_func)
+{
+	struct otx2_idev_cfg *idev;
+
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL) {
+		idev->sso_pf_func = sso_pf_func;
+		rte_smp_wmb();
+	}
+}
+
+/**
+ * @internal
+ * Get NPA PF_FUNC.
+ */
+uint16_t
+otx2_npa_pf_func_get(void)
+{
+	struct otx2_idev_cfg *idev;
+	uint16_t npa_pf_func;
+
+	npa_pf_func = 0;
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL)
+		npa_pf_func = idev->npa_pf_func;
+
+	return npa_pf_func;
+}
+
+/**
+ * @internal
+ * Get NPA lf object.
+ */
+struct otx2_npa_lf *
+otx2_npa_lf_obj_get(void)
+{
+	struct otx2_idev_cfg *idev;
+
+	idev = otx2_intra_dev_get_cfg();
+
+	if (idev != NULL && rte_atomic16_read(&idev->npa_refcnt))
+		return idev->npa_lf;
+
+	return NULL;
+}
+
+/**
+ * @internal
+ * Is NPA lf active for the given device?.
+ */
+int
+otx2_npa_lf_active(void *otx2_dev)
+{
+	struct otx2_dev *dev = otx2_dev;
+	struct otx2_idev_cfg *idev;
+
+	/* Check if npalf is actively used on this dev */
+	idev = otx2_intra_dev_get_cfg();
+	if (!idev || !idev->npa_lf || idev->npa_lf->mbox != dev->mbox)
+		return 0;
+
+	return rte_atomic16_read(&idev->npa_refcnt);
+}
+
+/*
+ * @internal
+ * Gets reference only to existing NPA LF object.
+ */
+int otx2_npa_lf_obj_ref(void)
+{
+	struct otx2_idev_cfg *idev;
+	uint16_t cnt;
+	int rc;
+
+	idev = otx2_intra_dev_get_cfg();
+
+	/* Check if ref not possible */
+	if (idev == NULL)
+		return -EINVAL;
+
+
+	/* Get ref only if > 0 */
+	cnt = rte_atomic16_read(&idev->npa_refcnt);
+	while (cnt != 0) {
+		rc = rte_atomic16_cmpset(&idev->npa_refcnt_u16, cnt, cnt + 1);
+		if (rc)
+			break;
+
+		cnt = rte_atomic16_read(&idev->npa_refcnt);
+	}
+
+	return cnt ? 0 : -EINVAL;
+}
 
 /**
  * @internal
drivers/common/octeontx2/otx2_common.h +31 -1
index b9e7a7f8d..cbc5c65a7 100644
@@ -5,9 +5,12 @@
 #ifndef _OTX2_COMMON_H_
 #define _OTX2_COMMON_H_
 
+#include <rte_atomic.h>
 #include <rte_common.h>
-#include <rte_io.h>
+#include <rte_cycles.h>
 #include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_io.h>
 
 #include "hw/otx2_rvu.h"
 #include "hw/otx2_nix.h"
@@ -33,6 +36,33 @@
 #define __hot   __attribute__((hot))
 #endif
 
+/* Intra device related functions */
+struct otx2_npa_lf {
+	struct otx2_mbox *mbox;
+	struct rte_pci_device *pci_dev;
+	struct rte_intr_handle *intr_handle;
+};
+
+struct otx2_idev_cfg {
+	uint16_t sso_pf_func;
+	uint16_t npa_pf_func;
+	struct otx2_npa_lf *npa_lf;
+	RTE_STD_C11
+	union {
+		rte_atomic16_t npa_refcnt;
+		uint16_t npa_refcnt_u16;
+	};
+};
+
+struct otx2_idev_cfg *otx2_intra_dev_get_cfg(void);
+void otx2_sso_pf_func_set(uint16_t sso_pf_func);
+uint16_t otx2_sso_pf_func_get(void);
+uint16_t otx2_npa_pf_func_get(void);
+struct otx2_npa_lf *otx2_npa_lf_obj_get(void);
+void otx2_npa_set_defaults(struct otx2_idev_cfg *idev);
+int otx2_npa_lf_active(void *dev);
+int otx2_npa_lf_obj_ref(void);
+
 /* Log */
 extern int otx2_logtype_base;
 extern int otx2_logtype_mbox;
drivers/common/octeontx2/otx2_dev.c +6 -0
index ccdb2df78..59bd988d1 100644
@@ -177,8 +177,14 @@ void
 otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 {
 	struct otx2_dev *dev = otx2_dev;
+	struct otx2_idev_cfg *idev;
 	struct otx2_mbox *mbox;
 
+	/* Clear references to this pci dev */
+	idev = otx2_intra_dev_get_cfg();
+	if (idev->npa_lf && idev->npa_lf->pci_dev == pci_dev)
+		idev->npa_lf = NULL;
+
 	/* Release PF - VF */
 	mbox = &dev->mbox_vfpf;
 	if (mbox->hwbase && mbox->dev)
drivers/common/octeontx2/otx2_dev.h +1 -0
index a89570b62..70104dfa2 100644
@@ -40,6 +40,7 @@ struct otx2_dev;
 	otx2_intr_t intr;				\
 	int timer_set;	/* ~0 : no alarm handling */	\
 	uint64_t hwcap;					\
+	struct otx2_npa_lf npalf;			\
 	struct otx2_mbox *mbox;				\
 	uint16_t maxvf;					\
 	const struct otx2_dev_ops *ops
drivers/common/octeontx2/rte_common_octeontx2_version.map +9 -0
index 2f8a607ee..602eb3651 100644
@@ -21,6 +21,15 @@ DPDK_19.05 {
 	otx2_mbox_msg_send;
 	otx2_mbox_wait_for_rsp;
 
+	otx2_intra_dev_get_cfg;
+	otx2_npa_lf_active;
+	otx2_npa_lf_obj_get;
+	otx2_npa_lf_obj_ref;
+	otx2_npa_pf_func_get;
+	otx2_npa_set_defaults;
+	otx2_sso_pf_func_get;
+	otx2_sso_pf_func_set;
+
 	otx2_disable_irqs;
 	otx2_unregister_irq;
 	otx2_register_irq;
Signature · 1 line
2.21.0
#40 lore raw

PATCH v2 10/27 common/octeontx2: add AF to PF mailbox IRQ and msg handlers

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

This patch adds support for AF to PF mailbox interrupt and message handling. PF writes the message on mapped mailbox region followed by writing the mailbox doorbell register. Upon receiving, the mailbox request in AF(In Linux kernel), It processes the messages and update the counter memory and update the AF mbox doorbell register. That would trigger a VFIO interrupt to userspace and otx2_process_msgs() will handle it.

---
 drivers/common/octeontx2/otx2_dev.c | 120 +++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_dev.c +119 -1
index 59bd988d1..ba4fd9547 100644
@@ -14,6 +14,9 @@
 #include "otx2_dev.h"
 #include "otx2_mbox.h"
 
+#define RVU_MAX_VF		64 /* RVU_PF_VFPF_MBOX_INT(0..1) */
+#define RVU_MAX_INT_RETRY	3
+
 /* PF/VF message handling timer */
 #define VF_PF_MBOX_TIMER_MS	(20 * 1000)
 
@@ -47,6 +50,108 @@ mbox_mem_unmap(void *va, size_t size)
 		munmap(va, size);
 }
 
+static void
+otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	int msgs_acked = 0;
+	int offset;
+	uint16_t i;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs == 0)
+		return;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+
+		msgs_acked++;
+		otx2_base_dbg("Message 0x%x (%s) pf:%d/vf:%d",
+			      msg->id, otx2_mbox_id2name(msg->id),
+			      otx2_get_pf(msg->pcifunc),
+			      otx2_get_vf(msg->pcifunc));
+
+		switch (msg->id) {
+			/* Add message id's that are handled here */
+		case MBOX_MSG_READY:
+			/* Get our identity */
+			dev->pf_func = msg->pcifunc;
+			break;
+
+		default:
+			if (msg->rc)
+				otx2_err("Message (%s) response has err=%d",
+					 otx2_mbox_id2name(msg->id), msg->rc);
+			break;
+		}
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+
+	otx2_mbox_reset(mbox, 0);
+	/* Update acked if someone is waiting a message */
+	mdev->msgs_acked = msgs_acked;
+	rte_wmb();
+}
+
+static void
+otx2_af_pf_mbox_irq(void *param)
+{
+	struct otx2_dev *dev = param;
+	uint64_t intr;
+
+	intr = otx2_read64(dev->bar2 + RVU_PF_INT);
+	if (intr == 0)
+		return;
+
+	otx2_write64(intr, dev->bar2 + RVU_PF_INT);
+
+	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
+	if (intr)
+		/* First process all configuration messages */
+		otx2_process_msgs(dev, dev->mbox);
+}
+
+static int
+mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int rc;
+
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	dev->timer_set = 0;
+
+	/* MBOX interrupt AF <-> PF */
+	rc = otx2_register_irq(intr_handle, otx2_af_pf_mbox_irq,
+			       dev, RVU_PF_INT_VEC_AFPF_MBOX);
+	if (rc) {
+		otx2_err("Fail to register AF<->PF mbox irq");
+		return rc;
+	}
+
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT);
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
+
+	return rc;
+}
+
+static void
+mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	dev->timer_set = 0;
+
+	/* MBOX interrupt AF <-> PF */
+	otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev,
+			    RVU_PF_INT_VEC_AFPF_MBOX);
+}
+
 static void
 otx2_update_pass_hwcap(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
@@ -120,10 +225,15 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 	if (rc)
 		goto error;
 
+	/* Register mbox interrupts */
+	rc = mbox_register_irq(pci_dev, dev);
+	if (rc)
+		goto mbox_fini;
+
 	/* Check the readiness of PF/VF */
 	rc = otx2_send_ready_msg(dev->mbox, &dev->pf_func);
 	if (rc)
-		goto mbox_fini;
+		goto mbox_unregister;
 
 	dev->pf = otx2_get_pf(dev->pf_func);
 	dev->vf = otx2_get_vf(dev->pf_func);
@@ -162,6 +272,8 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 
 iounmap:
 	mbox_mem_unmap(hwbase, MBOX_SIZE * pci_dev->max_vfs);
+mbox_unregister:
+	mbox_unregister_irq(pci_dev, dev);
 mbox_fini:
 	otx2_mbox_fini(dev->mbox);
 	otx2_mbox_fini(&dev->mbox_up);
@@ -176,6 +288,7 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 void
 otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 {
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct otx2_dev *dev = otx2_dev;
 	struct otx2_idev_cfg *idev;
 	struct otx2_mbox *mbox;
@@ -185,6 +298,8 @@ otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 	if (idev->npa_lf && idev->npa_lf->pci_dev == pci_dev)
 		idev->npa_lf = NULL;
 
+	mbox_unregister_irq(pci_dev, dev);
+
 	/* Release PF - VF */
 	mbox = &dev->mbox_vfpf;
 	if (mbox->hwbase && mbox->dev)
@@ -200,4 +315,7 @@ otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 	mbox = &dev->mbox_up;
 	otx2_mbox_fini(mbox);
 	dev->mbox_active = 0;
+
+	/* Disable MSIX vectors */
+	otx2_disable_irqs(intr_handle);
 }
Signature · 1 line
2.21.0
#41 lore raw

PATCH v2 11/27 common/octeontx2: add PF to VF mailbox IRQ and msg handlers

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

PF has additional responsibility being server for VF messages and forward to AF and once AF process it then forward the response back to VF.
otx2_vf_pf_mbox_irq() will process the VF mailbox request and af_pf_wait_msg() will until getting a response back from AF.

---
 drivers/common/octeontx2/otx2_dev.c | 240 +++++++++++++++++++++++++++-
 1 file changed, 239 insertions(+), 1 deletion(-)
drivers/common/octeontx2/otx2_dev.c +239 -1
index ba4fd9547..09b551819 100644
@@ -7,6 +7,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <rte_alarm.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_memcpy.h>
@@ -50,6 +51,200 @@ mbox_mem_unmap(void *va, size_t size)
 		munmap(va, size);
 }
 
+static int
+af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
+{
+	uint32_t timeout = 0, sleep = 1; struct otx2_mbox *mbox = dev->mbox;
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	volatile uint64_t int_status;
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	struct mbox_msghdr *rsp;
+	uint64_t offset;
+	size_t size;
+	int i;
+
+	/* We need to disable PF interrupts. We are in timer interrupt */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	/* Send message */
+	otx2_mbox_msg_send(mbox, 0);
+
+	do {
+		rte_delay_ms(sleep);
+		timeout++;
+		if (timeout >= MBOX_RSP_TIMEOUT) {
+			otx2_err("Routed messages %d timeout: %dms",
+				 num_msg, MBOX_RSP_TIMEOUT);
+			break;
+		}
+		int_status = otx2_read64(dev->bar2 + RVU_PF_INT);
+	} while ((int_status & 0x1) != 0x1);
+
+	/* Clear */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT);
+
+	/* Enable interrupts */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
+
+	rte_spinlock_lock(&mdev->mbox_lock);
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs != num_msg)
+		otx2_err("Routed messages: %d received: %d", num_msg,
+			 req_hdr->num_msgs);
+
+	/* Get messages from mbox */
+	offset = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+		size = mbox->rx_start + msg->next_msgoff - offset;
+
+		/* Reserve PF/VF mbox message */
+		size = RTE_ALIGN(size, MBOX_MSG_ALIGN);
+		rsp = otx2_mbox_alloc_msg(&dev->mbox_vfpf, vf, size);
+		otx2_mbox_rsp_init(msg->id, rsp);
+
+		/* Copy message from AF<->PF mbox to PF<->VF mbox */
+		otx2_mbox_memcpy((uint8_t *)rsp + sizeof(struct mbox_msghdr),
+				 (uint8_t *)msg + sizeof(struct mbox_msghdr),
+				 size - sizeof(struct mbox_msghdr));
+
+		/* Set status and sender pf_func data */
+		rsp->rc = msg->rc;
+		rsp->pcifunc = msg->pcifunc;
+
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+	rte_spinlock_unlock(&mdev->mbox_lock);
+
+	return req_hdr->num_msgs;
+}
+
+static int
+vf_pf_process_msgs(struct otx2_dev *dev, uint16_t vf)
+{
+	int offset, routed = 0; struct otx2_mbox *mbox = &dev->mbox_vfpf;
+	struct otx2_mbox_dev *mdev = &mbox->dev[vf];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	size_t size;
+	uint16_t i;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (!req_hdr->num_msgs)
+		return 0;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+		size = mbox->rx_start + msg->next_msgoff - offset;
+
+		/* RVU_PF_FUNC_S */
+		msg->pcifunc = otx2_pfvf_func(dev->pf, vf);
+
+		if (msg->id == MBOX_MSG_READY) {
+			struct ready_msg_rsp *rsp;
+			uint16_t max_bits = sizeof(dev->active_vfs[0]) * 8;
+
+			/* Handle READY message in PF */
+			dev->active_vfs[vf / max_bits] |=
+						BIT_ULL(vf % max_bits);
+			rsp = (struct ready_msg_rsp *)
+			       otx2_mbox_alloc_msg(mbox, vf, sizeof(*rsp));
+			otx2_mbox_rsp_init(msg->id, rsp);
+
+			/* PF/VF function ID */
+			rsp->hdr.pcifunc = msg->pcifunc;
+			rsp->hdr.rc = 0;
+		} else {
+			struct mbox_msghdr *af_req;
+			/* Reserve AF/PF mbox message */
+			size = RTE_ALIGN(size, MBOX_MSG_ALIGN);
+			af_req = otx2_mbox_alloc_msg(dev->mbox, 0, size);
+			otx2_mbox_req_init(msg->id, af_req);
+
+			/* Copy message from VF<->PF mbox to PF<->AF mbox */
+			otx2_mbox_memcpy((uint8_t *)af_req +
+				   sizeof(struct mbox_msghdr),
+				   (uint8_t *)msg + sizeof(struct mbox_msghdr),
+				   size - sizeof(struct mbox_msghdr));
+			af_req->pcifunc = msg->pcifunc;
+			routed++;
+		}
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+
+	if (routed > 0) {
+		otx2_base_dbg("pf:%d routed %d messages from vf:%d to AF",
+			      dev->pf, routed, vf);
+		af_pf_wait_msg(dev, vf, routed);
+		otx2_mbox_reset(dev->mbox, 0);
+	}
+
+	/* Send mbox responses to VF */
+	if (mdev->num_msgs) {
+		otx2_base_dbg("pf:%d reply %d messages to vf:%d",
+			      dev->pf, mdev->num_msgs, vf);
+		otx2_mbox_msg_send(mbox, vf);
+	}
+
+	return i;
+}
+
+static void
+otx2_vf_pf_mbox_handle_msg(void *param)
+{
+	uint16_t vf, max_vf, max_bits;
+	struct otx2_dev *dev = param;
+
+	max_bits = sizeof(dev->intr.bits[0]) * sizeof(uint64_t);
+	max_vf = max_bits * MAX_VFPF_DWORD_BITS;
+
+	for (vf = 0; vf < max_vf; vf++) {
+		if (dev->intr.bits[vf/max_bits] & BIT_ULL(vf%max_bits)) {
+			otx2_base_dbg("Process vf:%d request (pf:%d, vf:%d)",
+				       vf, dev->pf, dev->vf);
+			vf_pf_process_msgs(dev, vf);
+			dev->intr.bits[vf/max_bits] &= ~(BIT_ULL(vf%max_bits));
+		}
+	}
+	dev->timer_set = 0;
+}
+
+static void
+otx2_vf_pf_mbox_irq(void *param)
+{
+	struct otx2_dev *dev = param;
+	bool alarm_set = false;
+	uint64_t intr;
+	int vfpf;
+
+	for (vfpf = 0; vfpf < MAX_VFPF_DWORD_BITS; ++vfpf) {
+		intr = otx2_read64(dev->bar2 + RVU_PF_VFPF_MBOX_INTX(vfpf));
+		if (!intr)
+			continue;
+
+		otx2_base_dbg("vfpf: %d intr: 0x%" PRIx64 " (pf:%d, vf:%d)",
+			      vfpf, intr, dev->pf, dev->vf);
+
+		/* Save and clear intr bits */
+		dev->intr.bits[vfpf] |= intr;
+		otx2_write64(intr, dev->bar2 + RVU_PF_VFPF_MBOX_INTX(vfpf));
+		alarm_set = true;
+	}
+
+	if (!dev->timer_set && alarm_set) {
+		dev->timer_set = 1;
+		/* Start timer to handle messages */
+		rte_eal_alarm_set(VF_PF_MBOX_TIMER_MS,
+				  otx2_vf_pf_mbox_handle_msg, dev);
+	}
+}
+
 static void
 otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
 {
@@ -118,12 +313,33 @@ static int
 mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
-	int rc;
+	int i, rc;
+
+	/* HW clear irq */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i)
+		otx2_write64(~0ull, dev->bar2 +
+			     RVU_PF_VFPF_MBOX_INT_ENA_W1CX(i));
 
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
 
 	dev->timer_set = 0;
 
+	/* MBOX interrupt for VF(0...63) <-> PF */
+	rc = otx2_register_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			       RVU_PF_INT_VEC_VFPF_MBOX0);
+
+	if (rc) {
+		otx2_err("Fail to register PF(VF0-63) mbox irq");
+		return rc;
+	}
+	/* MBOX interrupt for VF(64...128) <-> PF */
+	rc = otx2_register_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			       RVU_PF_INT_VEC_VFPF_MBOX1);
+
+	if (rc) {
+		otx2_err("Fail to register PF(VF64-128) mbox irq");
+		return rc;
+	}
 	/* MBOX interrupt AF <-> PF */
 	rc = otx2_register_irq(intr_handle, otx2_af_pf_mbox_irq,
 			       dev, RVU_PF_INT_VEC_AFPF_MBOX);
@@ -132,6 +348,11 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 		return rc;
 	}
 
+	/* HW enable intr */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i)
+		otx2_write64(~0ull, dev->bar2 +
+			RVU_PF_VFPF_MBOX_INT_ENA_W1SX(i));
+
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT);
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
 
@@ -142,11 +363,28 @@ static void
 mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int i;
+
+	/* HW clear irq */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i)
+		otx2_write64(~0ull, dev->bar2 +
+			     RVU_PF_VFPF_MBOX_INT_ENA_W1CX(i));
 
 	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
 
 	dev->timer_set = 0;
 
+	rte_eal_alarm_cancel(otx2_vf_pf_mbox_handle_msg, dev);
+
+	/* Unregister the interrupt handler for each vectors */
+	/* MBOX interrupt for VF(0...63) <-> PF */
+	otx2_unregister_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			    RVU_PF_INT_VEC_VFPF_MBOX0);
+
+	/* MBOX interrupt for VF(64...128) <-> PF */
+	otx2_unregister_irq(intr_handle, otx2_vf_pf_mbox_irq, dev,
+			    RVU_PF_INT_VEC_VFPF_MBOX1);
+
 	/* MBOX interrupt AF <-> PF */
 	otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev,
 			    RVU_PF_INT_VEC_AFPF_MBOX);
Signature · 1 line
2.21.0
#42 lore raw

PATCH v2 12/27 common/octeontx2: add VF mailbox IRQ and msg handler

In reply to [email protected]

From: Jerin Jacob <[email protected]>

This patch adds support for PF <-> VF mailbox interrupt mailbox message interrupt handling.

---
 drivers/common/octeontx2/otx2_dev.c | 78 ++++++++++++++++++++++++++++-
 1 file changed, 76 insertions(+), 2 deletions(-)
drivers/common/octeontx2/otx2_dev.c +76 -2
index 09b551819..fc6dca624 100644
@@ -291,6 +291,24 @@ otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
 	rte_wmb();
 }
 
+static void
+otx2_pf_vf_mbox_irq(void *param)
+{
+	struct otx2_dev *dev = param;
+	uint64_t intr;
+
+	intr = otx2_read64(dev->bar2 + RVU_VF_INT);
+	if (intr == 0)
+		return;
+
+	otx2_write64(intr, dev->bar2 + RVU_VF_INT);
+	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
+	if (intr)
+		/* First process all configuration messages */
+		otx2_process_msgs(dev, dev->mbox);
+
+}
+
 static void
 otx2_af_pf_mbox_irq(void *param)
 {
@@ -310,7 +328,7 @@ otx2_af_pf_mbox_irq(void *param)
 }
 
 static int
-mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+mbox_register_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i, rc;
@@ -359,8 +377,41 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 	return rc;
 }
 
+static int
+mbox_register_vf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int rc;
+
+	/* Clear irq */
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1C);
+
+	/* MBOX interrupt PF <-> VF */
+	rc = otx2_register_irq(intr_handle, otx2_pf_vf_mbox_irq,
+			       dev, RVU_VF_INT_VEC_MBOX);
+	if (rc) {
+		otx2_err("Fail to register PF<->VF mbox irq");
+		return rc;
+	}
+
+	/* HW enable intr */
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT);
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1S);
+
+	return rc;
+}
+
+static int
+mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	if (otx2_dev_is_vf(dev))
+		return mbox_register_vf_irq(pci_dev, dev);
+	else
+		return mbox_register_pf_irq(pci_dev, dev);
+}
+
 static void
-mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+mbox_unregister_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i;
@@ -388,6 +439,29 @@ mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 	/* MBOX interrupt AF <-> PF */
 	otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev,
 			    RVU_PF_INT_VEC_AFPF_MBOX);
+
+}
+
+static void
+mbox_unregister_vf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+
+	/* Clear irq */
+	otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1C);
+
+	/* Unregister the interrupt handler */
+	otx2_unregister_irq(intr_handle, otx2_pf_vf_mbox_irq, dev,
+			    RVU_VF_INT_VEC_MBOX);
+}
+
+static void
+mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	if (otx2_dev_is_vf(dev))
+		return mbox_unregister_vf_irq(pci_dev, dev);
+	else
+		return mbox_unregister_pf_irq(pci_dev, dev);
 }
 
 static void
Signature · 1 line
2.21.0
#43 lore raw

PATCH v2 13/27 common/octeontx2: add uplink message support

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

The events like PHY link status change by AF or PHY configuration change by PF would call for the uplink message.
The AF initiated uplink would land it in PF and PF would further forward to VF(if it is intended for that specific VF)

The PF initiated uplink would be distributed to all active VFs. This patch adds support for the same.

---
 drivers/common/octeontx2/otx2_dev.c | 243 +++++++++++++++++++++++++++-
 drivers/common/octeontx2/otx2_dev.h |  11 ++
 2 files changed, 252 insertions(+), 2 deletions(-)
drivers/common/octeontx2/otx2_dev.c +241 -2
index fc6dca624..3522a1783 100644
@@ -195,6 +195,57 @@ vf_pf_process_msgs(struct otx2_dev *dev, uint16_t vf)
 	return i;
 }
 
+static int
+vf_pf_process_up_msgs(struct otx2_dev *dev, uint16_t vf)
+{
+	struct otx2_mbox *mbox = &dev->mbox_vfpf_up;
+	struct otx2_mbox_dev *mdev = &mbox->dev[vf];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	int msgs_acked = 0;
+	int offset;
+	uint16_t i;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs == 0)
+		return 0;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+
+		msgs_acked++;
+		/* RVU_PF_FUNC_S */
+		msg->pcifunc = otx2_pfvf_func(dev->pf, vf);
+
+		switch (msg->id) {
+		case MBOX_MSG_CGX_LINK_EVENT:
+			otx2_base_dbg("PF: Msg 0x%x (%s) fn:0x%x (pf:%d,vf:%d)",
+				      msg->id, otx2_mbox_id2name(msg->id),
+				      msg->pcifunc, otx2_get_pf(msg->pcifunc),
+				      otx2_get_vf(msg->pcifunc));
+			break;
+		case MBOX_MSG_CGX_PTP_RX_INFO:
+			otx2_base_dbg("PF: Msg 0x%x (%s) fn:0x%x (pf:%d,vf:%d)",
+				      msg->id, otx2_mbox_id2name(msg->id),
+				      msg->pcifunc, otx2_get_pf(msg->pcifunc),
+				      otx2_get_vf(msg->pcifunc));
+			break;
+		default:
+			otx2_err("Not handled UP msg 0x%x (%s) func:0x%x",
+				 msg->id, otx2_mbox_id2name(msg->id),
+				 msg->pcifunc);
+		}
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+	otx2_mbox_reset(mbox, vf);
+	mdev->msgs_acked = msgs_acked;
+	rte_wmb();
+
+	return i;
+}
+
 static void
 otx2_vf_pf_mbox_handle_msg(void *param)
 {
@@ -209,6 +260,8 @@ otx2_vf_pf_mbox_handle_msg(void *param)
 			otx2_base_dbg("Process vf:%d request (pf:%d, vf:%d)",
 				       vf, dev->pf, dev->vf);
 			vf_pf_process_msgs(dev, vf);
+			/* UP messages */
+			vf_pf_process_up_msgs(dev, vf);
 			dev->intr.bits[vf/max_bits] &= ~(BIT_ULL(vf%max_bits));
 		}
 	}
@@ -291,6 +344,185 @@ otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox)
 	rte_wmb();
 }
 
+/* Copies the message received from AF and sends it to VF */
+static void
+pf_vf_mbox_send_up_msg(struct otx2_dev *dev, void *rec_msg)
+{
+	uint16_t max_bits = sizeof(dev->active_vfs[0]) * sizeof(uint64_t);
+	struct otx2_mbox *vf_mbox = &dev->mbox_vfpf_up;
+	struct msg_req *msg = rec_msg;
+	struct mbox_msghdr *vf_msg;
+	uint16_t vf;
+	size_t size;
+
+	size = RTE_ALIGN(otx2_mbox_id2size(msg->hdr.id), MBOX_MSG_ALIGN);
+	/* Send UP message to all VF's */
+	for (vf = 0; vf < vf_mbox->ndevs; vf++) {
+		/* VF active */
+		if (!(dev->active_vfs[vf / max_bits] & (BIT_ULL(vf))))
+			continue;
+
+		otx2_base_dbg("(%s) size: %zx to VF: %d",
+			      otx2_mbox_id2name(msg->hdr.id), size, vf);
+
+		/* Reserve PF/VF mbox message */
+		vf_msg = otx2_mbox_alloc_msg(vf_mbox, vf, size);
+		if (!vf_msg) {
+			otx2_err("Failed to alloc VF%d UP message", vf);
+			continue;
+		}
+		otx2_mbox_req_init(msg->hdr.id, vf_msg);
+
+		/*
+		 * Copy message from AF<->PF UP mbox
+		 * to PF<->VF UP mbox
+		 */
+		otx2_mbox_memcpy((uint8_t *)vf_msg +
+				 sizeof(struct mbox_msghdr), (uint8_t *)msg
+				 + sizeof(struct mbox_msghdr), size -
+				 sizeof(struct mbox_msghdr));
+
+		vf_msg->rc = msg->hdr.rc;
+		/* Set PF to be a sender */
+		vf_msg->pcifunc = dev->pf_func;
+
+		/* Send to VF */
+		otx2_mbox_msg_send(vf_mbox, vf);
+	}
+}
+
+static int
+otx2_mbox_up_handler_cgx_link_event(struct otx2_dev *dev,
+				    struct cgx_link_info_msg *msg,
+				    struct msg_rsp *rsp)
+{
+	struct cgx_link_user_info *linfo = &msg->link_info;
+
+	otx2_base_dbg("pf:%d/vf:%d NIC Link %s --> 0x%x (%s) from: pf:%d/vf:%d",
+		      otx2_get_pf(dev->pf_func), otx2_get_vf(dev->pf_func),
+		      linfo->link_up ? "UP" : "DOWN", msg->hdr.id,
+		      otx2_mbox_id2name(msg->hdr.id),
+		      otx2_get_pf(msg->hdr.pcifunc),
+		      otx2_get_vf(msg->hdr.pcifunc));
+
+	/* PF gets link notification from AF */
+	if (otx2_get_pf(msg->hdr.pcifunc) == 0) {
+		if (dev->ops && dev->ops->link_status_update)
+			dev->ops->link_status_update(dev, linfo);
+
+		/* Forward the same message as received from AF to VF */
+		pf_vf_mbox_send_up_msg(dev, msg);
+	} else {
+		/* VF gets link up notification */
+		if (dev->ops && dev->ops->link_status_update)
+			dev->ops->link_status_update(dev, linfo);
+	}
+
+	rsp->hdr.rc = 0;
+	return 0;
+}
+
+static int
+otx2_mbox_up_handler_cgx_ptp_rx_info(struct otx2_dev *dev,
+				     struct cgx_ptp_rx_info_msg *msg,
+				     struct msg_rsp *rsp)
+{
+	otx2_nix_dbg("pf:%d/vf:%d PTP mode %s --> 0x%x (%s) from: pf:%d/vf:%d",
+		 otx2_get_pf(dev->pf_func),
+		 otx2_get_vf(dev->pf_func),
+		 msg->ptp_en ? "ENABLED" : "DISABLED",
+		 msg->hdr.id, otx2_mbox_id2name(msg->hdr.id),
+		 otx2_get_pf(msg->hdr.pcifunc),
+		 otx2_get_vf(msg->hdr.pcifunc));
+
+	/* PF gets PTP notification from AF */
+	if (otx2_get_pf(msg->hdr.pcifunc) == 0) {
+		if (dev->ops && dev->ops->ptp_info_update)
+			dev->ops->ptp_info_update(dev, msg->ptp_en);
+
+		/* Forward the same message as received from AF to VF */
+		pf_vf_mbox_send_up_msg(dev, msg);
+	} else {
+		/* VF gets PTP notification */
+		if (dev->ops && dev->ops->ptp_info_update)
+			dev->ops->ptp_info_update(dev, msg->ptp_en);
+	}
+
+	rsp->hdr.rc = 0;
+	return 0;
+}
+
+static int
+mbox_process_msgs_up(struct otx2_dev *dev, struct mbox_msghdr *req)
+{
+	/* Check if valid, if not reply with a invalid msg */
+	if (req->sig != OTX2_MBOX_REQ_SIG)
+		return -EIO;
+
+	switch (req->id) {
+#define M(_name, _id, _fn_name, _req_type, _rsp_type)		\
+	case _id: {						\
+		struct _rsp_type *rsp;				\
+		int err;					\
+								\
+		rsp = (struct _rsp_type *)otx2_mbox_alloc_msg(	\
+			&dev->mbox_up, 0,			\
+			sizeof(struct _rsp_type));		\
+		if (!rsp)					\
+			return -ENOMEM;				\
+								\
+		rsp->hdr.id = _id;				\
+		rsp->hdr.sig = OTX2_MBOX_RSP_SIG;		\
+		rsp->hdr.pcifunc = dev->pf_func;		\
+		rsp->hdr.rc = 0;				\
+								\
+		err = otx2_mbox_up_handler_ ## _fn_name(	\
+			dev, (struct _req_type *)req, rsp);	\
+		return err;					\
+	}
+MBOX_UP_CGX_MESSAGES
+#undef M
+
+	default :
+		otx2_reply_invalid_msg(&dev->mbox_up, 0, 0, req->id);
+	}
+
+	return -ENODEV;
+}
+
+static void
+otx2_process_msgs_up(struct otx2_dev *dev, struct otx2_mbox *mbox)
+{
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	struct mbox_hdr *req_hdr;
+	struct mbox_msghdr *msg;
+	int i, err, offset;
+
+	req_hdr = (struct mbox_hdr *)((uintptr_t)mdev->mbase + mbox->rx_start);
+	if (req_hdr->num_msgs == 0)
+		return;
+
+	offset = mbox->rx_start + RTE_ALIGN(sizeof(*req_hdr), MBOX_MSG_ALIGN);
+	for (i = 0; i < req_hdr->num_msgs; i++) {
+		msg = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + offset);
+
+		otx2_base_dbg("Message 0x%x (%s) pf:%d/vf:%d",
+				msg->id, otx2_mbox_id2name(msg->id),
+				otx2_get_pf(msg->pcifunc),
+				otx2_get_vf(msg->pcifunc));
+		err = mbox_process_msgs_up(dev, msg);
+		if (err)
+			otx2_err("Error %d handling 0x%x (%s)",
+				 err, msg->id, otx2_mbox_id2name(msg->id));
+		offset = mbox->rx_start + msg->next_msgoff;
+	}
+	/* Send mbox responses */
+	if (mdev->num_msgs) {
+		otx2_base_dbg("Reply num_msgs:%d", mdev->num_msgs);
+		otx2_mbox_msg_send(mbox, 0);
+	}
+}
+
 static void
 otx2_pf_vf_mbox_irq(void *param)
 {
@@ -303,10 +535,13 @@ otx2_pf_vf_mbox_irq(void *param)
 
 	otx2_write64(intr, dev->bar2 + RVU_VF_INT);
 	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
-	if (intr)
+	if (intr) {
 		/* First process all configuration messages */
 		otx2_process_msgs(dev, dev->mbox);
 
+		/* Process Uplink messages */
+		otx2_process_msgs_up(dev, &dev->mbox_up);
+	}
 }
 
 static void
@@ -322,9 +557,13 @@ otx2_af_pf_mbox_irq(void *param)
 	otx2_write64(intr, dev->bar2 + RVU_PF_INT);
 
 	otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf);
-	if (intr)
+	if (intr) {
 		/* First process all configuration messages */
 		otx2_process_msgs(dev, dev->mbox);
+
+		/* Process Uplink messages */
+		otx2_process_msgs_up(dev, &dev->mbox_up);
+	}
 }
 
 static int
drivers/common/octeontx2/otx2_dev.h +11 -0
index 70104dfa2..8fa5f32d2 100644
@@ -23,6 +23,17 @@
 
 struct otx2_dev;
 
+/* Link status callback */
+typedef void (*otx2_link_status_t)(struct otx2_dev *dev,
+				   struct cgx_link_user_info *link);
+/* PTP info callback */
+typedef int (*otx2_ptp_info_t)(struct otx2_dev *dev, bool ptp_en);
+
+struct otx2_dev_ops {
+	otx2_link_status_t link_status_update;
+	otx2_ptp_info_t ptp_info_update;
+};
+
 #define OTX2_DEV					\
 	int node __rte_cache_aligned;			\
 	uint16_t pf;					\
Signature · 1 line
2.21.0
#44 lore raw

PATCH v2 14/27 common/octeontx2: add FLR IRQ handler

In reply to [email protected]

From: Nithin Dabilpuram <[email protected]>

Upon receiving FLR request from VF, It is PF responsibly forward to AF and enable FLR for VFs.

This patch adds support for VF FLR support in PF.

This patch also add otx2_dev_active_vfs() API to find the number of active VF for given PF.

---
 drivers/common/octeontx2/otx2_dev.c           | 180 ++++++++++++++++++
 .../rte_common_octeontx2_version.map          |   1 +
 2 files changed, 181 insertions(+)
drivers/common/octeontx2/otx2_dev.c +180 -0
index 3522a1783..a75f79101 100644
@@ -51,6 +51,52 @@ mbox_mem_unmap(void *va, size_t size)
 		munmap(va, size);
 }
 
+static int
+pf_af_sync_msg(struct otx2_dev *dev, struct mbox_msghdr **rsp)
+{
+	uint32_t timeout = 0, sleep = 1; struct otx2_mbox *mbox = dev->mbox;
+	struct otx2_mbox_dev *mdev = &mbox->dev[0];
+	volatile uint64_t int_status;
+	struct mbox_msghdr *msghdr;
+	uint64_t off;
+	int rc = 0;
+
+	/* We need to disable PF interrupts. We are in timer interrupt */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C);
+
+	/* Send message */
+	otx2_mbox_msg_send(mbox, 0);
+
+	do {
+		rte_delay_ms(sleep);
+		timeout += sleep;
+		if (timeout >= MBOX_RSP_TIMEOUT) {
+			otx2_err("Message timeout: %dms", MBOX_RSP_TIMEOUT);
+			rc = -EIO;
+			break;
+		}
+		int_status = otx2_read64(dev->bar2 + RVU_PF_INT);
+	} while ((int_status & 0x1) != 0x1);
+
+	/* Clear */
+	otx2_write64(int_status, dev->bar2 + RVU_PF_INT);
+
+	/* Enable interrupts */
+	otx2_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1S);
+
+	if (rc == 0) {
+		/* Get message */
+		off = mbox->rx_start +
+			RTE_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
+		msghdr = (struct mbox_msghdr *)((uintptr_t)mdev->mbase + off);
+		if (rsp)
+			*rsp = msghdr;
+		rc = msghdr->rc;
+	}
+
+	return rc;
+}
+
 static int
 af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
 {
@@ -703,6 +749,132 @@ mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 		return mbox_unregister_pf_irq(pci_dev, dev);
 }
 
+static int
+vf_flr_send_msg(struct otx2_dev *dev, uint16_t vf)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+	struct msg_req *req;
+	int rc;
+
+	req = otx2_mbox_alloc_msg_vf_flr(mbox);
+	/* Overwrite pcifunc to indicate VF */
+	req->hdr.pcifunc = otx2_pfvf_func(dev->pf, vf);
+
+	/* Sync message in interrupt context */
+	rc = pf_af_sync_msg(dev, NULL);
+	if (rc)
+		otx2_err("Failed to send VF FLR mbox msg, rc=%d", rc);
+
+	return rc;
+}
+
+static void
+otx2_pf_vf_flr_irq(void *param)
+{
+	struct otx2_dev *dev = (struct otx2_dev *)param;
+	uint16_t max_vf = 64, vf;
+	uintptr_t bar2;
+	uint64_t intr;
+	int i;
+
+	max_vf = (dev->maxvf > 0) ? dev->maxvf : 64;
+	bar2 = dev->bar2;
+
+	otx2_base_dbg("FLR VF interrupt: max_vf: %d", max_vf);
+
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i) {
+		intr = otx2_read64(bar2 + RVU_PF_VFFLR_INTX(i));
+		if (!intr)
+			continue;
+
+		for (vf = 0; vf < max_vf; vf++) {
+			if (!(intr & (1ULL << vf)))
+				continue;
+
+			vf = 64 * i + vf;
+			otx2_base_dbg("FLR: i :%d intr: 0x%" PRIx64 ", vf-%d",
+				      i, intr, vf);
+			/* Clear interrupt */
+			otx2_write64(BIT_ULL(vf), bar2 + RVU_PF_VFFLR_INTX(i));
+			/* Disable the interrupt */
+			otx2_write64(BIT_ULL(vf),
+				     bar2 + RVU_PF_VFFLR_INT_ENA_W1CX(i));
+			/* Inform AF about VF reset */
+			vf_flr_send_msg(dev, vf);
+
+			/* Signal FLR finish */
+			otx2_write64(BIT_ULL(vf), bar2 + RVU_PF_VFTRPENDX(i));
+			/* Enable interrupt */
+			otx2_write64(~0ull,
+				     bar2 + RVU_PF_VFFLR_INT_ENA_W1SX(i));
+		}
+	}
+}
+
+static int
+vf_flr_unregister_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	int i;
+
+	otx2_base_dbg("Unregister VF FLR interrupts for %s", pci_dev->name);
+
+	/* HW clear irq */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; i++)
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFFLR_INT_ENA_W1CX(i));
+
+	otx2_unregister_irq(intr_handle, otx2_pf_vf_flr_irq, dev,
+			    RVU_PF_INT_VEC_VFFLR0);
+
+	otx2_unregister_irq(intr_handle, otx2_pf_vf_flr_irq, dev,
+			    RVU_PF_INT_VEC_VFFLR1);
+
+	return 0;
+}
+
+static int
+vf_flr_register_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
+{
+	struct rte_intr_handle *handle = &pci_dev->intr_handle;
+	int i, rc;
+
+	otx2_base_dbg("Register VF FLR interrupts for %s", pci_dev->name);
+
+	rc = otx2_register_irq(handle, otx2_pf_vf_flr_irq, dev,
+			       RVU_PF_INT_VEC_VFFLR0);
+	if (rc)
+		otx2_err("Failed to init RVU_PF_INT_VEC_VFFLR0 rc=%d", rc);
+
+	rc = otx2_register_irq(handle, otx2_pf_vf_flr_irq, dev,
+			       RVU_PF_INT_VEC_VFFLR1);
+	if (rc)
+		otx2_err("Failed to init RVU_PF_INT_VEC_VFFLR1 rc=%d", rc);
+
+	/* Enable HW interrupt */
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; ++i) {
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFFLR_INTX(i));
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFTRPENDX(i));
+		otx2_write64(~0ull, dev->bar2 + RVU_PF_VFFLR_INT_ENA_W1SX(i));
+	}
+	return 0;
+}
+
+/**
+ * @internal
+ * Get number of active VFs for the given PF device.
+ */
+int
+otx2_dev_active_vfs(void *otx2_dev)
+{
+	struct otx2_dev *dev = otx2_dev;
+	int i, count = 0;
+
+	for (i = 0; i < MAX_VFPF_DWORD_BITS; i++)
+		count += __builtin_popcount(dev->active_vfs[i]);
+
+	return count;
+}
+
 static void
 otx2_update_pass_hwcap(struct rte_pci_device *pci_dev, struct otx2_dev *dev)
 {
@@ -818,6 +990,12 @@ otx2_dev_init(struct rte_pci_device *pci_dev, void *otx2_dev)
 			goto mbox_fini;
 	}
 
+	/* Register VF-FLR irq handlers */
+	if (otx2_dev_is_pf(dev)) {
+		rc = vf_flr_register_irqs(pci_dev, dev);
+		if (rc)
+			goto iounmap;
+	}
 	dev->mbox_active = 1;
 	return rc;
 
@@ -851,6 +1029,8 @@ otx2_dev_fini(struct rte_pci_device *pci_dev, void *otx2_dev)
 
 	mbox_unregister_irq(pci_dev, dev);
 
+	if (otx2_dev_is_pf(dev))
+		vf_flr_unregister_irqs(pci_dev, dev);
 	/* Release PF - VF */
 	mbox = &dev->mbox_vfpf;
 	if (mbox->hwbase && mbox->dev)
drivers/common/octeontx2/rte_common_octeontx2_version.map +1 -0
index 602eb3651..858de2d3e 100644
@@ -1,6 +1,7 @@
 DPDK_19.05 {
 	global:
 
+	otx2_dev_active_vfs;
 	otx2_dev_fini;
 	otx2_dev_init;
 
Signature · 1 line
2.21.0