Add Marvell CNXK common driver
PATCH v4 2/52 common/cnxk: add build infrastructre and HW definition
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add meson build infrastructure along with HW definition header file.
This patch also adds cross-compile configs for arm for CN9K series and CN10K series of Marvell SoC's.
--- drivers/common/cnxk/hw/nix.h | 2191 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/hw/npa.h | 376 +++++++ drivers/common/cnxk/hw/npc.h | 525 +++++++++ drivers/common/cnxk/hw/rvu.h | 222 ++++ drivers/common/cnxk/hw/sdp.h | 182 +++ drivers/common/cnxk/hw/sso.h | 233 ++++ drivers/common/cnxk/hw/ssow.h | 70 ++ drivers/common/cnxk/hw/tim.h | 49 + drivers/common/cnxk/meson.build | 14 + drivers/common/cnxk/roc_api.h | 69 ++ drivers/common/cnxk/roc_bitfield.h | 15 + drivers/common/cnxk/roc_bits.h | 32 + drivers/common/cnxk/roc_platform.c | 5 + drivers/common/cnxk/roc_platform.h | 154 +++ drivers/common/cnxk/version.map | 4 + drivers/meson.build | 1 + 16 files changed, 4142 insertions(+) create mode 100644 drivers/common/cnxk/hw/nix.h create mode 100644 drivers/common/cnxk/hw/npa.h create mode 100644 drivers/common/cnxk/hw/npc.h create mode 100644 drivers/common/cnxk/hw/rvu.h create mode 100644 drivers/common/cnxk/hw/sdp.h create mode 100644 drivers/common/cnxk/hw/sso.h create mode 100644 drivers/common/cnxk/hw/ssow.h create mode 100644 drivers/common/cnxk/hw/tim.h create mode 100644 drivers/common/cnxk/meson.build create mode 100644 drivers/common/cnxk/roc_api.h create mode 100644 drivers/common/cnxk/roc_bitfield.h create mode 100644 drivers/common/cnxk/roc_bits.h create mode 100644 drivers/common/cnxk/roc_platform.c create mode 100644 drivers/common/cnxk/roc_platform.h create mode 100644 drivers/common/cnxk/version.map
drivers/common/cnxk/hw/nix.h new file +2191 -0
@@ -0,0 +1,2191 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef __NIX_HW_H__ +#define __NIX_HW_H__ + +/* Register offsets */ + +#define NIX_AF_CFG (0x0ull) +#define NIX_AF_STATUS (0x10ull) +#define NIX_AF_NDC_CFG (0x18ull) +#define NIX_AF_CONST (0x20ull) +#define NIX_AF_CONST1 (0x28ull) +#define NIX_AF_CONST2 (0x30ull) +#define NIX_AF_CONST3 (0x38ull) +#define NIX_AF_SQ_CONST (0x40ull) +#define NIX_AF_CQ_CONST (0x48ull) +#define NIX_AF_RQ_CONST (0x50ull) +#define NIX_AF_PL_CONST (0x58ull)/* [CN10K, .) */ +#define NIX_AF_PSE_CONST (0x60ull) +#define NIX_AF_TL1_CONST (0x70ull) +#define NIX_AF_TL2_CONST (0x78ull) +#define NIX_AF_TL3_CONST (0x80ull) +#define NIX_AF_TL4_CONST (0x88ull) +#define NIX_AF_MDQ_CONST (0x90ull) +#define NIX_AF_MC_MIRROR_CONST (0x98ull) +#define NIX_AF_LSO_CFG (0xa8ull) +#define NIX_AF_BLK_RST (0xb0ull) +#define NIX_AF_TX_TSTMP_CFG (0xc0ull) +#define NIX_AF_PL_TS (0xc8ull)/* [CN10K, .) */ +#define NIX_AF_RX_CFG (0xd0ull) +#define NIX_AF_AVG_DELAY (0xe0ull) +#define NIX_AF_CINT_DELAY (0xf0ull) +#define NIX_AF_VWQE_TIMER (0xf8ull)/* [CN10K, .) */ +#define NIX_AF_RX_MCAST_BASE (0x100ull) +#define NIX_AF_RX_MCAST_CFG (0x110ull) +#define NIX_AF_RX_MCAST_BUF_BASE (0x120ull) +#define NIX_AF_RX_MCAST_BUF_CFG (0x130ull) +#define NIX_AF_RX_MIRROR_BUF_BASE (0x140ull) +#define NIX_AF_RX_MIRROR_BUF_CFG (0x148ull) +#define NIX_AF_LF_RST (0x150ull) +#define NIX_AF_GEN_INT (0x160ull) +#define NIX_AF_GEN_INT_W1S (0x168ull) +#define NIX_AF_GEN_INT_ENA_W1S (0x170ull) +#define NIX_AF_GEN_INT_ENA_W1C (0x178ull) +#define NIX_AF_ERR_INT (0x180ull) +#define NIX_AF_ERR_INT_W1S (0x188ull) +#define NIX_AF_ERR_INT_ENA_W1S (0x190ull) +#define NIX_AF_ERR_INT_ENA_W1C (0x198ull) +#define NIX_AF_RAS (0x1a0ull) +#define NIX_AF_RAS_W1S (0x1a8ull) +#define NIX_AF_RAS_ENA_W1S (0x1b0ull) +#define NIX_AF_RAS_ENA_W1C (0x1b8ull) +#define NIX_AF_RVU_INT (0x1c0ull) +#define NIX_AF_RVU_INT_W1S (0x1c8ull) +#define NIX_AF_RVU_INT_ENA_W1S (0x1d0ull) +#define NIX_AF_RVU_INT_ENA_W1C (0x1d8ull) +#define NIX_AF_TCP_TIMER (0x1e0ull) +/* [CN10k, .) */ +#define NIX_AF_RX_DEF_ETX (a) (0x1f0ull | (uint64_t)(a) << 3) +#define NIX_AF_RX_DEF_OL2 (0x200ull) +#define NIX_AF_RX_DEF_GEN0_COLOR (0x208ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP4 (0x210ull) +#define NIX_AF_RX_DEF_GEN1_COLOR (0x218ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IIP4 (0x220ull) +#define NIX_AF_RX_DEF_VLAN0_PCP_DEI (0x228ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP6 (0x230ull) +#define NIX_AF_RX_DEF_VLAN1_PCP_DEI (0x238ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IIP6 (0x240ull) +#define NIX_AF_RX_DEF_OTCP (0x250ull) +#define NIX_AF_RX_DEF_ITCP (0x260ull) +#define NIX_AF_RX_DEF_OUDP (0x270ull) +#define NIX_AF_RX_DEF_IUDP (0x280ull) +#define NIX_AF_RX_DEF_OSCTP (0x290ull) +#define NIX_AF_RX_DEF_CST_APAD_0 (0x298ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_ISCTP (0x2a0ull) +#define NIX_AF_RX_DEF_CST_APAD_1 (0x2a8ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IPSECX (a) (0x2b0ull | (uint64_t)(a) << 3) +#define NIX_AF_RX_DEF_IIP4_DSCP (0x2e0ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP4_DSCP (0x2e8ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IIP6_DSCP (0x2f0ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP6_DSCP (0x2f8ull)/* [CN10K, .) */ +#define NIX_AF_RX_IPSEC_GEN_CFG (0x300ull) +#define NIX_AF_RX_IPSEC_VWQE_GEN_CFG (0x310ull)/* [CN10K, .) */ +#define NIX_AF_RX_CPTX_INST_QSEL (a) (0x320ull | (uint64_t)(a) << 3) +#define NIX_AF_RX_CPTX_CREDIT (a) (0x360ull | (uint64_t)(a) << 3) +#define NIX_AF_NDC_RX_SYNC (0x3e0ull) +#define NIX_AF_NDC_TX_SYNC (0x3f0ull) +#define NIX_AF_AQ_CFG (0x400ull) +#define NIX_AF_AQ_BASE (0x410ull) +#define NIX_AF_AQ_STATUS (0x420ull) +#define NIX_AF_AQ_DOOR (0x430ull) +#define NIX_AF_AQ_DONE_WAIT (0x440ull) +#define NIX_AF_AQ_DONE (0x450ull) +#define NIX_AF_AQ_DONE_ACK (0x460ull) +#define NIX_AF_AQ_DONE_TIMER (0x470ull) +#define NIX_AF_AQ_DONE_ENA_W1S (0x490ull) +#define NIX_AF_AQ_DONE_ENA_W1C (0x498ull) +#define NIX_AF_RX_LINKX_CFG (a) (0x540ull | (uint64_t)(a) << 16) +#define NIX_AF_RX_SW_SYNC (0x550ull) +#define NIX_AF_RX_LINKX_WRR_CFG (a) (0x560ull | (uint64_t)(a) << 16) +#define NIX_AF_SEB_CFG (0x5f0ull)/* [CN10K, .) */ +#define NIX_AF_EXPR_TX_FIFO_STATUS (0x640ull)/* [CN9K, CN10K) */ +#define NIX_AF_NORM_TX_FIFO_STATUS (0x648ull) +#define NIX_AF_SDP_TX_FIFO_STATUS (0x650ull) +#define NIX_AF_TX_NPC_CAPTURE_CONFIG (0x660ull) +#define NIX_AF_TX_NPC_CAPTURE_INFO (0x668ull) +#define NIX_AF_TX_NPC_CAPTURE_RESPX (a) (0x680ull | (uint64_t)(a) << 3) +#define NIX_AF_SEB_ACTIVE_CYCLES_PCX (a) (0x6c0ull | (uint64_t)(a) << 3) +#define NIX_AF_SMQX_CFG (a) (0x700ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_HEAD (a) (0x710ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_TAIL (a) (0x720ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_STATUS (a) (0x730ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_NXT_HEAD (a) (0x740ull | (uint64_t)(a) << 16) +#define NIX_AF_SQM_ACTIVE_CYCLES_PC (0x770ull) +#define NIX_AF_SQM_SCLK_CNT (0x780ull)/* [CN10K, .) */ +#define NIX_AF_DWRR_SDP_MTU (0x790ull)/* [CN10K, .) */ +#define NIX_AF_DWRR_RPM_MTU (0x7a0ull)/* [CN10K, .) */ +#define NIX_AF_PSE_CHANNEL_LEVEL (0x800ull) +#define NIX_AF_PSE_SHAPER_CFG (0x810ull) +#define NIX_AF_PSE_ACTIVE_CYCLES_PC (0x8c0ull) +#define NIX_AF_MARK_FORMATX_CTL (a) (0x900ull | (uint64_t)(a) << 18) +#define NIX_AF_TX_LINKX_NORM_CREDIT (a) (0xa00ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TX_LINKX_EXPR_CREDIT (a) (0xa10ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TX_LINKX_SW_XOFF (a) (0xa20ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TX_LINKX_NORM_CDT_ADJ (a) (0xa20ull | (uint64_t)(a) << 16) +#define NIX_AF_TX_LINKX_HW_XOFF (a) (0xa30ull | (uint64_t)(a) << 16) +#define NIX_AF_SDP_LINK_CREDIT (0xa40ull) +#define NIX_AF_SDP_LINK_CDT_ADJ (0xa50ull)/* [CN10K, .) */ +/* [CN9K, CN10K) */ +#define NIX_AF_SDP_SW_XOFFX (a) (0xa60ull | (uint64_t)(a) << 3) +#define NIX_AF_SDP_HW_XOFFX (a) (0xac0ull | (uint64_t)(a) << 3) +#define NIX_AF_TL4X_BP_STATUS (a) (0xb00ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SDP_LINK_CFG (a) (0xb10ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1_TW_ARB_CTL_DEBUG (0xbc0ull)/* [CN10K, .) */ +#define NIX_AF_TL1_TW_ARB_REQ_DEBUG (0xbc8ull)/* [CN10K, .) */ +#define NIX_AF_TL1X_SCHEDULE (a) (0xc00ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_SHAPE (a) (0xc10ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_CIR (a) (0xc20ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL1X_SHAPE_STATE (a) (0xc50ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL1X_SHAPE_STATE_CIR (a) (0xc50ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_SW_XOFF (a) (0xc70ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_TOPOLOGY (a) (0xc80ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_MD_DEBUG0 (a) (0xcc0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_MD_DEBUG1 (a) (0xcc8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL1X_MD_DEBUG2 (a) (0xcd0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL2X_SHAPE_STATE_CIR (a) (0xcd0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL1X_MD_DEBUG3 (a) (0xcd8ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_DROPPED_PACKETS (a) (0xd20ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_DROPPED_BYTES (a) (0xd30ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_RED_PACKETS (a) (0xd40ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_RED_BYTES (a) (0xd50ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_YELLOW_PACKETS (a) (0xd60ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_YELLOW_BYTES (a) (0xd70ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_GREEN_PACKETS (a) (0xd80ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_GREEN_BYTES (a) (0xd90ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQ_MD_COUNT (0xda0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_MDQX_OUT_MD_COUNT (a) (0xdb0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2_TW_ARB_CTL_DEBUG (0xdc0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_TL2_TWX_ARB_REQ_DEBUG0 (a) (0xdc8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL2_TWX_ARB_REQ_DEBUG1 (a) (0xdd0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SCHEDULE (a) (0xe00ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SHAPE (a) (0xe10ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_CIR (a) (0xe20ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_PIR (a) (0xe30ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SCHED_STATE (a) (0xe40ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL2X_SHAPE_STATE (a) (0xe50ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL2X_SHAPE_STATE_PIR (a) (0xe50ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SW_XOFF (a) (0xe70ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_TOPOLOGY (a) (0xe80ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_PARENT (a) (0xe88ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_MD_DEBUG0 (a) (0xec0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_MD_DEBUG1 (a) (0xec8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL2X_MD_DEBUG2 (a) (0xed0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL3X_SHAPE_STATE_CIR (a) (0xed0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL2X_MD_DEBUG3 (a) (0xed8ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3_TW_ARB_CTL_DEBUG (0xfc0ull)/* [CN10K, .) */ +/* [CN10k, .) */ +#define NIX_AF_TL3_TWX_ARB_REQ_DEBUG0 (a) (0xfc8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL3_TWX_ARB_REQ_DEBUG1 (a) (0xfd0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SCHEDULE (a) (0x1000ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SHAPE (a) (0x1010ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_CIR (a) (0x1020ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_PIR (a) (0x1030ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SCHED_STATE (a) (0x1040ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3X_SHAPE_STATE (a) (0x1050ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL3X_SHAPE_STATE_PIR (a) (0x1050ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SW_XOFF (a) (0x1070ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_TOPOLOGY (a) (0x1080ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_PARENT (a) (0x1088ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_MD_DEBUG0 (a) (0x10c0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_MD_DEBUG1 (a) (0x10c8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3X_MD_DEBUG2 (a) (0x10d0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL4X_SHAPE_STATE_CIR (a) (0x10d0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3X_MD_DEBUG3 (a) (0x10d8ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4_TW_ARB_CTL_DEBUG (0x11c0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_TL4_TWX_ARB_REQ_DEBUG0 (a) (0x11c8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL4_TWX_ARB_REQ_DEBUG1 (a) (0x11d0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SCHEDULE (a) (0x1200ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SHAPE (a) (0x1210ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_CIR (a) (0x1220ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_PIR (a) (0x1230ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SCHED_STATE (a) (0x1240ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SHAPE_STATE (a) (0x1250ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SW_XOFF (a) (0x1270ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_TOPOLOGY (a) (0x1280ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_PARENT (a) (0x1288ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_MD_DEBUG0 (a) (0x12c0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_MD_DEBUG1 (a) (0x12c8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL4X_MD_DEBUG2 (a) (0x12d0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQX_SHAPE_STATE_CIR (a) (0x12d0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL4X_MD_DEBUG3 (a) (0x12d8ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQ_TW_ARB_CTL_DEBUG (0x13c0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_MDQ_TWX_ARB_REQ_DEBUG0 (a) (0x13c8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQ_TWX_ARB_REQ_DEBUG1 (a) (0x13d0ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SCHEDULE (a) (0x1400ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SHAPE (a) (0x1410ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_CIR (a) (0x1420ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_PIR (a) (0x1430ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SCHED_STATE (a) (0x1440ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_MDQX_SHAPE_STATE (a) (0x1450ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQX_SHAPE_STATE_PIR (a) (0x1450ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SW_XOFF (a) (0x1470ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_PARENT (a) (0x1480ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_MD_DEBUG (a) (0x14c0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQX_IN_MD_COUNT (a) (0x14e0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3_TL2X_CFG (a) (0x1600ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3_TL2X_BP_STATUS (a) (0x1610ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3_TL2X_LINKX_CFG (a, b) \ + (0x1700ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3) +#define NIX_AF_RX_FLOW_KEY_ALGX_FIELDX (a, b) \ + (0x1800ull | (uint64_t)(a) << 18 | (uint64_t)(b) << 3) +#define NIX_AF_TX_MCASTX (a) (0x1900ull | (uint64_t)(a) << 15) +#define NIX_AF_TX_VTAG_DEFX_CTL (a) (0x1a00ull | (uint64_t)(a) << 16) +#define NIX_AF_TX_VTAG_DEFX_DATA (a) (0x1a10ull | (uint64_t)(a) << 16) +#define NIX_AF_RX_BPIDX_STATUS (a) (0x1a20ull | (uint64_t)(a) << 17) +#define NIX_AF_RX_CHANX_CFG (a) (0x1a30ull | (uint64_t)(a) << 15) +#define NIX_AF_CINT_TIMERX (a) (0x1a40ull | (uint64_t)(a) << 18) +#define NIX_AF_LSO_FORMATX_FIELDX (a, b) \ + (0x1b00ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_CFG (a) (0x4000ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LINKX_CFG (a) (0x4010ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_SQS_CFG (a) (0x4020ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_CFG2 (a) (0x4028ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_SQS_BASE (a) (0x4030ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RQS_CFG (a) (0x4040ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RQS_BASE (a) (0x4050ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CQS_CFG (a) (0x4060ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CQS_BASE (a) (0x4070ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_CFG (a) (0x4080ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_PARSE_CFG (a) (0x4090ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_CFG (a) (0x40a0ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RSS_CFG (a) (0x40c0ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RSS_BASE (a) (0x40d0ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_QINTS_CFG (a) (0x4100ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_QINTS_BASE (a) (0x4110ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CINTS_CFG (a) (0x4120ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CINTS_BASE (a) (0x4130ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_CFG0 (a) (0x4140ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_CFG1 (a) (0x4148ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_DYNO_CFG (a) (0x4150ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_DYNO_BASE (a) (0x4158ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_SA_BASE (a) (0x4170ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_STATUS (a) (0x4180ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_VTAG_TYPEX (a, b) \ + (0x4200ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_LOCKX (a, b) \ + (0x4300ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_TX_STATX (a, b) \ + (0x4400ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_RX_STATX (a, b) \ + (0x4500ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_RSS_GRPX (a, b) \ + (0x4600ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_RX_NPC_MC_RCV (0x4700ull) +#define NIX_AF_RX_NPC_MC_DROP (0x4710ull) +#define NIX_AF_RX_NPC_MIRROR_RCV (0x4720ull) +#define NIX_AF_RX_NPC_MIRROR_DROP (0x4730ull) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_NORM_COMPL (a) (0x4740ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_RLS_TIMEOUT (a) (0x4750ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_HASH_FULL (a) (0x4760ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_SA_FULL (a) (0x4770ull | (uint64_t)(a) << 17) +#define NIX_AF_VWQE_HASH_FUNC_MASK (0x47a0ull)/* [CN10K, .) */ +#define NIX_AF_RX_ACTIVE_CYCLES_PCX (a) (0x4800ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_RX_LINKX_WRR_OUT_CFG (a) (0x4a00ull | (uint64_t)(a) << 16) +#define NIX_PRIV_AF_INT_CFG (0x8000000ull) +#define NIX_PRIV_LFX_CFG (a) (0x8000010ull | (uint64_t)(a) << 8) +#define NIX_PRIV_LFX_INT_CFG (a) (0x8000020ull | (uint64_t)(a) << 8) +#define NIX_AF_RVU_LF_CFG_DEBUG (0x8000030ull) + +#define NIX_LF_RX_SECRETX (a) (0x0ull | (uint64_t)(a) << 3) +#define NIX_LF_CFG (0x100ull) +#define NIX_LF_GINT (0x200ull) +#define NIX_LF_GINT_W1S (0x208ull) +#define NIX_LF_GINT_ENA_W1C (0x210ull) +#define NIX_LF_GINT_ENA_W1S (0x218ull) +#define NIX_LF_ERR_INT (0x220ull) +#define NIX_LF_ERR_INT_W1S (0x228ull) +#define NIX_LF_ERR_INT_ENA_W1C (0x230ull) +#define NIX_LF_ERR_INT_ENA_W1S (0x238ull) +#define NIX_LF_RAS (0x240ull) +#define NIX_LF_RAS_W1S (0x248ull) +#define NIX_LF_RAS_ENA_W1C (0x250ull) +#define NIX_LF_RAS_ENA_W1S (0x258ull) +#define NIX_LF_SQ_OP_ERR_DBG (0x260ull) +#define NIX_LF_MNQ_ERR_DBG (0x270ull) +#define NIX_LF_SEND_ERR_DBG (0x280ull) +#define NIX_LF_TX_STATX (a) (0x300ull | (uint64_t)(a) << 3) +#define NIX_LF_RX_STATX (a) (0x400ull | (uint64_t)(a) << 3) +#define NIX_LF_OP_SENDX (a) (0x800ull | (uint64_t)(a) << 3) +#define NIX_LF_RQ_OP_INT (0x900ull) +#define NIX_LF_RQ_OP_OCTS (0x910ull) +#define NIX_LF_RQ_OP_PKTS (0x920ull) +#define NIX_LF_RQ_OP_DROP_OCTS (0x930ull) +#define NIX_LF_RQ_OP_DROP_PKTS (0x940ull) +#define NIX_LF_RQ_OP_RE_PKTS (0x950ull) +#define NIX_LF_OP_IPSEC_DYNO_CNT (0x980ull) +#define NIX_LF_OP_VWQE_FLUSH (0x9a0ull)/* [CN10K, .) */ +#define NIX_LF_PL_OP_BAND_PROF (0x9c0ull)/* [CN10K, .) */ +#define NIX_LF_SQ_OP_INT (0xa00ull) +#define NIX_LF_SQ_OP_OCTS (0xa10ull) +#define NIX_LF_SQ_OP_PKTS (0xa20ull) +#define NIX_LF_SQ_OP_STATUS (0xa30ull) +#define NIX_LF_SQ_OP_DROP_OCTS (0xa40ull) +#define NIX_LF_SQ_OP_DROP_PKTS (0xa50ull) +#define NIX_LF_CQ_OP_INT (0xb00ull) +#define NIX_LF_CQ_OP_DOOR (0xb30ull) +#define NIX_LF_CQ_OP_STATUS (0xb40ull) +#define NIX_LF_QINTX_CNT (a) (0xc00ull | (uint64_t)(a) << 12) +#define NIX_LF_QINTX_INT (a) (0xc10ull | (uint64_t)(a) << 12) +#define NIX_LF_QINTX_ENA_W1S (a) (0xc20ull | (uint64_t)(a) << 12) +#define NIX_LF_QINTX_ENA_W1C (a) (0xc30ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_CNT (a) (0xd00ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_WAIT (a) (0xd10ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_INT (a) (0xd20ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_INT_W1S (a) (0xd30ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_ENA_W1S (a) (0xd40ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_ENA_W1C (a) (0xd50ull | (uint64_t)(a) << 12) +/* [CN10K, .) */ +#define NIX_LF_RX_GEN_COLOR_CONVX (a) (0x4740ull | (uint64_t)(a) << 3) +#define NIX_LF_RX_VLAN0_COLOR_CONV (0x4760ull)/* [CN10K, .) */ +#define NIX_LF_RX_VLAN1_COLOR_CONV (0x4768ull)/* [CN10K, .) */ +#define NIX_LF_RX_IIP_COLOR_CONV_LO (0x4770ull)/* [CN10K, .) */ +#define NIX_LF_RX_IIP_COLOR_CONV_HI (0x4778ull)/* [CN10K, .) */ +#define NIX_LF_RX_OIP_COLOR_CONV_LO (0x4780ull)/* [CN10K, .) */ +#define NIX_LF_RX_OIP_COLOR_CONV_HI (0x4788ull)/* [CN10K, .) */ + +/* Enum offsets */ + +#define NIX_STAT_LF_TX_TX_UCAST (0x0ull) +#define NIX_STAT_LF_TX_TX_BCAST (0x1ull) +#define NIX_STAT_LF_TX_TX_MCAST (0x2ull) +#define NIX_STAT_LF_TX_TX_DROP (0x3ull) +#define NIX_STAT_LF_TX_TX_OCTS (0x4ull) + +#define NIX_STAT_LF_RX_RX_OCTS (0x0ull) +#define NIX_STAT_LF_RX_RX_UCAST (0x1ull) +#define NIX_STAT_LF_RX_RX_BCAST (0x2ull) +#define NIX_STAT_LF_RX_RX_MCAST (0x3ull) +#define NIX_STAT_LF_RX_RX_DROP (0x4ull) +#define NIX_STAT_LF_RX_RX_DROP_OCTS (0x5ull) +#define NIX_STAT_LF_RX_RX_FCS (0x6ull) +#define NIX_STAT_LF_RX_RX_ERR (0x7ull) +#define NIX_STAT_LF_RX_RX_DRP_BCAST (0x8ull) +#define NIX_STAT_LF_RX_RX_DRP_MCAST (0x9ull) +#define NIX_STAT_LF_RX_RX_DRP_L3BCAST (0xaull) +#define NIX_STAT_LF_RX_RX_DRP_L3MCAST (0xbull) + +#define NIX_STAT_LF_RX_RX_GC_OCTS_PASSED (0xcull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_GC_PKTS_PASSED (0xdull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_OCTS_PASSED (0xeull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_PKTS_PASSED (0xfull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_OCTS_PASSED (0x10ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_PKTS_PASSED (0x11ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_GC_OCTS_DROP (0x12ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_GC_PKTS_DROP (0x13ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_OCTS_DROP (0x14ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_PKTS_DROP (0x15ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_OCTS_DROP (0x16ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_PKTS_DROP (0x17ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_CPT_DROP_PKTS (0x18ull)/* [CN10K, .) */ + +#define CGX_RX_PKT_CNT (0x0ull)/* [CN9K, CN10K) */ +#define CGX_RX_OCT_CNT (0x1ull)/* [CN9K, CN10K) */ +#define CGX_RX_PAUSE_PKT_CNT (0x2ull)/* [CN9K, CN10K) */ +#define CGX_RX_PAUSE_OCT_CNT (0x3ull)/* [CN9K, CN10K) */ +#define CGX_RX_DMAC_FILT_PKT_CNT (0x4ull)/* [CN9K, CN10K) */ +#define CGX_RX_DMAC_FILT_OCT_CNT (0x5ull)/* [CN9K, CN10K) */ +#define CGX_RX_FIFO_DROP_PKT_CNT (0x6ull)/* [CN9K, CN10K) */ +#define CGX_RX_FIFO_DROP_OCT_CNT (0x7ull)/* [CN9K, CN10K) */ +#define CGX_RX_ERR_CNT (0x8ull)/* [CN9K, CN10K) */ + +#define CGX_TX_COLLISION_DROP (0x0ull)/* [CN9K, CN10K) */ +#define CGX_TX_FRAME_DEFER_CNT (0x1ull)/* [CN9K, CN10K) */ +#define CGX_TX_MULTIPLE_COLLISION (0x2ull)/* [CN9K, CN10K) */ +#define CGX_TX_SINGLE_COLLISION (0x3ull)/* [CN9K, CN10K) */ +#define CGX_TX_OCT_CNT (0x4ull)/* [CN9K, CN10K) */ +#define CGX_TX_PKT_CNT (0x5ull)/* [CN9K, CN10K) */ +#define CGX_TX_1_63_PKT_CNT (0x6ull)/* [CN9K, CN10K) */ +#define CGX_TX_64_PKT_CNT (0x7ull)/* [CN9K, CN10K) */ +#define CGX_TX_65_127_PKT_CNT (0x8ull)/* [CN9K, CN10K) */ +#define CGX_TX_128_255_PKT_CNT (0x9ull)/* [CN9K, CN10K) */ +#define CGX_TX_256_511_PKT_CNT (0xaull)/* [CN9K, CN10K) */ +#define CGX_TX_512_1023_PKT_CNT (0xbull)/* [CN9K, CN10K) */ +#define CGX_TX_1024_1518_PKT_CNT (0xcull)/* [CN9K, CN10K) */ +#define CGX_TX_1519_MAX_PKT_CNT (0xdull)/* [CN9K, CN10K) */ +#define CGX_TX_BCAST_PKTS (0xeull)/* [CN9K, CN10K) */ +#define CGX_TX_MCAST_PKTS (0xfull)/* [CN9K, CN10K) */ +#define CGX_TX_UFLOW_PKTS (0x10ull)/* [CN9K, CN10K) */ +#define CGX_TX_PAUSE_PKTS (0x11ull)/* [CN9K, CN10K) */ + +#define RPM_MTI_STAT_RX_OCT_CNT (0x0ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_OCT_RECV_OK (0x1ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_ALIG_ERR (0x2ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CTRL_FRM_RECV (0x3ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_FRM_LONG (0x4ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_LEN_ERR (0x5ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_FRM_RECV (0x6ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_FRM_SEQ_ERR (0x7ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_VLAN_OK (0x8ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_ERR (0x9ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_UCAST_PKT (0xaull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_MCAST_PKT (0xbull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_BCAST_PKT (0xcull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_DRP_EVENTS (0xdull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_PKT (0xeull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_UNDER_SIZE (0xfull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_1_64_PKT_CNT (0x10ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_65_127_PKT_CNT (0x11ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_128_255_PKT_CNT (0x12ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_256_511_PKT_CNT (0x13ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_512_1023_PKT_CNT (0x14ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_1024_1518_PKT_CNT (0x15ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_1519_MAX_PKT_CNT (0x16ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_OVER_SIZE (0x17ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_JABBER (0x18ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_ETH_FRAGS (0x19ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_0 (0x1aull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_1 (0x1bull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_2 (0x1cull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_3 (0x1dull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_4 (0x1eull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_5 (0x1full)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_6 (0x20ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_7 (0x21ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_8 (0x22ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_9 (0x23ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_10 (0x24ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_11 (0x25ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_12 (0x26ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_13 (0x27ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_14 (0x28ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_15 (0x29ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_MAC_CONTROL (0x2aull)/* [CN10K, .) */ + +#define RPM_MTI_STAT_TX_OCT_CNT (0x0ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_OCT_TX_OK (0x1ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_PAUSE_MAC_CTRL (0x2ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_FRAMES_OK (0x3ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_VLAN_OK (0x4ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_OUT_ERR (0x5ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_UCAST_PKT_CNT (0x6ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_MCAST_PKT_CNT (0x7ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_BCAST_PKT_CNT (0x8ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_1_64_PKT_CNT (0x9ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_65_127_PKT_CNT (0xaull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_128_255_PKT_CNT (0xbull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_256_511_PKT_CNT (0xcull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_512_1023_PKT_CNT (0xdull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_1024_1518_PKT_CNT (0xeull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_1519_MAX_PKT_CNT (0xfull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_0 (0x10ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_1 (0x11ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_2 (0x12ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_3 (0x13ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_4 (0x14ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_5 (0x15ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_6 (0x16ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_7 (0x17ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_8 (0x18ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_9 (0x19ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_10 (0x1aull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_11 (0x1bull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_12 (0x1cull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_13 (0x1dull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_14 (0x1eull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_15 (0x1full)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_MAC_CONTROL_FRAMES (0x20ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_PKT_CNT (0x21ull)/* [CN10K, .) */ + +#define NIX_SQOPERR_SQ_OOR (0x0ull) +#define NIX_SQOPERR_SQ_CTX_FAULT (0x1ull) +#define NIX_SQOPERR_SQ_CTX_POISON (0x2ull) +#define NIX_SQOPERR_SQ_DISABLED (0x3ull) +#define NIX_SQOPERR_MAX_SQE_SIZE_ERR (0x4ull) +#define NIX_SQOPERR_SQE_OFLOW (0x5ull) +#define NIX_SQOPERR_SQB_NULL (0x6ull) +#define NIX_SQOPERR_SQB_FAULT (0x7ull) +#define NIX_SQOPERR_SQE_SIZEM1_ZERO (0x8ull)/* [CN10K, .) */ + +#define NIX_SQINT_LMT_ERR (0x0ull) +#define NIX_SQINT_MNQ_ERR (0x1ull) +#define NIX_SQINT_SEND_ERR (0x2ull) +#define NIX_SQINT_SQB_ALLOC_FAIL (0x3ull) + +#define NIX_SEND_STATUS_GOOD (0x0ull) +#define NIX_SEND_STATUS_SQ_CTX_FAULT (0x1ull) +#define NIX_SEND_STATUS_SQ_CTX_POISON (0x2ull) +#define NIX_SEND_STATUS_SQB_FAULT (0x3ull) +#define NIX_SEND_STATUS_SQB_POISON (0x4ull) +#define NIX_SEND_STATUS_SEND_HDR_ERR (0x5ull) +#define NIX_SEND_STATUS_SEND_EXT_ERR (0x6ull) +#define NIX_SEND_STATUS_JUMP_FAULT (0x7ull) +#define NIX_SEND_STATUS_JUMP_POISON (0x8ull) +#define NIX_SEND_STATUS_SEND_CRC_ERR (0x10ull) +#define NIX_SEND_STATUS_SEND_IMM_ERR (0x11ull) +#define NIX_SEND_STATUS_SEND_SG_ERR (0x12ull) +#define NIX_SEND_STATUS_SEND_MEM_ERR (0x13ull) +#define NIX_SEND_STATUS_INVALID_SUBDC (0x14ull) +#define NIX_SEND_STATUS_SUBDC_ORDER_ERR (0x15ull) +#define NIX_SEND_STATUS_DATA_FAULT (0x16ull) +#define NIX_SEND_STATUS_DATA_POISON (0x17ull) +#define NIX_SEND_STATUS_NPC_DROP_ACTION (0x20ull) +#define NIX_SEND_STATUS_LOCK_VIOL (0x21ull) +#define NIX_SEND_STATUS_NPC_UCAST_CHAN_ERR (0x22ull) +#define NIX_SEND_STATUS_NPC_MCAST_CHAN_ERR (0x23ull) +#define NIX_SEND_STATUS_NPC_MCAST_ABORT (0x24ull) +#define NIX_SEND_STATUS_NPC_VTAG_PTR_ERR (0x25ull) +#define NIX_SEND_STATUS_NPC_VTAG_SIZE_ERR (0x26ull) +#define NIX_SEND_STATUS_SEND_MEM_FAULT (0x27ull) +#define NIX_SEND_STATUS_SEND_STATS_ERR (0x28ull) + +#define NIX_SENDSTATSALG_NOP (0x0ull) +#define NIX_SENDSTATSALG_ADD_PKT_CNT (0x1ull) +#define NIX_SENDSTATSALG_ADD_BYTE_CNT (0x2ull) +#define NIX_SENDSTATSALG_ADD_PKT_BYTE_CNT (0x3ull) +#define NIX_SENDSTATSALG_UPDATE_PKT_CNT_ON_DROP (0x4ull) +#define NIX_SENDSTATSALG_UPDATE_BYTE_CNT_ON_DROP (0x5ull) +#define NIX_SENDSTATSALG_UPDATE_PKT_BYTE_CNT_ON_DROP (0x6ull) + +#define NIX_SENDMEMDSZ_B64 (0x0ull) +#define NIX_SENDMEMDSZ_B32 (0x1ull) +#define NIX_SENDMEMDSZ_B16 (0x2ull) +#define NIX_SENDMEMDSZ_B8 (0x3ull) + +#define NIX_SENDMEMALG_SET (0x0ull) +#define NIX_SENDMEMALG_SETTSTMP (0x1ull) +#define NIX_SENDMEMALG_SETRSLT (0x2ull) +#define NIX_SENDMEMALG_ADD (0x8ull) +#define NIX_SENDMEMALG_SUB (0x9ull) +#define NIX_SENDMEMALG_ADDLEN (0xaull) +#define NIX_SENDMEMALG_SUBLEN (0xbull) +#define NIX_SENDMEMALG_ADDMBUF (0xcull) +#define NIX_SENDMEMALG_SUBMBUF (0xdull) + +#define NIX_SUBDC_NOP (0x0ull) +#define NIX_SUBDC_EXT (0x1ull) +#define NIX_SUBDC_CRC (0x2ull) +#define NIX_SUBDC_IMM (0x3ull) +#define NIX_SUBDC_SG (0x4ull) +#define NIX_SUBDC_MEM (0x5ull) +#define NIX_SUBDC_JUMP (0x6ull) +#define NIX_SUBDC_WORK (0x7ull) +#define NIX_SUBDC_SG2 (0x8ull)/* [CN10K, .) */ +#define NIX_SUBDC_AGE_AND_STATS (0x9ull)/* [CN10K, .) */ +#define NIX_SUBDC_SOD (0xfull) + +#define NIX_STYPE_STF (0x0ull) +#define NIX_STYPE_STT (0x1ull) +#define NIX_STYPE_STP (0x2ull) + +#define NIX_RX_ACTIONOP_DROP (0x0ull) +#define NIX_RX_ACTIONOP_UCAST (0x1ull) +#define NIX_RX_ACTIONOP_UCAST_IPSEC (0x2ull) +#define NIX_RX_ACTIONOP_MCAST (0x3ull) +#define NIX_RX_ACTIONOP_RSS (0x4ull) +#define NIX_RX_ACTIONOP_PF_FUNC_DROP (0x5ull) +#define NIX_RX_ACTIONOP_MIRROR (0x6ull) + +#define NIX_RX_VTAGACTION_VTAG0_RELPTR (0x0ull) +#define NIX_RX_VTAGACTION_VTAG1_RELPTR (0x4ull) +#define NIX_RX_VTAGACTION_VTAG_VALID (0x1ull) +#define NIX_TX_VTAGACTION_VTAG0_RELPTR (sizeof(struct nix_inst_hdr_s) + 2 * 6) +#define NIX_TX_VTAGACTION_VTAG1_RELPTR \ + (sizeof(struct nix_inst_hdr_s) + 2 * 6 + 4) +#define NIX_RQINT_DROP (0x0ull) +#define NIX_RQINT_RED (0x1ull) +#define NIX_RQINT_R2 (0x2ull) +#define NIX_RQINT_R3 (0x3ull) +#define NIX_RQINT_R4 (0x4ull) +#define NIX_RQINT_R5 (0x5ull) +#define NIX_RQINT_R6 (0x6ull) +#define NIX_RQINT_R7 (0x7ull) + +#define NIX_MAXSQESZ_W16 (0x0ull) +#define NIX_MAXSQESZ_W8 (0x1ull) + +#define NIX_LSOALG_NOP (0x0ull) +#define NIX_LSOALG_ADD_SEGNUM (0x1ull) +#define NIX_LSOALG_ADD_PAYLEN (0x2ull) +#define NIX_LSOALG_ADD_OFFSET (0x3ull) +#define NIX_LSOALG_TCP_FLAGS (0x4ull) + +#define NIX_MNQERR_SQ_CTX_FAULT (0x0ull) +#define NIX_MNQERR_SQ_CTX_POISON (0x1ull) +#define NIX_MNQERR_SQB_FAULT (0x2ull) +#define NIX_MNQERR_SQB_POISON (0x3ull) +#define NIX_MNQERR_TOTAL_ERR (0x4ull) +#define NIX_MNQERR_LSO_ERR (0x5ull) +#define NIX_MNQERR_CQ_QUERY_ERR (0x6ull) +#define NIX_MNQERR_MAX_SQE_SIZE_ERR (0x7ull) +#define NIX_MNQERR_MAXLEN_ERR (0x8ull) +#define NIX_MNQERR_SQE_SIZEM1_ZERO (0x9ull) + +#define NIX_MDTYPE_RSVD (0x0ull) +#define NIX_MDTYPE_FLUSH (0x1ull) +#define NIX_MDTYPE_PMD (0x2ull) + +#define NIX_NDC_TX_PORT_LMT (0x0ull) +#define NIX_NDC_TX_PORT_ENQ (0x1ull) +#define NIX_NDC_TX_PORT_MNQ (0x2ull) +#define NIX_NDC_TX_PORT_DEQ (0x3ull) +#define NIX_NDC_TX_PORT_DMA (0x4ull) +#define NIX_NDC_TX_PORT_XQE (0x5ull) + +#define NIX_NDC_RX_PORT_AQ (0x0ull) +#define NIX_NDC_RX_PORT_CQ (0x1ull) +#define NIX_NDC_RX_PORT_CINT (0x2ull) +#define NIX_NDC_RX_PORT_MC (0x3ull) +#define NIX_NDC_RX_PORT_PKT (0x4ull) +#define NIX_NDC_RX_PORT_RQ (0x5ull) + +#define NIX_RE_OPCODE_RE_NONE (0x0ull) +#define NIX_RE_OPCODE_RE_PARTIAL (0x1ull) +#define NIX_RE_OPCODE_RE_JABBER (0x2ull) +#define NIX_RE_OPCODE_RE_FCS (0x7ull) +#define NIX_RE_OPCODE_RE_FCS_RCV (0x8ull) +#define NIX_RE_OPCODE_RE_TERMINATE (0x9ull) +#define NIX_RE_OPCODE_RE_RX_CTL (0xbull) +#define NIX_RE_OPCODE_RE_SKIP (0xcull) +#define NIX_RE_OPCODE_RE_DMAPKT (0xfull) +#define NIX_RE_OPCODE_UNDERSIZE (0x10ull) +#define NIX_RE_OPCODE_OVERSIZE (0x11ull) +#define NIX_RE_OPCODE_OL2_LENMISM (0x12ull) + +#define NIX_REDALG_STD (0x0ull) +#define NIX_REDALG_SEND (0x1ull) +#define NIX_REDALG_STALL (0x2ull) +#define NIX_REDALG_DISCARD (0x3ull) + +#define NIX_RX_BAND_PROF_ACTIONRESULT_PASS (0x0ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_ACTIONRESULT_DROP (0x1ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_ACTIONRESULT_RED (0x2ull)/* [CN10K, .) */ + +#define NIX_RX_BAND_PROF_LAYER_LEAF (0x0ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_LAYER_MIDDLE (0x1ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_LAYER_TOP (0x2ull)/* [CN10K, .) */ + +#define NIX_RX_COLORRESULT_GREEN (0x0ull)/* [CN10K, .) */ +#define NIX_RX_COLORRESULT_YELLOW (0x1ull)/* [CN10K, .) */ +#define NIX_RX_COLORRESULT_RED (0x2ull)/* [CN10K, .) */ + +#define NIX_RX_MCOP_RQ (0x0ull) +#define NIX_RX_MCOP_RSS (0x1ull) + +#define NIX_RX_PERRCODE_NPC_RESULT_ERR (0x2ull) +#define NIX_RX_PERRCODE_MCAST_FAULT (0x4ull) +#define NIX_RX_PERRCODE_MIRROR_FAULT (0x5ull) +#define NIX_RX_PERRCODE_MCAST_POISON (0x6ull) +#define NIX_RX_PERRCODE_MIRROR_POISON (0x7ull) +#define NIX_RX_PERRCODE_DATA_FAULT (0x8ull) +#define NIX_RX_PERRCODE_MEMOUT (0x9ull) +#define NIX_RX_PERRCODE_BUFS_OFLOW (0xaull) +#define NIX_RX_PERRCODE_OL3_LEN (0x10ull) +#define NIX_RX_PERRCODE_OL4_LEN (0x11ull) +#define NIX_RX_PERRCODE_OL4_CHK (0x12ull) +#define NIX_RX_PERRCODE_OL4_PORT (0x13ull) +#define NIX_RX_PERRCODE_IL3_LEN (0x20ull) +#define NIX_RX_PERRCODE_IL4_LEN (0x21ull) +#define NIX_RX_PERRCODE_IL4_CHK (0x22ull) +#define NIX_RX_PERRCODE_IL4_PORT (0x23ull) + +#define NIX_SA_ALG_NON_MS (0x0ull)/* [CN10K, .) */ +#define NIX_SA_ALG_MS_CISCO (0x1ull)/* [CN10K, .) */ +#define NIX_SA_ALG_MS_VIPTELA (0x2ull)/* [CN10K, .) */ + +#define NIX_SENDCRCALG_CRC32 (0x0ull) +#define NIX_SENDCRCALG_CRC32C (0x1ull) +#define NIX_SENDCRCALG_ONES16 (0x2ull) + +#define NIX_SENDL3TYPE_NONE (0x0ull) +#define NIX_SENDL3TYPE_IP4 (0x2ull) +#define NIX_SENDL3TYPE_IP4_CKSUM (0x3ull) +#define NIX_SENDL3TYPE_IP6 (0x4ull) + +#define NIX_SENDL4TYPE_NONE (0x0ull) +#define NIX_SENDL4TYPE_TCP_CKSUM (0x1ull) +#define NIX_SENDL4TYPE_SCTP_CKSUM (0x2ull) +#define NIX_SENDL4TYPE_UDP_CKSUM (0x3ull) + +#define NIX_SENDLDTYPE_LDD (0x0ull) +#define NIX_SENDLDTYPE_LDT (0x1ull) +#define NIX_SENDLDTYPE_LDWB (0x2ull) + +#define NIX_XQESZ_W64 (0x0ull) +#define NIX_XQESZ_W16 (0x1ull) + +#define NIX_XQE_TYPE_INVALID (0x0ull) +#define NIX_XQE_TYPE_RX (0x1ull) +#define NIX_XQE_TYPE_RX_IPSECS (0x2ull) +#define NIX_XQE_TYPE_RX_IPSECH (0x3ull) +#define NIX_XQE_TYPE_RX_IPSECD (0x4ull) +#define NIX_XQE_TYPE_RX_VWQE (0x5ull)/* [CN10K, .) */ +#define NIX_XQE_TYPE_RES_6 (0x6ull) +#define NIX_XQE_TYPE_RES_7 (0x7ull) +#define NIX_XQE_TYPE_SEND (0x8ull) +#define NIX_XQE_TYPE_RES_9 (0x9ull) +#define NIX_XQE_TYPE_RES_A (0xAull) +#define NIX_XQE_TYPE_RES_B (0xBull) +#define NIX_XQE_TYPE_RES_C (0xCull) +#define NIX_XQE_TYPE_RES_D (0xDull) +#define NIX_XQE_TYPE_RES_E (0xEull) +#define NIX_XQE_TYPE_RES_F (0xFull) + +#define NIX_TX_VTAGOP_NOP (0x0ull) +#define NIX_TX_VTAGOP_INSERT (0x1ull) +#define NIX_TX_VTAGOP_REPLACE (0x2ull) + +#define NIX_VTAGSIZE_T4 (0x0ull) +#define NIX_VTAGSIZE_T8 (0x1ull) + +#define NIX_TXLAYER_OL3 (0x0ull) +#define NIX_TXLAYER_OL4 (0x1ull) +#define NIX_TXLAYER_IL3 (0x2ull) +#define NIX_TXLAYER_IL4 (0x3ull) + +#define NIX_TX_ACTIONOP_DROP (0x0ull) +#define NIX_TX_ACTIONOP_UCAST_DEFAULT (0x1ull) +#define NIX_TX_ACTIONOP_UCAST_CHAN (0x2ull) +#define NIX_TX_ACTIONOP_MCAST (0x3ull) +#define NIX_TX_ACTIONOP_DROP_VIOL (0x5ull) + +#define NIX_AQ_COMP_NOTDONE (0x0ull) +#define NIX_AQ_COMP_GOOD (0x1ull) +#define NIX_AQ_COMP_SWERR (0x2ull) +#define NIX_AQ_COMP_CTX_POISON (0x3ull) +#define NIX_AQ_COMP_CTX_FAULT (0x4ull) +#define NIX_AQ_COMP_LOCKERR (0x5ull) +#define NIX_AQ_COMP_SQB_ALLOC_FAIL (0x6ull) + +#define NIX_AF_INT_VEC_RVU (0x0ull) +#define NIX_AF_INT_VEC_GEN (0x1ull) +#define NIX_AF_INT_VEC_AQ_DONE (0x2ull) +#define NIX_AF_INT_VEC_AF_ERR (0x3ull) +#define NIX_AF_INT_VEC_POISON (0x4ull) + +#define NIX_AQINT_GEN_RX_MCAST_DROP (0x0ull) +#define NIX_AQINT_GEN_RX_MIRROR_DROP (0x1ull) +#define NIX_AQINT_GEN_TL1_DRAIN (0x3ull) +#define NIX_AQINT_GEN_SMQ_FLUSH_DONE (0x4ull) + +#define NIX_AQ_INSTOP_NOP (0x0ull) +#define NIX_AQ_INSTOP_INIT (0x1ull) +#define NIX_AQ_INSTOP_WRITE (0x2ull) +#define NIX_AQ_INSTOP_READ (0x3ull) +#define NIX_AQ_INSTOP_LOCK (0x4ull) +#define NIX_AQ_INSTOP_UNLOCK (0x5ull) + +#define NIX_AQ_CTYPE_RQ (0x0ull) +#define NIX_AQ_CTYPE_SQ (0x1ull) +#define NIX_AQ_CTYPE_CQ (0x2ull) +#define NIX_AQ_CTYPE_MCE (0x3ull) +#define NIX_AQ_CTYPE_RSS (0x4ull) +#define NIX_AQ_CTYPE_DYNO (0x5ull) +#define NIX_AQ_CTYPE_BAND_PROF (0x6ull)/* [CN10K, .) */ + +#define NIX_COLORRESULT_GREEN (0x0ull) +#define NIX_COLORRESULT_YELLOW (0x1ull) +#define NIX_COLORRESULT_RED_SEND (0x2ull) +#define NIX_COLORRESULT_RED_DROP (0x3ull) + +#define NIX_CHAN_LBKX_CHX (a, b) \ + (0x000ull | ((uint64_t)(a) << 8) | (uint64_t)(b)) +#define NIX_CHAN_CPT_CH_END (0x4ffull)/* [CN10K, .) */ +#define NIX_CHAN_CPT_CH_START (0x400ull)/* [CN10K, .) */ +#define NIX_CHAN_R4 (0x400ull)/* [CN9K, CN10K) */ +#define NIX_CHAN_R5 (0x500ull) +#define NIX_CHAN_R6 (0x600ull) +#define NIX_CHAN_SDP_CH_END (0x7ffull) +#define NIX_CHAN_SDP_CH_START (0x700ull) +/* [CN9K, CN10K) */ +#define NIX_CHAN_CGXX_LMACX_CHX (a, b, c) \ + (0x800ull | ((uint64_t)(a) << 8) | ((uint64_t)(b) << 4) | (uint64_t)(c)) +/* [CN10K, .) */ +#define NIX_CHAN_RPMX_LMACX_CHX (a, b, c) \ + (0x800ull | ((uint64_t)(a) << 8) | ((uint64_t)(b) << 4) | (uint64_t)(c)) + +#define NIX_INTF_SDP (0x4ull) +#define NIX_INTF_CGX0 (0x0ull)/* [CN9K, CN10K) */ +#define NIX_INTF_CGX1 (0x1ull)/* [CN9K, CN10K) */ +#define NIX_INTF_CGX2 (0x2ull)/* [CN9K, CN10K) */ +#define NIX_INTF_RPM0 (0x0ull)/* [CN10K, .) */ +#define NIX_INTF_RPM1 (0x1ull)/* [CN10K, .) */ +#define NIX_INTF_RPM2 (0x2ull)/* [CN10K, .) */ +#define NIX_INTF_LBK0 (0x3ull) +#define NIX_INTF_CPT0 (0x5ull)/* [CN10K, .) */ + +#define NIX_CQERRINT_DOOR_ERR (0x0ull) +#define NIX_CQERRINT_WR_FULL (0x1ull) +#define NIX_CQERRINT_CQE_FAULT (0x2ull) + +#define NIX_LINK_SDP (0xdull)/* [CN10K, .) */ +#define NIX_LINK_CPT (0xeull)/* [CN10K, .) */ +#define NIX_LINK_MC (0xfull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_LINK_RPMX_LMACX (a, b) \ + (0x00ull | ((uint64_t)(a) << 2) | (uint64_t)(b)) +#define NIX_LINK_LBK0 (0xcull) + +#define NIX_LF_INT_VEC_GINT (0x80ull) +#define NIX_LF_INT_VEC_ERR_INT (0x81ull) +#define NIX_LF_INT_VEC_POISON (0x82ull) +#define NIX_LF_INT_VEC_QINT_END (0x3full) +#define NIX_LF_INT_VEC_QINT_START (0x0ull) +#define NIX_LF_INT_VEC_CINT_END (0x7full) +#define NIX_LF_INT_VEC_CINT_START (0x40ull) + +#define NIX_INTF_RX (0x0ull) +#define NIX_INTF_TX (0x1ull) + +/* Enums definitions */ + +/* Structures definitions */ + +/* NIX aging and send stats subdescriptor structure */ +struct nix_age_and_send_stats_s { +uint64_t threshold :29 ; +uint64_t latency_drop :1 ; +uint64_t aging :1 ; +uint64_t wmem :1 ; +uint64_t ooffset :12 ; +uint64_t ioffset :12 ; +uint64_t sel :1 ; +uint64_t alg :3 ; +uint64_t subdc :4 ; +uint64_t addr :64 ;/* W1 */ +}; + +/* NIX admin queue instruction structure */ +struct nix_aq_inst_s { +uint64_t op :4 ; +uint64_t ctype :4 ; +uint64_t lf :7 ; +uint64_t rsvd_23_15 :9 ; +uint64_t cindex :20 ; +uint64_t rsvd_62_44 :19 ; +uint64_t doneint :1 ; +uint64_t res_addr :64 ;/* W1 */ +}; + +/* NIX admin queue result structure */ +struct nix_aq_res_s { +uint64_t op :4 ; +uint64_t ctype :4 ; +uint64_t compcode :8 ; +uint64_t doneint :1 ; +uint64_t rsvd_63_17 :47 ; +uint64_t rsvd_127_64 :64 ;/* W1 */ +}; + +/* NIX bandwidth profile structure */ +struct nix_band_prof_s { +uint64_t pc_mode :2 ; +uint64_t icolor :2 ; +uint64_t tnl_ena :1 ; +uint64_t rsvd_7_5 :3 ; +uint64_t peir_exponent :5 ; +uint64_t rsvd_15_13 :3 ; +uint64_t pebs_exponent :5 ; +uint64_t rsvd_23_21 :3 ; +uint64_t cir_exponent :5 ; +uint64_t rsvd_31_29 :3 ; +uint64_t cbs_exponent :5 ; +uint64_t rsvd_39_37 :3 ; +uint64_t peir_mantissa :8 ; +uint64_t pebs_mantissa :8 ; +uint64_t cir_mantissa :8 ; +uint64_t cbs_mantissa :8 ; +uint64_t lmode :1 ; +uint64_t l_sellect :3 ; +uint64_t rdiv :4 ; +uint64_t adjust_exponent :5 ; +uint64_t rsvd_86_85 :2 ; +uint64_t adjust_mantissa :9 ; +uint64_t gc_action :2 ; +uint64_t yc_action :2 ; +uint64_t rc_action :2 ; +uint64_t meter_algo :2 ; +uint64_t band_prof_id :7 ; +uint64_t rsvd_118_111 :8 ; +uint64_t hl_en :1 ; +uint64_t rsvd_127_120 :8 ; +uint64_t ts :48 ; +uint64_t rsvd_191_176 :16 ; +uint64_t pe_accum :32 ; +uint64_t c_accum :32 ; +uint64_t green_pkt_pass :48 ; +uint64_t rsvd_319_304 :16 ; +uint64_t yellow_pkt_pass :48 ; +uint64_t rsvd_383_368 :16 ; +uint64_t red_pkt_pass :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t green_octs_pass :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t yellow_octs_pass :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t red_octs_pass :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t green_pkt_drop :48 ; +uint64_t rsvd_703_688 :16 ; +uint64_t yellow_pkt_drop :48 ; +uint64_t rsvd_767_752 :16 ; +uint64_t red_pkt_drop :48 ; +uint64_t rsvd_831_816 :16 ; +uint64_t green_octs_drop :48 ; +uint64_t rsvd_895_880 :16 ; +uint64_t yellow_octs_drop :48 ; +uint64_t rsvd_959_944 :16 ; +uint64_t red_octs_drop :48 ; +uint64_t rsvd_1023_1008 :16 ; +}; + +/* NIX completion interrupt context hardware structure */ +struct nix_cint_hw_s { +uint64_t ecount :32 ; +uint64_t qcount :16 ; +uint64_t intr :1 ; +uint64_t ena :1 ; +uint64_t timer_idx :8 ; +uint64_t rsvd_63_58 :6 ; +uint64_t ecount_wait :32 ; +uint64_t qcount_wait :16 ; +uint64_t time_wait :8 ; +uint64_t rsvd_127_120 :8 ; +}; + +/* NIX completion queue entry header structure */ +struct nix_cqe_hdr_s { +uint64_t tag :32 ; +uint64_t q :20 ; +uint64_t rsvd_57_52 :6 ; +uint64_t node :2 ; +uint64_t cqe_type :4 ; +}; + +/* NIX completion queue context structure */ +struct nix_cq_ctx_s { +uint64_t base :64 ;/* W0 */ +uint64_t rsvd_67_64 :4 ; +uint64_t bp_ena :1 ; +uint64_t rsvd_71_69 :3 ; +uint64_t bpid :9 ; +uint64_t rsvd_83_81 :3 ; +uint64_t qint_idx :7 ; +uint64_t cq_err :1 ; +uint64_t cint_idx :7 ; +uint64_t avg_con :9 ; +uint64_t wrptr :20 ; +uint64_t tail :20 ; +uint64_t head :20 ; +uint64_t avg_level :8 ; +uint64_t update_time :16 ; +uint64_t bp :8 ; +uint64_t drop :8 ; +uint64_t drop_ena :1 ; +uint64_t ena :1 ; +uint64_t rsvd_211_210 :2 ; +uint64_t substream :20 ; +uint64_t caching :1 ; +uint64_t rsvd_235_233 :3 ; +uint64_t qsize :4 ; +uint64_t cq_err_int :8 ; +uint64_t cq_err_int_ena :8 ; +}; + +/* NIX instruction header structure */ +struct nix_inst_hdr_s { +uint64_t pf_func :16 ; +uint64_t sq :20 ; +uint64_t rsvd_63_36 :28 ; +}; + +/* NIX i/o virtual address structure */ +struct nix_iova_s { +uint64_t addr :64 ;/* W0 */ +}; + +/* NIX IPsec dynamic ordering counter structure */ +struct nix_ipsec_dyno_s { +uint32_t count :32 ;/* W0 */ +}; + +/* NIX memory value structure */ +struct nix_mem_result_s { +uint64_t v :1 ; +uint64_t color :2 ; +uint64_t rsvd_63_3 :61 ; +}; + +/* NIX statistics operation write data structure */ +struct nix_op_q_wdata_s { +uint64_t rsvd_31_0 :32 ; +uint64_t q :20 ; +uint64_t rsvd_63_52 :12 ; +}; + +/* NIX queue interrupt context hardware structure */ +struct nix_qint_hw_s { +uint32_t count :22 ; +uint32_t rsvd_30_22 :9 ; +uint32_t ena :1 ; +}; + +/* [CN10K, .) NIX receive queue context structure */ +struct nix_cn10k_rq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t rsvd_36_24 :13 ; +uint64_t lenerr_dis :1 ; +uint64_t csum_il4_dis :1 ; +uint64_t csum_ol4_dis :1 ; +uint64_t len_il4_dis :1 ; +uint64_t len_il3_dis :1 ; +uint64_t len_ol4_dis :1 ; +uint64_t len_ol3_dis :1 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t pb_stashing :1 ; +uint64_t ipsecd_drop_en :1 ; +uint64_t chi_ena :1 ; +uint64_t rsvd_127_125 :3 ; +uint64_t band_prof_id :10 ; +uint64_t rsvd_138 :1 ; +uint64_t policer_ena :1 ; +uint64_t spb_sizem1 :6 ; +uint64_t wqe_skip :2 ; +uint64_t spb_high_sizem1 :3 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_319_288 :32 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t ipsec_vwqe :1 ; +uint64_t vwqe_ena :1 ; +uint64_t vtime_wait :8 ; +uint64_t max_vsize_exp :4 ; +uint64_t vwqe_skip :2 ; +uint64_t rsvd_383_382 :2 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_702_688 :15 ; +uint64_t ena_copy :1 ; +uint64_t rsvd_739_704 :36 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_767_763 :5 ; +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* NIX receive queue context structure */ +struct nix_rq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t substream :20 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t wqe_skip :2 ; +uint64_t rsvd_127_124 :4 ; +uint64_t rsvd_139_128 :12 ; +uint64_t spb_sizem1 :6 ; +uint64_t rsvd_150_146 :5 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_319_288 :32 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t rsvd_383_366 :18 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_702_688 :15 ; +uint64_t ena_copy :1 ; +uint64_t rsvd_739_704 :36 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_767_763 :5 ; +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* [CN10K, .) NIX Receive queue context structure */ +struct nix_cn10k_rq_ctx_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t rsvd_36_24 :13 ; +uint64_t lenerr_dis :1 ; +uint64_t csum_il4_dis :1 ; +uint64_t csum_ol4_dis :1 ; +uint64_t len_il4_dis :1 ; +uint64_t len_il3_dis :1 ; +uint64_t len_ol4_dis :1 ; +uint64_t len_ol3_dis :1 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t pb_stashing :1 ; +uint64_t ipsecd_drop_en :1 ; +uint64_t chi_ena :1 ; +uint64_t rsvd_127_125 :3 ; +uint64_t band_prof_id :10 ; +uint64_t rsvd_138 :1 ; +uint64_t policer_ena :1 ; +uint64_t spb_sizem1 :6 ; +uint64_t wqe_skip :2 ; +uint64_t spb_high_sizem1 :3 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_291_288 :4 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_319_315 :5 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t ipsec_vwqe :1 ; +uint64_t vwqe_ena :1 ; +uint64_t vtime_wait :8 ; +uint64_t max_vsize_exp :4 ; +uint64_t vwqe_skip :2 ; +uint64_t rsvd_383_382 :2 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_703_688 :16 ; +uint64_t rsvd_767_704 :64 ;/* W11 */ +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* NIX receive queue context structure */ +struct nix_rq_ctx_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t substream :20 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t rsvd_127_122 :6 ; +uint64_t rsvd_139_128 :12 ; +uint64_t spb_sizem1 :6 ; +uint64_t wqe_skip :2 ; +uint64_t rsvd_150_148 :3 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_291_288 :4 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_319_315 :5 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t rsvd_383_366 :18 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_703_688 :16 ; +uint64_t rsvd_767_704 :64 ;/* W11 */ +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* NIX receive side scaling entry structure */ +struct nix_rsse_s { +uint32_t rq :20 ; +uint32_t rsvd_31_20 :12 ; +}; + +/* NIX receive action structure */ +struct nix_rx_action_s { +uint64_t op :4 ; +uint64_t pf_func :16 ; +uint64_t index :20 ; +uint64_t match_id :16 ; +uint64_t flow_key_alg :5 ; +uint64_t rsvd_63_61 :3 ; +}; + +/* NIX receive immediate sub descriptor structure */ +struct nix_rx_imm_s { +uint64_t size :16 ; +uint64_t apad :3 ; +uint64_t rsvd_59_19 :41 ; +uint64_t subdc :4 ; +}; + +/* NIX receive multicast/mirror entry structure */ +struct nix_rx_mce_s { +uint64_t op :2 ; +uint64_t rsvd_2 :1 ; +uint64_t eol :1 ; +uint64_t index :20 ; +uint64_t rsvd_31_24 :8 ; +uint64_t pf_func :16 ; +uint64_t next :16 ; +}; + +/* NIX receive parse structure */ +union nix_rx_parse_u { +struct { +uint64_t chan :12 ; +uint64_t desc_sizem1 :5 ; +uint64_t imm_copy :1 ; +uint64_t express :1 ; +uint64_t wqwd :1 ; +uint64_t errlev :4 ; +uint64_t errcode :8 ; +uint64_t latype :4 ; +uint64_t lbtype :4 ; +uint64_t lctype :4 ; +uint64_t ldtype :4 ; +uint64_t letype :4 ; +uint64_t lftype :4 ; +uint64_t lgtype :4 ; +uint64_t lhtype :4 ; +uint64_t pkt_lenm1 :16 ; +uint64_t l2m :1 ; +uint64_t l2b :1 ; +uint64_t l3m :1 ; +uint64_t l3b :1 ; +uint64_t vtag0_valid :1 ; +uint64_t vtag0_gone :1 ; +uint64_t vtag1_valid :1 ; +uint64_t vtag1_gone :1 ; +uint64_t pkind :6 ; +uint64_t nix_idx :2 ; +uint64_t vtag0_tci :16 ; +uint64_t vtag1_tci :16 ; +uint64_t laflags :8 ; +uint64_t lbflags :8 ; +uint64_t lcflags :8 ; +uint64_t ldflags :8 ; +uint64_t leflags :8 ; +uint64_t lfflags :8 ; +uint64_t lgflags :8 ; +uint64_t lhflags :8 ; +uint64_t eoh_ptr :8 ; +uint64_t wqe_aura :20 ; +uint64_t pb_aura :20 ; +uint64_t match_id :16 ; +uint64_t laptr :8 ; +uint64_t lbptr :8 ; +uint64_t lcptr :8 ; +uint64_t ldptr :8 ; +uint64_t leptr :8 ; +uint64_t lfptr :8 ; +uint64_t lgptr :8 ; +uint64_t lhptr :8 ; +uint64_t vtag0_ptr :8 ; +uint64_t vtag1_ptr :8 ; +uint64_t flow_key_alg :5 ; +uint64_t rsvd_341 :1 ; +uint64_t rsvd_349_342 :8 ; +uint64_t rsvd_353_350 :4 ; +uint64_t rsvd_359_354 :6 ; +uint64_t color :2 ; +uint64_t rsvd_381_362 :20 ; +uint64_t rsvd_382 :1 ; +uint64_t rsvd_383 :1 ; +uint64_t rsvd_447_384 :64 ;/* W6 */ + }; +struct { +uint64_t chan :12 ; +uint64_t desc_sizem1 :5 ; +uint64_t imm_copy :1 ; +uint64_t express :1 ; +uint64_t wqwd :1 ; +uint64_t errlev :4 ; +uint64_t errcode :8 ; +uint64_t latype :4 ; +uint64_t lbtype :4 ; +uint64_t lctype :4 ; +uint64_t ldtype :4 ; +uint64_t letype :4 ; +uint64_t lftype :4 ; +uint64_t lgtype :4 ; +uint64_t lhtype :4 ; +uint64_t pkt_lenm1 :16 ; +uint64_t l2m :1 ; +uint64_t l2b :1 ; +uint64_t l3m :1 ; +uint64_t l3b :1 ; +uint64_t vtag0_valid :1 ; +uint64_t vtag0_gone :1 ; +uint64_t vtag1_valid :1 ; +uint64_t vtag1_gone :1 ; +uint64_t pkind :6 ; +uint64_t rsvd_95_94 :2 ; +uint64_t vtag0_tci :16 ; +uint64_t vtag1_tci :16 ; +uint64_t laflags :8 ; +uint64_t lbflags :8 ; +uint64_t lcflags :8 ; +uint64_t ldflags :8 ; +uint64_t leflags :8 ; +uint64_t lfflags :8 ; +uint64_t lgflags :8 ; +uint64_t lhflags :8 ; +uint64_t eoh_ptr :8 ; +uint64_t wqe_aura :20 ; +uint64_t pb_aura :20 ; +uint64_t match_id :16 ; +uint64_t laptr :8 ; +uint64_t lbptr :8 ; +uint64_t lcptr :8 ; +uint64_t ldptr :8 ; +uint64_t leptr :8 ; +uint64_t lfptr :8 ; +uint64_t lgptr :8 ; +uint64_t lhptr :8 ; +uint64_t vtag0_ptr :8 ; +uint64_t vtag1_ptr :8 ; +uint64_t flow_key_alg :5 ; +uint64_t rsvd_383_341 :43 ; +uint64_t rsvd_447_384 :64 ;/* W6 */ + } cn9k; +}; + +/* NIX receive scatter/gather sub descriptor structure */ +struct nix_rx_sg_s { +uint64_t seg1_size :16 ; +uint64_t seg2_size :16 ; +uint64_t seg3_size :16 ; +uint64_t segs :2 ; +uint64_t rsvd_59_50 :10 ; +uint64_t subdc :4 ; +}; + +/* NIX receive vtag action structure */ +union nix_rx_vtag_action_u { +struct { +uint64_t vtag0_relptr :8 ; +uint64_t vtag0_lid :3 ; +uint64_t sa_xor :1 ; +uint64_t vtag0_type :3 ; +uint64_t vtag0_valid :1 ; +uint64_t sa_lo :16 ; +uint64_t vtag1_relptr :8 ; +uint64_t vtag1_lid :3 ; +uint64_t rsvd_43 :1 ; +uint64_t vtag1_type :3 ; +uint64_t vtag1_valid :1 ; +uint64_t sa_hi :16 ; + }; +struct { +uint64_t vtag0_relptr :8 ; +uint64_t vtag0_lid :3 ; +uint64_t rsvd_11 :1 ; +uint64_t vtag0_type :3 ; +uint64_t vtag0_valid :1 ; +uint64_t rsvd_31_16 :16 ; +uint64_t vtag1_relptr :8 ; +uint64_t vtag1_lid :3 ; +uint64_t rsvd_43 :1 ; +uint64_t vtag1_type :3 ; +uint64_t vtag1_valid :1 ; +uint64_t rsvd_63_48 :16 ; + } cn9k; +}; + +/* NIX send completion structure */ +struct nix_send_comp_s { +uint64_t status :8 ; +uint64_t sqe_id :16 ; +uint64_t rsvd_63_24 :40 ; +}; + +/* NIX send CRC sub descriptor structure */ +struct nix_send_crc_s { +uint64_t size :16 ; +uint64_t start :16 ; +uint64_t insert :16 ; +uint64_t rsvd_57_48 :10 ; +uint64_t alg :2 ; +uint64_t subdc :4 ; +uint64_t iv :32 ; +uint64_t rsvd_127_96 :32 ; +}; + +/* NIX send extended header sub descriptor structure */ +PLT_STD_C11 +union nix_send_ext_w0_u { +uint64_t u; +struct { +uint64_t lso_mps :14 ; +uint64_t lso :1 ; +uint64_t tstmp :1 ; +uint64_t lso_sb :8 ; +uint64_t lso_format :5 ; +uint64_t rsvd_31_29 :3 ; +uint64_t shp_chg :9 ; +uint64_t shp_dis :1 ; +uint64_t shp_ra :2 ; +uint64_t markptr :8 ; +uint64_t markform :7 ; +uint64_t mark_en :1 ; +uint64_t subdc :4 ; + }; +}; + +PLT_STD_C11 +union nix_send_ext_w1_u { +uint64_t u; +struct { +uint64_t vlan0_ins_ptr :8 ; +uint64_t vlan0_ins_tci :16 ; +uint64_t vlan1_ins_ptr :8 ; +uint64_t vlan1_ins_tci :16 ; +uint64_t vlan0_ins_ena :1 ; +uint64_t vlan1_ins_ena :1 ; +uint64_t init_color :2 ; +uint64_t rsvd_127_116 :12 ; + }; +struct { +uint64_t vlan0_ins_ptr :8 ; +uint64_t vlan0_ins_tci :16 ; +uint64_t vlan1_ins_ptr :8 ; +uint64_t vlan1_ins_tci :16 ; +uint64_t vlan0_ins_ena :1 ; +uint64_t vlan1_ins_ena :1 ; +uint64_t rsvd_127_114 :14 ; + } cn9k; +}; + +struct nix_send_ext_s { +union nix_send_ext_w0_u w0; +union nix_send_ext_w1_u w1; +}; + +/* NIX send header sub descriptor structure */ +PLT_STD_C11 +union nix_send_hdr_w0_u { +uint64_t u; +struct { +uint64_t total :18 ; +uint64_t rsvd_18 :1 ; +uint64_t df :1 ; +uint64_t aura :20 ; +uint64_t sizem1 :3 ; +uint64_t pnc :1 ; +uint64_t sq :20 ; + }; +}; + +PLT_STD_C11 +union nix_send_hdr_w1_u { +uint64_t u; +struct { +uint64_t ol3ptr :8 ; +uint64_t ol4ptr :8 ; +uint64_t il3ptr :8 ; +uint64_t il4ptr :8 ; +uint64_t ol3type :4 ; +uint64_t ol4type :4 ; +uint64_t il3type :4 ; +uint64_t il4type :4 ; +uint64_t sqe_id :16 ; + }; +}; + +struct nix_send_hdr_s { +union nix_send_hdr_w0_u w0; +union nix_send_hdr_w1_u w1; +}; + +/* NIX send immediate sub descriptor structure */ +struct nix_send_imm_s { +uint64_t size :16 ; +uint64_t apad :3 ; +uint64_t rsvd_59_19 :41 ; +uint64_t subdc :4 ; +}; + +/* NIX send jump sub descriptor structure */ +struct nix_send_jump_s { +uint64_t sizem1 :7 ; +uint64_t rsvd_13_7 :7 ; +uint64_t ld_type :2 ; +uint64_t aura :20 ; +uint64_t rsvd_58_36 :23 ; +uint64_t f :1 ; +uint64_t subdc :4 ; +uint64_t addr :64 ;/* W1 */ +}; + +/* NIX send memory sub descriptor structure */ +PLT_STD_C11 +union nix_send_mem_w0_u { +uint64_t u; +struct { +uint64_t offset :16 ; +uint64_t rsvd_51_16 :36 ; +uint64_t per_lso_seg :1 ; +uint64_t wmem :1 ; +uint64_t dsz :2 ; +uint64_t alg :4 ; +uint64_t subdc :4 ; + }; +struct { +uint64_t offset :16 ; +uint64_t rsvd_52_16 :37 ; +uint64_t wmem :1 ; +uint64_t dsz :2 ; +uint64_t alg :4 ; +uint64_t subdc :4 ; + } cn9k; +}; + +struct nix_send_mem_s { +union nix_send_mem_w0_u w0; +uint64_t addr :64 ;/* W1 */ +}; + +/* NIX send scatter/gather sub descriptor structure */ +PLT_STD_C11 +union nix_send_sg2_s { +uint64_t u; +struct { +uint64_t seg1_size :16 ; +uint64_t aura :20 ; +uint64_t i1 :1 ; +uint64_t fabs :1 ; +uint64_t foff :8 ; +uint64_t rsvd_57_46 :12 ; +uint64_t ld_type :2 ; +uint64_t subdc :4 ; + }; +}; + +PLT_STD_C11 +union nix_send_sg_s { +uint64_t u; +struct { +uint64_t seg1_size :16 ; +uint64_t seg2_size :16 ; +uint64_t seg3_size :16 ; +uint64_t segs :2 ; +uint64_t rsvd_54_50 :5 ; +uint64_t i1 :1 ; +uint64_t i2 :1 ; +uint64_t i3 :1 ; +uint64_t ld_type :2 ; +uint64_t subdc :4 ; + }; +}; + +/* NIX send work sub descriptor structure */ +struct nix_send_work_s { +uint64_t tag :32 ; +uint64_t tt :2 ; +uint64_t grp :10 ; +uint64_t rsvd_59_44 :16 ; +uint64_t subdc :4 ; +uint64_t addr :64 ;/* W1 */ +}; + +/* [CN10K, .) NIX sq context hardware structure */ +struct nix_cn10k_sq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t substream :20 ; +uint64_t max_sqe_size :2 ; +uint64_t sqe_way_mask :16 ; +uint64_t sqb_aura :20 ; +uint64_t gbl_rsvd1 :5 ; +uint64_t cq_id :20 ; +uint64_t cq_ena :1 ; +uint64_t qint_idx :6 ; +uint64_t gbl_rsvd2 :1 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t xoff :1 ; +uint64_t sqe_stype :2 ; +uint64_t gbl_rsvd :17 ; +uint64_t head_sqb :64 ;/* W2 */ +uint64_t head_offset :6 ; +uint64_t sqb_dequeue_count :16 ; +uint64_t default_chan :12 ; +uint64_t sdp_mcast :1 ; +uint64_t sso_ena :1 ; +uint64_t dse_rsvd1 :28 ; +uint64_t sqb_enqueue_count :16 ; +uint64_t tail_offset :6 ; +uint64_t lmt_dis :1 ; +uint64_t smq_rr_weight :14 ; +uint64_t dnq_rsvd1 :27 ; +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t next_sqb :64 ;/* W6 */ +uint64_t smq :10 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t mnq_dis :1 ; +uint64_t scm1_rsvd2 :31 ; +uint64_t smenq_sqb :64 ;/* W8 */ +uint64_t smenq_offset :6 ; +uint64_t cq_limit :8 ; +uint64_t smq_rr_count :32 ; +uint64_t scm_lso_rem :18 ; +uint64_t smq_lso_segnum :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t scm_dq_rsvd1 :9 ; +uint64_t smenq_next_sqb :64 ;/* W11 */ +uint64_t age_drop_octs :32 ; +uint64_t age_drop_pkts :32 ; +uint64_t drop_pkts :48 ; +uint64_t drop_octs_lsw :16 ; +uint64_t drop_octs_msw :32 ; +uint64_t pkts_lsw :32 ; +uint64_t pkts_msw :16 ; +uint64_t octs :48 ; +}; + +/* NIX sq context hardware structure */ +struct nix_sq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t substream :20 ; +uint64_t max_sqe_size :2 ; +uint64_t sqe_way_mask :16 ; +uint64_t sqb_aura :20 ; +uint64_t gbl_rsvd1 :5 ; +uint64_t cq_id :20 ; +uint64_t cq_ena :1 ; +uint64_t qint_idx :6 ; +uint64_t gbl_rsvd2 :1 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t xoff :1 ; +uint64_t sqe_stype :2 ; +uint64_t gbl_rsvd :17 ; +uint64_t head_sqb :64 ;/* W2 */ +uint64_t head_offset :6 ; +uint64_t sqb_dequeue_count :16 ; +uint64_t default_chan :12 ; +uint64_t sdp_mcast :1 ; +uint64_t sso_ena :1 ; +uint64_t dse_rsvd1 :28 ; +uint64_t sqb_enqueue_count :16 ; +uint64_t tail_offset :6 ; +uint64_t lmt_dis :1 ; +uint64_t smq_rr_quantum :24 ; +uint64_t dnq_rsvd1 :17 ; +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t next_sqb :64 ;/* W6 */ +uint64_t mnq_dis :1 ; +uint64_t smq :9 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t scm1_rsvd2 :32 ; +uint64_t smenq_sqb :64 ;/* W8 */ +uint64_t smenq_offset :6 ; +uint64_t cq_limit :8 ; +uint64_t smq_rr_count :25 ; +uint64_t scm_lso_rem :18 ; +uint64_t scm_dq_rsvd0 :7 ; +uint64_t smq_lso_segnum :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t scm_dq_rsvd1 :9 ; +uint64_t smenq_next_sqb :64 ;/* W11 */ +uint64_t seb_rsvd1 :64 ;/* W12 */ +uint64_t drop_pkts :48 ; +uint64_t drop_octs_lsw :16 ; +uint64_t drop_octs_msw :32 ; +uint64_t pkts_lsw :32 ; +uint64_t pkts_msw :16 ; +uint64_t octs :48 ; +}; + +/* [CN10K, .) NIX Send queue context structure */ +struct nix_cn10k_sq_ctx_s { +uint64_t ena :1 ; +uint64_t qint_idx :6 ; +uint64_t substream :20 ; +uint64_t sdp_mcast :1 ; +uint64_t cq :20 ; +uint64_t sqe_way_mask :16 ; +uint64_t smq :10 ; +uint64_t cq_ena :1 ; +uint64_t xoff :1 ; +uint64_t sso_ena :1 ; +uint64_t smq_rr_weight :14 ; +uint64_t default_chan :12 ; +uint64_t sqb_count :16 ; +uint64_t rsvd_120_119 :2 ; +uint64_t smq_rr_count_lb :7 ; +uint64_t smq_rr_count_ub :25 ; +uint64_t sqb_aura :20 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t sqe_stype :2 ; +uint64_t rsvd_191 :1 ; +uint64_t max_sqe_size :2 ; +uint64_t cq_limit :8 ; +uint64_t lmt_dis :1 ; +uint64_t mnq_dis :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_lso_segnum :8 ; +uint64_t tail_offset :6 ; +uint64_t smenq_offset :6 ; +uint64_t head_offset :6 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t rsvd_255_253 :3 ; +uint64_t next_sqb :64 ;/* W4 */ +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t smenq_sqb :64 ;/* W6 */ +uint64_t smenq_next_sqb :64 ;/* W7 */ +uint64_t head_sqb :64 ;/* W8 */ +uint64_t rsvd_583_576 :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t rsvd_639_630 :10 ; +uint64_t scm_lso_rem :18 ; +uint64_t rsvd_703_658 :46 ; +uint64_t octs :48 ; +uint64_t rsvd_767_752 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_831_816 :16 ; +uint64_t aged_drop_octs :32 ; +uint64_t aged_drop_pkts :32 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_959_944 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_1023_1008 :16 ; +}; + +/* NIX send queue context structure */ +struct nix_sq_ctx_s { +uint64_t ena :1 ; +uint64_t qint_idx :6 ; +uint64_t substream :20 ; +uint64_t sdp_mcast :1 ; +uint64_t cq :20 ; +uint64_t sqe_way_mask :16 ; +uint64_t smq :9 ; +uint64_t cq_ena :1 ; +uint64_t xoff :1 ; +uint64_t sso_ena :1 ; +uint64_t smq_rr_quantum :24 ; +uint64_t default_chan :12 ; +uint64_t sqb_count :16 ; +uint64_t smq_rr_count :25 ; +uint64_t sqb_aura :20 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t sqe_stype :2 ; +uint64_t rsvd_191 :1 ; +uint64_t max_sqe_size :2 ; +uint64_t cq_limit :8 ; +uint64_t lmt_dis :1 ; +uint64_t mnq_dis :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_lso_segnum :8 ; +uint64_t tail_offset :6 ; +uint64_t smenq_offset :6 ; +uint64_t head_offset :6 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t rsvd_255_253 :3 ; +uint64_t next_sqb :64 ;/* W4 */ +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t smenq_sqb :64 ;/* W6 */ +uint64_t smenq_next_sqb :64 ;/* W7 */ +uint64_t head_sqb :64 ;/* W8 */ +uint64_t rsvd_583_576 :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t rsvd_639_630 :10 ; +uint64_t scm_lso_rem :18 ; +uint64_t rsvd_703_658 :46 ; +uint64_t octs :48 ; +uint64_t rsvd_767_752 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_831_816 :16 ; +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t drop_octs :48 ; +uint64_t rsvd_959_944 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_1023_1008 :16 ; +}; + +/* NIX transmit action structure */ +struct nix_tx_action_s { +uint64_t op :4 ; +uint64_t rsvd_11_4 :8 ; +uint64_t index :20 ; +uint64_t match_id :16 ; +uint64_t rsvd_63_48 :16 ; +}; + +/* NIX transmit vtag action structure */ +struct nix_tx_vtag_action_s { +uint64_t vtag0_relptr :8 ; +uint64_t vtag0_lid :3 ; +uint64_t rsvd_11 :1 ; +uint64_t vtag0_op :2 ; +uint64_t rsvd_15_14 :2 ; +uint64_t vtag0_def :10 ; +uint64_t rsvd_31_26 :6 ; +uint64_t vtag1_relptr :8 ; +uint64_t vtag1_lid :3 ; +uint64_t rsvd_43 :1 ; +uint64_t vtag1_op :2 ; +uint64_t rsvd_47_46 :2 ; +uint64_t vtag1_def :10 ; +uint64_t rsvd_63_58 :6 ; +}; + +/* NIX work queue entry header structure */ +struct nix_wqe_hdr_s { +uint64_t tag :32 ; +uint64_t tt :2 ; +uint64_t grp :10 ; +uint64_t node :2 ; +uint64_t q :14 ; +uint64_t wqe_type :4 ; +}; + +/* NIX Rx flow key algorithm field structure */ +struct nix_rx_flowkey_alg { +uint64_t key_offset :6 ; +uint64_t ln_mask :1 ; +uint64_t fn_mask :1 ; +uint64_t hdr_offset :8 ; +uint64_t bytesm1 :5 ; +uint64_t lid :3 ; +uint64_t reserved_24_24 :1 ; +uint64_t ena :1 ; +uint64_t sel_chan :1 ; +uint64_t ltype_mask :4 ; +uint64_t ltype_match :4 ; +uint64_t reserved_35_63 :29 ; +}; + +/* NIX LSO format field structure */ +struct nix_lso_format { +uint64_t offset :8 ; +uint64_t layer :2 ; +uint64_t rsvd_10_11 :2 ; +uint64_t sizem1 :2 ; +uint64_t rsvd_14_15 :2 ; +uint64_t alg :3 ; +uint64_t rsvd_19_63 :45 ; +}; + +#define NIX_LSO_FIELD_MAX (8) +#define NIX_LSO_FIELD_ALG_MASK GENMASK(18, 16) +#define NIX_LSO_FIELD_SZ_MASK GENMASK(13, 12) +#define NIX_LSO_FIELD_LY_MASK GENMASK(9, 8) +#define NIX_LSO_FIELD_OFF_MASK GENMASK(7, 0) + +#define NIX_LSO_FIELD_MASK \ + (NIX_LSO_FIELD_OFF_MASK | NIX_LSO_FIELD_LY_MASK | \ + NIX_LSO_FIELD_SZ_MASK | NIX_LSO_FIELD_ALG_MASK) + +#define NIX_CN9K_MAX_HW_FRS 9212UL +#define NIX_LBK_MAX_HW_FRS 65535UL +#define NIX_RPM_MAX_HW_FRS 16380UL +#define NIX_MIN_HW_FRS 60UL + +/* NIX rate limits */ +#define NIX_TM_MAX_RATE_DIV_EXP 12 +#define NIX_TM_MAX_RATE_EXPONENT 0xf +#define NIX_TM_MAX_RATE_MANTISSA 0xff + +#define NIX_TM_SHAPER_RATE_CONST ((uint64_t)2E6) + +/* NIX rate calculation in Bits/Sec +* PIR_ADD = ((256 + NIX_*_PIR[RATE_MANTISSA]) +* << NIX_*_PIR[RATE_EXPONENT]) / 256 +* PIR = (2E6 * PIR_ADD / (1 << NIX_*_PIR[RATE_DIVIDER_EXPONENT])) +* +* CIR_ADD = ((256 + NIX_*_CIR[RATE_MANTISSA]) +* << NIX_*_CIR[RATE_EXPONENT]) / 256 +* CIR = (2E6 * CIR_ADD / (CCLK_TICKS << NIX_*_CIR[RATE_DIVIDER_EXPONENT])) +*/ +#define NIX_TM_SHAPER_RATE (exponent, mantissa, div_exp) \ + ((NIX_TM_SHAPER_RATE_CONST * ((256 + (mantissa)) << (exponent))) / \ + (((1ull << (div_exp)) * 256))) + +/* Rate limit in Bits/Sec */ +#define NIX_TM_MIN_SHAPER_RATE NIX_TM_SHAPER_RATE(0, 0, NIX_TM_MAX_RATE_DIV_EXP) + +#define NIX_TM_MAX_SHAPER_RATE \ + NIX_TM_SHAPER_RATE(NIX_TM_MAX_RATE_EXPONENT, NIX_TM_MAX_RATE_MANTISSA, \ + 0) + +/* NIX burst limits */ +#define NIX_TM_MAX_BURST_EXPONENT 0xf +#define NIX_TM_MAX_BURST_MANTISSA 0xff + +/* NIX burst calculation +* PIR_BURST = ((256 + NIX_*_PIR[BURST_MANTISSA]) +* << (NIX_*_PIR[BURST_EXPONENT] + 1)) +* / 256 +* +* CIR_BURST = ((256 + NIX_*_CIR[BURST_MANTISSA]) +* << (NIX_*_CIR[BURST_EXPONENT] + 1)) +* / 256 +*/ +#define NIX_TM_SHAPER_BURST (exponent, mantissa) \ + (((256 + (mantissa)) << ((exponent) + 1)) / 256) + +/* Burst limit in Bytes */ +#define NIX_TM_MIN_SHAPER_BURST NIX_TM_SHAPER_BURST(0, 0) + +#define NIX_TM_MAX_SHAPER_BURST \ + NIX_TM_SHAPER_BURST(NIX_TM_MAX_BURST_EXPONENT, \ + NIX_TM_MAX_BURST_MANTISSA) + +/* Min is limited so that NIX_AF_SMQX_CFG[MINLEN]+ADJUST is not -ve */ +#define NIX_TM_LENGTH_ADJUST_MIN ((int)-NIX_MIN_HW_FRS + 1) +#define NIX_TM_LENGTH_ADJUST_MAX 255 + +#define NIX_TM_TLX_SP_PRIO_MAX 10 +#define NIX_CN9K_TM_RR_QUANTUM_MAX (BIT_ULL(24) - 1) +#define NIX_TM_RR_QUANTUM_MAX (BIT_ULL(14) - 1) + +/* [CN9K, CN10K) */ +#define NIX_CN9K_TXSCH_LVL_SMQ_MAX 512 + +/* [CN10K, .) */ +#define NIX_TXSCH_LVL_SMQ_MAX 832 + +/* [CN9K, .) */ +#define NIX_TXSCH_LVL_TL4_MAX 512 +#define NIX_TXSCH_LVL_TL3_MAX 256 +#define NIX_TXSCH_LVL_TL2_MAX 256 +#define NIX_TXSCH_LVL_TL1_MAX 28 + +#define NIX_CQ_OP_STAT_OP_ERR 63 +#define NIX_CQ_OP_STAT_CQ_ERR 46 + +#define NIX_RQ_CN10K_SPB_MAX_SIZE 4096 + +/* [CN9K, .) */ +#define NIX_LSO_SEG_MAX 256 +#define NIX_LSO_MPS_MAX (BIT_ULL(14) - 1) + +/* Software defined LSO base format IDX */ +#define NIX_LSO_FORMAT_IDX_TSOV4 0 +#define NIX_LSO_FORMAT_IDX_TSOV6 1 + +#endif /* __NIX_HW_H__ */
drivers/common/cnxk/hw/npa.h new file +376 -0
376 lines not on this page · raw message
drivers/common/cnxk/hw/npc.h new file +525 -0
433 lines not on this page · raw message
drivers/common/cnxk/hw/rvu.h new file +222 -0
222 lines not on this page · raw message
drivers/common/cnxk/hw/sdp.h new file +182 -0
182 lines not on this page · raw message
drivers/common/cnxk/hw/sso.h new file +233 -0
233 lines not on this page · raw message
drivers/common/cnxk/hw/ssow.h new file +70 -0
70 lines not on this page · raw message
drivers/common/cnxk/hw/tim.h new file +49 -0
49 lines not on this page · raw message
drivers/common/cnxk/meson.build new file +14 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_api.h new file +69 -0
69 lines not on this page · raw message
drivers/common/cnxk/roc_bitfield.h new file +15 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_bits.h new file +32 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_platform.c new file +5 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_platform.h new file +154 -0
154 lines not on this page · raw message
drivers/common/cnxk/version.map new file +4 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.8.4
Part of the diff is not shown here. View the raw message.
PATCH v4 3/52 common/cnxk: add model init and IO handling API
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add routines for SoC model identification and HW IO handling routines specific to CN9K and CN10K Marvell SoC's. These are based on arm64 ISA and behaviour specific to Marvell SoC's.
--- drivers/common/cnxk/meson.build | 4 +- drivers/common/cnxk/roc_api.h | 13 +++ drivers/common/cnxk/roc_io.h | 187 ++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_io_generic.h | 122 +++++++++++++++++++++ drivers/common/cnxk/roc_model.c | 204 +++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_model.h | 128 ++++++++++++++++++++++ drivers/common/cnxk/roc_platform.c | 28 +++++ drivers/common/cnxk/roc_platform.h | 10 ++ drivers/common/cnxk/roc_priv.h | 11 ++ drivers/common/cnxk/roc_util_priv.h | 14 +++ drivers/common/cnxk/roc_utils.c | 35 ++++++ drivers/common/cnxk/roc_utils.h | 13 +++ drivers/common/cnxk/version.map | 5 + 13 files changed, 773 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/roc_io.h create mode 100644 drivers/common/cnxk/roc_io_generic.h create mode 100644 drivers/common/cnxk/roc_model.c create mode 100644 drivers/common/cnxk/roc_model.h create mode 100644 drivers/common/cnxk/roc_priv.h create mode 100644 drivers/common/cnxk/roc_util_priv.h create mode 100644 drivers/common/cnxk/roc_utils.c create mode 100644 drivers/common/cnxk/roc_utils.h
drivers/common/cnxk/meson.build +3 -1
@@ -10,5 +10,7 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] -sources = files('roc_platform.c') +sources = files('roc_model.c', + 'roc_platform.c', + 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_api.h +13 -0
@@ -29,6 +29,13 @@#define ROC_LMT_BASE_PER_CORE_LOG2 \ (ROC_LMT_LINES_PER_CORE_LOG2 + ROC_LMT_LINE_SIZE_LOG2) +/* IO */ +#if defined(__aarch64__) +#include "roc_io.h" +#else +#include "roc_io_generic.h" +#endif +/* PCI IDs */ #define PCI_VENDOR_ID_CAVIUM 0x177D#define PCI_DEVID_CNXK_RVU_PF 0xA063
@@ -66,4 +73,10 @@#include "hw/ssow.h" #include "hw/tim.h" +/* Model */ +#include "roc_model.h" + +/* Utils */ +#include "roc_utils.h" +#endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_io.h new file +187 -0
187 lines not on this page · raw message
drivers/common/cnxk/roc_io_generic.h new file +122 -0
122 lines not on this page · raw message
drivers/common/cnxk/roc_model.c new file +204 -0
204 lines not on this page · raw message
drivers/common/cnxk/roc_model.h new file +128 -0
128 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +28 -0
@@ -3,3 +3,31 @@*/ #include "roc_api.h" + +int +roc_plt_init (void ) +{ +const struct rte_memzone *mz; + + mz =rte_memzone_lookup (PLT_MODEL_MZ_NAME ); +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { +if (mz ==NULL ) { + mz =rte_memzone_reserve (PLT_MODEL_MZ_NAME , +sizeof (struct roc_model ), +SOCKET_ID_ANY ,0 ); +if (mz ==NULL ) { +plt_err ("Failed to reserve mem for roc_model" ); +return -ENOMEM ; + } +roc_model_init (mz->addr); + } + }else { +if (mz ==NULL ) { +plt_err ("Failed to lookup mem for roc_model" ); +return -ENOMEM ; + } + roc_model = mz->addr; + } + +return 0 ; +}
drivers/common/cnxk/roc_platform.h +10 -0
@@ -131,6 +131,13 @@#define plt_strlcpy rte_strlcpy +/* Log */ +#define plt_err(fmt, args...) \ + RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args) +#define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) +#define plt_warn(fmt, args...) RTE_LOG(WARNING, PMD, fmt "\n", ##args) +#define plt_print(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) +#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \ { \
@@ -151,4 +158,7 @@ }#endif +__rte_internal +int roc_plt_init(void); +#endif /* _ROC_PLATFORM_H_ */
drivers/common/cnxk/roc_priv.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_PRIV_H_ +#define _ROC_PRIV_H_ + +/* Utils */ +#include "roc_util_priv.h" + +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/roc_util_priv.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_UTIL_PRIV_H_ +#define _ROC_UTIL_PRIV_H_ + +enum util_err_status { +UTIL_ERR_PARAM =-6000 , +UTIL_ERR_FS , +UTIL_ERR_INVALID_MODEL , +}; + +#endif /* _ROC_UTIL_PRIV_H_ */
drivers/common/cnxk/roc_utils.c new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#include "roc_api.h" +#include "roc_priv.h" + +const char * +roc_error_msg_get (int errorcode) +{ +const char *err_msg; + +switch (errorcode) { +case UTIL_ERR_PARAM : + err_msg ="Invalid parameter" ; +break ; +case UTIL_ERR_FS : + err_msg ="file operation failed" ; +break ; +case UTIL_ERR_INVALID_MODEL : + err_msg ="Invalid RoC model" ; +break ; +default : +/** +* Handle general error (as defined in linux errno.h) +*/ +if (abs (errorcode) <300 ) + err_msg =strerror (abs (errorcode)); +else + err_msg ="Unknown error code" ; +break ; + } + +return err_msg; +}
drivers/common/cnxk/roc_utils.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_UTILS_H_ +#define _ROC_UTILS_H_ + +#include "roc_platform.h" + +/* Utils */ +const char *__roc_api roc_error_msg_get(int errorcode); + +#endif /* _ROC_UTILS_H_ */
drivers/common/cnxk/version.map +5 -0
@@ -1,4 +1,9 @@ INTERNAL { + global: + + roc_error_msg_get; + roc_model; + roc_plt_init; local: *; };
Signature · 1 line
2.8.4
PATCH v4 4/52 common/cnxk: add roc plt init callback support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add support for registering callbacks for roc plt init.
--- drivers/common/cnxk/roc_platform.c | 19 +++++++++++++++++++ drivers/common/cnxk/roc_platform.h | 4 ++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 24 insertions(+)
drivers/common/cnxk/roc_platform.c +19 -0
@@ -4,10 +4,23 @@#include "roc_api.h" +#define ROC_PLT_INIT_CB_MAX 8 + +static int plt_init_cb_num; +static roc_plt_init_cb_t plt_init_cbs[ROC_PLT_INIT_CB_MAX ]; + +void +roc_plt_init_cb_register (roc_plt_init_cb_t cb) +{ +RTE_ASSERT (plt_init_cb_num <ROC_PLT_INIT_CB_MAX ); + plt_init_cbs[plt_init_cb_num++] = cb; +} +int roc_plt_init (void ) {const struct rte_memzone *mz; +int i, rc; mz =rte_memzone_lookup (PLT_MODEL_MZ_NAME );if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -29,5 +42,11 @@ roc_plt_init(void) roc_model = mz->addr; } +for (i =0 ; i < plt_init_cb_num; i++) { + rc = (*plt_init_cbs[i])(); +if (rc) +return rc; + } +return 0 ; }
drivers/common/cnxk/roc_platform.h +4 -0
@@ -161,4 +161,8 @@__rte_internal int roc_plt_init(void); +/* Init callbacks */ +typedef int (*roc_plt_init_cb_t )(void ); +void __roc_api roc_plt_init_cb_register(roc_plt_init_cb_t cb); +#endif /* _ROC_PLATFORM_H_ */
drivers/common/cnxk/version.map +1 -0
@@ -4,6 +4,7 @@ INTERNAL { roc_error_msg_get; roc_model; roc_plt_init; + roc_plt_init_cb_register; local: *; };
Signature · 1 line
2.8.4
Re: [dpdk-dev] [PATCH v4 04/52] common/cnxk: add roc plt init callback support
Quoted 17 lines · Nithin Dabilpuram
From: Ashwin Sekhar T K <[email protected]>
Add support for registering callbacks for roc plt init.
Signed-off-by Ashwin Sekhar T K <[email protected]>--- drivers/common/cnxk/roc_platform.c | 19 +++++++++++++++++++ drivers/common/cnxk/roc_platform.h | 4 ++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 24 insertions(+)drivers/common/cnxk/roc_platform.c +0
-0
drivers/common/cnxk/roc_platform.c line 7
Quoted 4 lines
drivers/common/cnxk/roc_platform.c +1
-0@@ -4,10 +4,23 @@#include "roc_api.h" +#define ROC_PLT_INIT_CB_MAX 8
Since it local to this file. Please change to PLT_INIT_CB_MAX
drivers/common/cnxk/roc_platform.c line 15
Quoted 8 lines
drivers/common/cnxk/roc_platform.c +8
-0+ +static int plt_init_cb_num; +static roc_plt_init_cb_t plt_init_cbs[ROC_PLT_INIT_CB_MAX ]; + +void +roc_plt_init_cb_register (roc_plt_init_cb_t cb) +{ +RTE_ASSERT (plt_init_cb_num <ROC_PLT_INIT_CB_MAX );
RTE_ASSERT not allowed in the library, please return the "-ERANGE" or so for this function in case of error.
the caller can put some error print on failure as it is called from the constructor.
Rest of the series looks good.
PATCH v4 5/52 common/cnxk: add interrupt helper API
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add interrupt helper API's in common code to register and unregister for specific interrupt vectors. These API's will be used by all cnxk drivers.
--- drivers/common/cnxk/meson.build | 3 +- drivers/common/cnxk/roc_dev_priv.h | 14 +++ drivers/common/cnxk/roc_irq.c | 249 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_platform.c | 4 + drivers/common/cnxk/roc_platform.h | 11 ++ drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/version.map | 1 + 7 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/roc_dev_priv.h create mode 100644 drivers/common/cnxk/roc_irq.c
drivers/common/cnxk/meson.build +2 -1
@@ -10,7 +10,8 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] -sources = files('roc_model.c', +sources = files('roc_irq.c', + 'roc_model.c', 'roc_platform.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_dev_priv.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_DEV_PRIV_H +#define _ROC_DEV_PRIV_H + +int dev_irq_register (struct plt_intr_handle *intr_handle, +plt_intr_callback_fn cb,void *data,unsigned int vec); +void dev_irq_unregister (struct plt_intr_handle *intr_handle, +plt_intr_callback_fn cb,void *data,unsigned int vec); +int dev_irqs_disable (struct plt_intr_handle *intr_handle); + +#endif /* _ROC_DEV_PRIV_H */
drivers/common/cnxk/roc_irq.c new file +249 -0
249 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +4 -0
@@ -2,6 +2,8 @@* Copyright(C) 2021 Marvell. */ +#include <rte_log.h> +#include "roc_api.h" #define ROC_PLT_INIT_CB_MAX 8
@@ -50,3 +52,5 @@ roc_plt_init(void)return 0 ; } + +RTE_LOG_REGISTER (cnxk_logtype_base, pmd.cnxk.base,NOTICE );
drivers/common/cnxk/roc_platform.h +11 -0
@@ -132,12 +132,23 @@#define plt_strlcpy rte_strlcpy/* Log */ +extern int cnxk_logtype_base; #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args) #define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) #define plt_warn(fmt, args...) RTE_LOG(WARNING, PMD, fmt "\n", ##args) #define plt_print(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) +/** +* Log debug message if given subsystem logging is enabled. +*/ +#define plt_dbg(subsystem, fmt, args...) \ + rte_log(RTE_LOG_DEBUG, cnxk_logtype_##subsystem, \ + "[%s] %s():%u " fmt "\n", #subsystem, __func__, __LINE__, \ + ##args) + +#define plt_base_dbg (fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__) +#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \ { \
drivers/common/cnxk/roc_priv.h +3 -0
@@ -8,4 +8,7 @@/* Utils */ #include "roc_util_priv.h" +/* Dev */ +#include "roc_dev_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/version.map +1 -0
@@ -1,6 +1,7 @@ INTERNAL { global: + cnxk_logtype_base; roc_error_msg_get; roc_model; roc_plt_init;
Signature · 1 line
2.8.4
PATCH v4 6/52 common/cnxk: add mbox request and response definitions
In reply to Nithin DabilpuramFrom: 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/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_mbox.h | 1735 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1738 insertions(+) create mode 100644 drivers/common/cnxk/roc_mbox.h
drivers/common/cnxk/roc_api.h +3 -0
@@ -76,6 +76,9 @@/* Model */ #include "roc_model.h" +/* Mbox */ +#include "roc_mbox.h" +/* Utils */ #include "roc_utils.h"
drivers/common/cnxk/roc_mbox.h new file +1735 -0
1,735 lines not on this page · raw message
Signature · 1 line
2.8.4
PATCH v4 7/52 common/cnxk: add mailbox base infra
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
This patch adds mailbox infra API's to communicate with Kernel AF driver. These API's will be used by all the other cnxk drivers for mbox init/fini, send/recv functionality.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_dev_priv.h | 3 + drivers/common/cnxk/roc_mbox.c | 483 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_mbox_priv.h | 215 ++++++++++++++++ drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 3 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_utils.c | 7 + drivers/common/cnxk/roc_utils.h | 2 + drivers/common/cnxk/version.map | 2 + 10 files changed, 720 insertions(+) create mode 100644 drivers/common/cnxk/roc_mbox.c create mode 100644 drivers/common/cnxk/roc_mbox_priv.h
drivers/common/cnxk/meson.build +1 -0
@@ -11,6 +11,7 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] sources = files('roc_irq.c', + 'roc_mbox.c', 'roc_model.c', 'roc_platform.c', 'roc_utils.c')
drivers/common/cnxk/roc_dev_priv.h +3 -0
@@ -5,6 +5,9 @@#ifndef _ROC_DEV_PRIV_H#define _ROC_DEV_PRIV_H +extern uint16_t dev_rclk_freq; +extern uint16_t dev_sclk_freq; +int dev_irq_register (struct plt_intr_handle *intr_handle,plt_intr_callback_fn cb,void *data,unsigned int vec); void dev_irq_unregister(struct plt_intr_handle *intr_handle,
drivers/common/cnxk/roc_mbox.c new file +483 -0
483 lines not on this page · raw message
drivers/common/cnxk/roc_mbox_priv.h new file +215 -0
215 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +1 -0
@@ -54,3 +54,4 @@ roc_plt_init(void) }RTE_LOG_REGISTER (cnxk_logtype_base, pmd.cnxk.base,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_mbox, pmd.cnxk.mbox,NOTICE );
drivers/common/cnxk/roc_platform.h +3 -0
@@ -133,6 +133,8 @@/* Log */ extern int cnxk_logtype_base; +extern int cnxk_logtype_mbox; + #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args) #define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args)
@@ -148,6 +150,7 @@ extern int cnxk_logtype_base; ##args)#define plt_base_dbg (fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__) +#define plt_mbox_dbg (fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__)#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \
drivers/common/cnxk/roc_priv.h +3 -0
@@ -8,6 +8,9 @@/* Utils */ #include "roc_util_priv.h" +/* Mbox */ +#include "roc_mbox_priv.h" +/* Dev */ #include "roc_dev_priv.h"
drivers/common/cnxk/roc_utils.c +7 -0
@@ -33,3 +33,10 @@ roc_error_msg_get(int errorcode)return err_msg; } + +void +roc_clk_freq_get (uint16_t *rclk_freq,uint16_t *sclk_freq) +{ + *rclk_freq = dev_rclk_freq; + *sclk_freq = dev_sclk_freq; +}
drivers/common/cnxk/roc_utils.h +2 -0
@@ -10,4 +10,6 @@/* Utils */ const char *__roc_api roc_error_msg_get(int errorcode); +void __roc_api roc_clk_freq_get(uint16_t *rclk_freq, uint16_t *sclk_freq); +#endif /* _ROC_UTILS_H_ */
drivers/common/cnxk/version.map +2 -0
@@ -2,6 +2,8 @@ INTERNAL { global: cnxk_logtype_base; + cnxk_logtype_mbox; + roc_clk_freq_get; roc_error_msg_get; roc_model; roc_plt_init;
Signature · 1 line
2.8.4
PATCH v4 8/52 common/cnxk: add base device class
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Introduce 'dev' class to hold cnxk PCIe device specific information and operations.
All PCIe drivers(ethdev, mempool, cryptodev and eventdev) of cnxk inherits this base object to avail the common functionalities such as mailbox creation, interrupt registration, LMT setup, VF message mbox forwarding, etc.
--- drivers/common/cnxk/meson.build | 4 +- drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_dev.c | 362 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_dev_priv.h | 42 +++++ drivers/common/cnxk/roc_idev.c | 77 ++++++++ drivers/common/cnxk/roc_idev.h | 12 ++ drivers/common/cnxk/roc_idev_priv.h | 22 +++ drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/version.map | 2 + 9 files changed, 526 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/roc_dev.c create mode 100644 drivers/common/cnxk/roc_idev.c create mode 100644 drivers/common/cnxk/roc_idev.h create mode 100644 drivers/common/cnxk/roc_idev_priv.h
drivers/common/cnxk/meson.build +3 -1
@@ -10,7 +10,9 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] -sources = files('roc_irq.c', +sources = files('roc_dev.c', + 'roc_idev.c', + 'roc_irq.c', 'roc_mbox.c', 'roc_model.c', 'roc_platform.c',
drivers/common/cnxk/roc_api.h +3 -0
@@ -82,4 +82,7 @@/* Utils */ #include "roc_utils.h" +/* Idev */ +#include "roc_idev.h" +#endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_dev.c new file +362 -0
362 lines not on this page · raw message
drivers/common/cnxk/roc_dev_priv.h +42 -0
51 lines not on this page · raw message
drivers/common/cnxk/roc_idev.c new file +77 -0
77 lines not on this page · raw message
drivers/common/cnxk/roc_idev.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_IDEV_H_ +#define _ROC_IDEV_H_ + +/* LMT */ +uint64_t __roc_api roc_idev_lmt_base_addr_get(void); +uint16_t __roc_api roc_idev_num_lmtlines_get(void); + +#endif /* _ROC_IDEV_H_ */
drivers/common/cnxk/roc_idev_priv.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_IDEV_PRIV_H_ +#define _ROC_IDEV_PRIV_H_ + +/* Intra device related functions */ +struct idev_cfg { +uint16_t lmt_pf_func; +uint16_t num_lmtlines; +uint64_t lmt_base_addr; +}; + +/* Generic */ +struct idev_cfg *idev_get_cfg (void ); +void idev_set_defaults (struct idev_cfg *idev); + +/* idev lmt */ +uint16_t idev_lmt_pffunc_get (void ); + +#endif /* _ROC_IDEV_PRIV_H_ */
drivers/common/cnxk/roc_priv.h +3 -0
@@ -14,4 +14,7 @@/* Dev */ #include "roc_dev_priv.h" +/* idev */ +#include "roc_idev_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/version.map +2 -0
@@ -5,6 +5,8 @@ INTERNAL { cnxk_logtype_mbox; roc_clk_freq_get; roc_error_msg_get; + roc_idev_lmt_base_addr_get; + roc_idev_num_lmtlines_get; roc_model; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4
PATCH v4 9/52 common/cnxk: add VF support to base device class
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add VF specific handling such as BAR4 setup, forwarding VF mbox messages to AF and vice-versa, VF FLR handling etc.
--- drivers/common/cnxk/roc_dev.c | 857 ++++++++++++++++++++++++++++++++++++- drivers/common/cnxk/roc_dev_priv.h | 42 ++ 2 files changed, 879 insertions(+), 20 deletions(-)
drivers/common/cnxk/roc_dev.c +837 -20
@@ -17,6 +17,337 @@/* Single Root I/O Virtualization */ #define ROC_PCI_SRIOV_TOTAL_VF 0x0e/* Total VFs */ +static void * +mbox_mem_map (off_t off,size_t size) +{ +void *va =MAP_FAILED ; +int mem_fd; + +if (size <=0 || !off) { +plt_err ("Invalid mbox area off 0x%lx size %lu" , off, size); + goto error; + } + + mem_fd =open ("/dev/mem" ,O_RDWR ); +if (mem_fd <0 ) + goto error; + + va =plt_mmap (NULL , size,PLT_PROT_READ |PLT_PROT_WRITE , +PLT_MAP_SHARED , mem_fd, off); +close (mem_fd); + +if (va ==MAP_FAILED ) +plt_err ("Failed to mmap sz=0x%zx, fd=%d, off=%jd" , size, mem_fd, + (intmax_t )off); +error: +return va; +} + +static void +mbox_mem_unmap (void *va,size_t size) +{ +if (va) +munmap (va, size); +} + +static int +pf_af_sync_msg (struct dev *dev,struct mbox_msghdr **rsp) +{ +uint32_t timeout =0 , sleep =1 ; +struct mbox *mbox = dev->mbox; +struct 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 */ +plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1C ); + +/* Send message */ +mbox_msg_send (mbox,0 ); + +do { +plt_delay_ms (sleep); + timeout += sleep; +if (timeout >= mbox->rsp_tmo) { +plt_err ("Message timeout: %dms" , mbox->rsp_tmo); + rc = -EIO ; +break ; + } + int_status =plt_read64 (dev->bar2 +RVU_PF_INT ); + }while ((int_status &0x1 ) !=0x1 ); + +/* Clear */ +plt_write64 (int_status, dev->bar2 +RVU_PF_INT ); + +/* Enable interrupts */ +plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1S ); + +if (rc ==0 ) { +/* Get message */ + off = mbox->rx_start + +PLT_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 dev *dev,uint16_t vf,int num_msg) +{ +uint32_t timeout =0 , sleep =1 ; +struct mbox *mbox = dev->mbox; +struct 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 */ +plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1C ); + +/* Send message */ +mbox_msg_send (mbox,0 ); + +do { +plt_delay_ms (sleep); + timeout++; +if (timeout >= mbox->rsp_tmo) { +plt_err ("Routed messages %d timeout: %dms" , num_msg, + mbox->rsp_tmo); +break ; + } + int_status =plt_read64 (dev->bar2 +RVU_PF_INT ); + }while ((int_status &0x1 ) !=0x1 ); + +/* Clear */ +plt_write64 (~0ull , dev->bar2 +RVU_PF_INT ); + +/* Enable interrupts */ +plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1S ); + +plt_spinlock_lock (&mdev->mbox_lock); + + req_hdr = (struct mbox_hdr *)((uintptr_t )mdev->mbase + mbox->rx_start); +if (req_hdr->num_msgs != num_msg) +plt_err ("Routed messages: %d received: %d" , num_msg, + req_hdr->num_msgs); + +/* Get messages from mbox */ + offset = mbox->rx_start + +PLT_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 =PLT_ALIGN (size,MBOX_MSG_ALIGN ); + rsp =mbox_alloc_msg (&dev->mbox_vfpf, vf, size); +mbox_rsp_init (msg->id, rsp); + +/* Copy message from AF<->PF mbox to PF<->VF mbox */ +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; + } +plt_spinlock_unlock (&mdev->mbox_lock); + +return req_hdr->num_msgs; +} + +static int +vf_pf_process_msgs (struct dev *dev,uint16_t vf) +{ +struct mbox *mbox = &dev->mbox_vfpf; +struct mbox_dev *mdev = &mbox->dev[vf]; +struct mbox_hdr *req_hdr; +struct mbox_msghdr *msg; +int offset, routed =0 ; +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 +PLT_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 =dev_pf_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 *)mbox_alloc_msg ( + mbox, vf,sizeof (*rsp)); +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 =PLT_ALIGN (size,MBOX_MSG_ALIGN ); + af_req =mbox_alloc_msg (dev->mbox,0 , size); +if (af_req ==NULL ) +return -ENOSPC ; +mbox_req_init (msg->id, af_req); + +/* Copy message from VF<->PF mbox to PF<->AF mbox */ +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 ) { +plt_base_dbg ("pf:%d routed %d messages from vf:%d to AF" , + dev->pf, routed, vf); +af_pf_wait_msg (dev, vf, routed); +mbox_reset (dev->mbox,0 ); + } + +/* Send mbox responses to VF */ +if (mdev->num_msgs) { +plt_base_dbg ("pf:%d reply %d messages to vf:%d" , dev->pf, + mdev->num_msgs, vf); +mbox_msg_send (mbox, vf); + } + +return i; +} + +static int +vf_pf_process_up_msgs (struct dev *dev,uint16_t vf) +{ +struct mbox *mbox = &dev->mbox_vfpf_up; +struct 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 +PLT_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 =dev_pf_func (dev->pf, vf); + +switch (msg->id) { +case MBOX_MSG_CGX_LINK_EVENT : +plt_base_dbg ("PF: Msg 0x%x (%s) fn:0x%x (pf:%d,vf:%d)" , + msg->id,mbox_id2name (msg->id), + msg->pcifunc,dev_get_pf (msg->pcifunc), +dev_get_vf (msg->pcifunc)); +break ; +case MBOX_MSG_CGX_PTP_RX_INFO : +plt_base_dbg ("PF: Msg 0x%x (%s) fn:0x%x (pf:%d,vf:%d)" , + msg->id,mbox_id2name (msg->id), + msg->pcifunc,dev_get_pf (msg->pcifunc), +dev_get_vf (msg->pcifunc)); +break ; +default : +plt_err ("Not handled UP msg 0x%x (%s) func:0x%x" , + msg->id,mbox_id2name (msg->id), msg->pcifunc); + } + offset = mbox->rx_start + msg->next_msgoff; + } +mbox_reset (mbox, vf); + mdev->msgs_acked = msgs_acked; +plt_wmb (); + +return i; +} + +static void +roc_vf_pf_mbox_handle_msg (void *param) +{ +uint16_t vf, max_vf, max_bits; +struct 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)) { +plt_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)); + } + } + dev->timer_set =0 ; +} + +static void +roc_vf_pf_mbox_irq (void *param) +{ +struct dev *dev = param; +bool alarm_set = false; +uint64_t intr; +int vfpf; + +for (vfpf =0 ; vfpf <MAX_VFPF_DWORD_BITS ; ++vfpf) { + intr =plt_read64 (dev->bar2 +RVU_PF_VFPF_MBOX_INTX (vfpf)); +if (!intr) +continue ; + +plt_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; +plt_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 */ +plt_alarm_set (VF_PF_MBOX_TIMER_MS , roc_vf_pf_mbox_handle_msg, + dev); + } +} +static void process_msgs (struct dev *dev,struct mbox *mbox) {
@@ -62,6 +393,112 @@ process_msgs(struct dev *dev, struct mbox *mbox)plt_wmb (); } +/* Copies the message received from AF and sends it to VF */ +static void +pf_vf_mbox_send_up_msg (struct dev *dev,void *rec_msg) +{ +uint16_t max_bits =sizeof (dev->active_vfs[0 ]) *sizeof (uint64_t ); +struct 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 =PLT_ALIGN (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 ; + +plt_base_dbg ("(%s) size: %zx to VF: %d" , +mbox_id2name (msg->hdr.id), size, vf); + +/* Reserve PF/VF mbox message */ + vf_msg =mbox_alloc_msg (vf_mbox, vf, size); +if (!vf_msg) { +plt_err ("Failed to alloc VF%d UP message" , vf); +continue ; + } +mbox_req_init (msg->hdr.id, vf_msg); + +/* +* Copy message from AF<->PF UP mbox +* to PF<->VF UP mbox +*/ +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 */ +mbox_msg_send (vf_mbox, vf); + } +} + +static int +mbox_up_handler_cgx_link_event (struct dev *dev,struct cgx_link_info_msg *msg, +struct msg_rsp *rsp) +{ +struct cgx_link_user_info *linfo = &msg->link_info; +void *roc_nix = dev->roc_nix; + +plt_base_dbg ("pf:%d/vf:%d NIC Link %s --> 0x%x (%s) from: pf:%d/vf:%d" , +dev_get_pf (dev->pf_func),dev_get_vf (dev->pf_func), + linfo->link_up ?"UP" :"DOWN" , msg->hdr.id, +mbox_id2name (msg->hdr.id),dev_get_pf (msg->hdr.pcifunc), +dev_get_vf (msg->hdr.pcifunc)); + +/* PF gets link notification from AF */ +if (dev_get_pf (msg->hdr.pcifunc) ==0 ) { +if (dev->ops && dev->ops->link_status_update) + dev->ops->link_status_update (roc_nix, 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 (roc_nix, linfo); + } + + rsp->hdr.rc =0 ; +return 0 ; +} + +static int +mbox_up_handler_cgx_ptp_rx_info (struct dev *dev, +struct cgx_ptp_rx_info_msg *msg, +struct msg_rsp *rsp) +{ +void *roc_nix = dev->roc_nix; + +plt_base_dbg ("pf:%d/vf:%d PTP mode %s --> 0x%x (%s) from: pf:%d/vf:%d" , +dev_get_pf (dev->pf_func),dev_get_vf (dev->pf_func), + msg->ptp_en ?"ENABLED" :"DISABLED" , msg->hdr.id, +mbox_id2name (msg->hdr.id),dev_get_pf (msg->hdr.pcifunc), +dev_get_vf (msg->hdr.pcifunc)); + +/* PF gets PTP notification from AF */ +if (dev_get_pf (msg->hdr.pcifunc) ==0 ) { +if (dev->ops && dev->ops->ptp_info_update) + dev->ops->ptp_info_update (roc_nix, 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 (roc_nix, msg->ptp_en); + } + + rsp->hdr.rc =0 ; +return 0 ; +} +static int mbox_process_msgs_up (struct dev *dev,struct mbox_msghdr *req) {
@@ -73,6 +510,24 @@ mbox_process_msgs_up(struct dev *dev, struct mbox_msghdr *req)default :reply_invalid_msg (&dev->mbox_up,0 ,0 , req->id);break ; +#define M (_name, _id, _fn_name, _req_type, _rsp_type) \ + case _id: { \ + struct _rsp_type *rsp; \ + int err; \ + rsp = (struct _rsp_type *)mbox_alloc_msg( \ + &dev->mbox_up, 0, sizeof(struct _rsp_type)); \ + if (!rsp) \ + return -ENOMEM; \ + rsp->hdr.id = _id; \ + rsp->hdr.sig = MBOX_RSP_SIG; \ + rsp->hdr.pcifunc = dev->pf_func; \ + rsp->hdr.rc = 0; \ + err = mbox_up_handler_##_fn_name(dev, (struct _req_type *)req, \ + rsp); \ + return err; \ + } + MBOX_UP_CGX_MESSAGES +#undef M }return -ENODEV ;
@@ -111,6 +566,26 @@ process_msgs_up(struct dev *dev, struct mbox *mbox) }static void +roc_pf_vf_mbox_irq (void *param) +{ +struct dev *dev = param; +uint64_t intr; + + intr =plt_read64 (dev->bar2 +RVU_VF_INT ); +if (intr ==0 ) +plt_base_dbg ("Proceeding to check mbox UP messages if any" ); + +plt_write64 (intr, dev->bar2 +RVU_VF_INT ); +plt_base_dbg ("Irq 0x%" PRIx64"(pf:%d,vf:%d)" , intr, dev->pf, dev->vf); + +/* First process all configuration messages */ +process_msgs (dev, dev->mbox); + +/* Process Uplink messages */ +process_msgs_up (dev, &dev->mbox_up); +} + +static void roc_af_pf_mbox_irq (void *param) {struct dev *dev = param;
@@ -121,7 +596,7 @@ roc_af_pf_mbox_irq(void *param)plt_base_dbg ("Proceeding to check mbox UP messages if any" );plt_write64 (intr, dev->bar2 +RVU_PF_INT ); -plt_base_dbg ("Irq 0x%" PRIx64"(pf:%d)" , intr, dev->pf); +plt_base_dbg ("Irq 0x%" PRIx64"(pf:%d,vf:%d)" , intr, dev->pf, dev->vf);/* First process all configuration messages */ process_msgs (dev, dev->mbox);
@@ -134,10 +609,33 @@ static int mbox_register_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev) { struct plt_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) +plt_write64 (~0ull , + dev->bar2 +RVU_PF_VFPF_MBOX_INT_ENA_W1CX (i));plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1C ); + dev->timer_set =0 ; + +/* MBOX interrupt for VF(0...63) <-> PF */ + rc =dev_irq_register (intr_handle, roc_vf_pf_mbox_irq, dev, +RVU_PF_INT_VEC_VFPF_MBOX0 ); + +if (rc) { +plt_err ("Fail to register PF(VF0-63) mbox irq" ); +return rc; + } +/* MBOX interrupt for VF(64...128) <-> PF */ + rc =dev_irq_register (intr_handle, roc_vf_pf_mbox_irq, dev, +RVU_PF_INT_VEC_VFPF_MBOX1 ); + +if (rc) { +plt_err ("Fail to register PF(VF64-128) mbox irq" ); +return rc; + }/* MBOX interrupt AF <-> PF */ rc =dev_irq_register (intr_handle, roc_af_pf_mbox_irq, dev,RVU_PF_INT_VEC_AFPF_MBOX );
@@ -146,6 +644,11 @@ mbox_register_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)return rc; } +/* HW enable intr */ +for (i =0 ; i <MAX_VFPF_DWORD_BITS ; ++i) +plt_write64 (~0ull , + dev->bar2 +RVU_PF_VFPF_MBOX_INT_ENA_W1SX (i)); +plt_write64 (~0ull , dev->bar2 +RVU_PF_INT );plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1S );
@@ -153,27 +656,263 @@ mbox_register_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev) }static int +mbox_register_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) +{ +struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +int rc; + +/* Clear irq */ +plt_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C ); + +/* MBOX interrupt PF <-> VF */ + rc =dev_irq_register (intr_handle, roc_pf_vf_mbox_irq, dev, +RVU_VF_INT_VEC_MBOX ); +if (rc) { +plt_err ("Fail to register PF<->VF mbox irq" ); +return rc; + } + +/* HW enable intr */ +plt_write64 (~0ull , dev->bar2 +RVU_VF_INT ); +plt_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1S ); + +return rc; +} + +static int mbox_register_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -return mbox_register_pf_irq (pci_dev, dev); +if (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_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) {struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +int i; + +/* HW clear irq */ +for (i =0 ; i <MAX_VFPF_DWORD_BITS ; ++i) +plt_write64 (~0ull , + dev->bar2 +RVU_PF_VFPF_MBOX_INT_ENA_W1CX (i));plt_write64 (~0ull , dev->bar2 +RVU_PF_INT_ENA_W1C ); + dev->timer_set =0 ; + +plt_alarm_cancel (roc_vf_pf_mbox_handle_msg, dev); + +/* Unregister the interrupt handler for each vectors */ +/* MBOX interrupt for VF(0...63) <-> PF */ +dev_irq_unregister (intr_handle, roc_vf_pf_mbox_irq, dev, +RVU_PF_INT_VEC_VFPF_MBOX0 ); + +/* MBOX interrupt for VF(64...128) <-> PF */ +dev_irq_unregister (intr_handle, roc_vf_pf_mbox_irq, dev, +RVU_PF_INT_VEC_VFPF_MBOX1 ); +/* MBOX interrupt AF <-> PF */ dev_irq_unregister (intr_handle, roc_af_pf_mbox_irq, dev,RVU_PF_INT_VEC_AFPF_MBOX ); }static void +mbox_unregister_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) +{ +struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; + +/* Clear irq */ +plt_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C ); + +/* Unregister the interrupt handler */ +dev_irq_unregister (intr_handle, roc_pf_vf_mbox_irq, dev, +RVU_VF_INT_VEC_MBOX ); +} + +static void mbox_unregister_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -mbox_unregister_pf_irq (pci_dev, dev); +if (dev_is_vf (dev)) +mbox_unregister_vf_irq (pci_dev, dev); +else +mbox_unregister_pf_irq (pci_dev, dev); +} + +static int +vf_flr_send_msg (struct dev *dev,uint16_t vf) +{ +struct mbox *mbox = dev->mbox; +struct msg_req *req; +int rc; + + req =mbox_alloc_msg_vf_flr (mbox); +if (req ==NULL ) +return -ENOSPC ; +/* Overwrite pcifunc to indicate VF */ + req->hdr.pcifunc =dev_pf_func (dev->pf, vf); + +/* Sync message in interrupt context */ + rc =pf_af_sync_msg (dev,NULL ); +if (rc) +plt_err ("Failed to send VF FLR mbox msg, rc=%d" , rc); + +return rc; +} + +static void +roc_pf_vf_flr_irq (void *param) +{ +struct dev *dev = (struct 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; + +plt_base_dbg ("FLR VF interrupt: max_vf: %d" , max_vf); + +for (i =0 ; i <MAX_VFPF_DWORD_BITS ; ++i) { + intr =plt_read64 (bar2 +RVU_PF_VFFLR_INTX (i)); +if (!intr) +continue ; + +for (vf =0 ; vf < max_vf; vf++) { +if (!(intr & (1ULL << vf))) +continue ; + +plt_base_dbg ("FLR: i :%d intr: 0x%" PRIx64", vf-%d" , i, + intr, (64 * i + vf)); +/* Clear interrupt */ +plt_write64 (BIT_ULL (vf), bar2 +RVU_PF_VFFLR_INTX (i)); +/* Disable the interrupt */ +plt_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 */ +plt_write64 (BIT_ULL (vf), bar2 +RVU_PF_VFTRPENDX (i)); +/* Enable interrupt */ +plt_write64 (~0ull , bar2 +RVU_PF_VFFLR_INT_ENA_W1SX (i)); + } + } +} + +static int +vf_flr_unregister_irqs (struct plt_pci_device *pci_dev,struct dev *dev) +{ +struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +int i; + +plt_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name); + +/* HW clear irq */ +for (i =0 ; i <MAX_VFPF_DWORD_BITS ; i++) +plt_write64 (~0ull , dev->bar2 +RVU_PF_VFFLR_INT_ENA_W1CX (i)); + +dev_irq_unregister (intr_handle, roc_pf_vf_flr_irq, dev, +RVU_PF_INT_VEC_VFFLR0 ); + +dev_irq_unregister (intr_handle, roc_pf_vf_flr_irq, dev, +RVU_PF_INT_VEC_VFFLR1 ); + +return 0 ; +} + +static int +vf_flr_register_irqs (struct plt_pci_device *pci_dev,struct dev *dev) +{ +struct plt_intr_handle *handle = &pci_dev->intr_handle; +int i, rc; + +plt_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name); + + rc =dev_irq_register (handle, roc_pf_vf_flr_irq, dev, +RVU_PF_INT_VEC_VFFLR0 ); +if (rc) +plt_err ("Failed to init RVU_PF_INT_VEC_VFFLR0 rc=%d" , rc); + + rc =dev_irq_register (handle, roc_pf_vf_flr_irq, dev, +RVU_PF_INT_VEC_VFFLR1 ); +if (rc) +plt_err ("Failed to init RVU_PF_INT_VEC_VFFLR1 rc=%d" , rc); + +/* Enable HW interrupt */ +for (i =0 ; i <MAX_VFPF_DWORD_BITS ; ++i) { +plt_write64 (~0ull , dev->bar2 +RVU_PF_VFFLR_INTX (i)); +plt_write64 (~0ull , dev->bar2 +RVU_PF_VFTRPENDX (i)); +plt_write64 (~0ull , dev->bar2 +RVU_PF_VFFLR_INT_ENA_W1SX (i)); + } +return 0 ; +} + +int +dev_active_vfs (struct dev *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 +dev_vf_hwcap_update (struct plt_pci_device *pci_dev,struct dev *dev) +{ +switch (pci_dev->id.device_id) { +case PCI_DEVID_CNXK_RVU_PF : +break ; +case PCI_DEVID_CNXK_RVU_SSO_TIM_VF : +case PCI_DEVID_CNXK_RVU_NPA_VF : +case PCI_DEVID_CNXK_RVU_AF_VF : +case PCI_DEVID_CNXK_RVU_VF : +case PCI_DEVID_CNXK_RVU_SDP_VF : + dev->hwcap |=DEV_HWCAP_F_VF ; +break ; + } +} + +static uintptr_t +dev_vf_mbase_get (struct plt_pci_device *pci_dev,struct dev *dev) +{ +void *vf_mbase =NULL ; +uintptr_t pa; + +if (dev_is_vf (dev)) +return 0 ; + +/* For CN10K onwards, it is just after PF MBOX */ +if (!roc_model_is_cn9k ()) +return dev->bar4 +MBOX_SIZE ; + + pa =plt_read64 (dev->bar2 +RVU_PF_VF_BAR4_ADDR ); +if (!pa) { +plt_err ("Invalid VF mbox base pa" ); +return pa; + } + + vf_mbase =mbox_mem_map (pa,MBOX_SIZE * pci_dev->max_vfs); +if (vf_mbase ==MAP_FAILED ) { +plt_err ("Failed to mmap vf mbase at pa 0x%lx, rc=%d" , pa, + errno); +return 0 ; + } +return (uintptr_t )vf_mbase; +} + +static void +dev_vf_mbase_put (struct plt_pci_device *pci_dev,uintptr_t vf_mbase) +{ +if (!vf_mbase || !pci_dev->max_vfs || !roc_model_is_cn9k ()) +return ; + +mbox_mem_unmap ((void *)vf_mbase,MBOX_SIZE * pci_dev->max_vfs); } static uint16_t
@@ -213,7 +952,6 @@ dev_setup_shared_lmt_region(struct mbox *mbox)static int dev_lmt_setup (struct plt_pci_device *pci_dev,struct dev *dev) { -uint64_t bar4_mbox_sz =MBOX_SIZE ;struct idev_cfg *idev;int rc;
@@ -237,19 +975,34 @@ dev_lmt_setup(struct plt_pci_device *pci_dev, struct dev *dev) dev->pf_func, rc); } -/* PF BAR4 should always be sufficient enough to -* hold PF-AF MBOX + PF-VF MBOX + LMT lines. -*/ -if (pci_dev->mem_resource[4 ].len < - (bar4_mbox_sz + (RVU_LMT_LINE_MAX *RVU_LMT_SZ ))) { -plt_err ("Not enough bar4 space for lmt lines and mbox" ); -return -EFAULT ; +if (dev_is_vf (dev)) { +/* VF BAR4 should always be sufficient enough to +* hold LMT lines. +*/ +if (pci_dev->mem_resource[4 ].len < + (RVU_LMT_LINE_MAX *RVU_LMT_SZ )) { +plt_err ("Not enough bar4 space for lmt lines" ); +return -EFAULT ; + } + + dev->lmt_base = dev->bar4; + }else { +uint64_t bar4_mbox_sz =MBOX_SIZE ; + +/* PF BAR4 should always be sufficient enough to +* hold PF-AF MBOX + PF-VF MBOX + LMT lines. +*/ +if (pci_dev->mem_resource[4 ].len < + (bar4_mbox_sz + (RVU_LMT_LINE_MAX *RVU_LMT_SZ ))) { +plt_err ("Not enough bar4 space for lmt lines and mbox" ); +return -EFAULT ; + } + +/* LMT base is just after total VF MBOX area */ + bar4_mbox_sz += (MBOX_SIZE *dev_pf_total_vfs (pci_dev)); + dev->lmt_base = dev->bar4 + bar4_mbox_sz; } -/* LMT base is just after total VF MBOX area */ - bar4_mbox_sz += (MBOX_SIZE *dev_pf_total_vfs (pci_dev)); - dev->lmt_base = dev->bar4 + bar4_mbox_sz; -/* Base LMT address should be chosen from only those pci funcs which * participate in LMT shared mode. */
@@ -270,6 +1023,7 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev) {int direction, up_direction, rc;uintptr_t bar2, bar4, mbox; +uintptr_t vf_mbase =0 ;uint64_t intr_offset; bar2 = (uintptr_t )pci_dev->mem_resource[2 ].addr;
@@ -293,13 +1047,23 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev) goto error; } + dev->maxvf = pci_dev->max_vfs; dev->bar2 = bar2; dev->bar4 = bar4; +dev_vf_hwcap_update (pci_dev, dev); - mbox = bar4; - direction =MBOX_DIR_PFAF ; - up_direction =MBOX_DIR_PFAF_UP ; - intr_offset =RVU_PF_INT ; +if (dev_is_vf (dev)) { + mbox = (roc_model_is_cn9k () ? + bar4 : (bar2 +RVU_VF_MBOX_REGION )); + direction =MBOX_DIR_VFPF ; + up_direction =MBOX_DIR_VFPF_UP ; + intr_offset =RVU_VF_INT ; + }else { + mbox = bar4; + direction =MBOX_DIR_PFAF ; + up_direction =MBOX_DIR_PFAF_UP ; + intr_offset =RVU_PF_INT ; + }/* Initialize the local mbox */ rc =mbox_init (&dev->mbox_local, mbox, bar2, direction,1 , intr_offset);
@@ -322,7 +1086,43 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev) goto mbox_unregister; dev->pf =dev_get_pf (dev->pf_func); + dev->vf =dev_get_vf (dev->pf_func); +memset (&dev->active_vfs,0 ,sizeof (dev->active_vfs)); +/* Allocate memory for device ops */ + dev->ops =plt_zmalloc (sizeof (struct dev_ops ),0 ); +if (dev->ops ==NULL ) { + rc = -ENOMEM ; + goto mbox_unregister; + } + +/* Found VF devices in a PF device */ +if (pci_dev->max_vfs >0 ) { +/* Remap mbox area for all vf's */ + vf_mbase =dev_vf_mbase_get (pci_dev, dev); +if (!vf_mbase) { + rc = -ENODEV ; + goto mbox_unregister; + } +/* Init mbox object */ + rc =mbox_init (&dev->mbox_vfpf, vf_mbase, bar2,MBOX_DIR_PFVF , + pci_dev->max_vfs, intr_offset); +if (rc) + goto iounmap; + +/* PF -> VF UP messages */ + rc =mbox_init (&dev->mbox_vfpf_up, vf_mbase, bar2, +MBOX_DIR_PFVF_UP , pci_dev->max_vfs, intr_offset); +if (rc) + goto iounmap; + } + +/* Register VF-FLR irq handlers */ +if (!dev_is_vf (dev)) { + rc =vf_flr_register_irqs (pci_dev, dev); +if (rc) + goto iounmap; + } dev->mbox_active =1 ;/* Setup LMT line base */
@@ -332,8 +1132,11 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev)return rc; iounmap: +dev_vf_mbase_put (pci_dev, vf_mbase); mbox_unregister:mbox_unregister_irq (pci_dev, dev); +if (dev->ops) +plt_free (dev->ops); mbox_fini:mbox_fini (dev->mbox);mbox_fini (&dev->mbox_up);
@@ -349,6 +1152,20 @@ dev_fini(struct dev *dev, struct plt_pci_device *pci_dev)mbox_unregister_irq (pci_dev, dev); +if (!dev_is_vf (dev)) +vf_flr_unregister_irqs (pci_dev, dev); +/* Release PF - VF */ + mbox = &dev->mbox_vfpf; +if (mbox->hwbase && mbox->dev) +dev_vf_mbase_put (pci_dev, mbox->hwbase); + +if (dev->ops) +plt_free (dev->ops); + +mbox_fini (mbox); + mbox = &dev->mbox_vfpf_up; +mbox_fini (mbox); +/* Release PF - AF */ mbox = dev->mbox;mbox_fini (mbox);
drivers/common/cnxk/roc_dev_priv.h +42 -0
78 lines not on this page · raw message
Signature · 1 line
2.8.4
PATCH v4 10/52 common/cnxk: add base npa device support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add base NPA device support. NPA i.e Network Pool Allocator is HW block that provides HW mempool functionality on Marvell CN9K and CN10K SoC's. NPA by providing HW mempool support, also facilitates Rx and Tx packet alloc and packet free by HW without SW intervention.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_dev.c | 11 ++ drivers/common/cnxk/roc_dev_priv.h | 6 + drivers/common/cnxk/roc_idev.c | 67 ++++++++ drivers/common/cnxk/roc_idev.h | 3 + drivers/common/cnxk/roc_idev_priv.h | 12 ++ drivers/common/cnxk/roc_npa.c | 318 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 20 +++ drivers/common/cnxk/roc_npa_priv.h | 59 +++++++ drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 2 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_utils.c | 22 +++ drivers/common/cnxk/version.map | 5 + 15 files changed, 533 insertions(+) create mode 100644 drivers/common/cnxk/roc_npa.c create mode 100644 drivers/common/cnxk/roc_npa.h create mode 100644 drivers/common/cnxk/roc_npa_priv.h
drivers/common/cnxk/meson.build +1 -0
@@ -15,6 +15,7 @@ sources = files('roc_dev.c', 'roc_irq.c', 'roc_mbox.c', 'roc_model.c', + 'roc_npa.c', 'roc_platform.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_api.h +3 -0
@@ -79,6 +79,9 @@/* Mbox */ #include "roc_mbox.h" +/* NPA */ +#include "roc_npa.h" +/* Utils */ #include "roc_utils.h"
drivers/common/cnxk/roc_dev.c +11 -0
@@ -1125,6 +1125,10 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev) } dev->mbox_active =1 ; + rc =npa_lf_init (dev, pci_dev); +if (rc) + goto iounmap; +/* Setup LMT line base */ rc =dev_lmt_setup (pci_dev, dev);if (rc)
@@ -1150,6 +1154,13 @@ dev_fini(struct dev *dev, struct plt_pci_device *pci_dev)struct plt_intr_handle *intr_handle = &pci_dev->intr_handle;struct mbox *mbox; +/* Check if this dev hosts npalf and has 1+ refs */ +if (idev_npa_lf_active (dev) >1 ) +return -EAGAIN ; + +/* Clear references to this pci dev */ +npa_lf_fini (); +mbox_unregister_irq (pci_dev, dev);if (!dev_is_vf (dev))
drivers/common/cnxk/roc_dev_priv.h +6 -0
@@ -78,6 +78,7 @@ struct dev {dev_intr_t intr;int timer_set;/* ~0 : no alarm handling */ uint64_t hwcap; +struct npa_lf npa;struct mbox *mbox;uint16_t maxvf;struct dev_ops *ops;
@@ -85,6 +86,11 @@ struct dev {bool disable_shared_lmt;/* false(default): shared lmt mode enabled */ } __plt_cache_aligned; +struct npa { +struct plt_pci_device *pci_dev; +struct dev dev; +} __plt_cache_aligned; +extern uint16_t dev_rclk_freq;extern uint16_t dev_sclk_freq;
drivers/common/cnxk/roc_idev.c +67 -0
76 lines not on this page · raw message
drivers/common/cnxk/roc_idev.h +3 -0
@@ -5,6 +5,9 @@#ifndef _ROC_IDEV_H_#define _ROC_IDEV_H_ +uint32_t __roc_api roc_idev_npa_maxpools_get(void); +void __roc_api roc_idev_npa_maxpools_set(uint32_t max_pools); +/* LMT */ uint64_t __roc_api roc_idev_lmt_base_addr_get(void); uint16_t __roc_api roc_idev_num_lmtlines_get(void);
drivers/common/cnxk/roc_idev_priv.h +12 -0
@@ -6,7 +6,12 @@#define _ROC_IDEV_PRIV_H_/* Intra device related functions */ +struct npa_lf ;struct idev_cfg { +uint16_t npa_pf_func; +struct npa_lf *npa; +uint16_t npa_refcnt; +uint32_t max_pools;uint16_t lmt_pf_func;uint16_t num_lmtlines;uint64_t lmt_base_addr;
@@ -16,6 +21,13 @@ struct idev_cfg {struct idev_cfg *idev_get_cfg (void );void idev_set_defaults (struct idev_cfg *idev); +/* idev npa */ +uint16_t idev_npa_pffunc_get (void ); +struct npa_lf *idev_npa_obj_get (void ); +uint32_t idev_npa_maxpools_get (void ); +void idev_npa_maxpools_set (uint32_t max_pools); +uint16_t idev_npa_lf_active (struct dev *dev); +/* idev lmt */ uint16_t idev_lmt_pffunc_get (void );
drivers/common/cnxk/roc_npa.c new file +318 -0
318 lines not on this page · raw message
drivers/common/cnxk/roc_npa.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_NPA_H_ +#define _ROC_NPA_H_ + +#define ROC_AURA_ID_MASK (BIT_ULL(16) - 1) + +struct roc_npa { +struct plt_pci_device *pci_dev; + +#define ROC_NPA_MEM_SZ (1 * 1024) + uint8_t reserved[ROC_NPA_MEM_SZ] __plt_cache_aligned; +} __plt_cache_aligned; + +int __roc_api roc_npa_dev_init(struct roc_npa *roc_npa); +int __roc_api roc_npa_dev_fini(struct roc_npa *roc_npa); + +#endif /* _ROC_NPA_H_ */
drivers/common/cnxk/roc_npa_priv.h new file +59 -0
59 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +1 -0
@@ -55,3 +55,4 @@ roc_plt_init(void)RTE_LOG_REGISTER (cnxk_logtype_base, pmd.cnxk.base,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_mbox, pmd.cnxk.mbox,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_npa, pmd.mempool.cnxk,NOTICE );
drivers/common/cnxk/roc_platform.h +2 -0
@@ -134,6 +134,7 @@/* Log */ extern int cnxk_logtype_base;extern int cnxk_logtype_mbox; +extern int cnxk_logtype_npa; #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args)
@@ -151,6 +152,7 @@ extern int cnxk_logtype_mbox;#define plt_base_dbg (fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__)#define plt_mbox_dbg (fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__) +#define plt_npa_dbg (fmt, ...) plt_dbg(npa, fmt, ##__VA_ARGS__)#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \
drivers/common/cnxk/roc_priv.h +3 -0
@@ -11,6 +11,9 @@/* Mbox */ #include "roc_mbox_priv.h" +/* NPA */ +#include "roc_npa_priv.h" +/* Dev */ #include "roc_dev_priv.h"
drivers/common/cnxk/roc_utils.c +22 -0
@@ -11,9 +11,31 @@ roc_error_msg_get(int errorcode)const char *err_msg;switch (errorcode) { +case NPA_ERR_PARAM :case UTIL_ERR_PARAM : err_msg ="Invalid parameter" ;break ; +case NPA_ERR_ALLOC : + err_msg ="NPA alloc failed" ; +break ; +case NPA_ERR_INVALID_BLOCK_SZ : + err_msg ="NPA invalid block size" ; +break ; +case NPA_ERR_AURA_ID_ALLOC : + err_msg ="NPA aura id alloc failed" ; +break ; +case NPA_ERR_AURA_POOL_INIT : + err_msg ="NPA aura pool init failed" ; +break ; +case NPA_ERR_AURA_POOL_FINI : + err_msg ="NPA aura pool fini failed" ; +break ; +case NPA_ERR_BASE_INVALID : + err_msg ="NPA invalid base" ; +break ; +case NPA_ERR_DEVICE_NOT_BOUNDED : + err_msg ="NPA device is not bounded" ; +break ;case UTIL_ERR_FS : err_msg ="file operation failed" ;break ;
drivers/common/cnxk/version.map +5 -0
@@ -3,11 +3,16 @@ INTERNAL { cnxk_logtype_base; cnxk_logtype_mbox; + cnxk_logtype_npa; roc_clk_freq_get; roc_error_msg_get; roc_idev_lmt_base_addr_get; + roc_idev_npa_maxpools_get; + roc_idev_npa_maxpools_set; roc_idev_num_lmtlines_get; roc_model; + roc_npa_dev_fini; + roc_npa_dev_init; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4
PATCH v4 11/52 common/cnxk: add npa irq support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add support for NPA IRQs.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_npa.c | 7 + drivers/common/cnxk/roc_npa_irq.c | 297 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa_priv.h | 4 + 4 files changed, 309 insertions(+) create mode 100644 drivers/common/cnxk/roc_npa_irq.c
drivers/common/cnxk/meson.build +1 -0
@@ -16,6 +16,7 @@ sources = files('roc_dev.c', 'roc_mbox.c', 'roc_model.c', 'roc_npa.c', + 'roc_npa_irq.c', 'roc_platform.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_npa.c +7 -0
@@ -242,11 +242,17 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev) idev->npa = lf;plt_wmb (); + rc =npa_register_irqs (lf); +if (rc) + goto npa_fini; +plt_npa_dbg ("npa=%p max_pools=%d pf_func=0x%x msix=0x%x" , lf,roc_idev_npa_maxpools_get (), lf->pf_func, npa_msixoff);return 0 ; +npa_fini: +npa_dev_fini (idev->npa); npa_detach:npa_detach (dev->mbox); fail:
@@ -268,6 +274,7 @@ npa_lf_fini(void)if (__atomic_sub_fetch (&idev->npa_refcnt,1 , __ATOMIC_SEQ_CST) !=0 )return 0 ; +npa_unregister_irqs (idev->npa); rc |=npa_dev_fini (idev->npa); rc |=npa_detach (idev->npa->mbox);idev_set_defaults (idev);
drivers/common/cnxk/roc_npa_irq.c new file +297 -0
297 lines not on this page · raw message
drivers/common/cnxk/roc_npa_priv.h +4 -0
@@ -56,4 +56,8 @@ roc_npa_to_npa_priv(struct roc_npa *roc_npa)int npa_lf_init (struct dev *dev,struct plt_pci_device *pci_dev);int npa_lf_fini (void ); +/* IRQ */ +int npa_register_irqs (struct npa_lf *lf); +void npa_unregister_irqs (struct npa_lf *lf); +#endif /* _ROC_NPA_PRIV_H_ */
Signature · 1 line
2.8.4
PATCH v4 12/52 common/cnxk: add npa debug support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add NPA debug APIs.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_npa.h | 4 + drivers/common/cnxk/roc_npa_debug.c | 184 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa_irq.c | 1 + drivers/common/cnxk/version.map | 2 + 5 files changed, 192 insertions(+) create mode 100644 drivers/common/cnxk/roc_npa_debug.c
drivers/common/cnxk/meson.build +1 -0
@@ -16,6 +16,7 @@ sources = files('roc_dev.c', 'roc_mbox.c', 'roc_model.c', 'roc_npa.c', + 'roc_npa_debug.c', 'roc_npa_irq.c', 'roc_platform.c', 'roc_utils.c')
drivers/common/cnxk/roc_npa.h +4 -0
@@ -17,4 +17,8 @@ struct roc_npa { int __roc_api roc_npa_dev_init(struct roc_npa *roc_npa); int __roc_api roc_npa_dev_fini(struct roc_npa *roc_npa); +/* Debug */ +int __roc_api roc_npa_ctx_dump(void); +int __roc_api roc_npa_dump(void); +#endif /* _ROC_NPA_H_ */
drivers/common/cnxk/roc_npa_debug.c new file +184 -0
184 lines not on this page · raw message
drivers/common/cnxk/roc_npa_irq.c +1 -0
@@ -192,6 +192,7 @@ npa_q_irq(void *param)/* Clear interrupt */ plt_write64 (intr, lf->base +NPA_LF_QINTX_INT (qintx)); +roc_npa_ctx_dump (); } static int
drivers/common/cnxk/version.map +2 -0
@@ -11,8 +11,10 @@ INTERNAL { roc_idev_npa_maxpools_set; roc_idev_num_lmtlines_get; roc_model; + roc_npa_ctx_dump; roc_npa_dev_fini; roc_npa_dev_init; + roc_npa_dump; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4
PATCH v4 13/52 common/cnxk: add npa pool HW ops
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add APIs for creating, destroying, modifying
NPA pools.
--- drivers/common/cnxk/roc_npa.c | 421 ++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 146 ++++++++++++++ drivers/common/cnxk/version.map | 5 + 3 files changed, 572 insertions(+)
drivers/common/cnxk/roc_npa.c +421 -0
@@ -5,6 +5,427 @@#include "roc_api.h" #include "roc_priv.h" +void +roc_npa_aura_op_range_set (uint64_t aura_handle,uint64_t start_iova, +uint64_t end_iova) +{ +const uint64_t start =roc_npa_aura_handle_to_base (aura_handle) + +NPA_LF_POOL_OP_PTR_START0 ; +const uint64_t end =roc_npa_aura_handle_to_base (aura_handle) + +NPA_LF_POOL_OP_PTR_END0 ; +uint64_t reg =roc_npa_aura_handle_to_aura (aura_handle); +struct npa_lf *lf =idev_npa_obj_get (); +struct npa_aura_lim *lim; + +PLT_ASSERT (lf); + lim = lf->aura_lim; + + lim[reg].ptr_start =PLT_MIN (lim[reg].ptr_start, start_iova); + lim[reg].ptr_end =PLT_MAX (lim[reg].ptr_end, end_iova); + +roc_store_pair (lim[reg].ptr_start, reg, start); +roc_store_pair (lim[reg].ptr_end, reg, end); +} + +static int +npa_aura_pool_init (struct mbox *mbox,uint32_t aura_id,struct npa_aura_s *aura, +struct npa_pool_s *pool) +{ +struct npa_aq_enq_req *aura_init_req, *pool_init_req; +struct npa_aq_enq_rsp *aura_init_rsp, *pool_init_rsp; +struct mbox_dev *mdev = &mbox->dev[0 ]; +int rc = -ENOSPC , off; + + aura_init_req =mbox_alloc_msg_npa_aq_enq (mbox); +if (aura_init_req ==NULL ) +return rc; + aura_init_req->aura_id = aura_id; + aura_init_req->ctype =NPA_AQ_CTYPE_AURA ; + aura_init_req->op =NPA_AQ_INSTOP_INIT ; +mbox_memcpy (&aura_init_req->aura, aura,sizeof (*aura)); + + pool_init_req =mbox_alloc_msg_npa_aq_enq (mbox); +if (pool_init_req ==NULL ) +return rc; + pool_init_req->aura_id = aura_id; + pool_init_req->ctype =NPA_AQ_CTYPE_POOL ; + pool_init_req->op =NPA_AQ_INSTOP_INIT ; +mbox_memcpy (&pool_init_req->pool, pool,sizeof (*pool)); + + rc =mbox_process (mbox); +if (rc <0 ) +return rc; + + off = mbox->rx_start + +PLT_ALIGN (sizeof (struct mbox_hdr ),MBOX_MSG_ALIGN ); + aura_init_rsp = (struct npa_aq_enq_rsp *)((uintptr_t )mdev->mbase + off); + off = mbox->rx_start + aura_init_rsp->hdr.next_msgoff; + pool_init_rsp = (struct npa_aq_enq_rsp *)((uintptr_t )mdev->mbase + off); + +if (aura_init_rsp->hdr.rc ==0 && pool_init_rsp->hdr.rc ==0 ) +return 0 ; +else +return NPA_ERR_AURA_POOL_INIT ; +} + +static int +npa_aura_pool_fini (struct 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 mbox_dev *mdev = &mbox->dev[0 ]; +struct ndc_sync_op *ndc_req; +int rc = -ENOSPC , off; +uint64_t ptr; + +/* Procedure for disabling an aura/pool */ +plt_delay_us (10 ); + +/* Clear all the pointers from the aura */ +do { + ptr =roc_npa_aura_op_alloc (aura_handle,0 ); + }while (ptr); + + pool_req =mbox_alloc_msg_npa_aq_enq (mbox); +if (pool_req ==NULL ) +return rc; + 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 =mbox_alloc_msg_npa_aq_enq (mbox); +if (aura_req ==NULL ) +return rc; + 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; + + rc =mbox_process (mbox); +if (rc <0 ) +return rc; + + off = mbox->rx_start + +PLT_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 (aura_rsp->hdr.rc !=0 || pool_rsp->hdr.rc !=0 ) +return NPA_ERR_AURA_POOL_FINI ; + +/* Sync NDC-NPA for LF */ + ndc_req =mbox_alloc_msg_ndc_sync_op (mbox); +if (ndc_req ==NULL ) +return -ENOSPC ; + ndc_req->npa_lf_sync =1 ; + rc =mbox_process (mbox); +if (rc) { +plt_err ("Error on NDC-NPA LF sync, rc %d" , rc); +return NPA_ERR_AURA_POOL_FINI ; + } +return 0 ; +} + +static inline char * +npa_stack_memzone_name (struct npa_lf *lf,int pool_id,char *name) +{ +snprintf (name,PLT_MEMZONE_NAMESIZE ,"roc_npa_stack_%x_%d" , lf->pf_func, + pool_id); +return name; +} + +static inline const struct plt_memzone * +npa_stack_dma_alloc (struct npa_lf *lf,char *name,int pool_id,size_t size) +{ +const char *mz_name =npa_stack_memzone_name (lf, pool_id, name); + +return plt_memzone_reserve_cache_align (mz_name, size); +} + +static inline int +npa_stack_dma_free (struct npa_lf *lf,char *name,int pool_id) +{ +const struct plt_memzone *mz; + + mz =plt_memzone_lookup (npa_stack_memzone_name (lf, pool_id, name)); +if (mz ==NULL ) +return NPA_ERR_PARAM ; + +return plt_memzone_free (mz); +} + +static inline int +bitmap_ctzll (uint64_t slab) +{ +if (slab ==0 ) +return 0 ; + +return __builtin_ctzll (slab); +} + +static int +npa_aura_pool_pair_alloc (struct npa_lf *lf,const uint32_t block_size, +const uint32_t block_count,struct npa_aura_s *aura, +struct npa_pool_s *pool,uint64_t *aura_handle) +{ +int rc, aura_id, pool_id, stack_size, alloc_size; +char name[PLT_MEMZONE_NAMESIZE ]; +const struct plt_memzone *mz; +uint64_t slab; +uint32_t pos; + +/* Sanity check */ +if (!lf || !block_size || !block_count || !pool || !aura || + !aura_handle) +return NPA_ERR_PARAM ; + +/* Block size should be cache line aligned and in range of 128B-128KB */ +if (block_size %ROC_ALIGN || block_size <128 || + block_size >128 *1024 ) +return NPA_ERR_INVALID_BLOCK_SZ ; + + pos =0 ; + slab =0 ; +/* Scan from the beginning */ +plt_bitmap_scan_init (lf->npa_bmp); +/* Scan bitmap to get the free pool */ + rc =plt_bitmap_scan (lf->npa_bmp, &pos, &slab); +/* Empty bitmap */ +if (rc ==0 ) { +plt_err ("Mempools exhausted" ); +return NPA_ERR_AURA_ID_ALLOC ; + } + +/* Get aura_id from resource bitmap */ + aura_id = pos +bitmap_ctzll (slab); +/* Mark pool as reserved */ +plt_bitmap_clear (lf->npa_bmp, aura_id); + +/* Configuration based on each aura has separate pool(aura-pool pair) */ + pool_id = aura_id; + rc = (aura_id <0 || pool_id >= (int )lf->nr_pools || + aura_id >= (int )BIT_ULL (6 + lf->aura_sz)) ? +NPA_ERR_AURA_ID_ALLOC : +0 ; +if (rc) + goto exit; + +/* Allocate stack memory */ + stack_size = (block_count + lf->stack_pg_ptrs -1 ) / lf->stack_pg_ptrs; + alloc_size = stack_size * lf->stack_pg_bytes; + + mz =npa_stack_dma_alloc (lf, name, pool_id, alloc_size); +if (mz ==NULL ) { + rc =NPA_ERR_ALLOC ; + goto aura_res_put; + } + +/* Update aura fields */ + aura->pool_addr = pool_id;/* AF will translate to associated poolctx */ + aura->ena =1 ; + aura->shift =__builtin_clz (block_count) -8 ; + aura->limit = block_count; + aura->pool_caching =1 ; + aura->err_int_ena =BIT (NPA_AURA_ERR_INT_AURA_ADD_OVER ); + aura->err_int_ena |=BIT (NPA_AURA_ERR_INT_AURA_ADD_UNDER ); + aura->err_int_ena |=BIT (NPA_AURA_ERR_INT_AURA_FREE_UNDER ); + aura->err_int_ena |=BIT (NPA_AURA_ERR_INT_POOL_DIS ); +/* Many to one reduction */ + aura->err_qint_idx = aura_id % lf->qints; + +/* Update pool fields */ + pool->stack_base = mz->iova; + pool->ena =1 ; + pool->buf_size = block_size /ROC_ALIGN ; + pool->stack_max_pages = stack_size; + pool->shift =__builtin_clz (block_count) -8 ; + pool->ptr_start =0 ; + pool->ptr_end = ~0 ; + pool->stack_caching =1 ; + pool->err_int_ena =BIT (NPA_POOL_ERR_INT_OVFLS ); + pool->err_int_ena |=BIT (NPA_POOL_ERR_INT_RANGE ); + pool->err_int_ena |=BIT (NPA_POOL_ERR_INT_PERR ); + +/* Many to one reduction */ + pool->err_qint_idx = pool_id % lf->qints; + +/* Issue AURA_INIT and POOL_INIT op */ + rc =npa_aura_pool_init (lf->mbox, aura_id, aura, pool); +if (rc) + goto stack_mem_free; + + *aura_handle =roc_npa_aura_handle_gen (aura_id, lf->base); +/* Update aura count */ +roc_npa_aura_op_cnt_set (*aura_handle,0 , block_count); +/* Read it back to make sure aura count is updated */ +roc_npa_aura_op_cnt_get (*aura_handle); + +return 0 ; + +stack_mem_free: +plt_memzone_free (mz); +aura_res_put: +plt_bitmap_set (lf->npa_bmp, aura_id); +exit: +return rc; +} + +int +roc_npa_pool_create (uint64_t *aura_handle,uint32_t block_size, +uint32_t block_count,struct npa_aura_s *aura, +struct npa_pool_s *pool) +{ +struct npa_aura_s defaura; +struct npa_pool_s defpool; +struct idev_cfg *idev; +struct npa_lf *lf; +int rc; + + lf =idev_npa_obj_get (); +if (lf ==NULL ) { + rc =NPA_ERR_DEVICE_NOT_BOUNDED ; + goto error; + } + + idev =idev_get_cfg (); +if (idev ==NULL ) { + rc =NPA_ERR_ALLOC ; + goto error; + } + +if (aura ==NULL ) { +memset (&defaura,0 ,sizeof (struct npa_aura_s )); + aura = &defaura; + } +if (pool ==NULL ) { +memset (&defpool,0 ,sizeof (struct npa_pool_s )); + defpool.nat_align =1 ; + defpool.buf_offset =1 ; + pool = &defpool; + } + + rc =npa_aura_pool_pair_alloc (lf, block_size, block_count, aura, pool, + aura_handle); +if (rc) { +plt_err ("Failed to alloc pool or aura rc=%d" , rc); + goto error; + } + +plt_npa_dbg ("lf=%p block_sz=%d block_count=%d aura_handle=0x%" PRIx64, + lf, block_size, block_count, *aura_handle); + +/* Just hold the reference of the object */ +__atomic_fetch_add (&idev->npa_refcnt,1 , __ATOMIC_SEQ_CST); +error: +return rc; +} + +int +roc_npa_aura_limit_modify (uint64_t aura_handle,uint16_t aura_limit) +{ +struct npa_aq_enq_req *aura_req; +struct npa_lf *lf; +int rc; + + lf =idev_npa_obj_get (); +if (lf ==NULL ) +return NPA_ERR_DEVICE_NOT_BOUNDED ; + + aura_req =mbox_alloc_msg_npa_aq_enq (lf->mbox); +if (aura_req ==NULL ) +return -ENOMEM ; + aura_req->aura_id =roc_npa_aura_handle_to_aura (aura_handle); + aura_req->ctype =NPA_AQ_CTYPE_AURA ; + aura_req->op =NPA_AQ_INSTOP_WRITE ; + + aura_req->aura.limit = aura_limit; + aura_req->aura_mask.limit = ~(aura_req->aura_mask.limit); + rc =mbox_process (lf->mbox); + +return rc; +} + +static int +npa_aura_pool_pair_free (struct npa_lf *lf,uint64_t aura_handle) +{ +char name[PLT_MEMZONE_NAMESIZE ]; +int aura_id, pool_id, rc; + +if (!lf || !aura_handle) +return NPA_ERR_PARAM ; + + aura_id =roc_npa_aura_handle_to_aura (aura_handle); + pool_id = aura_id; + rc =npa_aura_pool_fini (lf->mbox, aura_id, aura_handle); + rc |=npa_stack_dma_free (lf, name, pool_id); + +plt_bitmap_set (lf->npa_bmp, aura_id); + +return rc; +} + +int +roc_npa_pool_destroy (uint64_t aura_handle) +{ +struct npa_lf *lf =idev_npa_obj_get (); +int rc =0 ; + +plt_npa_dbg ("lf=%p aura_handle=0x%" PRIx64, lf, aura_handle); + rc =npa_aura_pool_pair_free (lf, aura_handle); +if (rc) +plt_err ("Failed to destroy pool or aura rc=%d" , rc); + +/* Release the reference of npa */ + rc |=npa_lf_fini (); +return rc; +} + +int +roc_npa_pool_range_update_check (uint64_t aura_handle) +{ +uint64_t aura_id =roc_npa_aura_handle_to_aura (aura_handle); +struct npa_lf *lf; +struct npa_aura_lim *lim; + __io struct npa_pool_s *pool; +struct npa_aq_enq_req *req; +struct npa_aq_enq_rsp *rsp; +int rc; + + lf =idev_npa_obj_get (); +if (lf ==NULL ) +return NPA_ERR_PARAM ; + + lim = lf->aura_lim; + + req =mbox_alloc_msg_npa_aq_enq (lf->mbox); +if (req ==NULL ) +return -ENOSPC ; + + req->aura_id = aura_id; + req->ctype =NPA_AQ_CTYPE_POOL ; + req->op =NPA_AQ_INSTOP_READ ; + + rc =mbox_process_msg (lf->mbox, (void *)&rsp); +if (rc) { +plt_err ("Failed to get pool(0x%" PRIx64") context" , aura_id); +return rc; + } + + pool = &rsp->pool; +if (lim[aura_id].ptr_start != pool->ptr_start || + lim[aura_id].ptr_end != pool->ptr_end) { +plt_err ("Range update failed on pool(0x%" PRIx64")" , aura_id); +return NPA_ERR_PARAM ; + } + +return 0 ; +} +static inline int npa_attach (struct mbox *mbox) {
drivers/common/cnxk/roc_npa.h +146 -0
158 lines not on this page · raw message
drivers/common/cnxk/version.map +5 -0
@@ -11,10 +11,15 @@ INTERNAL { roc_idev_npa_maxpools_set; roc_idev_num_lmtlines_get; roc_model; + roc_npa_aura_limit_modify; + roc_npa_aura_op_range_set; roc_npa_ctx_dump; roc_npa_dev_fini; roc_npa_dev_init; roc_npa_dump; + roc_npa_pool_create; + roc_npa_pool_destroy; + roc_npa_pool_range_update_check; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4
PATCH v4 14/52 common/cnxk: add npa bulk alloc/free support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add APIs to alloc/free in bulk from NPA pool.
--- drivers/common/cnxk/roc_npa.h | 229 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+)
drivers/common/cnxk/roc_npa.h +229 -0
@@ -8,6 +8,11 @@#define ROC_AURA_ID_MASK (BIT_ULL(16) - 1)#define ROC_AURA_OP_LIMIT_MASK (BIT_ULL(36) - 1) +/* 16 CASP instructions can be outstanding in CN9k, but we use only 15 +* outstanding CASPs as we run out of registers. +*/ +#define ROC_CN9K_NPA_BULK_ALLOC_MAX_PTRS 30 +/* * Generate 64bit handle to have optimized alloc and free aura operation. * 0 - ROC_AURA_ID_MASK for storing the aura_id.
@@ -141,6 +146,230 @@ roc_npa_aura_op_available(uint64_t aura_handle)return reg &0xFFFFFFFFF ; } +static inline void +roc_npa_aura_op_bulk_free (uint64_t aura_handle,uint64_t const *buf, +unsigned int num,const int fabs) +{ +unsigned int i; + +for (i =0 ; i < num; i++) { +const uint64_t inbuf = buf[i]; + +roc_npa_aura_op_free (aura_handle, fabs, inbuf); + } +} + +static inline unsigned int +roc_npa_aura_bulk_alloc (uint64_t aura_handle,uint64_t *buf,unsigned int num, +const int drop) +{ +#if defined(__aarch64__) +uint64_t wdata =roc_npa_aura_handle_to_aura (aura_handle); +unsigned int i, count; +uint64_t addr; + +if (drop) + wdata |=BIT_ULL (63 );/* DROP */ + + addr =roc_npa_aura_handle_to_base (aura_handle) + +NPA_LF_AURA_OP_ALLOCX (0 ); + +switch (num) { +case 30 : + asmvolatile ( +".cpu generic+lse\n" +"mov v18.d[0], %[dst]\n" +"mov v18.d[1], %[loc]\n" +"mov v19.d[0], %[wdata]\n" +"mov v19.d[1], x30\n" +"mov v20.d[0], x24\n" +"mov v20.d[1], x25\n" +"mov v21.d[0], x26\n" +"mov v21.d[1], x27\n" +"mov v22.d[0], x28\n" +"mov v22.d[1], x29\n" +"mov x28, v19.d[0]\n" +"mov x29, v19.d[0]\n" +"mov x30, v18.d[1]\n" +"casp x0, x1, x28, x29, [x30]\n" +"casp x2, x3, x28, x29, [x30]\n" +"casp x4, x5, x28, x29, [x30]\n" +"casp x6, x7, x28, x29, [x30]\n" +"casp x8, x9, x28, x29, [x30]\n" +"casp x10, x11, x28, x29, [x30]\n" +"casp x12, x13, x28, x29, [x30]\n" +"casp x14, x15, x28, x29, [x30]\n" +"casp x16, x17, x28, x29, [x30]\n" +"casp x18, x19, x28, x29, [x30]\n" +"casp x20, x21, x28, x29, [x30]\n" +"casp x22, x23, x28, x29, [x30]\n" +"casp x24, x25, x28, x29, [x30]\n" +"casp x26, x27, x28, x29, [x30]\n" +"casp x28, x29, x28, x29, [x30]\n" +"mov x30, v18.d[0]\n" +"stp x0, x1, [x30]\n" +"stp x2, x3, [x30, #16]\n" +"stp x4, x5, [x30, #32]\n" +"stp x6, x7, [x30, #48]\n" +"stp x8, x9, [x30, #64]\n" +"stp x10, x11, [x30, #80]\n" +"stp x12, x13, [x30, #96]\n" +"stp x14, x15, [x30, #112]\n" +"stp x16, x17, [x30, #128]\n" +"stp x18, x19, [x30, #144]\n" +"stp x20, x21, [x30, #160]\n" +"stp x22, x23, [x30, #176]\n" +"stp x24, x25, [x30, #192]\n" +"stp x26, x27, [x30, #208]\n" +"stp x28, x29, [x30, #224]\n" +"mov %[dst], v18.d[0]\n" +"mov %[loc], v18.d[1]\n" +"mov %[wdata], v19.d[0]\n" +"mov x30, v19.d[1]\n" +"mov x24, v20.d[0]\n" +"mov x25, v20.d[1]\n" +"mov x26, v21.d[0]\n" +"mov x27, v21.d[1]\n" +"mov x28, v22.d[0]\n" +"mov x29, v22.d[1]\n" + : + : [wdata]"r" (wdata), [loc]"r" (addr), [dst]"r" (buf) + :"memory" ,"x0" ,"x1" ,"x2" ,"x3" ,"x4" ,"x5" ,"x6" , +"x7" ,"x8" ,"x9" ,"x10" ,"x11" ,"x12" ,"x13" ,"x14" , +"x15" ,"x16" ,"x17" ,"x18" ,"x19" ,"x20" ,"x21" , +"x22" ,"x23" ,"v18" ,"v19" ,"v20" ,"v21" ,"v22" ); +break ; +case 16 : + asmvolatile ( +".cpu generic+lse\n" +"mov x16, %[wdata]\n" +"mov x17, %[wdata]\n" +"casp x0, x1, x16, x17, [%[loc]]\n" +"casp x2, x3, x16, x17, [%[loc]]\n" +"casp x4, x5, x16, x17, [%[loc]]\n" +"casp x6, x7, x16, x17, [%[loc]]\n" +"casp x8, x9, x16, x17, [%[loc]]\n" +"casp x10, x11, x16, x17, [%[loc]]\n" +"casp x12, x13, x16, x17, [%[loc]]\n" +"casp x14, x15, x16, x17, [%[loc]]\n" +"stp x0, x1, [%[dst]]\n" +"stp x2, x3, [%[dst], #16]\n" +"stp x4, x5, [%[dst], #32]\n" +"stp x6, x7, [%[dst], #48]\n" +"stp x8, x9, [%[dst], #64]\n" +"stp x10, x11, [%[dst], #80]\n" +"stp x12, x13, [%[dst], #96]\n" +"stp x14, x15, [%[dst], #112]\n" + : + : [wdata]"r" (wdata), [dst]"r" (buf), [loc]"r" (addr) + :"memory" ,"x0" ,"x1" ,"x2" ,"x3" ,"x4" ,"x5" ,"x6" , +"x7" ,"x8" ,"x9" ,"x10" ,"x11" ,"x12" ,"x13" ,"x14" , +"x15" ,"x16" ,"x17" + ); +break ; +case 8 : + asmvolatile ( +".cpu generic+lse\n" +"mov x16, %[wdata]\n" +"mov x17, %[wdata]\n" +"casp x0, x1, x16, x17, [%[loc]]\n" +"casp x2, x3, x16, x17, [%[loc]]\n" +"casp x4, x5, x16, x17, [%[loc]]\n" +"casp x6, x7, x16, x17, [%[loc]]\n" +"stp x0, x1, [%[dst]]\n" +"stp x2, x3, [%[dst], #16]\n" +"stp x4, x5, [%[dst], #32]\n" +"stp x6, x7, [%[dst], #48]\n" + : + : [wdata]"r" (wdata), [dst]"r" (buf), [loc]"r" (addr) + :"memory" ,"x0" ,"x1" ,"x2" ,"x3" ,"x4" ,"x5" ,"x6" , +"x7" ,"x16" ,"x17" + ); +break ; +case 4 : + asmvolatile ( +".cpu generic+lse\n" +"mov x16, %[wdata]\n" +"mov x17, %[wdata]\n" +"casp x0, x1, x16, x17, [%[loc]]\n" +"casp x2, x3, x16, x17, [%[loc]]\n" +"stp x0, x1, [%[dst]]\n" +"stp x2, x3, [%[dst], #16]\n" + : + : [wdata]"r" (wdata), [dst]"r" (buf), [loc]"r" (addr) + :"memory" ,"x0" ,"x1" ,"x2" ,"x3" ,"x16" ,"x17" + ); +break ; +case 2 : + asmvolatile ( +".cpu generic+lse\n" +"mov x16, %[wdata]\n" +"mov x17, %[wdata]\n" +"casp x0, x1, x16, x17, [%[loc]]\n" +"stp x0, x1, [%[dst]]\n" + : + : [wdata]"r" (wdata), [dst]"r" (buf), [loc]"r" (addr) + :"memory" ,"x0" ,"x1" ,"x16" ,"x17" + ); +break ; +case 1 : + buf[0 ] =roc_npa_aura_op_alloc (aura_handle, drop); +return !!buf[0 ]; + } + +/* Pack the pointers */ +for (i =0 , count =0 ; i < num; i++) +if (buf[i]) + buf[count++] = buf[i]; + +return count; +#else +unsigned int i, count; + +for (i =0 , count =0 ; i < num; i++) { + buf[count] =roc_npa_aura_op_alloc (aura_handle, drop); +if (buf[count]) + count++; + } + +return count; +#endif +} + +static inline unsigned int +roc_npa_aura_op_bulk_alloc (uint64_t aura_handle,uint64_t *buf, +unsigned int num,const int drop,const int partial) +{ +unsigned int chunk, count, num_alloc; + + count =0 ; +while (num) { + chunk = (num >=ROC_CN9K_NPA_BULK_ALLOC_MAX_PTRS ) ? +ROC_CN9K_NPA_BULK_ALLOC_MAX_PTRS : +plt_align32prevpow2 (num); + + num_alloc = +roc_npa_aura_bulk_alloc (aura_handle, buf, chunk, drop); + + count += num_alloc; + buf += num_alloc; + num -= num_alloc; + +if (unlikely (num_alloc != chunk)) +break ; + } + +/* If the requested number of pointers was not allocated and if partial +* alloc is not desired, then free allocated pointers. +*/ +if (unlikely (num !=0 && !partial)) { +roc_npa_aura_op_bulk_free (aura_handle, buf - count, count,1 ); + count =0 ; + } + +return count; +} +struct roc_npa {struct plt_pci_device *pci_dev;
Signature · 1 line
2.8.4
PATCH v4 15/52 common/cnxk: add npa performance counter support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add APIs to read NPA performance counters.
--- drivers/common/cnxk/roc_npa.c | 50 +++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 37 ++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 88 insertions(+)
drivers/common/cnxk/roc_npa.c +50 -0
@@ -131,6 +131,56 @@ npa_aura_pool_fini(struct mbox *mbox, uint32_t aura_id, uint64_t aura_handle)return 0 ; } +int +roc_npa_pool_op_pc_reset (uint64_t aura_handle) +{ +struct npa_lf *lf =idev_npa_obj_get (); +struct npa_aq_enq_req *pool_req; +struct npa_aq_enq_rsp *pool_rsp; +struct ndc_sync_op *ndc_req; +struct mbox_dev *mdev; +int rc = -ENOSPC , off; +struct mbox *mbox; + +if (lf ==NULL ) +return NPA_ERR_PARAM ; + + mbox = lf->mbox; + mdev = &mbox->dev[0 ]; +plt_npa_dbg ("lf=%p aura_handle=0x%" PRIx64, lf, aura_handle); + + pool_req =mbox_alloc_msg_npa_aq_enq (mbox); +if (pool_req ==NULL ) +return rc; + pool_req->aura_id =roc_npa_aura_handle_to_aura (aura_handle); + pool_req->ctype =NPA_AQ_CTYPE_POOL ; + pool_req->op =NPA_AQ_INSTOP_WRITE ; + pool_req->pool.op_pc =0 ; + pool_req->pool_mask.op_pc = ~pool_req->pool_mask.op_pc; + + rc =mbox_process (mbox); +if (rc <0 ) +return rc; + + off = mbox->rx_start + +PLT_ALIGN (sizeof (struct mbox_hdr ),MBOX_MSG_ALIGN ); + pool_rsp = (struct npa_aq_enq_rsp *)((uintptr_t )mdev->mbase + off); + +if (pool_rsp->hdr.rc !=0 ) +return NPA_ERR_AURA_POOL_FINI ; + +/* Sync NDC-NPA for LF */ + ndc_req =mbox_alloc_msg_ndc_sync_op (mbox); +if (ndc_req ==NULL ) +return -ENOSPC ; + ndc_req->npa_lf_sync =1 ; + rc =mbox_process (mbox); +if (rc) { +plt_err ("Error on NDC-NPA LF sync, rc %d" , rc); +return NPA_ERR_AURA_POOL_FINI ; + } +return 0 ; +}static inline char *npa_stack_memzone_name (struct npa_lf *lf,int pool_id,char *name) {
drivers/common/cnxk/roc_npa.h +37 -0
@@ -146,6 +146,40 @@ roc_npa_aura_op_available(uint64_t aura_handle)return reg &0xFFFFFFFFF ; } +static inline uint64_t +roc_npa_pool_op_performance_counter (uint64_t aura_handle,const int drop) +{ +union { +uint64_t u; +struct npa_aura_op_wdata_s s; + } op_wdata; +int64_t *addr; +uint64_t reg; + + op_wdata.u =0 ; + op_wdata.s.aura =roc_npa_aura_handle_to_aura (aura_handle); +if (drop) + op_wdata.s.drop |=BIT_ULL (63 );/* DROP */ + + addr = (int64_t *)(roc_npa_aura_handle_to_base (aura_handle) + +NPA_LF_POOL_OP_PC ); + + reg =roc_atomic64_add_nosync (op_wdata.u, addr); +/* +* NPA_LF_POOL_OP_PC Read Data +* +* 63 49 48 48 47 0 +* ----------------------------- +* | Reserved | OP_ERR | OP_PC | +* ----------------------------- +*/ + +if (reg &BIT_ULL (48 )/* OP_ERR */ ) +return 0 ; +else +return reg &0xFFFFFFFFFFFF ; +} +static inline void roc_npa_aura_op_bulk_free (uint64_t aura_handle,uint64_t const *buf,unsigned int num,const int fabs)
@@ -396,4 +430,7 @@ void __roc_api roc_npa_aura_op_range_set(uint64_t aura_handle, int __roc_api roc_npa_ctx_dump(void); int __roc_api roc_npa_dump(void); +/* Reset operation performance counter. */ +int __roc_api roc_npa_pool_op_pc_reset(uint64_t aura_handle); +#endif /* _ROC_NPA_H_ */
drivers/common/cnxk/version.map +1 -0
@@ -19,6 +19,7 @@ INTERNAL { roc_npa_dump; roc_npa_pool_create; roc_npa_pool_destroy; + roc_npa_pool_op_pc_reset; roc_npa_pool_range_update_check; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4
PATCH v4 16/52 common/cnxk: add npa batch alloc/free support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add APIs to do allocations/frees in batch from
NPA pool.
--- drivers/common/cnxk/roc_npa.h | 217 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+)
drivers/common/cnxk/roc_npa.h +217 -0
@@ -8,6 +8,9 @@#define ROC_AURA_ID_MASK (BIT_ULL(16) - 1)#define ROC_AURA_OP_LIMIT_MASK (BIT_ULL(36) - 1) +#define ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS 512 +#define ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS 15 +/* 16 CASP instructions can be outstanding in CN9k, but we use only 15 * outstanding CASPs as we run out of registers. */
@@ -180,6 +183,114 @@ roc_npa_pool_op_performance_counter(uint64_t aura_handle, const int drop)return reg &0xFFFFFFFFFFFF ; } +static inline int +roc_npa_aura_batch_alloc_issue (uint64_t aura_handle,uint64_t *buf, +unsigned int num,const int dis_wait, +const int drop) +{ +unsigned int i; +int64_t *addr; +uint64_t res; +union { +uint64_t u; +struct npa_batch_alloc_compare_s compare_s; + } cmp; + +if (num >ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS ) +return -1 ; + +/* Zero first word of every cache line */ +for (i =0 ; i < num; i += (ROC_ALIGN /sizeof (uint64_t ))) + buf[i] =0 ; + + addr = (int64_t *)(roc_npa_aura_handle_to_base (aura_handle) + +NPA_LF_AURA_BATCH_ALLOC ); + cmp.u =0 ; + cmp.compare_s.aura =roc_npa_aura_handle_to_aura (aura_handle); + cmp.compare_s.drop = drop; + cmp.compare_s.stype =ALLOC_STYPE_STSTP ; + cmp.compare_s.dis_wait = dis_wait; + cmp.compare_s.count = num; + + res =roc_atomic64_cas (cmp.u, (uint64_t )buf, addr); +if (res !=ALLOC_RESULT_ACCEPTED && res !=ALLOC_RESULT_NOCORE ) +return -1 ; + +return 0 ; +} + +static inline unsigned int +roc_npa_aura_batch_alloc_count (uint64_t *aligned_buf,unsigned int num) +{ +unsigned int count, i; + +if (num >ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS ) +return 0 ; + + count =0 ; +/* Check each ROC cache line one by one */ +for (i =0 ; i < num; i += (ROC_ALIGN >>3 )) { +struct npa_batch_alloc_status_s *status; +int ccode; + + status = (struct npa_batch_alloc_status_s *)&aligned_buf[i]; + +/* Status is updated in first 7 bits of each 128 byte cache +* line. Wait until the status gets updated. +*/ +do { + ccode = (volatile int )status->ccode; + }while (ccode ==ALLOC_CCODE_INVAL ); + + count += status->count; + } + +return count; +} + +static inline unsigned int +roc_npa_aura_batch_alloc_extract (uint64_t *buf,uint64_t *aligned_buf, +unsigned int num) +{ +unsigned int count, i; + +if (num >ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS ) +return 0 ; + + count =0 ; +/* Check each ROC cache line one by one */ +for (i =0 ; i < num; i += (ROC_ALIGN >>3 )) { +struct npa_batch_alloc_status_s *status; +int line_count, ccode; + + status = (struct npa_batch_alloc_status_s *)&aligned_buf[i]; + +/* Status is updated in first 7 bits of each 128 byte cache +* line. Wait until the status gets updated. +*/ +do { + ccode = (volatile int )status->ccode; + }while (ccode ==ALLOC_CCODE_INVAL ); + + line_count = status->count; + +/* Clear the status from the cache line */ + status->ccode =0 ; + status->count =0 ; + +/* 'Compress' the allocated buffers as there can +* be 'holes' at the end of the 128 byte cache +* lines. +*/ +memmove (&buf[count], &aligned_buf[i], + line_count *sizeof (uint64_t )); + + count += line_count; + } + +return count; +} +static inline void roc_npa_aura_op_bulk_free (uint64_t aura_handle,uint64_t const *buf,unsigned int num,const int fabs)
@@ -194,6 +305,112 @@ roc_npa_aura_op_bulk_free(uint64_t aura_handle, uint64_t const *buf, }static inline unsigned int +roc_npa_aura_op_batch_alloc (uint64_t aura_handle,uint64_t *buf, +uint64_t *aligned_buf,unsigned int num, +const int dis_wait,const int drop, +const int partial) +{ +unsigned int count, chunk, num_alloc; + +/* The buffer should be 128 byte cache line aligned */ +if (((uint64_t )aligned_buf & (ROC_ALIGN -1 )) !=0 ) +return 0 ; + + count =0 ; +while (num) { + chunk = (num >ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS ) ? +ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS : + num; + +if (roc_npa_aura_batch_alloc_issue (aura_handle, aligned_buf, + chunk, dis_wait, drop)) +break ; + + num_alloc =roc_npa_aura_batch_alloc_extract (buf, aligned_buf, + chunk); + + count += num_alloc; + buf += num_alloc; + num -= num_alloc; + +if (num_alloc != chunk) +break ; + } + +/* If the requested number of pointers was not allocated and if partial +* alloc is not desired, then free allocated pointers. +*/ +if (unlikely (num !=0 && !partial)) { +roc_npa_aura_op_bulk_free (aura_handle, buf - count, count,1 ); + count =0 ; + } + +return count; +} + +static inline void +roc_npa_aura_batch_free (uint64_t aura_handle,uint64_t const *buf, +unsigned int num,const int fabs,uint64_t lmt_addr, +uint64_t lmt_id) +{ +uint64_t addr, tar_addr, free0; +volatile uint64_t *lmt_data; +unsigned int i; + +if (num >ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS ) +return ; + + lmt_data = (uint64_t *)lmt_addr; + + addr =roc_npa_aura_handle_to_base (aura_handle) + +NPA_LF_AURA_BATCH_FREE0 ; + +/* +* NPA_LF_AURA_BATCH_FREE0 +* +* 63 63 62 33 32 32 31 20 19 0 +* ----------------------------------------- +* | FABS | Rsvd | COUNT_EOT | Rsvd | AURA | +* ----------------------------------------- +*/ + free0 =roc_npa_aura_handle_to_aura (aura_handle); +if (fabs) + free0 |= (0x1UL <<63 ); +if (num &0x1 ) + free0 |= (0x1UL <<32 ); + +/* tar_addr[4:6] is LMTST size-1 in units of 128b */ + tar_addr = addr | ((num >>1 ) <<4 ); + + lmt_data[0 ] = free0; +for (i =0 ; i < num; i++) + lmt_data[i +1 ] = buf[i]; + +roc_lmt_submit_steorl (lmt_id, tar_addr); +plt_io_wmb (); +} + +static inline void +roc_npa_aura_op_batch_free (uint64_t aura_handle,uint64_t const *buf, +unsigned int num,const int fabs,uint64_t lmt_addr, +uint64_t lmt_id) +{ +unsigned int chunk; + +while (num) { + chunk = (num >=ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS ) ? +ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS : + num; + +roc_npa_aura_batch_free (aura_handle, buf, chunk, fabs, lmt_addr, + lmt_id); + + buf += chunk; + num -= chunk; + } +} + +static inline unsigned int roc_npa_aura_bulk_alloc (uint64_t aura_handle,uint64_t *buf,unsigned int num,const int drop) {
Signature · 1 line
2.8.4
PATCH v4 17/52 common/cnxk: add base nix support
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add base nix support as ROC(Rest of Chip) API which will be used by generic ETHDEV PMD(net/cnxk).
This patch adds support to device init, fini, resource alloc and free API which sets up a ETHDEV PCI device of either CN9K or CN10K Marvell SoC.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_idev.c | 13 ++ drivers/common/cnxk/roc_idev.h | 2 + drivers/common/cnxk/roc_nix.c | 396 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix.h | 84 ++++++++ drivers/common/cnxk/roc_nix_priv.h | 100 ++++++++++ drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 2 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_utils.c | 41 ++++ drivers/common/cnxk/version.map | 16 ++ 12 files changed, 662 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix.c create mode 100644 drivers/common/cnxk/roc_nix.h create mode 100644 drivers/common/cnxk/roc_nix_priv.h
drivers/common/cnxk/meson.build +1 -0
@@ -15,6 +15,7 @@ sources = files('roc_dev.c', 'roc_irq.c', 'roc_mbox.c', 'roc_model.c', + 'roc_nix.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c',
drivers/common/cnxk/roc_api.h +3 -0
@@ -82,6 +82,9 @@/* NPA */ #include "roc_npa.h" +/* NIX */ +#include "roc_nix.h" +/* Utils */ #include "roc_utils.h"
drivers/common/cnxk/roc_idev.c +13 -0
@@ -142,3 +142,16 @@ roc_idev_num_lmtlines_get(void)return num_lmtlines; } + +struct roc_nix * +roc_idev_npa_nix_get (void ) +{ +struct npa_lf *npa_lf =idev_npa_obj_get (); +struct dev *dev; + +if (!npa_lf) +return NULL ; + + dev = container_of(npa_lf, struct dev, npa); +return dev->roc_nix; +}
drivers/common/cnxk/roc_idev.h +2 -0
@@ -12,4 +12,6 @@ void __roc_api roc_idev_npa_maxpools_set(uint32_t max_pools); uint64_t __roc_api roc_idev_lmt_base_addr_get(void); uint16_t __roc_api roc_idev_num_lmtlines_get(void); +struct roc_nix *__roc_api roc_idev_npa_nix_get(void); +#endif /* _ROC_IDEV_H_ */
drivers/common/cnxk/roc_nix.c new file +396 -0
396 lines not on this page · raw message
drivers/common/cnxk/roc_nix.h new file +84 -0
84 lines not on this page · raw message
drivers/common/cnxk/roc_nix_priv.h new file +100 -0
100 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +1 -0
@@ -56,3 +56,4 @@ roc_plt_init(void)RTE_LOG_REGISTER (cnxk_logtype_base, pmd.cnxk.base,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_mbox, pmd.cnxk.mbox,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_npa, pmd.mempool.cnxk,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_nix, pmd.net.cnxk,NOTICE );
drivers/common/cnxk/roc_platform.h +2 -0
@@ -135,6 +135,7 @@extern int cnxk_logtype_base;extern int cnxk_logtype_mbox;extern int cnxk_logtype_npa; +extern int cnxk_logtype_nix; #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args)
@@ -153,6 +154,7 @@ extern int cnxk_logtype_npa;#define plt_base_dbg (fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__)#define plt_mbox_dbg (fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__)#define plt_npa_dbg (fmt, ...) plt_dbg(npa, fmt, ##__VA_ARGS__) +#define plt_nix_dbg (fmt, ...) plt_dbg(nix, fmt, ##__VA_ARGS__)#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \
drivers/common/cnxk/roc_priv.h +3 -0
@@ -20,4 +20,7 @@/* idev */ #include "roc_idev_priv.h" +/* NIX */ +#include "roc_nix_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/roc_utils.c +41 -0
57 lines not on this page · raw message
drivers/common/cnxk/version.map +16 -0
@@ -3,14 +3,30 @@ INTERNAL { cnxk_logtype_base; cnxk_logtype_mbox; + cnxk_logtype_nix; cnxk_logtype_npa; roc_clk_freq_get; roc_error_msg_get; roc_idev_lmt_base_addr_get; roc_idev_npa_maxpools_get; roc_idev_npa_maxpools_set; + roc_idev_npa_nix_get; roc_idev_num_lmtlines_get; roc_model; + roc_nix_dev_fini; + roc_nix_dev_init; + roc_nix_get_base_chan; + roc_nix_get_pf; + roc_nix_get_pf_func; + roc_nix_get_vf; + roc_nix_get_vwqe_interval; + roc_nix_is_lbk; + roc_nix_is_pf; + roc_nix_is_sdp; + roc_nix_is_vf_or_sdp; + roc_nix_lf_alloc; + roc_nix_lf_free; + roc_nix_max_pkt_len; roc_npa_aura_limit_modify; roc_npa_aura_op_range_set; roc_npa_ctx_dump;
Signature · 1 line
2.8.4
PATCH v4 18/52 common/cnxk: add nix irq support
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add support to register NIX error and completion queue IRQ's using base device class IRQ helper API's.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.c | 7 + drivers/common/cnxk/roc_nix.h | 12 + drivers/common/cnxk/roc_nix_irq.c | 484 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_priv.h | 18 ++ drivers/common/cnxk/version.map | 8 + 6 files changed, 530 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_irq.c
drivers/common/cnxk/meson.build +1 -0
@@ -16,6 +16,7 @@ sources = files('roc_dev.c', 'roc_mbox.c', 'roc_model.c', 'roc_nix.c', + 'roc_nix_irq.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c',
drivers/common/cnxk/roc_nix.c +7 -0
@@ -363,6 +363,11 @@ roc_nix_dev_init(struct roc_nix *roc_nix) nix->reta_sz = reta_sz; nix->mtu =ROC_NIX_DEFAULT_HW_FRS ; +/* Register error and ras interrupts */ + rc =nix_register_irqs (nix); +if (rc) + goto lf_detach; +/* Get NIX HW info */ roc_nix_get_hw_info (roc_nix); nix->dev.drv_inited = true;
@@ -388,6 +393,8 @@ roc_nix_dev_fini(struct roc_nix *roc_nix)if (!nix->dev.drv_inited) goto fini; +nix_unregister_irqs (nix); + rc =nix_lf_detach (nix); nix->dev.drv_inited = false; fini:
drivers/common/cnxk/roc_nix.h +12 -0
@@ -81,4 +81,16 @@ int __roc_api roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq, uint32_t nb_txq, uint64_t rx_cfg); int __roc_api roc_nix_lf_free(struct roc_nix *roc_nix); +/* IRQ */ +void __roc_api roc_nix_rx_queue_intr_enable(struct roc_nix *roc_nix, +uint16_t rxq_id); +void __roc_api roc_nix_rx_queue_intr_disable(struct roc_nix *roc_nix, +uint16_t rxq_id); +void __roc_api roc_nix_err_intr_ena_dis(struct roc_nix *roc_nix, bool enb); +void __roc_api roc_nix_ras_intr_ena_dis(struct roc_nix *roc_nix, bool enb); +int __roc_api roc_nix_register_queue_irqs(struct roc_nix *roc_nix); +void __roc_api roc_nix_unregister_queue_irqs(struct roc_nix *roc_nix); +int __roc_api roc_nix_register_cq_irqs(struct roc_nix *roc_nix); +void __roc_api roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix); +#endif /* _ROC_NIX_H_ */
drivers/common/cnxk/roc_nix_irq.c new file +484 -0
484 lines not on this page · raw message
drivers/common/cnxk/roc_nix_priv.h +18 -0
@@ -18,11 +18,25 @@/* Apply BP/DROP when CQ is 95% full */ #define NIX_CQ_THRESH_LEVEL (5 * 256 / 100) +/* IRQ triggered when NIX_LF_CINTX_CNT[QCOUNT] crosses this value */ +#define CQ_CQE_THRESH_DEFAULT 0x1ULL +#define CQ_TIMER_THRESH_DEFAULT 0xAULL/* ~1usec i.e (0xA * 100nsec) */ +#define CQ_TIMER_THRESH_MAX 255 + +struct nix_qint { +struct nix *nix; +uint8_t qintx; +}; +struct nix {uint16_t reta[ROC_NIX_RSS_GRPS ][ROC_NIX_RSS_RETA_MAX ];enum roc_nix_rss_reta_sz reta_sz;struct plt_pci_device *pci_dev;uint16_t bpid[NIX_MAX_CHAN ]; +struct nix_qint *qints_mem; +struct nix_qint *cints_mem; +uint8_t configured_qints; +uint8_t configured_cints;struct roc_nix_sq **sqs;uint16_t vwqe_interval;uint16_t tx_chan_base;
@@ -97,4 +111,8 @@ nix_priv_to_roc_nix(struct nix *nix) offsetof(struct roc_nix, reserved)); } +/* IRQ */ +int nix_register_irqs (struct nix *nix); +void nix_unregister_irqs (struct nix *nix); +#endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/version.map +8 -0
@@ -15,6 +15,7 @@ INTERNAL { roc_model; roc_nix_dev_fini; roc_nix_dev_init; + roc_nix_err_intr_ena_dis; roc_nix_get_base_chan; roc_nix_get_pf; roc_nix_get_pf_func;
@@ -27,6 +28,13 @@ INTERNAL { roc_nix_lf_alloc; roc_nix_lf_free; roc_nix_max_pkt_len; + roc_nix_ras_intr_ena_dis; + roc_nix_register_cq_irqs; + roc_nix_register_queue_irqs; + roc_nix_rx_queue_intr_disable; + roc_nix_rx_queue_intr_enable; + roc_nix_unregister_cq_irqs; + roc_nix_unregister_queue_irqs; roc_npa_aura_limit_modify; roc_npa_aura_op_range_set; roc_npa_ctx_dump;
Signature · 1 line
2.8.4
PATCH v4 19/52 common/cnxk: add nix Rx queue management API
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add nix Rx queue management API to init/modify/fini RQ context and also setup CQ(completion queue) context. Current support is both for CN9K and CN10K devices.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 52 ++++ drivers/common/cnxk/roc_nix_queue.c | 496 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 6 + 4 files changed, 555 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_queue.c
drivers/common/cnxk/meson.build +1 -0
@@ -17,6 +17,7 @@ sources = files('roc_dev.c', 'roc_model.c', 'roc_nix.c', 'roc_nix_irq.c', + 'roc_nix_queue.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c',
drivers/common/cnxk/roc_nix.h +52 -0
62 lines not on this page · raw message
drivers/common/cnxk/roc_nix_queue.c new file +496 -0
496 lines not on this page · raw message
drivers/common/cnxk/version.map +6 -0
@@ -13,6 +13,8 @@ INTERNAL { roc_idev_npa_nix_get; roc_idev_num_lmtlines_get; roc_model; + roc_nix_cq_fini; + roc_nix_cq_init; roc_nix_dev_fini; roc_nix_dev_init; roc_nix_err_intr_ena_dis;
@@ -31,6 +33,10 @@ INTERNAL { roc_nix_ras_intr_ena_dis; roc_nix_register_cq_irqs; roc_nix_register_queue_irqs; + roc_nix_rq_ena_dis; + roc_nix_rq_fini; + roc_nix_rq_init; + roc_nix_rq_modify; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; roc_nix_unregister_cq_irqs;
Signature · 1 line
2.8.4
PATCH v4 20/52 common/cnxk: add nix Tx queue management API
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
This patch adds support to init/modify/fini NIX
SQ(send queue) for both CN9K and CN10K platforms.
--- drivers/common/cnxk/roc_nix.h | 19 ++ drivers/common/cnxk/roc_nix_queue.c | 358 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 2 + 3 files changed, 379 insertions(+)
drivers/common/cnxk/roc_nix.h +19 -0
@@ -83,6 +83,23 @@ struct roc_nix_cq {uint32_t head; }; +struct roc_nix_sq { +/* Input parameters */ +enum roc_nix_sq_max_sqe_sz max_sqe_sz; +uint32_t nb_desc; +uint16_t qid; +/* End of Input parameters */ +uint16_t sqes_per_sqb_log2; +struct roc_nix *roc_nix; +uint64_t aura_handle; +int16_t nb_sqb_bufs_adj; +uint16_t nb_sqb_bufs; +plt_iova_t io_addr; +void *lmt_addr; +void *sqe_mem; +void *fc; +}; +struct roc_nix {/* Input parameters */ struct plt_pci_device *pci_dev;
@@ -144,5 +161,7 @@ int __roc_api roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable); int __roc_api roc_nix_rq_fini(struct roc_nix_rq *rq); int __roc_api roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq); int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq); +int __roc_api roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq); +int __roc_api roc_nix_sq_fini(struct roc_nix_sq *sq);#endif /* _ROC_NIX_H_ */
drivers/common/cnxk/roc_nix_queue.c +358 -0
361 lines not on this page · raw message
drivers/common/cnxk/version.map +2 -0
@@ -39,6 +39,8 @@ INTERNAL { roc_nix_rq_modify; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; + roc_nix_sq_fini; + roc_nix_sq_init; roc_nix_unregister_cq_irqs; roc_nix_unregister_queue_irqs; roc_npa_aura_limit_modify;
Signature · 1 line
2.8.4
PATCH v4 21/52 common/cnxk: add nix MAC operations support
In reply to Nithin DabilpuramFrom: Sunil Kumar Kori <[email protected]>
Add support to different MAC related operations such as MAC address set/get, link set/get, link status callback, etc.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 41 ++++++ drivers/common/cnxk/roc_nix_mac.c | 298 ++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 15 ++ 4 files changed, 355 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_mac.c
drivers/common/cnxk/meson.build +1 -0
@@ -17,6 +17,7 @@ sources = files('roc_dev.c', 'roc_model.c', 'roc_nix.c', 'roc_nix_irq.c', + 'roc_nix_mac.c', 'roc_nix_queue.c', 'roc_npa.c', 'roc_npa_debug.c',
drivers/common/cnxk/roc_nix.h +41 -0
53 lines not on this page · raw message
drivers/common/cnxk/roc_nix_mac.c new file +298 -0
298 lines not on this page · raw message
drivers/common/cnxk/version.map +15 -0
@@ -29,6 +29,21 @@ INTERNAL { roc_nix_is_vf_or_sdp; roc_nix_lf_alloc; roc_nix_lf_free; + roc_nix_mac_addr_add; + roc_nix_mac_addr_del; + roc_nix_mac_addr_set; + roc_nix_mac_link_cb_register; + roc_nix_mac_link_cb_unregister; + roc_nix_mac_link_event_start_stop; + roc_nix_mac_link_info_get; + roc_nix_mac_link_info_set; + roc_nix_mac_link_state_set; + roc_nix_mac_loopback_enable; + roc_nix_mac_max_entries_get; + roc_nix_mac_max_rx_len_set; + roc_nix_mac_mtu_set; + roc_nix_mac_promisc_mode_enable; + roc_nix_mac_rxtx_start_stop; roc_nix_max_pkt_len; roc_nix_ras_intr_ena_dis; roc_nix_register_cq_irqs;
Signature · 1 line
2.8.4
PATCH v4 22/52 common/cnxk: add nix specific npc operations
In reply to Nithin DabilpuramFrom: Sunil Kumar Kori <[email protected]>
Add NIX specific NPC operations such as NPC mac address get/set, mcast entry add/delete, promiscuous mode enable/disable etc.
--- drivers/common/cnxk/meson.build | 2 + drivers/common/cnxk/roc_nix.h | 25 +++++++++ drivers/common/cnxk/roc_nix_mcast.c | 98 ++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_npc.c | 103 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 9 ++++ 5 files changed, 237 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_mcast.c create mode 100644 drivers/common/cnxk/roc_nix_npc.c
drivers/common/cnxk/meson.build +2 -0
@@ -18,6 +18,8 @@ sources = files('roc_dev.c', 'roc_nix.c', 'roc_nix_irq.c', 'roc_nix_mac.c', + 'roc_nix_mcast.c', + 'roc_nix_npc.c', 'roc_nix_queue.c', 'roc_npa.c', 'roc_npa_debug.c',
drivers/common/cnxk/roc_nix.h +25 -0
@@ -193,6 +193,18 @@ int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, link_status_t link_update); void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix); +/* NPC */ +int __roc_api roc_nix_npc_promisc_ena_dis(struct roc_nix *roc_nix, int enable); + +int __roc_api roc_nix_npc_mac_addr_set(struct roc_nix *roc_nix, uint8_t addr[]); + +int __roc_api roc_nix_npc_mac_addr_get(struct roc_nix *roc_nix, uint8_t *addr); + +int __roc_api roc_nix_npc_rx_ena_dis(struct roc_nix *roc_nix, bool enable); + +int __roc_api roc_nix_npc_mcast_config(struct roc_nix *roc_nix, +bool mcast_enable,bool prom_enable); +/* Queue */ int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq,bool ena);
@@ -205,4 +217,17 @@ int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq); int __roc_api roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq); int __roc_api roc_nix_sq_fini(struct roc_nix_sq *sq); +/* MCAST*/ +int __roc_api roc_nix_mcast_mcam_entry_alloc(struct roc_nix *roc_nix, +uint16_t nb_entries, +uint8_t priority, +uint16_t index[]); +int __roc_api roc_nix_mcast_mcam_entry_free(struct roc_nix *roc_nix, +uint32_t index); +int __roc_api roc_nix_mcast_mcam_entry_write(struct roc_nix *roc_nix, +struct mcam_entry *entry, +uint32_t index,uint8_t intf, +uint64_t action); +int __roc_api roc_nix_mcast_mcam_entry_ena_dis(struct roc_nix *roc_nix, +uint32_t index,bool enable);#endif /* _ROC_NIX_H_ */
drivers/common/cnxk/roc_nix_mcast.c new file +98 -0
98 lines not on this page · raw message
drivers/common/cnxk/roc_nix_npc.c new file +103 -0
103 lines not on this page · raw message
drivers/common/cnxk/version.map +9 -0
@@ -45,6 +45,15 @@ INTERNAL { roc_nix_mac_promisc_mode_enable; roc_nix_mac_rxtx_start_stop; roc_nix_max_pkt_len; + roc_nix_mcast_mcam_entry_alloc; + roc_nix_mcast_mcam_entry_ena_dis; + roc_nix_mcast_mcam_entry_free; + roc_nix_mcast_mcam_entry_write; + roc_nix_npc_mac_addr_get; + roc_nix_npc_mac_addr_set; + roc_nix_npc_promisc_ena_dis; + roc_nix_npc_rx_ena_dis; + roc_nix_npc_mcast_config; roc_nix_ras_intr_ena_dis; roc_nix_register_cq_irqs; roc_nix_register_queue_irqs;
Signature · 1 line
2.8.4
PATCH v4 23/52 common/cnxk: add nix inline IPsec config API
In reply to Nithin DabilpuramFrom: Vidya Sagar Velumuri <[email protected]>
Add API to configure NIX block for inline IPSec.
--- drivers/common/cnxk/roc_nix.c | 28 ++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix.h | 10 ++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 39 insertions(+)
drivers/common/cnxk/roc_nix.c +28 -0
@@ -81,6 +81,34 @@ roc_nix_get_pf_func(struct roc_nix *roc_nix) }int +roc_nix_lf_inl_ipsec_cfg (struct roc_nix *roc_nix,struct roc_nix_ipsec_cfg *cfg, +bool enb) +{ +struct nix *nix =roc_nix_to_nix_priv (roc_nix); +struct nix_inline_ipsec_lf_cfg *lf_cfg; +struct mbox *mbox = (&nix->dev)->mbox; + + lf_cfg =mbox_alloc_msg_nix_inline_ipsec_lf_cfg (mbox); +if (lf_cfg ==NULL ) +return -ENOSPC ; + +if (enb) { + lf_cfg->enable =1 ; + lf_cfg->sa_base_addr = cfg->iova; + lf_cfg->ipsec_cfg1.sa_idx_w =plt_log2_u32 (cfg->max_sa); + lf_cfg->ipsec_cfg0.lenm1_max =roc_nix_max_pkt_len (roc_nix) -1 ; + lf_cfg->ipsec_cfg1.sa_idx_max = cfg->max_sa -1 ; + lf_cfg->ipsec_cfg0.sa_pow2_size =plt_log2_u32 (cfg->sa_size); + lf_cfg->ipsec_cfg0.tag_const = cfg->tag_const; + lf_cfg->ipsec_cfg0.tt = cfg->tt; + }else { + lf_cfg->enable =0 ; + } + +return mbox_process (mbox); +} + +int roc_nix_max_pkt_len (struct roc_nix *roc_nix) {struct nix *nix =roc_nix_to_nix_priv (roc_nix);
drivers/common/cnxk/roc_nix.h +10 -0
@@ -110,6 +110,14 @@ struct roc_nix_link_info { uint64_t port : 8; }; +struct roc_nix_ipsec_cfg { +uint32_t sa_size; +uint32_t tag_const; +plt_iova_t iova; +uint16_t max_sa; +uint8_t tt; +}; +/* Link status update callback */ typedef void (*link_status_t )(struct roc_nix *roc_nix,struct roc_nix_link_info *link);
@@ -156,6 +164,8 @@ int __roc_api roc_nix_max_pkt_len(struct roc_nix *roc_nix); int __roc_api roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq,uint32_t nb_txq,uint64_t rx_cfg); int __roc_api roc_nix_lf_free(struct roc_nix *roc_nix); +int __roc_api roc_nix_lf_inl_ipsec_cfg(struct roc_nix *roc_nix, +struct roc_nix_ipsec_cfg *cfg,bool enb);/* IRQ */ void __roc_api roc_nix_rx_queue_intr_enable(struct roc_nix *roc_nix,
drivers/common/cnxk/version.map +1 -0
@@ -28,6 +28,7 @@ INTERNAL { roc_nix_is_sdp; roc_nix_is_vf_or_sdp; roc_nix_lf_alloc; + roc_nix_lf_inl_ipsec_cfg; roc_nix_lf_free; roc_nix_mac_addr_add; roc_nix_mac_addr_del;
Signature · 1 line
2.8.4
PATCH v4 24/52 common/cnxk: add nix RSS support
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add API's for default/non-default reta table setup, key set/get, and flow algo setup for CN9K and CN10K.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 17 +++ drivers/common/cnxk/roc_nix_rss.c | 220 ++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 7 ++ 4 files changed, 245 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_rss.c
drivers/common/cnxk/meson.build +1 -0
@@ -21,6 +21,7 @@ sources = files('roc_dev.c', 'roc_nix_mcast.c', 'roc_nix_npc.c', 'roc_nix_queue.c', + 'roc_nix_rss.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c',
drivers/common/cnxk/roc_nix.h +17 -0
@@ -215,6 +215,23 @@ int __roc_api roc_nix_npc_rx_ena_dis(struct roc_nix *roc_nix, bool enable); int __roc_api roc_nix_npc_mcast_config(struct roc_nix *roc_nix,bool mcast_enable,bool prom_enable); +/* RSS */ +void __roc_api roc_nix_rss_key_default_fill(struct roc_nix *roc_nix, +uint8_t key[ROC_NIX_RSS_KEY_LEN ]); +void __roc_api roc_nix_rss_key_set(struct roc_nix *roc_nix, +const uint8_t key[ROC_NIX_RSS_KEY_LEN ]); +void __roc_api roc_nix_rss_key_get(struct roc_nix *roc_nix, +uint8_t key[ROC_NIX_RSS_KEY_LEN ]); +int __roc_api roc_nix_rss_reta_set(struct roc_nix *roc_nix, uint8_t group, +uint16_t reta[ROC_NIX_RSS_RETA_MAX ]); +int __roc_api roc_nix_rss_reta_get(struct roc_nix *roc_nix, uint8_t group, +uint16_t reta[ROC_NIX_RSS_RETA_MAX ]); +int __roc_api roc_nix_rss_flowkey_set(struct roc_nix *roc_nix, uint8_t *alg_idx, +uint32_t flowkey,uint8_t group, +int mcam_index); +int __roc_api roc_nix_rss_default_setup(struct roc_nix *roc_nix, +uint32_t flowkey); +/* Queue */ int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq,bool ena);
drivers/common/cnxk/roc_nix_rss.c new file +220 -0
220 lines not on this page · raw message
drivers/common/cnxk/version.map +7 -0
@@ -62,6 +62,13 @@ INTERNAL { roc_nix_rq_fini; roc_nix_rq_init; roc_nix_rq_modify; + roc_nix_rss_default_setup; + roc_nix_rss_flowkey_set; + roc_nix_rss_key_default_fill; + roc_nix_rss_key_get; + roc_nix_rss_key_set; + roc_nix_rss_reta_get; + roc_nix_rss_reta_set; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; roc_nix_sq_fini;
Signature · 1 line
2.8.4
PATCH v4 25/52 common/cnxk: add nix ptp support
In reply to Nithin DabilpuramFrom: Sunil Kumar Kori <[email protected]>
Add support to enable/disable Rx and Tx PTP timestamping support. Also provide API's to register ptp info callbacks to get config change update from Kernel.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 16 +++++ drivers/common/cnxk/roc_nix_ptp.c | 122 ++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 6 ++ 4 files changed, 145 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_ptp.c
drivers/common/cnxk/meson.build +1 -0
@@ -20,6 +20,7 @@ sources = files('roc_dev.c', 'roc_nix_mac.c', 'roc_nix_mcast.c', 'roc_nix_npc.c', + 'roc_nix_ptp.c', 'roc_nix_queue.c', 'roc_nix_rss.c', 'roc_npa.c',
drivers/common/cnxk/roc_nix.h +16 -0
@@ -17,6 +17,11 @@ enum roc_nix_sq_max_sqe_sz { roc_nix_maxsqesz_w8 = NIX_MAXSQESZ_W8, }; +/* Range to adjust PTP frequency. Valid range is +* (-ROC_NIX_PTP_FREQ_ADJUST, ROC_NIX_PTP_FREQ_ADJUST) +*/ +#define ROC_NIX_PTP_FREQ_ADJUST (1 << 9) +/* NIX LF RX offload configuration flags. * These are input flags to roc_nix_lf_alloc:rx_cfg */
@@ -244,6 +249,17 @@ int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq); int __roc_api roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq); int __roc_api roc_nix_sq_fini(struct roc_nix_sq *sq); +/* PTP */ +int __roc_api roc_nix_ptp_rx_ena_dis(struct roc_nix *roc_nix, int enable); +int __roc_api roc_nix_ptp_tx_ena_dis(struct roc_nix *roc_nix, int enable); +int __roc_api roc_nix_ptp_clock_read(struct roc_nix *roc_nix, uint64_t *clock, +uint64_t *tsc,uint8_t is_pmu); +int __roc_api roc_nix_ptp_sync_time_adjust(struct roc_nix *roc_nix, +int64_t delta); +int __roc_api roc_nix_ptp_info_cb_register(struct roc_nix *roc_nix, +ptp_info_update_t ptp_update); +void __roc_api roc_nix_ptp_info_cb_unregister(struct roc_nix *roc_nix); +/* MCAST*/ int __roc_api roc_nix_mcast_mcam_entry_alloc(struct roc_nix *roc_nix, uint16_t nb_entries,
drivers/common/cnxk/roc_nix_ptp.c new file +122 -0
122 lines not on this page · raw message
drivers/common/cnxk/version.map +6 -0
@@ -55,6 +55,12 @@ INTERNAL { roc_nix_npc_promisc_ena_dis; roc_nix_npc_rx_ena_dis; roc_nix_npc_mcast_config; + roc_nix_ptp_clock_read; + roc_nix_ptp_info_cb_register; + roc_nix_ptp_info_cb_unregister; + roc_nix_ptp_rx_ena_dis; + roc_nix_ptp_sync_time_adjust; + roc_nix_ptp_tx_ena_dis; roc_nix_ras_intr_ena_dis; roc_nix_register_cq_irqs; roc_nix_register_queue_irqs;
Signature · 1 line
2.8.4
PATCH v4 26/52 common/cnxk: add nix stats support
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add API to provide Rx and Tx stats for a given NIX.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 53 ++++++++ drivers/common/cnxk/roc_nix_stats.c | 239 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 4 + 4 files changed, 297 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_stats.c
drivers/common/cnxk/meson.build +1 -0
@@ -23,6 +23,7 @@ sources = files('roc_dev.c', 'roc_nix_ptp.c', 'roc_nix_queue.c', 'roc_nix_rss.c', + 'roc_nix_stats.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c',
drivers/common/cnxk/roc_nix.h +53 -0
65 lines not on this page · raw message
drivers/common/cnxk/roc_nix_stats.c new file +239 -0
239 lines not on this page · raw message
drivers/common/cnxk/version.map +4 -0
@@ -79,6 +79,10 @@ INTERNAL { roc_nix_rx_queue_intr_enable; roc_nix_sq_fini; roc_nix_sq_init; + roc_nix_stats_get; + roc_nix_stats_queue_get; + roc_nix_stats_queue_reset; + roc_nix_stats_reset; roc_nix_unregister_cq_irqs; roc_nix_unregister_queue_irqs; roc_npa_aura_limit_modify;
Signature · 1 line
2.8.4
PATCH v4 27/52 common/cnxk: add support for nix extended stats
In reply to Nithin DabilpuramFrom: Satha Rao <[email protected]>
Add support for retrieving NIX extended stats that are per NIX LF and per LMAC.
--- drivers/common/cnxk/roc_nix.h | 18 ++++ drivers/common/cnxk/roc_nix_stats.c | 172 +++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_xstats.h | 204 +++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 3 + 4 files changed, 397 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_xstats.h
drivers/common/cnxk/roc_nix.h +18 -0
@@ -158,6 +158,18 @@ struct roc_nix_link_info { uint64_t port : 8; }; +/** Maximum name length for extended statistics counters */ +#define ROC_NIX_XSTATS_NAME_SIZE 64 + +struct roc_nix_xstat { +uint64_t id;/**< The index in xstats name array. */ +uint64_t value;/**< The statistic counter value. */ +}; + +struct roc_nix_xstat_name { +char name[ROC_NIX_XSTATS_NAME_SIZE ]; +}; +struct roc_nix_ipsec_cfg {uint32_t sa_size;uint32_t tag_const;
@@ -289,6 +301,12 @@ int __roc_api roc_nix_stats_queue_get(struct roc_nix *roc_nix, uint16_t qid, struct roc_nix_stats_queue *qstats); int __roc_api roc_nix_stats_queue_reset(struct roc_nix *roc_nix, uint16_t qid,bool is_rx); +int __roc_api roc_nix_num_xstats_get(struct roc_nix *roc_nix); +int __roc_api roc_nix_xstats_get(struct roc_nix *roc_nix, +struct roc_nix_xstat *xstats,unsigned int n); +int __roc_api roc_nix_xstats_names_get(struct roc_nix *roc_nix, +struct roc_nix_xstat_name *xstats_names, +unsigned int limit);/* Queue */ int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
drivers/common/cnxk/roc_nix_stats.c +172 -0
187 lines not on this page · raw message
drivers/common/cnxk/roc_nix_xstats.h new file +204 -0
204 lines not on this page · raw message
drivers/common/cnxk/version.map +3 -0
@@ -83,6 +83,9 @@ INTERNAL { roc_nix_stats_queue_get; roc_nix_stats_queue_reset; roc_nix_stats_reset; + roc_nix_num_xstats_get; + roc_nix_xstats_get; + roc_nix_xstats_names_get; roc_nix_unregister_cq_irqs; roc_nix_unregister_queue_irqs; roc_npa_aura_limit_modify;
Signature · 1 line
2.8.4
PATCH v4 28/52 common/cnxk: add nix debug dump support
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add support to dump NIX RQ, SQ and CQ contexts apart from NIX LF registers.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 10 + drivers/common/cnxk/roc_nix_debug.c | 805 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_irq.c | 11 + drivers/common/cnxk/version.map | 8 + 5 files changed, 835 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_debug.c
drivers/common/cnxk/meson.build +1 -0
@@ -16,6 +16,7 @@ sources = files('roc_dev.c', 'roc_mbox.c', 'roc_model.c', 'roc_nix.c', + 'roc_nix_debug.c', 'roc_nix_irq.c', 'roc_nix_mac.c', 'roc_nix_mcast.c',
drivers/common/cnxk/roc_nix.h +10 -0
@@ -227,6 +227,16 @@ int __roc_api roc_nix_lf_free(struct roc_nix *roc_nix); int __roc_api roc_nix_lf_inl_ipsec_cfg(struct roc_nix *roc_nix,struct roc_nix_ipsec_cfg *cfg,bool enb); +/* Debug */ +int __roc_api roc_nix_lf_get_reg_count(struct roc_nix *roc_nix); +int __roc_api roc_nix_lf_reg_dump(struct roc_nix *roc_nix, uint64_t *data); +int __roc_api roc_nix_queues_ctx_dump(struct roc_nix *roc_nix); +void __roc_api roc_nix_cqe_dump(const struct nix_cqe_hdr_s *cq); +void __roc_api roc_nix_rq_dump(struct roc_nix_rq *rq); +void __roc_api roc_nix_cq_dump(struct roc_nix_cq *cq); +void __roc_api roc_nix_sq_dump(struct roc_nix_sq *sq); +void __roc_api roc_nix_dump(struct roc_nix *roc_nix); +/* IRQ */ void __roc_api roc_nix_rx_queue_intr_enable(struct roc_nix *roc_nix,uint16_t rxq_id);
drivers/common/cnxk/roc_nix_debug.c new file +805 -0
805 lines not on this page · raw message
drivers/common/cnxk/roc_nix_irq.c +11 -0
@@ -74,6 +74,9 @@ nix_lf_err_irq(void *param)/* Clear interrupt */ plt_write64 (intr, nix->base +NIX_LF_ERR_INT ); +/* Dump registers to std out */ +roc_nix_lf_reg_dump (nix_priv_to_roc_nix (nix),NULL ); +roc_nix_queues_ctx_dump (nix_priv_to_roc_nix (nix)); } static int
@@ -119,6 +122,10 @@ nix_lf_ras_irq(void *param)plt_err ("Ras_intr=0x%" PRIx64" pf=%d, vf=%d" , intr, dev->pf, dev->vf);/* Clear interrupt */ plt_write64 (intr, nix->base +NIX_LF_RAS ); + +/* Dump registers to std out */ +roc_nix_lf_reg_dump (nix_priv_to_roc_nix (nix),NULL ); +roc_nix_queues_ctx_dump (nix_priv_to_roc_nix (nix)); } static int
@@ -279,6 +286,10 @@ nix_lf_q_irq(void *param)/* Clear interrupt */ plt_write64 (intr, nix->base +NIX_LF_QINTX_INT (qintx)); + +/* Dump registers to std out */ +roc_nix_lf_reg_dump (nix_priv_to_roc_nix (nix),NULL ); +roc_nix_queues_ctx_dump (nix_priv_to_roc_nix (nix)); }int
drivers/common/cnxk/version.map +8 -0
@@ -13,10 +13,13 @@ INTERNAL { roc_idev_npa_nix_get; roc_idev_num_lmtlines_get; roc_model; + roc_nix_cq_dump; roc_nix_cq_fini; roc_nix_cq_init; + roc_nix_cqe_dump; roc_nix_dev_fini; roc_nix_dev_init; + roc_nix_dump; roc_nix_err_intr_ena_dis; roc_nix_get_base_chan; roc_nix_get_pf;
@@ -30,6 +33,8 @@ INTERNAL { roc_nix_lf_alloc; roc_nix_lf_inl_ipsec_cfg; roc_nix_lf_free; + roc_nix_lf_get_reg_count; + roc_nix_lf_reg_dump; roc_nix_mac_addr_add; roc_nix_mac_addr_del; roc_nix_mac_addr_set;
@@ -61,9 +66,11 @@ INTERNAL { roc_nix_ptp_rx_ena_dis; roc_nix_ptp_sync_time_adjust; roc_nix_ptp_tx_ena_dis; + roc_nix_queues_ctx_dump; roc_nix_ras_intr_ena_dis; roc_nix_register_cq_irqs; roc_nix_register_queue_irqs; + roc_nix_rq_dump; roc_nix_rq_ena_dis; roc_nix_rq_fini; roc_nix_rq_init;
@@ -77,6 +84,7 @@ INTERNAL { roc_nix_rss_reta_set; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; + roc_nix_sq_dump; roc_nix_sq_fini; roc_nix_sq_init; roc_nix_stats_get;
Signature · 1 line
2.8.4
PATCH v4 29/52 common/cnxk: add VLAN filter support
In reply to Nithin DabilpuramFrom: Sunil Kumar Kori <[email protected]>
Add helper API to support VLAN filtering and stripping on Rx and VLAN insertion on Tx.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 45 ++++++++ drivers/common/cnxk/roc_nix_vlan.c | 205 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 8 ++ 4 files changed, 259 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_vlan.c
drivers/common/cnxk/meson.build +1 -0
@@ -25,6 +25,7 @@ sources = files('roc_dev.c', 'roc_nix_queue.c', 'roc_nix_rss.c', 'roc_nix_stats.c', + 'roc_nix_vlan.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c',
drivers/common/cnxk/roc_nix.h +45 -0
57 lines not on this page · raw message
drivers/common/cnxk/roc_nix_vlan.c new file +205 -0
205 lines not on this page · raw message
drivers/common/cnxk/version.map +8 -0
@@ -96,6 +96,14 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_unregister_cq_irqs; roc_nix_unregister_queue_irqs; + roc_nix_vlan_insert_ena_dis; + roc_nix_vlan_mcam_entry_alloc_and_write; + roc_nix_vlan_mcam_entry_ena_dis; + roc_nix_vlan_mcam_entry_free; + roc_nix_vlan_mcam_entry_read; + roc_nix_vlan_mcam_entry_write; + roc_nix_vlan_strip_vtag_ena_dis; + roc_nix_vlan_tpid_set; roc_npa_aura_limit_modify; roc_npa_aura_op_range_set; roc_npa_ctx_dump;
Signature · 1 line
2.8.4
PATCH v4 30/52 common/cnxk: add nix flow control support
In reply to Nithin DabilpuramFrom: Sunil Kumar Kori <[email protected]>
Add support to enable/disable Rx/Tx flow control and pause frame configuration on NIX.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 34 ++++++ drivers/common/cnxk/roc_nix_fc.c | 251 +++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 4 + 4 files changed, 290 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_fc.c
drivers/common/cnxk/meson.build +1 -0
@@ -17,6 +17,7 @@ sources = files('roc_dev.c', 'roc_model.c', 'roc_nix.c', 'roc_nix_debug.c', + 'roc_nix_fc.c', 'roc_nix_irq.c', 'roc_nix_mac.c', 'roc_nix_mcast.c',
drivers/common/cnxk/roc_nix.h +34 -0
@@ -17,6 +17,13 @@ enum roc_nix_sq_max_sqe_sz { roc_nix_maxsqesz_w8 = NIX_MAXSQESZ_W8, }; +enum roc_nix_fc_mode { +ROC_NIX_FC_NONE =0 , +ROC_NIX_FC_RX , +ROC_NIX_FC_TX , +ROC_NIX_FC_FULL +}; +enum roc_nix_vlan_type {ROC_NIX_VLAN_TYPE_INNER =0x01 ,ROC_NIX_VLAN_TYPE_OUTER =0x02 ,
@@ -37,6 +44,21 @@ struct roc_nix_vlan_config { }; }; +struct roc_nix_fc_cfg { +bool cq_cfg_valid; +union { +struct { +bool enable; + } rxchan_cfg; + +struct { +uint32_t rq; +uint16_t cq_drop; +bool enable; + } cq_cfg; + }; +}; +/* Range to adjust PTP frequency. Valid range is * (-ROC_NIX_PTP_FREQ_ADJUST, ROC_NIX_PTP_FREQ_ADJUST) */
@@ -293,6 +315,18 @@ int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, link_status_t link_update); void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix); +/* Flow control */ +int __roc_api roc_nix_fc_config_set(struct roc_nix *roc_nix, +struct roc_nix_fc_cfg *fc_cfg); + +int __roc_api roc_nix_fc_config_get(struct roc_nix *roc_nix, +struct roc_nix_fc_cfg *fc_cfg); + +int __roc_api roc_nix_fc_mode_set(struct roc_nix *roc_nix, +enum roc_nix_fc_mode mode); + +enum roc_nix_fc_mode __roc_api roc_nix_fc_mode_get(struct roc_nix *roc_nix); +/* NPC */ int __roc_api roc_nix_npc_promisc_ena_dis(struct roc_nix *roc_nix, int enable);
drivers/common/cnxk/roc_nix_fc.c new file +251 -0
251 lines not on this page · raw message
drivers/common/cnxk/version.map +4 -0
@@ -21,6 +21,10 @@ INTERNAL { roc_nix_dev_init; roc_nix_dump; roc_nix_err_intr_ena_dis; + roc_nix_fc_config_get; + roc_nix_fc_config_set; + roc_nix_fc_mode_set; + roc_nix_fc_mode_get; roc_nix_get_base_chan; roc_nix_get_pf; roc_nix_get_pf_func;
Signature · 1 line
2.8.4
PATCH v4 31/52 common/cnxk: add nix LSO support and misc utils
In reply to Nithin DabilpuramFrom: Sunil Kumar Kori <[email protected]>
Add support to create LSO formats for TCP segmentation offload for IPv4/IPv6, tunnel and non-tunnel protocols. Tunnel protocol support is for GRE and UDP based tunnel protocols.
This patch also adds other helper API to retrieve eeprom info and configure Rx for different switch headers.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_nix.h | 28 +++ drivers/common/cnxk/roc_nix_debug.c | 16 ++ drivers/common/cnxk/roc_nix_ops.c | 438 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_priv.h | 2 + drivers/common/cnxk/version.map | 5 + 6 files changed, 490 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_ops.c
drivers/common/cnxk/meson.build +1 -0
@@ -22,6 +22,7 @@ sources = files('roc_dev.c', 'roc_nix_mac.c', 'roc_nix_mcast.c', 'roc_nix_npc.c', + 'roc_nix_ops.c', 'roc_nix_ptp.c', 'roc_nix_queue.c', 'roc_nix_rss.c',
drivers/common/cnxk/roc_nix.h +28 -0
@@ -59,6 +59,12 @@ struct roc_nix_fc_cfg { }; }; +struct roc_nix_eeprom_info { +#define ROC_NIX_EEPROM_SIZE 256 +uint16_t sff_id; +uint8_t buf[ROC_NIX_EEPROM_SIZE ]; +}; +/* Range to adjust PTP frequency. Valid range is * (-ROC_NIX_PTP_FREQ_ADJUST, ROC_NIX_PTP_FREQ_ADJUST) */
@@ -246,6 +252,14 @@ struct roc_nix { uint8_t reserved[ROC_NIX_MEM_SZ] __plt_cache_aligned; } __plt_cache_aligned; +enum roc_nix_lso_tun_type { +ROC_NIX_LSO_TUN_V4V4 , +ROC_NIX_LSO_TUN_V4V6 , +ROC_NIX_LSO_TUN_V6V4 , +ROC_NIX_LSO_TUN_V6V6 , +ROC_NIX_LSO_TUN_MAX , +}; +/* Dev */ int __roc_api roc_nix_dev_init(struct roc_nix *roc_nix); int __roc_api roc_nix_dev_fini(struct roc_nix *roc_nix);
@@ -315,6 +329,20 @@ int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, link_status_t link_update); void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix); +/* Ops */ +int __roc_api roc_nix_switch_hdr_set(struct roc_nix *roc_nix, +uint64_t switch_header_type); +int __roc_api roc_nix_lso_fmt_setup(struct roc_nix *roc_nix); +int __roc_api roc_nix_lso_fmt_get(struct roc_nix *roc_nix, +uint8_t udp_tun[ROC_NIX_LSO_TUN_MAX ], +uint8_t tun[ROC_NIX_LSO_TUN_MAX ]); +int __roc_api roc_nix_lso_custom_fmt_setup(struct roc_nix *roc_nix, +struct nix_lso_format *fields, +uint16_t nb_fields); + +int __roc_api roc_nix_eeprom_info_get(struct roc_nix *roc_nix, +struct roc_nix_eeprom_info *info); +/* Flow control */ int __roc_api roc_nix_fc_config_set(struct roc_nix *roc_nix,struct roc_nix_fc_cfg *fc_cfg);
drivers/common/cnxk/roc_nix_debug.c +16 -0
@@ -786,6 +786,22 @@ roc_nix_dump(struct roc_nix *roc_nix)nix_dump (" \tnb_tx_queues = %d" , nix->nb_tx_queues);nix_dump (" \tlso_tsov6_idx = %d" , nix->lso_tsov6_idx);nix_dump (" \tlso_tsov4_idx = %d" , nix->lso_tsov4_idx); +nix_dump (" \tlso_udp_tun_v4v4 = %d" , + nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4 ]); +nix_dump (" \tlso_udp_tun_v4v6 = %d" , + nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6 ]); +nix_dump (" \tlso_udp_tun_v6v4 = %d" , + nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4 ]); +nix_dump (" \tlso_udp_tun_v6v6 = %d" , + nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6 ]); +nix_dump (" \tlso_tun_v4v4 = %d" , + nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4 ]); +nix_dump (" \tlso_tun_v4v6 = %d" , + nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6 ]); +nix_dump (" \tlso_tun_v6v4 = %d" , + nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4 ]); +nix_dump (" \tlso_tun_v6v6 = %d" , + nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6 ]);nix_dump (" \tlf_rx_stats = %d" , nix->lf_rx_stats);nix_dump (" \tlf_tx_stats = %d" , nix->lf_tx_stats);nix_dump (" \trx_chan_cnt = %d" , nix->rx_chan_cnt);
drivers/common/cnxk/roc_nix_ops.c new file +438 -0
438 lines not on this page · raw message
drivers/common/cnxk/roc_nix_priv.h +2 -0
@@ -45,6 +45,8 @@ struct nix {uint16_t nb_tx_queues;uint8_t lso_tsov6_idx;uint8_t lso_tsov4_idx; +uint8_t lso_udp_tun_idx[ROC_NIX_LSO_TUN_MAX ]; +uint8_t lso_tun_idx[ROC_NIX_LSO_TUN_MAX ];uint8_t lf_rx_stats;uint8_t lf_tx_stats;uint8_t rx_chan_cnt;
drivers/common/cnxk/version.map +5 -0
@@ -39,6 +39,9 @@ INTERNAL { roc_nix_lf_free; roc_nix_lf_get_reg_count; roc_nix_lf_reg_dump; + roc_nix_lso_custom_fmt_setup; + roc_nix_lso_fmt_get; + roc_nix_lso_fmt_setup; roc_nix_mac_addr_add; roc_nix_mac_addr_del; roc_nix_mac_addr_set;
@@ -98,6 +101,8 @@ INTERNAL { roc_nix_num_xstats_get; roc_nix_xstats_get; roc_nix_xstats_names_get; + roc_nix_switch_hdr_set; + roc_nix_eeprom_info_get; roc_nix_unregister_cq_irqs; roc_nix_unregister_queue_irqs; roc_nix_vlan_insert_ena_dis;
Signature · 1 line
2.8.4
PATCH v4 32/52 common/cnxk: add nix traffic management base support
In reply to Nithin DabilpuramAdd nix traffic management base support to init/fini node, shaper profile and topology, setup SQ for a given user hierarchy or default internal hierarchy.
--- drivers/common/cnxk/meson.build | 3 + drivers/common/cnxk/roc_nix.c | 7 + drivers/common/cnxk/roc_nix.h | 26 +++ drivers/common/cnxk/roc_nix_priv.h | 219 ++++++++++++++++++ drivers/common/cnxk/roc_nix_queue.c | 9 + drivers/common/cnxk/roc_nix_tm.c | 397 +++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_tm_ops.c | 67 ++++++ drivers/common/cnxk/roc_nix_tm_utils.c | 62 +++++ drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 2 + drivers/common/cnxk/version.map | 3 + 11 files changed, 796 insertions(+) create mode 100644 drivers/common/cnxk/roc_nix_tm.c create mode 100644 drivers/common/cnxk/roc_nix_tm_ops.c create mode 100644 drivers/common/cnxk/roc_nix_tm_utils.c
drivers/common/cnxk/meson.build +3 -0
@@ -27,6 +27,9 @@ sources = files('roc_dev.c', 'roc_nix_queue.c', 'roc_nix_rss.c', 'roc_nix_stats.c', + 'roc_nix_tm.c', + 'roc_nix_tm_ops.c', + 'roc_nix_tm_utils.c', 'roc_nix_vlan.c', 'roc_npa.c', 'roc_npa_debug.c',
drivers/common/cnxk/roc_nix.c +7 -0
@@ -396,11 +396,17 @@ roc_nix_dev_init(struct roc_nix *roc_nix)if (rc) goto lf_detach; + rc =nix_tm_conf_init (roc_nix); +if (rc) + goto unregister_irqs; +/* Get NIX HW info */ roc_nix_get_hw_info (roc_nix); nix->dev.drv_inited = true;return 0 ; +unregister_irqs: +nix_unregister_irqs (nix); lf_detach:nix_lf_detach (nix); dev_fini:
@@ -421,6 +427,7 @@ roc_nix_dev_fini(struct roc_nix *roc_nix)if (!nix->dev.drv_inited) goto fini; +nix_tm_conf_fini (roc_nix);nix_unregister_irqs (nix); rc =nix_lf_detach (nix);
drivers/common/cnxk/roc_nix.h +26 -0
@@ -305,6 +305,32 @@ void __roc_api roc_nix_unregister_queue_irqs(struct roc_nix *roc_nix); int __roc_api roc_nix_register_cq_irqs(struct roc_nix *roc_nix); void __roc_api roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix); +/* Traffic Management */ +#define ROC_NIX_TM_MAX_SCHED_WT ((uint8_t)~0) + +enum roc_nix_tm_tree { +ROC_NIX_TM_DEFAULT =0 , +ROC_NIX_TM_RLIMIT , +ROC_NIX_TM_USER , +ROC_NIX_TM_TREE_MAX , +}; + +enum roc_tm_node_level { +ROC_TM_LVL_ROOT =0 , +ROC_TM_LVL_SCH1 , +ROC_TM_LVL_SCH2 , +ROC_TM_LVL_SCH3 , +ROC_TM_LVL_SCH4 , +ROC_TM_LVL_QUEUE , +ROC_TM_LVL_MAX , +}; + +/* +* TM runtime hierarchy init API. +*/ +int __roc_api roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable); +int __roc_api roc_nix_tm_sq_flush_spin(struct roc_nix_sq *sq); +/* MAC */ int __roc_api roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start); int __roc_api roc_nix_mac_link_event_start_stop(struct roc_nix *roc_nix,
drivers/common/cnxk/roc_nix_priv.h +219 -0
241 lines not on this page · raw message
drivers/common/cnxk/roc_nix_queue.c +9 -0
@@ -788,6 +788,12 @@ roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq)if (rc) goto nomem; + rc =nix_tm_leaf_data_get (nix, sq->qid, &rr_quantum, &smq); +if (rc) { + rc =NIX_ERR_TM_LEAF_NODE_GET ; + goto nomem; + } +/* Init SQ context */ if (roc_model_is_cn9k ())sq_cn9k_init (nix, sq, rr_quantum, smq);
@@ -831,6 +837,8 @@ roc_nix_sq_fini(struct roc_nix_sq *sq) qid = sq->qid; + rc =nix_tm_sq_flush_pre (sq); +/* Release SQ context */ if (roc_model_is_cn9k ()) rc |=sq_cn9k_fini (roc_nix_to_nix_priv (sq->roc_nix), sq);
@@ -845,6 +853,7 @@ roc_nix_sq_fini(struct roc_nix_sq *sq)if (mbox_process (mbox)) rc |=NIX_ERR_NDC_SYNC ; + rc |=nix_tm_sq_flush_post (sq); rc |=roc_npa_pool_destroy (sq->aura_handle);plt_free (sq->fc);plt_free (sq->sqe_mem);
drivers/common/cnxk/roc_nix_tm.c new file +397 -0
397 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_ops.c new file +67 -0
67 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_utils.c new file +62 -0
62 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +1 -0
@@ -57,3 +57,4 @@ RTE_LOG_REGISTER(cnxk_logtype_base, pmd.cnxk.base, NOTICE);RTE_LOG_REGISTER (cnxk_logtype_mbox, pmd.cnxk.mbox,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_npa, pmd.mempool.cnxk,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_nix, pmd.net.cnxk,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_tm, pmd.net.cnxk.tm,NOTICE );
drivers/common/cnxk/roc_platform.h +2 -0
@@ -136,6 +136,7 @@ extern int cnxk_logtype_base;extern int cnxk_logtype_mbox;extern int cnxk_logtype_npa;extern int cnxk_logtype_nix; +extern int cnxk_logtype_tm; #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args)
@@ -155,6 +156,7 @@ extern int cnxk_logtype_nix;#define plt_mbox_dbg (fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__)#define plt_npa_dbg (fmt, ...) plt_dbg(npa, fmt, ##__VA_ARGS__)#define plt_nix_dbg (fmt, ...) plt_dbg(nix, fmt, ##__VA_ARGS__) +#define plt_tm_dbg (fmt, ...) plt_dbg(tm, fmt, ##__VA_ARGS__)#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \
drivers/common/cnxk/version.map +3 -0
@@ -5,6 +5,7 @@ INTERNAL { cnxk_logtype_mbox; cnxk_logtype_nix; cnxk_logtype_npa; + cnxk_logtype_tm; roc_clk_freq_get; roc_error_msg_get; roc_idev_lmt_base_addr_get;
@@ -103,6 +104,8 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; + roc_nix_tm_sq_aura_fc; + roc_nix_tm_sq_flush_spin; roc_nix_unregister_cq_irqs; roc_nix_unregister_queue_irqs; roc_nix_vlan_insert_ena_dis;
Signature · 1 line
2.8.4
PATCH v4 33/52 common/cnxk: add nix tm support to add/delete node
In reply to Nithin DabilpuramAdd support to add/delete nodes in a hierarchy. This patch also adds misc utils to get node name, walk through nodes etc.
--- drivers/common/cnxk/roc_nix.h | 42 +++++++ drivers/common/cnxk/roc_nix_priv.h | 14 +++ drivers/common/cnxk/roc_nix_tm.c | 205 +++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_tm_ops.c | 88 ++++++++++++++ drivers/common/cnxk/roc_nix_tm_utils.c | 212 +++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 7 ++ 6 files changed, 568 insertions(+)
drivers/common/cnxk/roc_nix.h +42 -0
@@ -307,6 +307,8 @@ void __roc_api roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix);/* Traffic Management */ #define ROC_NIX_TM_MAX_SCHED_WT ((uint8_t)~0) +#define ROC_NIX_TM_SHAPER_PROFILE_NONE UINT32_MAX +#define ROC_NIX_TM_NODE_ID_INVALID UINT32_MAXenum roc_nix_tm_tree {ROC_NIX_TM_DEFAULT =0 ,
@@ -331,6 +333,46 @@ enum roc_tm_node_level { int __roc_api roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable); int __roc_api roc_nix_tm_sq_flush_spin(struct roc_nix_sq *sq); +/* +* TM User hierarchy API. +*/ + +struct roc_nix_tm_node { +#define ROC_NIX_TM_NODE_SZ (128) +uint8_t reserved[ROC_NIX_TM_NODE_SZ ]; + +uint32_t id; +uint32_t parent_id; +uint32_t priority; +uint32_t weight; +uint32_t shaper_profile_id; +uint16_t lvl; +bool pkt_mode; +bool pkt_mode_set; +/* Function to free this memory */ +void (*free_fn)(void *node); +}; + +int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix, +struct roc_nix_tm_node *roc_node); +int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id, +bool free); +int __roc_api roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix, +uint32_t node_id,bool pkt_mode); + +struct roc_nix_tm_node *__roc_api roc_nix_tm_node_get(struct roc_nix *roc_nix, +uint32_t node_id); +struct roc_nix_tm_node *__roc_api +roc_nix_tm_node_next (struct roc_nix *roc_nix,struct roc_nix_tm_node *__prev); + +/* +* TM utilities API. +*/ +int __roc_api roc_nix_tm_node_lvl(struct roc_nix *roc_nix, uint32_t node_id); +int __roc_api roc_nix_tm_node_name_get(struct roc_nix *roc_nix, +uint32_t node_id,char *buf, +size_t buflen); +/* MAC */ int __roc_api roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start); int __roc_api roc_nix_mac_link_event_start_stop(struct roc_nix *roc_nix,
drivers/common/cnxk/roc_nix_priv.h +14 -0
@@ -326,14 +326,28 @@ int nix_tm_leaf_data_get(struct nix *nix, uint16_t sq, uint32_t *rr_quantum,int nix_tm_sq_flush_pre (struct roc_nix_sq *sq);int nix_tm_sq_flush_post (struct roc_nix_sq *sq);int nix_tm_smq_xoff (struct nix *nix,struct nix_tm_node *node,bool enable); +int nix_tm_node_add (struct roc_nix *roc_nix,struct nix_tm_node *node); +int nix_tm_node_delete (struct roc_nix *roc_nix,uint32_t node_id, +enum roc_nix_tm_tree tree,bool free); +int nix_tm_free_node_resource (struct nix *nix,struct nix_tm_node *node);int nix_tm_clear_path_xoff (struct nix *nix,struct nix_tm_node *node);/* * TM priv utils. */ +uint16_t nix_tm_lvl2nix (struct nix *nix,uint32_t lvl); +uint16_t nix_tm_lvl2nix_tl1_root (uint32_t lvl); +uint16_t nix_tm_lvl2nix_tl2_root (uint32_t lvl); +uint16_t nix_tm_resource_avail (struct nix *nix,uint8_t hw_lvl,bool contig); +int nix_tm_validate_prio (struct nix *nix,uint32_t lvl,uint32_t parent_id, +uint32_t priority,enum roc_nix_tm_tree tree);struct nix_tm_node *nix_tm_node_search (struct nix *nix,uint32_t node_id,enum roc_nix_tm_tree tree); +struct nix_tm_shaper_profile *nix_tm_shaper_profile_search (struct nix *nix, +uint32_t id);uint8_t nix_tm_sw_xoff_prep (struct nix_tm_node *node,bool enable,volatile uint64_t *reg,volatile uint64_t *regval); +struct nix_tm_node *nix_tm_node_alloc (void ); +void nix_tm_node_free (struct nix_tm_node *node);#endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_tm.c +205 -0
223 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_ops.c +88 -0
91 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_utils.c +212 -0
227 lines not on this page · raw message
drivers/common/cnxk/version.map +7 -0
@@ -104,6 +104,13 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; + roc_nix_tm_node_add; + roc_nix_tm_node_delete; + roc_nix_tm_node_get; + roc_nix_tm_node_lvl; + roc_nix_tm_node_name_get; + roc_nix_tm_node_next; + roc_nix_tm_node_pkt_mode_update; roc_nix_tm_sq_aura_fc; roc_nix_tm_sq_flush_spin; roc_nix_unregister_cq_irqs;
Signature · 1 line
2.8.4
PATCH v4 34/52 common/cnxk: add nix tm shaper profile add support
In reply to Nithin DabilpuramFrom: Satha Rao <[email protected]>
Add support to add/delete/update shaper profile for a given NIX. Also add support to walk through existing shaper profiles.
--- drivers/common/cnxk/roc_nix.h | 25 +++++ drivers/common/cnxk/roc_nix_priv.h | 8 ++ drivers/common/cnxk/roc_nix_tm.c | 18 ++++ drivers/common/cnxk/roc_nix_tm_ops.c | 145 ++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_tm_utils.c | 167 +++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 5 + 6 files changed, 368 insertions(+)
drivers/common/cnxk/roc_nix.h +25 -0
@@ -353,17 +353,42 @@ struct roc_nix_tm_node {void (*free_fn)(void *node); }; +struct roc_nix_tm_shaper_profile { +#define ROC_NIX_TM_SHAPER_PROFILE_SZ (128) +uint8_t reserved[ROC_NIX_TM_SHAPER_PROFILE_SZ ]; + +uint32_t id; +uint64_t commit_rate; +uint64_t commit_sz; +uint64_t peak_rate; +uint64_t peak_sz; +int32_t pkt_len_adj; +bool pkt_mode; +/* Function to free this memory */ +void (*free_fn)(void *profile); +}; + int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix,struct roc_nix_tm_node *roc_node); int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id,bool free); int __roc_api roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix,uint32_t node_id,bool pkt_mode); +int __roc_api roc_nix_tm_shaper_profile_add( +struct roc_nix *roc_nix,struct roc_nix_tm_shaper_profile *profile); +int __roc_api roc_nix_tm_shaper_profile_update( +struct roc_nix *roc_nix,struct roc_nix_tm_shaper_profile *profile); +int __roc_api roc_nix_tm_shaper_profile_delete(struct roc_nix *roc_nix, +uint32_t id); struct roc_nix_tm_node *__roc_api roc_nix_tm_node_get(struct roc_nix *roc_nix,uint32_t node_id); struct roc_nix_tm_node *__roc_apiroc_nix_tm_node_next (struct roc_nix *roc_nix,struct roc_nix_tm_node *__prev); +struct roc_nix_tm_shaper_profile *__roc_api +roc_nix_tm_shaper_profile_get (struct roc_nix *roc_nix,uint32_t profile_id); +struct roc_nix_tm_shaper_profile *__roc_api roc_nix_tm_shaper_profile_next( +struct roc_nix *roc_nix,struct roc_nix_tm_shaper_profile *__prev);/* * TM utilities API.
drivers/common/cnxk/roc_nix_priv.h +8 -0
@@ -331,6 +331,7 @@ int nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id, enum roc_nix_tm_tree tree, bool free);int nix_tm_free_node_resource (struct nix *nix,struct nix_tm_node *node);int nix_tm_clear_path_xoff (struct nix *nix,struct nix_tm_node *node); +void nix_tm_clear_shaper_profiles (struct nix *nix);/* * TM priv utils.
@@ -347,7 +348,14 @@ struct nix_tm_shaper_profile *nix_tm_shaper_profile_search(struct nix *nix, uint32_t id);uint8_t nix_tm_sw_xoff_prep (struct nix_tm_node *node,bool enable,volatile uint64_t *reg,volatile uint64_t *regval); +uint64_t nix_tm_shaper_profile_rate_min (struct nix *nix); +uint64_t nix_tm_shaper_rate_conv (uint64_t value,uint64_t *exponent_p, +uint64_t *mantissa_p,uint64_t *div_exp_p); +uint64_t nix_tm_shaper_burst_conv (uint64_t value,uint64_t *exponent_p, +uint64_t *mantissa_p);struct nix_tm_node *nix_tm_node_alloc (void );void nix_tm_node_free (struct nix_tm_node *node); +struct nix_tm_shaper_profile *nix_tm_shaper_profile_alloc (void ); +void nix_tm_shaper_profile_free (struct nix_tm_shaper_profile *profile);#endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_tm.c +18 -0
@@ -5,6 +5,22 @@#include "roc_api.h" #include "roc_priv.h" +void +nix_tm_clear_shaper_profiles (struct nix *nix) +{ +struct nix_tm_shaper_profile *shaper_profile; + + shaper_profile =TAILQ_FIRST (&nix->shaper_profile_list); +while (shaper_profile !=NULL ) { +if (shaper_profile->ref_cnt) +plt_warn ("Shaper profile %u has non zero references" , + shaper_profile->id); +TAILQ_REMOVE (&nix->shaper_profile_list, shaper_profile, shaper); +nix_tm_shaper_profile_free (shaper_profile); + shaper_profile =TAILQ_FIRST (&nix->shaper_profile_list); + } +} +int nix_tm_node_add (struct roc_nix *roc_nix,struct nix_tm_node *node) {
@@ -532,6 +548,8 @@ nix_tm_conf_init(struct roc_nix *roc_nix)int rc, i;PLT_STATIC_ASSERT (sizeof (struct nix_tm_node ) <=ROC_NIX_TM_NODE_SZ ); +PLT_STATIC_ASSERT (sizeof (struct nix_tm_shaper_profile ) <= +ROC_NIX_TM_SHAPER_PROFILE_SZ ); nix->tm_flags =0 ;for (i =0 ; i <ROC_NIX_TM_TREE_MAX ; i++)
drivers/common/cnxk/roc_nix_tm_ops.c +145 -0
151 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_utils.c +167 -0
188 lines not on this page · raw message
drivers/common/cnxk/version.map +5 -0
@@ -111,6 +111,11 @@ INTERNAL { roc_nix_tm_node_name_get; roc_nix_tm_node_next; roc_nix_tm_node_pkt_mode_update; + roc_nix_tm_shaper_profile_add; + roc_nix_tm_shaper_profile_delete; + roc_nix_tm_shaper_profile_get; + roc_nix_tm_shaper_profile_next; + roc_nix_tm_shaper_profile_update; roc_nix_tm_sq_aura_fc; roc_nix_tm_sq_flush_spin; roc_nix_unregister_cq_irqs;
Signature · 1 line
2.8.4
PATCH v4 35/52 common/cnxk: add nix tm helper to alloc and free resource
In reply to Nithin DabilpuramAdd TM helper API to estimate, alloc, assign, and free resources for a NIX LF / ethdev.
--- drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_priv.h | 16 ++ drivers/common/cnxk/roc_nix_tm.c | 461 +++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_tm_ops.c | 11 + drivers/common/cnxk/roc_nix_tm_utils.c | 133 ++++++++++ drivers/common/cnxk/version.map | 1 + 6 files changed, 623 insertions(+)
drivers/common/cnxk/roc_nix.h +1 -0
@@ -372,6 +372,7 @@ int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix, struct roc_nix_tm_node *roc_node); int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id,bool free); +int __roc_api roc_nix_tm_free_resources(struct roc_nix *roc_nix, bool hw_only); int __roc_api roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix,uint32_t node_id,bool pkt_mode); int __roc_api roc_nix_tm_shaper_profile_add(
drivers/common/cnxk/roc_nix_priv.h +16 -0
@@ -330,8 +330,17 @@ int nix_tm_node_add(struct roc_nix *roc_nix, struct nix_tm_node *node);int nix_tm_node_delete (struct roc_nix *roc_nix,uint32_t node_id,enum roc_nix_tm_tree tree,bool free);int nix_tm_free_node_resource (struct nix *nix,struct nix_tm_node *node); +int nix_tm_free_resources (struct roc_nix *roc_nix,uint32_t tree_mask, +bool hw_only);int nix_tm_clear_path_xoff (struct nix *nix,struct nix_tm_node *node);void nix_tm_clear_shaper_profiles (struct nix *nix); +int nix_tm_alloc_txschq (struct nix *nix,enum roc_nix_tm_tree tree); +int nix_tm_assign_resources (struct nix *nix,enum roc_nix_tm_tree tree); +int nix_tm_release_resources (struct nix *nix,uint8_t hw_lvl,bool contig, +bool above_thresh); +void nix_tm_copy_rsp_to_nix (struct nix *nix,struct nix_txsch_alloc_rsp *rsp); + +int nix_tm_update_parent_info (struct nix *nix,enum roc_nix_tm_tree tree);/* * TM priv utils.
@@ -348,11 +357,18 @@ struct nix_tm_shaper_profile *nix_tm_shaper_profile_search(struct nix *nix, uint32_t id);uint8_t nix_tm_sw_xoff_prep (struct nix_tm_node *node,bool enable,volatile uint64_t *reg,volatile uint64_t *regval); +uint32_t nix_tm_check_rr (struct nix *nix,uint32_t parent_id, +enum roc_nix_tm_tree tree,uint32_t *rr_prio, +uint32_t *max_prio);uint64_t nix_tm_shaper_profile_rate_min (struct nix *nix);uint64_t nix_tm_shaper_rate_conv (uint64_t value,uint64_t *exponent_p,uint64_t *mantissa_p,uint64_t *div_exp_p);uint64_t nix_tm_shaper_burst_conv (uint64_t value,uint64_t *exponent_p,uint64_t *mantissa_p); +bool nix_tm_child_res_valid (struct nix_tm_node_list *list, +struct nix_tm_node *parent); +uint16_t nix_tm_resource_estimate (struct nix *nix,uint16_t *schq_contig, +uint16_t *schq,enum roc_nix_tm_tree tree);struct nix_tm_node *nix_tm_node_alloc (void );void nix_tm_node_free (struct nix_tm_node *node);struct nix_tm_shaper_profile *nix_tm_shaper_profile_alloc (void );
drivers/common/cnxk/roc_nix_tm.c +461 -0
485 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_ops.c +11 -0
@@ -66,6 +66,17 @@ roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable)return 0 ; } +int +roc_nix_tm_free_resources (struct roc_nix *roc_nix,bool hw_only) +{ +struct nix *nix =roc_nix_to_nix_priv (roc_nix); + +if (nix->tm_flags &NIX_TM_HIERARCHY_ENA ) +return -EBUSY ; + +return nix_tm_free_resources (roc_nix,BIT (ROC_NIX_TM_USER ), hw_only); +} +static int nix_tm_shaper_profile_add (struct roc_nix *roc_nix,struct nix_tm_shaper_profile *profile,int skip_ins)
drivers/common/cnxk/roc_nix_tm_utils.c +133 -0
151 lines not on this page · raw message
drivers/common/cnxk/version.map +1 -0
@@ -104,6 +104,7 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; + roc_nix_tm_free_resources; roc_nix_tm_node_add; roc_nix_tm_node_delete; roc_nix_tm_node_get;
Signature · 1 line
2.8.4
PATCH v4 36/52 common/cnxk: add nix tm hierarchy enable/disable
In reply to Nithin DabilpuramAdd support to enable or disable hierarchy along with allocating node HW resources such as shapers and schedulers and configuring them to match the user created or default hierarchy.
--- drivers/common/cnxk/roc_nix.h | 8 + drivers/common/cnxk/roc_nix_priv.h | 16 ++ drivers/common/cnxk/roc_nix_tm.c | 147 ++++++++++++ drivers/common/cnxk/roc_nix_tm_ops.c | 234 +++++++++++++++++++ drivers/common/cnxk/roc_nix_tm_utils.c | 410 +++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 2 + 6 files changed, 817 insertions(+)
drivers/common/cnxk/roc_nix.h +8 -0
@@ -392,6 +392,14 @@ struct roc_nix_tm_shaper_profile *__roc_api roc_nix_tm_shaper_profile_next( struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *__prev);/* +* TM hierarchy enable/disable API. +*/ +int __roc_api roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix); +int __roc_api roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix, +enum roc_nix_tm_tree tree, +bool xmit_enable); + +/* * TM utilities API. */ int __roc_api roc_nix_tm_node_lvl(struct roc_nix *roc_nix, uint32_t node_id);
drivers/common/cnxk/roc_nix_priv.h +16 -0
@@ -340,7 +340,10 @@ int nix_tm_release_resources(struct nix *nix, uint8_t hw_lvl, bool contig, bool above_thresh);void nix_tm_copy_rsp_to_nix (struct nix *nix,struct nix_txsch_alloc_rsp *rsp); +int nix_tm_txsch_reg_config (struct nix *nix,enum roc_nix_tm_tree tree);int nix_tm_update_parent_info (struct nix *nix,enum roc_nix_tm_tree tree); +int nix_tm_sq_sched_conf (struct nix *nix,struct nix_tm_node *node, +bool rr_quantum_only);/* * TM priv utils.
@@ -369,6 +372,19 @@ bool nix_tm_child_res_valid(struct nix_tm_node_list *list, struct nix_tm_node *parent);uint16_t nix_tm_resource_estimate (struct nix *nix,uint16_t *schq_contig,uint16_t *schq,enum roc_nix_tm_tree tree); +uint8_t nix_tm_tl1_default_prep (uint32_t schq,volatile uint64_t *reg, +volatile uint64_t *regval); +uint8_t nix_tm_topology_reg_prep (struct nix *nix,struct nix_tm_node *node, +volatile uint64_t *reg, +volatile uint64_t *regval, +volatile uint64_t *regval_mask); +uint8_t nix_tm_sched_reg_prep (struct nix *nix,struct nix_tm_node *node, +volatile uint64_t *reg, +volatile uint64_t *regval); +uint8_t nix_tm_shaper_reg_prep (struct nix_tm_node *node, +struct nix_tm_shaper_profile *profile, +volatile uint64_t *reg, +volatile uint64_t *regval);struct nix_tm_node *nix_tm_node_alloc (void );void nix_tm_node_free (struct nix_tm_node *node);struct nix_tm_shaper_profile *nix_tm_shaper_profile_alloc (void );
drivers/common/cnxk/roc_nix_tm.c +147 -0
159 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_ops.c +234 -0
237 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_utils.c +410 -0
434 lines not on this page · raw message
drivers/common/cnxk/version.map +2 -0
@@ -105,6 +105,8 @@ INTERNAL { roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; roc_nix_tm_free_resources; + roc_nix_tm_hierarchy_disable; + roc_nix_tm_hierarchy_enable; roc_nix_tm_node_add; roc_nix_tm_node_delete; roc_nix_tm_node_get;
Signature · 1 line
2.8.4
PATCH v4 37/52 common/cnxk: add nix tm support for internal hierarchy
In reply to Nithin DabilpuramAdd support to create internal TM default hierarchy and ratelimit hierarchy and API to ratelimit SQ to a given rate. This will be used by cnxk ethdev driver's tx queue ratelimit op.
--- drivers/common/cnxk/roc_nix.h | 7 ++ drivers/common/cnxk/roc_nix_priv.h | 2 + drivers/common/cnxk/roc_nix_tm.c | 156 +++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_tm_ops.c | 141 +++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 3 + 5 files changed, 309 insertions(+)
drivers/common/cnxk/roc_nix.h +7 -0
@@ -330,6 +330,8 @@ enum roc_tm_node_level {/* * TM runtime hierarchy init API. */ +int __roc_api roc_nix_tm_init(struct roc_nix *roc_nix); +void __roc_api roc_nix_tm_fini(struct roc_nix *roc_nix); int __roc_api roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable); int __roc_api roc_nix_tm_sq_flush_spin(struct roc_nix_sq *sq);
@@ -392,6 +394,11 @@ struct roc_nix_tm_shaper_profile *__roc_api roc_nix_tm_shaper_profile_next( struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *__prev);/* +* TM ratelimit tree API. +*/ +int __roc_api roc_nix_tm_rlimit_sq(struct roc_nix *roc_nix, uint16_t qid, +uint64_t rate); +/* * TM hierarchy enable/disable API. */ int __roc_api roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix);
drivers/common/cnxk/roc_nix_priv.h +2 -0
@@ -326,6 +326,7 @@ int nix_tm_leaf_data_get(struct nix *nix, uint16_t sq, uint32_t *rr_quantum,int nix_tm_sq_flush_pre (struct roc_nix_sq *sq);int nix_tm_sq_flush_post (struct roc_nix_sq *sq);int nix_tm_smq_xoff (struct nix *nix,struct nix_tm_node *node,bool enable); +int nix_tm_prepare_default_tree (struct roc_nix *roc_nix);int nix_tm_node_add (struct roc_nix *roc_nix,struct nix_tm_node *node);int nix_tm_node_delete (struct roc_nix *roc_nix,uint32_t node_id,enum roc_nix_tm_tree tree,bool free);
@@ -344,6 +345,7 @@ int nix_tm_txsch_reg_config(struct nix *nix, enum roc_nix_tm_tree tree);int nix_tm_update_parent_info (struct nix *nix,enum roc_nix_tm_tree tree);int nix_tm_sq_sched_conf (struct nix *nix,struct nix_tm_node *node,bool rr_quantum_only); +int nix_tm_prepare_rate_limited_tree (struct roc_nix *roc_nix);/* * TM priv utils.
drivers/common/cnxk/roc_nix_tm.c +156 -0
162 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_ops.c +141 -0
144 lines not on this page · raw message
drivers/common/cnxk/version.map +3 -0
@@ -104,9 +104,11 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; + roc_nix_tm_fini; roc_nix_tm_free_resources; roc_nix_tm_hierarchy_disable; roc_nix_tm_hierarchy_enable; + roc_nix_tm_init; roc_nix_tm_node_add; roc_nix_tm_node_delete; roc_nix_tm_node_get;
@@ -114,6 +116,7 @@ INTERNAL { roc_nix_tm_node_name_get; roc_nix_tm_node_next; roc_nix_tm_node_pkt_mode_update; + roc_nix_tm_rlimit_sq; roc_nix_tm_shaper_profile_add; roc_nix_tm_shaper_profile_delete; roc_nix_tm_shaper_profile_get;
Signature · 1 line
2.8.4
PATCH v4 38/52 common/cnxk: add nix tm dynamic update support
In reply to Nithin DabilpuramAdd support for dynamic node update of shaper profile, RR quantum and also support to suspend or resume an active TM node.
--- drivers/common/cnxk/roc_nix.h | 10 ++ drivers/common/cnxk/roc_nix_tm_ops.c | 220 +++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 3 + 3 files changed, 233 insertions(+)
drivers/common/cnxk/roc_nix.h +10 -0
@@ -375,6 +375,16 @@ int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix, int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id,bool free); int __roc_api roc_nix_tm_free_resources(struct roc_nix *roc_nix, bool hw_only); +int __roc_api roc_nix_tm_node_suspend_resume(struct roc_nix *roc_nix, +uint32_t node_id,bool suspend); +int __roc_api roc_nix_tm_node_parent_update(struct roc_nix *roc_nix, +uint32_t node_id, +uint32_t new_parent_id, +uint32_t priority,uint32_t weight); +int __roc_api roc_nix_tm_node_shaper_update(struct roc_nix *roc_nix, +uint32_t node_id, +uint32_t profile_id, +bool force_update); int __roc_api roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix,uint32_t node_id,bool pkt_mode); int __roc_api roc_nix_tm_shaper_profile_add(
drivers/common/cnxk/roc_nix_tm_ops.c +220 -0
226 lines not on this page · raw message
drivers/common/cnxk/version.map +3 -0
@@ -115,7 +115,10 @@ INTERNAL { roc_nix_tm_node_lvl; roc_nix_tm_node_name_get; roc_nix_tm_node_next; + roc_nix_tm_node_parent_update; roc_nix_tm_node_pkt_mode_update; + roc_nix_tm_node_shaper_update; + roc_nix_tm_node_suspend_resume; roc_nix_tm_rlimit_sq; roc_nix_tm_shaper_profile_add; roc_nix_tm_shaper_profile_delete;
Signature · 1 line
2.8.4
PATCH v4 39/52 common/cnxk: add nix tm debug support and misc utils
In reply to Nithin DabilpuramAdd support to dump TM HW registers and hierarchy on error. This patch also adds support for misc utils such as API to query TM HW resource availability, resource pre-allocation and static priority support on root node.
--- drivers/common/cnxk/roc_nix.h | 9 + drivers/common/cnxk/roc_nix_debug.c | 330 +++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_tm.c | 1 + drivers/common/cnxk/roc_nix_tm_ops.c | 125 +++++++++++++ drivers/common/cnxk/roc_nix_tm_utils.c | 18 ++ drivers/common/cnxk/roc_utils.c | 108 +++++++++++ drivers/common/cnxk/version.map | 6 + 7 files changed, 597 insertions(+)
drivers/common/cnxk/roc_nix.h +9 -0
@@ -291,6 +291,7 @@ void __roc_api roc_nix_cqe_dump(const struct nix_cqe_hdr_s *cq); void __roc_api roc_nix_rq_dump(struct roc_nix_rq *rq); void __roc_api roc_nix_cq_dump(struct roc_nix_cq *cq); void __roc_api roc_nix_sq_dump(struct roc_nix_sq *sq); +void __roc_api roc_nix_tm_dump(struct roc_nix *roc_nix); void __roc_api roc_nix_dump(struct roc_nix *roc_nix);/* IRQ */
@@ -394,6 +395,10 @@ int __roc_api roc_nix_tm_shaper_profile_update( int __roc_api roc_nix_tm_shaper_profile_delete(struct roc_nix *roc_nix,uint32_t id); +int __roc_api roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl, +uint16_t discontig,uint16_t contig); +uint16_t __roc_api roc_nix_tm_leaf_cnt(struct roc_nix *roc_nix); + struct roc_nix_tm_node *__roc_api roc_nix_tm_node_get(struct roc_nix *roc_nix,uint32_t node_id);struct roc_nix_tm_node *__roc_api
@@ -420,6 +425,10 @@ int __roc_api roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix,* TM utilities API. */ int __roc_api roc_nix_tm_node_lvl(struct roc_nix *roc_nix, uint32_t node_id); +bool __roc_api roc_nix_tm_root_has_sp(struct roc_nix *roc_nix); +void __roc_api roc_nix_tm_rsrc_max(bool pf, uint16_t schq[ROC_TM_LVL_MAX]); +int __roc_api roc_nix_tm_rsrc_count(struct roc_nix *roc_nix, +uint16_t schq[ROC_TM_LVL_MAX ]); int __roc_api roc_nix_tm_node_name_get(struct roc_nix *roc_nix,uint32_t node_id,char *buf,size_t buflen);
drivers/common/cnxk/roc_nix_debug.c +330 -0
342 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm.c +1 -0
@@ -393,6 +393,7 @@ roc_nix_tm_sq_flush_spin(struct roc_nix_sq *sq)return 0 ; exit: +roc_nix_tm_dump (sq->roc_nix);roc_nix_queues_ctx_dump (sq->roc_nix);return -EFAULT ; }
drivers/common/cnxk/roc_nix_tm_ops.c +125 -0
134 lines not on this page · raw message
drivers/common/cnxk/roc_nix_tm_utils.c +18 -0
@@ -868,6 +868,24 @@ nix_tm_resource_estimate(struct nix *nix, uint16_t *schq_contig, uint16_t *schq,return cnt; } +uint16_t +roc_nix_tm_leaf_cnt (struct roc_nix *roc_nix) +{ +struct nix *nix =roc_nix_to_nix_priv (roc_nix); +struct nix_tm_node_list *list; +struct nix_tm_node *node; +uint16_t leaf_cnt =0 ; + +/* Count leafs only in user list */ + list =nix_tm_node_list (nix,ROC_NIX_TM_USER ); + TAILQ_FOREACH(node, list, node) { +if (node->id < nix->nb_tx_queues) + leaf_cnt++; + } + +return leaf_cnt; +} +int roc_nix_tm_node_lvl (struct roc_nix *roc_nix,uint32_t node_id) {
drivers/common/cnxk/roc_utils.c +108 -0
123 lines not on this page · raw message
drivers/common/cnxk/version.map +6 -0
@@ -104,11 +104,13 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; + roc_nix_tm_dump; roc_nix_tm_fini; roc_nix_tm_free_resources; roc_nix_tm_hierarchy_disable; roc_nix_tm_hierarchy_enable; roc_nix_tm_init; + roc_nix_tm_leaf_cnt; roc_nix_tm_node_add; roc_nix_tm_node_delete; roc_nix_tm_node_get;
@@ -119,7 +121,11 @@ INTERNAL { roc_nix_tm_node_pkt_mode_update; roc_nix_tm_node_shaper_update; roc_nix_tm_node_suspend_resume; + roc_nix_tm_prealloc_res; roc_nix_tm_rlimit_sq; + roc_nix_tm_root_has_sp; + roc_nix_tm_rsrc_count; + roc_nix_tm_rsrc_max; roc_nix_tm_shaper_profile_add; roc_nix_tm_shaper_profile_delete; roc_nix_tm_shaper_profile_get;
Signature · 1 line
2.8.4
PATCH v4 40/52 common/cnxk: add npc support
In reply to Nithin DabilpuramFrom: Kiran Kumar K <[email protected]>
Adding initial support for programming NPC. NPC is Network Parser and CAM unit that provides Rx and Tx packet parsing and packet manipulation functionality on Marvell CN9K and CN10K SoC's. It is mapped to RTE Flow in DPDK.
--- drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_npc.h | 129 +++++++++++++ drivers/common/cnxk/roc_npc_priv.h | 381 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 2 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_utils.c | 25 +++ drivers/common/cnxk/version.map | 1 + 8 files changed, 545 insertions(+) create mode 100644 drivers/common/cnxk/roc_npc.h create mode 100644 drivers/common/cnxk/roc_npc_priv.h
drivers/common/cnxk/roc_api.h +3 -0
@@ -82,6 +82,9 @@/* NPA */ #include "roc_npa.h" +/* NPC */ +#include "roc_npc.h" +/* NIX */ #include "roc_nix.h"
drivers/common/cnxk/roc_npc.h new file +129 -0
129 lines not on this page · raw message
drivers/common/cnxk/roc_npc_priv.h new file +381 -0
381 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +1 -0
@@ -57,4 +57,5 @@ RTE_LOG_REGISTER(cnxk_logtype_base, pmd.cnxk.base, NOTICE);RTE_LOG_REGISTER (cnxk_logtype_mbox, pmd.cnxk.mbox,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_npa, pmd.mempool.cnxk,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_nix, pmd.net.cnxk,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_npc, pmd.net.cnxk.flow,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_tm, pmd.net.cnxk.tm,NOTICE );
drivers/common/cnxk/roc_platform.h +2 -0
@@ -136,6 +136,7 @@ extern int cnxk_logtype_base;extern int cnxk_logtype_mbox;extern int cnxk_logtype_npa;extern int cnxk_logtype_nix; +extern int cnxk_logtype_npc;extern int cnxk_logtype_tm; #define plt_err(fmt, args...) \
@@ -156,6 +157,7 @@ extern int cnxk_logtype_tm;#define plt_mbox_dbg (fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__)#define plt_npa_dbg (fmt, ...) plt_dbg(npa, fmt, ##__VA_ARGS__)#define plt_nix_dbg (fmt, ...) plt_dbg(nix, fmt, ##__VA_ARGS__) +#define plt_npc_dbg (fmt, ...) plt_dbg(npc, fmt, ##__VA_ARGS__)#define plt_tm_dbg (fmt, ...) plt_dbg(tm, fmt, ##__VA_ARGS__)#ifdef __cplusplus
drivers/common/cnxk/roc_priv.h +3 -0
@@ -23,4 +23,7 @@/* NIX */ #include "roc_nix_priv.h" +/* NPC */ +#include "roc_npc_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/roc_utils.c +25 -0
@@ -14,16 +14,20 @@ roc_error_msg_get(int errorcode)case NIX_AF_ERR_PARAM :case NIX_ERR_PARAM :case NPA_ERR_PARAM : +case NPC_ERR_PARAM :case UTIL_ERR_PARAM : err_msg ="Invalid parameter" ;break ;case NIX_ERR_NO_MEM : +case NPC_ERR_NO_MEM : err_msg ="Out of memory" ;break ;case NIX_ERR_INVALID_RANGE : +case NPC_ERR_INVALID_RANGE : err_msg ="Range is not supported" ;break ;case NIX_ERR_INTERNAL : +case NPC_ERR_INTERNAL : err_msg ="Internal error" ;break ;case NIX_ERR_OP_NOTSUP :
@@ -104,6 +108,27 @@ roc_error_msg_get(int errorcode)case NIX_ERR_NDC_SYNC : err_msg ="NDC Sync failed" ;break ; +case NPC_ERR_INVALID_SPEC : + err_msg ="NPC invalid spec" ; +break ; +case NPC_ERR_INVALID_MASK : + err_msg ="NPC invalid mask" ; +break ; +case NPC_ERR_INVALID_KEX : + err_msg ="NPC invalid key" ; +break ; +case NPC_ERR_INVALID_SIZE : + err_msg ="NPC invalid key size" ; +break ; +case NPC_ERR_ACTION_NOTSUP : + err_msg ="NPC action not supported" ; +break ; +case NPC_ERR_PATTERN_NOTSUP : + err_msg ="NPC pattern not supported" ; +break ; +case NPC_ERR_MCAM_ALLOC : + err_msg ="MCAM entry alloc failed" ; +break ;case NPA_ERR_ALLOC : err_msg ="NPA alloc failed" ;break ;
drivers/common/cnxk/version.map +1 -0
@@ -5,6 +5,7 @@ INTERNAL { cnxk_logtype_mbox; cnxk_logtype_nix; cnxk_logtype_npa; + cnxk_logtype_npc; cnxk_logtype_tm; roc_clk_freq_get; roc_error_msg_get;
Signature · 1 line
2.8.4
PATCH v4 41/52 common/cnxk: add npc helper API
In reply to Nithin DabilpuramFrom: Kiran Kumar K <[email protected]>
Adding NPC helper APIs to manage MCAM like pre allocating the mcam, configuring the rules, shifting mcam rules and preparing the data for mcam based on KEX.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_npc_priv.h | 11 + drivers/common/cnxk/roc_npc_utils.c | 631 ++++++++++++++++++++++++++++++++++++ 3 files changed, 643 insertions(+) create mode 100644 drivers/common/cnxk/roc_npc_utils.c
drivers/common/cnxk/meson.build +1 -0
@@ -34,6 +34,7 @@ sources = files('roc_dev.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c', + 'roc_npc_utils.c', 'roc_platform.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_npc_priv.h +11 -0
@@ -378,4 +378,15 @@ roc_npc_to_npc_priv(struct roc_npc *npc) {return (struct npc *)npc->reserved; } + +int npc_update_parse_state (struct npc_parse_state *pst, +struct npc_parse_item_info *info,int lid,int lt, +uint8_t flags); +void npc_get_hw_supp_mask (struct npc_parse_state *pst, +struct npc_parse_item_info *info,int lid,int lt); +int npc_parse_item_basic (const struct roc_npc_item_info *item, +struct npc_parse_item_info *info); +int npc_check_preallocated_entry_cache (struct mbox *mbox, +struct roc_npc_flow *flow, +struct npc *npc);#endif /* _ROC_NPC_PRIV_H_ */
drivers/common/cnxk/roc_npc_utils.c new file +631 -0
631 lines not on this page · raw message
Signature · 1 line
2.8.4
PATCH v4 42/52 common/cnxk: add mcam utility API
In reply to Nithin DabilpuramFrom: Kiran Kumar K <[email protected]>
Adding mcam utility functions like reading KEX and reserving and writing mcam rules.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_npc_mcam.c | 708 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npc_priv.h | 21 ++ 3 files changed, 730 insertions(+) create mode 100644 drivers/common/cnxk/roc_npc_mcam.c
drivers/common/cnxk/meson.build +1 -0
@@ -34,6 +34,7 @@ sources = files('roc_dev.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c', + 'roc_npc_mcam.c', 'roc_npc_utils.c', 'roc_platform.c', 'roc_utils.c')
drivers/common/cnxk/roc_npc_mcam.c new file +708 -0
708 lines not on this page · raw message
drivers/common/cnxk/roc_npc_priv.h +21 -0
@@ -379,6 +379,22 @@ roc_npc_to_npc_priv(struct roc_npc *npc)return (struct npc *)npc->reserved; } +int npc_mcam_free_counter (struct npc *npc,uint16_t ctr_id); +int npc_mcam_read_counter (struct npc *npc,uint32_t ctr_id,uint64_t *count); +int npc_mcam_clear_counter (struct npc *npc,uint32_t ctr_id); +int npc_mcam_free_entry (struct npc *npc,uint32_t entry); +int npc_mcam_free_all_entries (struct npc *npc); +int npc_mcam_alloc_and_write (struct npc *npc,struct roc_npc_flow *flow, +struct npc_parse_state *pst); +int npc_mcam_alloc_entry (struct npc *npc,struct roc_npc_flow *mcam, +struct roc_npc_flow *ref_mcam,int prio, +int *resp_count); +int npc_mcam_alloc_entries (struct npc *npc,int ref_mcam,int *alloc_entry, +int req_count,int prio,int *resp_count); + +int npc_mcam_ena_dis_entry (struct npc *npc,struct roc_npc_flow *mcam, +bool enable); +int npc_mcam_write_entry (struct npc *npc,struct roc_npc_flow *mcam);int npc_update_parse_state (struct npc_parse_state *pst,struct npc_parse_item_info *info,int lid,int lt,uint8_t flags);
@@ -386,7 +402,12 @@ void npc_get_hw_supp_mask(struct npc_parse_state *pst, struct npc_parse_item_info *info, int lid, int lt);int npc_parse_item_basic (const struct roc_npc_item_info *item,struct npc_parse_item_info *info); +int npc_mcam_fetch_kex_cfg (struct npc *npc);int npc_check_preallocated_entry_cache (struct mbox *mbox,struct roc_npc_flow *flow,struct npc *npc); +int npc_flow_free_all_resources (struct npc *npc); +int npc_program_mcam (struct npc *npc,struct npc_parse_state *pst, +bool mcam_alloc); +uint64_t npc_get_kex_capability (struct npc *npc);#endif /* _ROC_NPC_PRIV_H_ */
Signature · 1 line
2.8.4
PATCH v4 43/52 common/cnxk: add npc parsing API
In reply to Nithin DabilpuramFrom: Kiran Kumar K <[email protected]>
Adding npc parsing API support to parse different patterns and actions. Based on the pattern and actions ltype values will be chosen and mcam data will be configured at perticular offsets.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_npc_parse.c | 703 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npc_priv.h | 13 + 3 files changed, 717 insertions(+) create mode 100644 drivers/common/cnxk/roc_npc_parse.c
drivers/common/cnxk/meson.build +1 -0
@@ -35,6 +35,7 @@ sources = files('roc_dev.c', 'roc_npa_debug.c', 'roc_npa_irq.c', 'roc_npc_mcam.c', + 'roc_npc_parse.c', 'roc_npc_utils.c', 'roc_platform.c', 'roc_utils.c')
drivers/common/cnxk/roc_npc_parse.c new file +703 -0
703 lines not on this page · raw message
drivers/common/cnxk/roc_npc_priv.h +13 -0
@@ -402,11 +402,24 @@ void npc_get_hw_supp_mask(struct npc_parse_state *pst, struct npc_parse_item_info *info, int lid, int lt);int npc_parse_item_basic (const struct roc_npc_item_info *item,struct npc_parse_item_info *info); +int npc_parse_meta_items (struct npc_parse_state *pst); +int npc_parse_higig2_hdr (struct npc_parse_state *pst); +int npc_parse_cpt_hdr (struct npc_parse_state *pst); +int npc_parse_la (struct npc_parse_state *pst); +int npc_parse_lb (struct npc_parse_state *pst); +int npc_parse_lc (struct npc_parse_state *pst); +int npc_parse_ld (struct npc_parse_state *pst); +int npc_parse_le (struct npc_parse_state *pst); +int npc_parse_lf (struct npc_parse_state *pst); +int npc_parse_lg (struct npc_parse_state *pst); +int npc_parse_lh (struct npc_parse_state *pst);int npc_mcam_fetch_kex_cfg (struct npc *npc);int npc_check_preallocated_entry_cache (struct mbox *mbox,struct roc_npc_flow *flow,struct npc *npc);int npc_flow_free_all_resources (struct npc *npc); +const struct roc_npc_item_info * +npc_parse_skip_void_and_any_items (const struct roc_npc_item_info *pattern);int npc_program_mcam (struct npc *npc,struct npc_parse_state *pst,bool mcam_alloc);uint64_t npc_get_kex_capability (struct npc *npc);
Signature · 1 line
2.8.4
PATCH v4 44/52 common/cnxk: add npc init and fini support
In reply to Nithin DabilpuramFrom: Kiran Kumar K <[email protected]>
Adding support initialize and fini the npc. Further, adding APIs to create and destroy the npc rules.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_npc.c | 713 ++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npc.h | 40 +++ drivers/common/cnxk/version.map | 16 + 4 files changed, 770 insertions(+) create mode 100644 drivers/common/cnxk/roc_npc.c
drivers/common/cnxk/meson.build +1 -0
@@ -34,6 +34,7 @@ sources = files('roc_dev.c', 'roc_npa.c', 'roc_npa_debug.c', 'roc_npa_irq.c', + 'roc_npc.c', 'roc_npc_mcam.c', 'roc_npc_parse.c', 'roc_npc_utils.c',
drivers/common/cnxk/roc_npc.c new file +713 -0
713 lines not on this page · raw message
drivers/common/cnxk/roc_npc.h +40 -0
@@ -126,4 +126,44 @@ struct roc_npc {uint8_t reserved[ROC_NPC_MEM_SZ ]; } __plt_cache_aligned; +int __roc_api roc_npc_init(struct roc_npc *roc_npc); +int __roc_api roc_npc_fini(struct roc_npc *roc_npc); +const char *__roc_api roc_npc_profile_name_get(struct roc_npc *roc_npc); + +struct roc_npc_flow *__roc_api +roc_npc_flow_create (struct roc_npc *roc_npc,const struct roc_npc_attr *attr, +const struct roc_npc_item_info pattern[], +const struct roc_npc_action actions[],int *errcode); +int __roc_api roc_npc_flow_destroy(struct roc_npc *roc_npc, +struct roc_npc_flow *flow); +int __roc_api roc_npc_mcam_free_entry(struct roc_npc *roc_npc, uint32_t entry); +int __roc_api roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc, +struct roc_npc_flow *mcam, +struct roc_npc_flow *ref_mcam,int prio, +int *resp_count); +int __roc_api roc_npc_mcam_alloc_entries(struct roc_npc *roc_npc, int ref_entry, +int *alloc_entry,int req_count, +int priority,int *resp_count); +int __roc_api roc_npc_mcam_ena_dis_entry(struct roc_npc *roc_npc, +struct roc_npc_flow *mcam, +bool enable); +int __roc_api roc_npc_mcam_write_entry(struct roc_npc *roc_npc, +struct roc_npc_flow *mcam); +int __roc_api roc_npc_flow_parse(struct roc_npc *roc_npc, +const struct roc_npc_attr *attr, +const struct roc_npc_item_info pattern[], +const struct roc_npc_action actions[], +struct roc_npc_flow *flow); +int __roc_api roc_npc_get_low_priority_mcam(struct roc_npc *roc_npc); + +int __roc_api roc_npc_mcam_free_counter(struct roc_npc *roc_npc, +uint16_t ctr_id); + +int __roc_api roc_npc_mcam_read_counter(struct roc_npc *roc_npc, +uint32_t ctr_id,uint64_t *count); +int __roc_api roc_npc_mcam_clear_counter(struct roc_npc *roc_npc, +uint32_t ctr_id); + +int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc); +#endif /* _ROC_NPC_H_ */
drivers/common/cnxk/version.map +16 -0
@@ -154,6 +154,22 @@ INTERNAL { roc_npa_pool_destroy; roc_npa_pool_op_pc_reset; roc_npa_pool_range_update_check; + roc_npc_fini; + roc_npc_flow_create; + roc_npc_flow_destroy; + roc_npc_flow_parse; + roc_npc_get_low_priority_mcam; + roc_npc_init; + roc_npc_mcam_alloc_entries; + roc_npc_mcam_alloc_entry; + roc_npc_mcam_clear_counter; + roc_npc_mcam_ena_dis_entry; + roc_npc_mcam_free_all_resources; + roc_npc_mcam_free_counter; + roc_npc_mcam_free_entry; + roc_npc_mcam_write_entry; + roc_npc_mcam_read_counter; + roc_npc_profile_name_get; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4
PATCH v4 45/52 common/cnxk: add base sso device support
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add SSO device init and fini which attach SSO LF resources to the RVU PF/VF and SSO HWS and HWGRP LFs alloc, free.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_idev.c | 27 ++++ drivers/common/cnxk/roc_idev_priv.h | 5 + drivers/common/cnxk/roc_nix.c | 1 + drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 2 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_sso.c | 273 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_sso.h | 34 +++++ drivers/common/cnxk/roc_sso_priv.h | 33 +++++ drivers/common/cnxk/roc_utils.c | 1 + drivers/common/cnxk/version.map | 5 + 13 files changed, 389 insertions(+) create mode 100644 drivers/common/cnxk/roc_sso.c create mode 100644 drivers/common/cnxk/roc_sso.h create mode 100644 drivers/common/cnxk/roc_sso_priv.h
drivers/common/cnxk/meson.build +1 -0
@@ -39,5 +39,6 @@ sources = files('roc_dev.c', 'roc_npc_parse.c', 'roc_npc_utils.c', 'roc_platform.c', + 'roc_sso.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_api.h +3 -0
@@ -88,6 +88,9 @@/* NIX */ #include "roc_nix.h" +/* SSO */ +#include "roc_sso.h" +/* Utils */ #include "roc_utils.h"
drivers/common/cnxk/roc_idev.c +27 -0
@@ -29,6 +29,7 @@ idev_get_cfg(void)void idev_set_defaults (struct idev_cfg *idev) { + idev->sso_pf_func =0 ; idev->npa =NULL ; idev->npa_pf_func =0 ; idev->max_pools =128 ;
@@ -39,6 +40,32 @@ idev_set_defaults(struct idev_cfg *idev) }uint16_t +idev_sso_pffunc_get (void ) +{ +struct idev_cfg *idev; +uint16_t sso_pf_func; + + idev =idev_get_cfg (); + sso_pf_func =0 ; +if (idev !=NULL ) + sso_pf_func =__atomic_load_n (&idev->sso_pf_func, + __ATOMIC_ACQUIRE); + +return sso_pf_func; +} + +void +idev_sso_pffunc_set (uint16_t sso_pf_func) +{ +struct idev_cfg *idev; + + idev =idev_get_cfg (); +if (idev !=NULL ) +__atomic_store_n (&idev->sso_pf_func, sso_pf_func, + __ATOMIC_RELEASE); +} + +uint16_t idev_npa_pffunc_get (void ) {struct idev_cfg *idev;
drivers/common/cnxk/roc_idev_priv.h +5 -0
@@ -8,6 +8,7 @@/* Intra device related functions */ struct npa_lf ;struct idev_cfg { +uint16_t sso_pf_func;uint16_t npa_pf_func;struct npa_lf *npa;uint16_t npa_refcnt;
@@ -28,6 +29,10 @@ uint32_t idev_npa_maxpools_get(void);void idev_npa_maxpools_set (uint32_t max_pools);uint16_t idev_npa_lf_active (struct dev *dev); +/* idev sso */ +void idev_sso_pffunc_set (uint16_t sso_pf_func); +uint16_t idev_sso_pffunc_get (void ); +/* idev lmt */ uint16_t idev_lmt_pffunc_get (void );
drivers/common/cnxk/roc_nix.c +1 -0
@@ -143,6 +143,7 @@ roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq, uint32_t nb_txq, req->rss_sz = nix->reta_sz; req->rss_grps =ROC_NIX_RSS_GRPS ; req->npa_func =idev_npa_pffunc_get (); + req->sso_func =idev_sso_pffunc_get (); req->rx_cfg = rx_cfg;if (!roc_nix->rss_tag_as_xor)
drivers/common/cnxk/roc_platform.c +1 -0
@@ -58,4 +58,5 @@ RTE_LOG_REGISTER(cnxk_logtype_mbox, pmd.cnxk.mbox, NOTICE);RTE_LOG_REGISTER (cnxk_logtype_npa, pmd.mempool.cnxk,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_nix, pmd.net.cnxk,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_npc, pmd.net.cnxk.flow,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_sso, pmd.event.cnxk,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_tm, pmd.net.cnxk.tm,NOTICE );
drivers/common/cnxk/roc_platform.h +2 -0
@@ -137,6 +137,7 @@ extern int cnxk_logtype_mbox;extern int cnxk_logtype_npa;extern int cnxk_logtype_nix;extern int cnxk_logtype_npc; +extern int cnxk_logtype_sso;extern int cnxk_logtype_tm; #define plt_err(fmt, args...) \
@@ -158,6 +159,7 @@ extern int cnxk_logtype_tm;#define plt_npa_dbg (fmt, ...) plt_dbg(npa, fmt, ##__VA_ARGS__)#define plt_nix_dbg (fmt, ...) plt_dbg(nix, fmt, ##__VA_ARGS__)#define plt_npc_dbg (fmt, ...) plt_dbg(npc, fmt, ##__VA_ARGS__) +#define plt_sso_dbg (fmt, ...) plt_dbg(sso, fmt, ##__VA_ARGS__)#define plt_tm_dbg (fmt, ...) plt_dbg(tm, fmt, ##__VA_ARGS__)#ifdef __cplusplus
drivers/common/cnxk/roc_priv.h +3 -0
@@ -26,4 +26,7 @@/* NPC */ #include "roc_npc_priv.h" +/* SSO */ +#include "roc_sso_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/roc_sso.c new file +273 -0
273 lines not on this page · raw message
drivers/common/cnxk/roc_sso.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_SSO_H_ +#define _ROC_SSO_H_ + +struct roc_sso { +struct plt_pci_device *pci_dev; +/* Public data. */ +uint16_t max_hwgrp; +uint16_t max_hws; +uint16_t nb_hwgrp; +uint8_t nb_hws; +uintptr_t lmt_base; +/* HW Const. */ +uint32_t xae_waes; +uint32_t xaq_buf_size; +uint32_t iue; +/* Private data. */ +#define ROC_SSO_MEM_SZ (16 * 1024) + uint8_t reserved[ROC_SSO_MEM_SZ] __plt_cache_aligned; +} __plt_cache_aligned; + +/* SSO device initialization */ +int __roc_api roc_sso_dev_init(struct roc_sso *roc_sso); +int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso); + +/* SSO device configuration */ +int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, +uint16_t nb_hwgrp); +void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso); + +#endif /* _ROC_SSOW_H_ */
drivers/common/cnxk/roc_sso_priv.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_SSO_PRIV_H_ +#define _ROC_SSO_PRIV_H_ + +struct sso_rsrc { +uint16_t rsrc_id; +uint64_t base; +}; + +struct sso { +struct plt_pci_device *pci_dev; +struct dev dev; +} __plt_cache_aligned; + +enum sso_err_status { +SSO_ERR_PARAM =-4096 , +}; + +enum sso_lf_type { +SSO_LF_TYPE_HWS , +SSO_LF_TYPE_HWGRP , +}; + +static inline struct sso * +roc_sso_to_sso_priv (struct roc_sso *roc_sso) +{ +return (struct sso *)&roc_sso->reserved[0 ]; +} + +#endif /* _ROC_SSO_PRIV_H_ */
drivers/common/cnxk/roc_utils.c +1 -0
@@ -15,6 +15,7 @@ roc_error_msg_get(int errorcode)case NIX_ERR_PARAM :case NPA_ERR_PARAM :case NPC_ERR_PARAM : +case SSO_ERR_PARAM :case UTIL_ERR_PARAM : err_msg ="Invalid parameter" ;break ;
drivers/common/cnxk/version.map +5 -0
@@ -6,6 +6,7 @@ INTERNAL { cnxk_logtype_nix; cnxk_logtype_npa; cnxk_logtype_npc; + cnxk_logtype_sso; cnxk_logtype_tm; roc_clk_freq_get; roc_error_msg_get;
@@ -172,6 +173,10 @@ INTERNAL { roc_npc_profile_name_get; roc_plt_init; roc_plt_init_cb_register; + roc_sso_dev_fini; + roc_sso_dev_init; + roc_sso_rsrc_fini; + roc_sso_rsrc_init; local: *; };
Signature · 1 line
2.8.4
PATCH v4 46/52 common/cnxk: add sso hws interface
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add SSO HWS interface for setting/unsetting links, retrieving base address and nanoseconds to getwork timeout.
--- drivers/common/cnxk/roc_sso.c | 128 ++++++++++++++++++++++++++++++++++++- drivers/common/cnxk/roc_sso.h | 6 ++ drivers/common/cnxk/roc_sso_priv.h | 3 + drivers/common/cnxk/version.map | 4 ++ 4 files changed, 140 insertions(+), 1 deletion(-)
drivers/common/cnxk/roc_sso.c +127 -1
@@ -152,6 +152,104 @@ sso_rsrc_get(struct roc_sso *roc_sso)return 0 ; } +static void +sso_hws_link_modify (uint8_t hws,uintptr_t base,struct plt_bitmap *bmp, +uint16_t hwgrp[],uint16_t n,uint16_t enable) +{ +uint64_t reg; +int i, j, k; + + i =0 ; +while (n) { +uint64_t mask[4 ] = { +0x8000 , +0x8000 , +0x8000 , +0x8000 , + }; + + k = n %4 ; + k = k ? k :4 ; +for (j =0 ; j < k; j++) { + mask[j] = hwgrp[i + j] | enable <<14 ; + enable ?plt_bitmap_set (bmp, hwgrp[i + j]) : +plt_bitmap_clear (bmp, hwgrp[i + j]); +plt_sso_dbg ("HWS %d Linked to HWGRP %d" , hws, + hwgrp[i + j]); + } + + n -= j; + i += j; + reg = mask[0 ] | mask[1 ] <<16 | mask[2 ] <<32 | mask[3 ] <<48 ; +plt_write64 (reg, base +SSOW_LF_GWS_GRPMSK_CHG ); + } +} + +/* Public Functions. */ +uintptr_t +roc_sso_hws_base_get (struct roc_sso *roc_sso,uint8_t hws) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; + +return dev->bar2 + (RVU_BLOCK_ADDR_SSOW <<20 | hws <<12 ); +} + +uint64_t +roc_sso_ns_to_gw (struct roc_sso *roc_sso,uint64_t ns) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +uint64_t current_us, current_ns, new_ns; +uintptr_t base; + + base = dev->bar2 + (RVU_BLOCK_ADDR_SSOW <<20 ); + current_us =plt_read64 (base +SSOW_LF_GWS_NW_TIM ); +/* From HRM, table 14-19: +* The SSOW_LF_GWS_NW_TIM[NW_TIM] period is specified in n-1 notation. +*/ + current_us +=1 ; + +/* From HRM, table 14-1: +* SSOW_LF_GWS_NW_TIM[NW_TIM] specifies the minimum timeout. The SSO +* hardware times out a GET_WORK request within 2 usec of the minimum +* timeout specified by SSOW_LF_GWS_NW_TIM[NW_TIM]. +*/ + current_us +=2 ; + current_ns = current_us *1E3 ; + new_ns = (ns -PLT_MIN (ns, current_ns)); + new_ns = !new_ns ?1 : new_ns; +return (new_ns *plt_tsc_hz ()) /1E9 ; +} + +int +roc_sso_hws_link (struct roc_sso *roc_sso,uint8_t hws,uint16_t hwgrp[], +uint16_t nb_hwgrp) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso; +uintptr_t base; + + sso =roc_sso_to_sso_priv (roc_sso); + base = dev->bar2 + (RVU_BLOCK_ADDR_SSOW <<20 | hws <<12 ); +sso_hws_link_modify (hws, base, sso->link_map[hws], hwgrp, nb_hwgrp,1 ); + +return nb_hwgrp; +} + +int +roc_sso_hws_unlink (struct roc_sso *roc_sso,uint8_t hws,uint16_t hwgrp[], +uint16_t nb_hwgrp) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso *sso; +uintptr_t base; + + sso =roc_sso_to_sso_priv (roc_sso); + base = dev->bar2 + (RVU_BLOCK_ADDR_SSOW <<20 | hws <<12 ); +sso_hws_link_modify (hws, base, sso->link_map[hws], hwgrp, nb_hwgrp,0 ); + +return nb_hwgrp; +} +int roc_sso_rsrc_init (struct roc_sso *roc_sso,uint8_t nb_hws,uint16_t nb_hwgrp) {
@@ -225,8 +323,10 @@ int roc_sso_dev_init(struct roc_sso *roc_sso) {struct plt_pci_device *pci_dev; +uint32_t link_map_sz;struct sso *sso; -int rc; +void *link_mem; +int i, rc;if (roc_sso ==NULL || roc_sso->pci_dev ==NULL )return SSO_ERR_PARAM ;
@@ -249,12 +349,38 @@ roc_sso_dev_init(struct roc_sso *roc_sso) } rc = -ENOMEM ; + sso->link_map = +plt_zmalloc (sizeof (struct plt_bitmap *) * roc_sso->max_hws,0 ); +if (sso->link_map ==NULL ) { +plt_err ("Failed to allocate memory for link_map array" ); + goto rsrc_fail; + } + + link_map_sz =plt_bitmap_get_memory_footprint (roc_sso->max_hwgrp); + sso->link_map_mem =plt_zmalloc (link_map_sz * roc_sso->max_hws,0 ); +if (sso->link_map_mem ==NULL ) { +plt_err ("Failed to get link_map memory" ); + goto rsrc_fail; + } + + link_mem = sso->link_map_mem; +for (i =0 ; i < roc_sso->max_hws; i++) { + sso->link_map[i] =plt_bitmap_init (roc_sso->max_hwgrp, link_mem, + link_map_sz); +if (sso->link_map[i] ==NULL ) { +plt_err ("Failed to allocate link map" ); + goto link_mem_free; + } + link_mem =PLT_PTR_ADD (link_mem, link_map_sz); + }idev_sso_pffunc_set (sso->dev.pf_func); sso->pci_dev = pci_dev; sso->dev.drv_inited = true; roc_sso->lmt_base = sso->dev.lmt_base;return 0 ; +link_mem_free: +plt_free (sso->link_map_mem); rsrc_fail: rc |=dev_fini (&sso->dev, pci_dev); fail:
drivers/common/cnxk/roc_sso.h +6 -0
@@ -30,5 +30,11 @@ int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso); int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws,uint16_t nb_hwgrp); void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso); +uint64_t __roc_api roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns); +int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws, +uint16_t hwgrp[],uint16_t nb_hwgrp); +int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws, +uint16_t hwgrp[],uint16_t nb_hwgrp); +uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws);#endif /* _ROC_SSOW_H_ */
drivers/common/cnxk/roc_sso_priv.h +3 -0
@@ -13,6 +13,9 @@ struct sso_rsrc {struct sso {struct plt_pci_device *pci_dev;struct dev dev; +/* SSO link mapping. */ +struct plt_bitmap **link_map; +void *link_map_mem; } __plt_cache_aligned;enum sso_err_status {
drivers/common/cnxk/version.map +4 -0
@@ -175,6 +175,10 @@ INTERNAL { roc_plt_init_cb_register; roc_sso_dev_fini; roc_sso_dev_init; + roc_sso_hws_base_get; + roc_sso_hws_link; + roc_sso_hws_unlink; + roc_sso_ns_to_gw; roc_sso_rsrc_fini; roc_sso_rsrc_init;
Signature · 1 line
2.8.4
PATCH v4 47/52 common/cnxk: add sso hwgrp interface
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add SSO HWGRP interface for configuring XAQ pool, setting priority and internal HW buffer limits for each HWGRP.
--- drivers/common/cnxk/roc_sso.c | 110 ++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_sso.h | 21 ++++++++ drivers/common/cnxk/version.map | 6 +++ 3 files changed, 137 insertions(+)
drivers/common/cnxk/roc_sso.c +110 -0
@@ -194,6 +194,14 @@ roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws)return dev->bar2 + (RVU_BLOCK_ADDR_SSOW <<20 | hws <<12 ); } +uintptr_t +roc_sso_hwgrp_base_get (struct roc_sso *roc_sso,uint16_t hwgrp) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; + +return dev->bar2 + (RVU_BLOCK_ADDR_SSO <<20 | hwgrp <<12 ); +} +uint64_t roc_sso_ns_to_gw (struct roc_sso *roc_sso,uint64_t ns) {
@@ -251,6 +259,108 @@ roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], }int +roc_sso_hwgrp_hws_link_status (struct roc_sso *roc_sso,uint8_t hws, +uint16_t hwgrp) +{ +struct sso *sso; + + sso =roc_sso_to_sso_priv (roc_sso); +return plt_bitmap_get (sso->link_map[hws], hwgrp); +} + +int +roc_sso_hwgrp_qos_config (struct roc_sso *roc_sso,struct roc_sso_hwgrp_qos *qos, +uint8_t nb_qos,uint32_t nb_xaq) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso_grp_qos_cfg *req; +int i, rc; + +for (i =0 ; i < nb_qos; i++) { +uint8_t xaq_prcnt = qos[i].xaq_prcnt; +uint8_t iaq_prcnt = qos[i].iaq_prcnt; +uint8_t taq_prcnt = qos[i].taq_prcnt; + + req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox); +if (req ==NULL ) { + rc =mbox_process (dev->mbox); +if (rc <0 ) +return rc; + req =mbox_alloc_msg_sso_grp_qos_config (dev->mbox); +if (req ==NULL ) +return -ENOSPC ; + } + req->grp = qos[i].hwgrp; + req->xaq_limit = (nb_xaq * (xaq_prcnt ? xaq_prcnt :100 )) /100 ; + req->taq_thr = (SSO_HWGRP_IAQ_MAX_THR_MASK * + (iaq_prcnt ? iaq_prcnt :100 )) / +100 ; + req->iaq_thr = (SSO_HWGRP_TAQ_MAX_THR_MASK * + (taq_prcnt ? taq_prcnt :100 )) / +100 ; + } + +return mbox_process (dev->mbox); +} + +int +roc_sso_hwgrp_alloc_xaq (struct roc_sso *roc_sso,uint32_t npa_aura_id, +uint16_t hwgrps) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso_hw_setconfig *req; +int rc = -ENOSPC ; + + req =mbox_alloc_msg_sso_hw_setconfig (dev->mbox); +if (req ==NULL ) +return rc; + req->npa_pf_func =idev_npa_pffunc_get (); + req->npa_aura_id = npa_aura_id; + req->hwgrps = hwgrps; + +return mbox_process (dev->mbox); +} + +int +roc_sso_hwgrp_release_xaq (struct roc_sso *roc_sso,uint16_t hwgrps) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso_hw_xaq_release *req; + + req =mbox_alloc_msg_sso_hw_release_xaq_aura (dev->mbox); +if (req ==NULL ) +return -EINVAL ; + req->hwgrps = hwgrps; + +return mbox_process (dev->mbox); +} + +int +roc_sso_hwgrp_set_priority (struct roc_sso *roc_sso,uint16_t hwgrp, +uint8_t weight,uint8_t affinity,uint8_t priority) +{ +struct dev *dev = &roc_sso_to_sso_priv (roc_sso)->dev; +struct sso_grp_priority *req; +int rc = -ENOSPC ; + + req =mbox_alloc_msg_sso_grp_set_priority (dev->mbox); +if (req ==NULL ) +return rc; + req->grp = hwgrp; + req->weight = weight; + req->affinity = affinity; + req->priority = priority; + + rc =mbox_process (dev->mbox); +if (rc <0 ) +return rc; +plt_sso_dbg ("HWGRP %d weight %d affinity %d priority %d" , hwgrp, weight, + affinity, priority); + +return 0 ; +} + +int roc_sso_rsrc_init (struct roc_sso *roc_sso,uint8_t nb_hws,uint16_t nb_hwgrp) {struct sso_lf_alloc_rsp *rsp_hwgrp;
drivers/common/cnxk/roc_sso.h +21 -0
@@ -5,6 +5,13 @@ #ifndef _ROC_SSO_H_ #define _ROC_SSO_H_ +struct roc_sso_hwgrp_qos { + uint16_t hwgrp; + uint8_t xaq_prcnt; + uint8_t iaq_prcnt; + uint8_t taq_prcnt; +}; + struct roc_sso { struct plt_pci_device *pci_dev; /* Public data. */
@@ -30,11 +37,25 @@ int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso); int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws,uint16_t nb_hwgrp); void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso); +int __roc_api roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, +struct roc_sso_hwgrp_qos *qos, +uint8_t nb_qos,uint32_t nb_xaq); +int __roc_api roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, +uint32_t npa_aura_id,uint16_t hwgrps); +int __roc_api roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, +uint16_t hwgrps); +int __roc_api roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, +uint16_t hwgrp,uint8_t weight, +uint8_t affinity,uint8_t priority); uint64_t __roc_api roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns); int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws,uint16_t hwgrp[],uint16_t nb_hwgrp); int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws,uint16_t hwgrp[],uint16_t nb_hwgrp); +int __roc_api roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso, +uint8_t hws,uint16_t hwgrp); uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws); +uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso, +uint16_t hwgrp);#endif /* _ROC_SSOW_H_ */
drivers/common/cnxk/version.map +6 -0
@@ -175,6 +175,12 @@ INTERNAL { roc_plt_init_cb_register; roc_sso_dev_fini; roc_sso_dev_init; + roc_sso_hwgrp_alloc_xaq; + roc_sso_hwgrp_base_get; + roc_sso_hwgrp_hws_link_status; + roc_sso_hwgrp_qos_config; + roc_sso_hwgrp_release_xaq; + roc_sso_hwgrp_set_priority; roc_sso_hws_base_get; roc_sso_hws_link; roc_sso_hws_unlink;
Signature · 1 line
2.8.4
PATCH v4 48/52 common/cnxk: add sso irq support
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add support to registering and un-registering SSO HWS and HWGRP IRQs.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_sso.c | 41 ++++++++++ drivers/common/cnxk/roc_sso_irq.c | 164 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_sso_priv.h | 14 ++++ 4 files changed, 220 insertions(+) create mode 100644 drivers/common/cnxk/roc_sso_irq.c
drivers/common/cnxk/meson.build +1 -0
@@ -40,5 +40,6 @@ sources = files('roc_dev.c', 'roc_npc_utils.c', 'roc_platform.c', 'roc_sso.c', + 'roc_sso_irq.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_sso.c +41 -0
72 lines not on this page · raw message
drivers/common/cnxk/roc_sso_irq.c new file +164 -0
164 lines not on this page · raw message
drivers/common/cnxk/roc_sso_priv.h +14 -0
@@ -13,6 +13,12 @@ struct sso_rsrc {struct sso {struct plt_pci_device *pci_dev;struct dev dev; +/* Interrupt handler args. */ +struct sso_rsrc hws_rsrc[MAX_RVU_BLKLF_CNT ]; +struct sso_rsrc hwgrp_rsrc[MAX_RVU_BLKLF_CNT ]; +/* MSIX offsets */ +uint16_t hws_msix_offset[MAX_RVU_BLKLF_CNT ]; +uint16_t hwgrp_msix_offset[MAX_RVU_BLKLF_CNT ];/* SSO link mapping. */ struct plt_bitmap **link_map;void *link_map_mem;
@@ -33,4 +39,12 @@ roc_sso_to_sso_priv(struct roc_sso *roc_sso) return (struct sso *)&roc_sso->reserved[0]; } +/* SSO IRQ */ +int sso_register_irqs_priv (struct roc_sso *roc_sso, +struct plt_intr_handle *handle,uint16_t nb_hws, +uint16_t nb_hwgrp); +void sso_unregister_irqs_priv (struct roc_sso *roc_sso, +struct plt_intr_handle *handle,uint16_t nb_hws, +uint16_t nb_hwgrp); +#endif /* _ROC_SSO_PRIV_H_ */
Signature · 1 line
2.8.4
PATCH v4 49/52 common/cnxk: add sso debug support
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add sso debug dump support. This dumps all SSO LF register values to a given file handle.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_sso.h | 4 +++ drivers/common/cnxk/roc_sso_debug.c | 68 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 4 files changed, 74 insertions(+) create mode 100644 drivers/common/cnxk/roc_sso_debug.c
drivers/common/cnxk/meson.build +1 -0
@@ -40,6 +40,7 @@ sources = files('roc_dev.c', 'roc_npc_utils.c', 'roc_platform.c', 'roc_sso.c', + 'roc_sso_debug.c', 'roc_sso_irq.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_sso.h +4 -0
@@ -58,4 +58,8 @@ uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws); uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso,uint16_t hwgrp); +/* Debug */ +void __roc_api roc_sso_dump(struct roc_sso *roc_sso, uint8_t nb_hws, +uint16_t hwgrp,FILE *f); +#endif /* _ROC_SSOW_H_ */
drivers/common/cnxk/roc_sso_debug.c new file +68 -0
68 lines not on this page · raw message
drivers/common/cnxk/version.map +1 -0
@@ -175,6 +175,7 @@ INTERNAL { roc_plt_init_cb_register; roc_sso_dev_fini; roc_sso_dev_init; + roc_sso_dump; roc_sso_hwgrp_alloc_xaq; roc_sso_hwgrp_base_get; roc_sso_hwgrp_hws_link_status;
Signature · 1 line
2.8.4
PATCH v4 50/52 common/cnxk: add base tim device support
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add TIM device init, fini which are used to attach TIM LF resources to the RVU PF/VF and TIM LF alloc and free.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 2 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_tim.c | 263 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_tim.h | 43 ++++++ drivers/common/cnxk/roc_tim_priv.h | 21 +++ drivers/common/cnxk/version.map | 9 ++ 9 files changed, 346 insertions(+) create mode 100644 drivers/common/cnxk/roc_tim.c create mode 100644 drivers/common/cnxk/roc_tim.h create mode 100644 drivers/common/cnxk/roc_tim_priv.h
drivers/common/cnxk/meson.build +1 -0
@@ -42,5 +42,6 @@ sources = files('roc_dev.c', 'roc_sso.c', 'roc_sso_debug.c', 'roc_sso_irq.c', + 'roc_tim.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_api.h +3 -0
@@ -91,6 +91,9 @@/* SSO */ #include "roc_sso.h" +/* TIM */ +#include "roc_tim.h" +/* Utils */ #include "roc_utils.h"
drivers/common/cnxk/roc_platform.c +1 -0
@@ -59,4 +59,5 @@ RTE_LOG_REGISTER(cnxk_logtype_npa, pmd.mempool.cnxk, NOTICE);RTE_LOG_REGISTER (cnxk_logtype_nix, pmd.net.cnxk,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_npc, pmd.net.cnxk.flow,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_sso, pmd.event.cnxk,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_tim, pmd.event.cnxk.timer,NOTICE );RTE_LOG_REGISTER (cnxk_logtype_tm, pmd.net.cnxk.tm,NOTICE );
drivers/common/cnxk/roc_platform.h +2 -0
@@ -138,6 +138,7 @@ extern int cnxk_logtype_npa;extern int cnxk_logtype_nix;extern int cnxk_logtype_npc;extern int cnxk_logtype_sso; +extern int cnxk_logtype_tim;extern int cnxk_logtype_tm; #define plt_err(fmt, args...) \
@@ -160,6 +161,7 @@ extern int cnxk_logtype_tm;#define plt_nix_dbg (fmt, ...) plt_dbg(nix, fmt, ##__VA_ARGS__)#define plt_npc_dbg (fmt, ...) plt_dbg(npc, fmt, ##__VA_ARGS__)#define plt_sso_dbg (fmt, ...) plt_dbg(sso, fmt, ##__VA_ARGS__) +#define plt_tim_dbg (fmt, ...) plt_dbg(tim, fmt, ##__VA_ARGS__)#define plt_tm_dbg (fmt, ...) plt_dbg(tm, fmt, ##__VA_ARGS__)#ifdef __cplusplus
drivers/common/cnxk/roc_priv.h +3 -0
@@ -29,4 +29,7 @@/* SSO */ #include "roc_sso_priv.h" +/* TIM */ +#include "roc_tim_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/roc_tim.c new file +263 -0
263 lines not on this page · raw message
drivers/common/cnxk/roc_tim.h new file +43 -0
43 lines not on this page · raw message
drivers/common/cnxk/roc_tim_priv.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_TIM_PRIV_H_ +#define _ROC_TIM_PRIV_H_ + +struct tim { +}; + +enum tim_err_status { +TIM_ERR_PARAM =-5120 , +}; + +static inline struct tim * +roc_tim_to_tim_priv (struct roc_tim *roc_tim) +{ +return (struct tim *)&roc_tim->reserved[0 ]; +} + +#endif /* _ROC_TIM_PRIV_H_ */
drivers/common/cnxk/version.map +9 -0
@@ -7,6 +7,7 @@ INTERNAL { cnxk_logtype_npa; cnxk_logtype_npc; cnxk_logtype_sso; + cnxk_logtype_tim; cnxk_logtype_tm; roc_clk_freq_get; roc_error_msg_get;
@@ -188,6 +189,14 @@ INTERNAL { roc_sso_ns_to_gw; roc_sso_rsrc_fini; roc_sso_rsrc_init; + roc_tim_fini; + roc_tim_init; + roc_tim_lf_alloc; + roc_tim_lf_base_get; + roc_tim_lf_config; + roc_tim_lf_disable; + roc_tim_lf_enable; + roc_tim_lf_free; local: *; };
Signature · 1 line
2.8.4
PATCH v4 51/52 common/cnxk: add tim irq support
In reply to Nithin DabilpuramFrom: Pavan Nikhilesh <[email protected]>
Add TIM LF IRQ register and un-register functions.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_tim.c | 51 ++++++++++++++++++ drivers/common/cnxk/roc_tim_irq.c | 104 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_tim_priv.h | 9 ++++ 4 files changed, 165 insertions(+) create mode 100644 drivers/common/cnxk/roc_tim_irq.c
drivers/common/cnxk/meson.build +1 -0
@@ -43,5 +43,6 @@ sources = files('roc_dev.c', 'roc_sso_debug.c', 'roc_sso_irq.c', 'roc_tim.c', + 'roc_tim_irq.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_tim.c +51 -0
91 lines not on this page · raw message
drivers/common/cnxk/roc_tim_irq.c new file +104 -0
104 lines not on this page · raw message
drivers/common/cnxk/roc_tim_priv.h +9 -0
@@ -6,6 +6,7 @@#define _ROC_TIM_PRIV_H_struct tim { +uint16_t tim_msix_offsets[MAX_RVU_BLKLF_CNT ]; };enum tim_err_status {
@@ -18,4 +19,12 @@ roc_tim_to_tim_priv(struct roc_tim *roc_tim) return (struct tim *)&roc_tim->reserved[0]; } +/* TIM IRQ*/ +int tim_register_irq_priv (struct roc_tim *roc_tim, +struct plt_intr_handle *handle,uint8_t ring_id, +uint16_t msix_offset); +void tim_unregister_irq_priv (struct roc_tim *roc_tim, +struct plt_intr_handle *handle,uint8_t ring_id, +uint16_t msix_offset); +#endif /* _ROC_TIM_PRIV_H_ */
Signature · 1 line
2.8.4
PATCH v4 52/52 common/cnxk: add support for RSS action in RTE Flow
In reply to Nithin DabilpuramFrom: Satheesh Paul <[email protected]>
Added support for allocating RSS group and setting it as action of an NPC rule for rte_flow.
--- drivers/common/cnxk/roc_npc.c | 159 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_npc.h | 20 +++++ drivers/common/cnxk/roc_npc_mcam.c | 1 + drivers/common/cnxk/roc_npc_priv.h | 9 +++ 4 files changed, 189 insertions(+)
drivers/common/cnxk/roc_npc.c +159 -0
@@ -634,6 +634,129 @@ roc_npc_flow_parse(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,return npc_program_mcam (npc, &parse_state,0 ); } +int +npc_rss_free_grp_get (struct npc *npc,uint32_t *pos) +{ +struct plt_bitmap *bmap = npc->rss_grp_entries; + +for (*pos =0 ; *pos <ROC_NIX_RSS_GRPS ; ++*pos) { +if (!plt_bitmap_get (bmap, *pos)) +break ; + } +return *pos <ROC_NIX_RSS_GRPS ?0 :-1 ; +} + +int +npc_rss_action_configure (struct roc_npc *roc_npc, +const struct roc_npc_action_rss *rss,uint8_t *alg_idx, +uint32_t *rss_grp,uint32_t mcam_id) +{ +struct npc *npc =roc_npc_to_npc_priv (roc_npc); +struct roc_nix *roc_nix = roc_npc->roc_nix; +struct nix *nix =roc_nix_to_nix_priv (roc_nix); +uint32_t flowkey_cfg, rss_grp_idx, i, rem; +uint8_t key[ROC_NIX_RSS_KEY_LEN ]; +const uint8_t *key_ptr; +uint8_t flowkey_algx; +uint16_t *reta; +int rc; + + rc =npc_rss_free_grp_get (npc, &rss_grp_idx); +/* RSS group :0 is not usable for flow rss action */ +if (rc <0 || rss_grp_idx ==0 ) +return -ENOSPC ; + +for (i =0 ; i < rss->queue_num; i++) { +if (rss->queue[i] >= nix->nb_rx_queues) { +plt_err ("queue id > max number of queues" ); +return -EINVAL ; + } + } + + *rss_grp = rss_grp_idx; + +if (rss->key ==NULL ) { +roc_nix_rss_key_default_fill (roc_nix, key); + key_ptr = key; + }else { + key_ptr = rss->key; + } + +roc_nix_rss_key_set (roc_nix, key_ptr); + +/* If queue count passed in the rss action is less than +* HW configured reta size, replicate rss action reta +* across HW reta table. +*/ + reta = nix->reta[rss_grp_idx]; + +if (rss->queue_num > nix->reta_sz) { +plt_err ("too many queues for RSS context" ); +return -ENOTSUP ; + } + +for (i =0 ; i < (nix->reta_sz / rss->queue_num); i++) +memcpy (reta + i * rss->queue_num, rss->queue, +sizeof (uint16_t ) * rss->queue_num); + + rem = nix->reta_sz % rss->queue_num; +if (rem) +memcpy (&reta[i * rss->queue_num], rss->queue, + rem *sizeof (uint16_t )); + + rc =roc_nix_rss_reta_set (roc_nix, *rss_grp, reta); +if (rc) { +plt_err ("Failed to init rss table rc = %d" , rc); +return rc; + } + + flowkey_cfg = roc_npc->flowkey_cfg_state; + + rc =roc_nix_rss_flowkey_set (roc_nix, &flowkey_algx, flowkey_cfg, + *rss_grp, mcam_id); +if (rc) { +plt_err ("Failed to set rss hash function rc = %d" , rc); +return rc; + } + + *alg_idx = flowkey_algx; + +plt_bitmap_set (npc->rss_grp_entries, *rss_grp); + +return 0 ; +} + +int +npc_rss_action_program (struct roc_npc *roc_npc, +const struct roc_npc_action actions[], +struct roc_npc_flow *flow) +{ +const struct roc_npc_action_rss *rss; +uint32_t rss_grp; +uint8_t alg_idx; +int rc; + +for (; actions->type !=ROC_NPC_ACTION_TYPE_END ; actions++) { +if (actions->type ==ROC_NPC_ACTION_TYPE_RSS ) { + rss = (const struct roc_npc_action_rss *)actions->conf; + rc =npc_rss_action_configure (roc_npc, rss, &alg_idx, + &rss_grp, flow->mcam_id); +if (rc) +return rc; + + flow->npc_action &= (~(0xfULL )); + flow->npc_action |=NIX_RX_ACTIONOP_RSS ; + flow->npc_action |= + ((uint64_t )(alg_idx &NPC_RSS_ACT_ALG_MASK ) + <<NPC_RSS_ACT_ALG_OFFSET ) | + ((uint64_t )(rss_grp &NPC_RSS_ACT_GRP_MASK ) + <<NPC_RSS_ACT_GRP_OFFSET ); +break ; + } + } +return 0 ; +} +struct roc_npc_flow * roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, const struct roc_npc_item_info pattern[],
@@ -666,6 +789,12 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, goto err_exit; } + rc =npc_rss_action_program (roc_npc, actions, flow); +if (rc !=0 ) { + *errcode = rc; + goto set_rss_failed; + } + list = &npc->flow_list[flow->priority];/* List in ascending order of mcam entries */ TAILQ_FOREACH(flow_iter, list, next) {
@@ -678,12 +807,36 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,TAILQ_INSERT_TAIL (list, flow, next);return flow; +set_rss_failed: + rc =npc_mcam_free_entry (npc, flow->mcam_id); +if (rc !=0 ) { + *errcode = rc; +plt_free (flow); +return NULL ; + } err_exit:plt_free (flow);return NULL ; }int +npc_rss_group_free (struct npc *npc,struct roc_npc_flow *flow) +{ +uint32_t rss_grp; + +if ((flow->npc_action &0xF ) ==NIX_RX_ACTIONOP_RSS ) { + rss_grp = (flow->npc_action >>NPC_RSS_ACT_GRP_OFFSET ) & +NPC_RSS_ACT_GRP_MASK ; +if (rss_grp ==0 || rss_grp >= npc->rss_grps) +return -EINVAL ; + +plt_bitmap_clear (npc->rss_grp_entries, rss_grp); + } + +return 0 ; +} + +int roc_npc_flow_destroy (struct roc_npc *roc_npc,struct roc_npc_flow *flow) {struct npc *npc =roc_npc_to_npc_priv (roc_npc);
@@ -699,6 +852,12 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)return NPC_ERR_PARAM ; } + rc =npc_rss_group_free (npc, flow); +if (rc !=0 ) { +plt_err ("Failed to free rss action rc = %d" , rc); +return rc; + } + rc =npc_mcam_free_entry (npc, flow->mcam_id);if (rc !=0 )return rc;
drivers/common/cnxk/roc_npc.h +20 -0
@@ -106,6 +106,24 @@ struct roc_npc_flow {TAILQ_ENTRY (roc_npc_flow) next; }; +enum roc_npc_rss_hash_function { +ROC_NPC_RSS_HASH_FUNCTION_DEFAULT =0 , +ROC_NPC_RSS_HASH_FUNCTION_TOEPLITZ ,/**< Toeplitz */ +ROC_NPC_RSS_HASH_FUNCTION_SIMPLE_XOR ,/**< Simple XOR */ +ROC_NPC_RSS_HASH_FUNCTION_SYMMETRIC_TOEPLITZ , +ROC_NPC_RSS_HASH_FUNCTION_MAX , +}; + +struct roc_npc_action_rss { +enum roc_npc_rss_hash_function func; +uint32_t level; +uint64_t types;/**< Specific RSS hash types (see ETH_RSS_*). */ +uint32_t key_len;/**< Hash key length in bytes. */ +uint32_t queue_num;/**< Number of entries in @p queue. */ +const uint8_t *key;/**< Hash key. */ +const uint16_t *queue;/**< Queue indices to use. */ +}; +enum roc_npc_intf {ROC_NPC_INTF_RX =0 ,ROC_NPC_INTF_TX =1 ,
@@ -121,6 +139,8 @@ struct roc_npc {uint16_t pf_func;uint64_t kex_capability;uint64_t rx_parse_nibble; +/* Parsed RSS Flowkey cfg for current flow being created */ +uint32_t flowkey_cfg_state;#define ROC_NPC_MEM_SZ (5 * 1024)uint8_t reserved[ROC_NPC_MEM_SZ ];
drivers/common/cnxk/roc_npc_mcam.c +1 -0
@@ -692,6 +692,7 @@ npc_flow_free_all_resources(struct npc *npc)/* Free any MCAM counters and delete flow list */ for (idx =0 ; idx < npc->flow_max_priority; idx++) {while ((flow =TAILQ_FIRST (&npc->flow_list[idx])) !=NULL ) { +npc_rss_group_free (npc, flow);if (flow->ctr_id !=NPC_COUNTER_NONE ) rc |=npc_mcam_free_counter (npc, flow->ctr_id);
drivers/common/cnxk/roc_npc_priv.h +9 -0
@@ -423,4 +423,13 @@ npc_parse_skip_void_and_any_items(const struct roc_npc_item_info *pattern);int npc_program_mcam (struct npc *npc,struct npc_parse_state *pst,bool mcam_alloc);uint64_t npc_get_kex_capability (struct npc *npc); +int npc_rss_free_grp_get (struct npc *npc,uint32_t *grp); +int npc_rss_action_configure (struct roc_npc *roc_npc, +const struct roc_npc_action_rss *rss, +uint8_t *alg_idx,uint32_t *rss_grp, +uint32_t mcam_id); +int npc_rss_action_program (struct roc_npc *roc_npc, +const struct roc_npc_action actions[], +struct roc_npc_flow *flow); +int npc_rss_group_free (struct npc *npc,struct roc_npc_flow *flow);#endif /* _ROC_NPC_PRIV_H_ */
Signature · 1 line
2.8.4
v5 cover Add Marvell CNXK common driver
In reply to Nithin DabilpuramThis patchset adds initial support for common code for Marvell CN10K SoC. Based on this common 'cnxk' driver, new PMD's such as 'net/cnxk', 'mempool/cnxk', 'event/cnxk' etc, will be added later on.
Initially 'cnxk' drivers will only support Marvell CN106XX SoC. In future, when code is ready, CN9K/octeontx2 will also be supported by the same set of drivers and 'common/octeontx2' and its associated drivers will be deprecated.
Ashwin Sekhar T K (8):
common/cnxk: add roc plt init callback support common/cnxk: add base npa device support common/cnxk: add npa irq support common/cnxk: add npa debug support common/cnxk: add npa pool HW ops common/cnxk: add npa bulk alloc/free support common/cnxk: add npa performance counter support common/cnxk: add npa batch alloc/free support
Jerin Jacob (14):
common/cnxk: add build infrastructre and HW definition common/cnxk: add model init and IO handling API common/cnxk: add interrupt helper API common/cnxk: add mbox request and response definitions common/cnxk: add mailbox base infra common/cnxk: add base device class common/cnxk: add VF support to base device class common/cnxk: add base nix support common/cnxk: add nix irq support
common/cnxk: add nix Rx queue management API common/cnxk: add nix Tx queue management API common/cnxk: add nix RSS support
common/cnxk: add nix stats support common/cnxk: add nix debug dump support
Kiran Kumar K (5):
common/cnxk: add npc support
common/cnxk: add npc helper API
common/cnxk: add mcam utility API
common/cnxk: add npc parsing API
common/cnxk: add npc init and fini support
Nithin Dabilpuram (8):
doc: add Marvell CNXK platform guide common/cnxk: add nix traffic management base support common/cnxk: add nix tm support to add/delete node common/cnxk: add nix tm helper to alloc and free resource common/cnxk: add nix tm hierarchy enable/disable common/cnxk: add nix tm support for internal hierarchy common/cnxk: add nix tm dynamic update support common/cnxk: add nix tm debug support and misc utils
Pavan Nikhilesh (7):
common/cnxk: add base sso device support
common/cnxk: add sso hws interface
common/cnxk: add sso hwgrp interface
common/cnxk: add sso irq support
common/cnxk: add sso debug support
common/cnxk: add base tim device support
common/cnxk: add tim irq support
Satha Rao (2):
common/cnxk: add support for nix extended stats common/cnxk: add nix tm shaper profile add support
Satheesh Paul (1):
common/cnxk: add support for RSS action in RTE Flow
Sunil Kumar Kori (6):
common/cnxk: add nix MAC operations support
common/cnxk: add nix specific npc operations
common/cnxk: add nix ptp support
common/cnxk: add VLAN filter support
common/cnxk: add nix flow control support
common/cnxk: add nix LSO support and misc utils
Vidya Sagar Velumuri (1):
common/cnxk: add nix inline IPsec config API
v5:
- Fixed naming issues in patch 04/52 and removed
RTE_ASSERT()
- Sync roc_mbox.h with kernel driver.
v4:
- Added entry to release notes. Fixed checkpatch issues
- Add plt callback for init by
"common/cnxk: add roc plt init callback support" replacing "common/cnxk: add npa lf init/fini callback support" to fix multi-process related failures.
- Fix supported SoC list to include CNF105xx
v3:
- Disable build for all except linux 64-bit.
v2:
- Added PART_95O to models supported
- Addressed comments from Jerin with respect to patch split and documentation
- Fixed a bug is lso utils and added get and custom fmt setup
- Handled rss action as well for rte flow rule
- Fixed issue with sso hws hwgrp link setup
- Renamed plt_init to roc_plt_init
- Disabled windows compilation
MAINTAINERS | 9 + doc/guides/platform/cnxk.rst | 579 ++++ .../img/cnxk_packet_flow_hw_accelerators.svg | 2795 ++++++++++++++++++++ .../platform/img/cnxk_resource_virtualization.svg | 2428 +++++++++++++++++ doc/guides/platform/index.rst | 1 + doc/guides/rel_notes/release_21_05.rst | 9 + drivers/common/cnxk/hw/nix.h | 2191 +++++++++++++++ drivers/common/cnxk/hw/npa.h | 376 +++ drivers/common/cnxk/hw/npc.h | 525 ++++ drivers/common/cnxk/hw/rvu.h | 222 ++ drivers/common/cnxk/hw/sdp.h | 182 ++ drivers/common/cnxk/hw/sso.h | 233 ++ drivers/common/cnxk/hw/ssow.h | 70 + drivers/common/cnxk/hw/tim.h | 49 + drivers/common/cnxk/meson.build | 48 + drivers/common/cnxk/roc_api.h | 103 + drivers/common/cnxk/roc_bitfield.h | 15 + drivers/common/cnxk/roc_bits.h | 32 + drivers/common/cnxk/roc_dev.c | 1190 +++++++++ drivers/common/cnxk/roc_dev_priv.h | 107 + drivers/common/cnxk/roc_idev.c | 184 ++ drivers/common/cnxk/roc_idev.h | 17 + drivers/common/cnxk/roc_idev_priv.h | 39 + drivers/common/cnxk/roc_io.h | 187 ++ drivers/common/cnxk/roc_io_generic.h | 122 + drivers/common/cnxk/roc_irq.c | 249 ++ drivers/common/cnxk/roc_mbox.c | 483 ++++ drivers/common/cnxk/roc_mbox.h | 1766 +++++++++++++ drivers/common/cnxk/roc_mbox_priv.h | 215 ++ drivers/common/cnxk/roc_model.c | 204 ++ drivers/common/cnxk/roc_model.h | 128 + drivers/common/cnxk/roc_nix.c | 439 +++ drivers/common/cnxk/roc_nix.h | 592 +++++ drivers/common/cnxk/roc_nix_debug.c | 1151 ++++++++ drivers/common/cnxk/roc_nix_fc.c | 251 ++ drivers/common/cnxk/roc_nix_irq.c | 495 ++++ drivers/common/cnxk/roc_nix_mac.c | 298 +++ drivers/common/cnxk/roc_nix_mcast.c | 98 + drivers/common/cnxk/roc_nix_npc.c | 103 + drivers/common/cnxk/roc_nix_ops.c | 438 +++ drivers/common/cnxk/roc_nix_priv.h | 395 +++ drivers/common/cnxk/roc_nix_ptp.c | 122 + drivers/common/cnxk/roc_nix_queue.c | 863 ++++++ drivers/common/cnxk/roc_nix_rss.c | 220 ++ drivers/common/cnxk/roc_nix_stats.c | 411 +++ drivers/common/cnxk/roc_nix_tm.c | 1385 ++++++++++ drivers/common/cnxk/roc_nix_tm_ops.c | 1031 ++++++++ drivers/common/cnxk/roc_nix_tm_utils.c | 1002 +++++++ drivers/common/cnxk/roc_nix_vlan.c | 205 ++ drivers/common/cnxk/roc_nix_xstats.h | 204 ++ drivers/common/cnxk/roc_npa.c | 796 ++++++ drivers/common/cnxk/roc_npa.h | 653 +++++ drivers/common/cnxk/roc_npa_debug.c | 184 ++ drivers/common/cnxk/roc_npa_irq.c | 298 +++ drivers/common/cnxk/roc_npa_priv.h | 63 + drivers/common/cnxk/roc_npc.c | 872 ++++++ drivers/common/cnxk/roc_npc.h | 189 ++ drivers/common/cnxk/roc_npc_mcam.c | 709 +++++ drivers/common/cnxk/roc_npc_parse.c | 703 +++++ drivers/common/cnxk/roc_npc_priv.h | 435 +++ drivers/common/cnxk/roc_npc_utils.c | 631 +++++ drivers/common/cnxk/roc_platform.c | 66 + drivers/common/cnxk/roc_platform.h | 194 ++ drivers/common/cnxk/roc_priv.h | 35 + drivers/common/cnxk/roc_sso.c | 550 ++++ drivers/common/cnxk/roc_sso.h | 65 + drivers/common/cnxk/roc_sso_debug.c | 68 + drivers/common/cnxk/roc_sso_irq.c | 164 ++ drivers/common/cnxk/roc_sso_priv.h | 50 + drivers/common/cnxk/roc_tim.c | 314 +++ drivers/common/cnxk/roc_tim.h | 43 + drivers/common/cnxk/roc_tim_irq.c | 104 + drivers/common/cnxk/roc_tim_priv.h | 30 + drivers/common/cnxk/roc_util_priv.h | 14 + drivers/common/cnxk/roc_utils.c | 239 ++ drivers/common/cnxk/roc_utils.h | 15 + drivers/common/cnxk/version.map | 202 ++ drivers/meson.build | 1 + 78 files changed, 32148 insertions(+) create mode 100644 doc/guides/platform/cnxk.rst create mode 100644 doc/guides/platform/img/cnxk_packet_flow_hw_accelerators.svg create mode 100644 doc/guides/platform/img/cnxk_resource_virtualization.svg create mode 100644 drivers/common/cnxk/hw/nix.h create mode 100644 drivers/common/cnxk/hw/npa.h create mode 100644 drivers/common/cnxk/hw/npc.h create mode 100644 drivers/common/cnxk/hw/rvu.h create mode 100644 drivers/common/cnxk/hw/sdp.h create mode 100644 drivers/common/cnxk/hw/sso.h create mode 100644 drivers/common/cnxk/hw/ssow.h create mode 100644 drivers/common/cnxk/hw/tim.h create mode 100644 drivers/common/cnxk/meson.build create mode 100644 drivers/common/cnxk/roc_api.h create mode 100644 drivers/common/cnxk/roc_bitfield.h create mode 100644 drivers/common/cnxk/roc_bits.h create mode 100644 drivers/common/cnxk/roc_dev.c create mode 100644 drivers/common/cnxk/roc_dev_priv.h create mode 100644 drivers/common/cnxk/roc_idev.c create mode 100644 drivers/common/cnxk/roc_idev.h create mode 100644 drivers/common/cnxk/roc_idev_priv.h create mode 100644 drivers/common/cnxk/roc_io.h create mode 100644 drivers/common/cnxk/roc_io_generic.h create mode 100644 drivers/common/cnxk/roc_irq.c create mode 100644 drivers/common/cnxk/roc_mbox.c create mode 100644 drivers/common/cnxk/roc_mbox.h create mode 100644 drivers/common/cnxk/roc_mbox_priv.h create mode 100644 drivers/common/cnxk/roc_model.c create mode 100644 drivers/common/cnxk/roc_model.h create mode 100644 drivers/common/cnxk/roc_nix.c create mode 100644 drivers/common/cnxk/roc_nix.h create mode 100644 drivers/common/cnxk/roc_nix_debug.c create mode 100644 drivers/common/cnxk/roc_nix_fc.c create mode 100644 drivers/common/cnxk/roc_nix_irq.c create mode 100644 drivers/common/cnxk/roc_nix_mac.c create mode 100644 drivers/common/cnxk/roc_nix_mcast.c create mode 100644 drivers/common/cnxk/roc_nix_npc.c create mode 100644 drivers/common/cnxk/roc_nix_ops.c create mode 100644 drivers/common/cnxk/roc_nix_priv.h create mode 100644 drivers/common/cnxk/roc_nix_ptp.c create mode 100644 drivers/common/cnxk/roc_nix_queue.c create mode 100644 drivers/common/cnxk/roc_nix_rss.c create mode 100644 drivers/common/cnxk/roc_nix_stats.c create mode 100644 drivers/common/cnxk/roc_nix_tm.c create mode 100644 drivers/common/cnxk/roc_nix_tm_ops.c create mode 100644 drivers/common/cnxk/roc_nix_tm_utils.c create mode 100644 drivers/common/cnxk/roc_nix_vlan.c create mode 100644 drivers/common/cnxk/roc_nix_xstats.h create mode 100644 drivers/common/cnxk/roc_npa.c create mode 100644 drivers/common/cnxk/roc_npa.h create mode 100644 drivers/common/cnxk/roc_npa_debug.c create mode 100644 drivers/common/cnxk/roc_npa_irq.c create mode 100644 drivers/common/cnxk/roc_npa_priv.h create mode 100644 drivers/common/cnxk/roc_npc.c create mode 100644 drivers/common/cnxk/roc_npc.h create mode 100644 drivers/common/cnxk/roc_npc_mcam.c create mode 100644 drivers/common/cnxk/roc_npc_parse.c create mode 100644 drivers/common/cnxk/roc_npc_priv.h create mode 100644 drivers/common/cnxk/roc_npc_utils.c create mode 100644 drivers/common/cnxk/roc_platform.c create mode 100644 drivers/common/cnxk/roc_platform.h create mode 100644 drivers/common/cnxk/roc_priv.h create mode 100644 drivers/common/cnxk/roc_sso.c create mode 100644 drivers/common/cnxk/roc_sso.h create mode 100644 drivers/common/cnxk/roc_sso_debug.c create mode 100644 drivers/common/cnxk/roc_sso_irq.c create mode 100644 drivers/common/cnxk/roc_sso_priv.h create mode 100644 drivers/common/cnxk/roc_tim.c create mode 100644 drivers/common/cnxk/roc_tim.h create mode 100644 drivers/common/cnxk/roc_tim_irq.c create mode 100644 drivers/common/cnxk/roc_tim_priv.h create mode 100644 drivers/common/cnxk/roc_util_priv.h create mode 100644 drivers/common/cnxk/roc_utils.c create mode 100644 drivers/common/cnxk/roc_utils.h create mode 100644 drivers/common/cnxk/version.map
Signature · 1 line
2.8.4
PATCH v5 1/52 doc: add Marvell CNXK platform guide
Platform specific guide for Marvell OCTEON CN9K/CN10K SoC is added.
--- MAINTAINERS | 9 + doc/guides/platform/cnxk.rst | 579 ++++ .../img/cnxk_packet_flow_hw_accelerators.svg | 2795 ++++++++++++++++++++ .../platform/img/cnxk_resource_virtualization.svg | 2428 +++++++++++++++++ doc/guides/platform/index.rst | 1 + doc/guides/rel_notes/release_21_05.rst | 9 + 6 files changed, 5821 insertions(+) create mode 100644 doc/guides/platform/cnxk.rst create mode 100644 doc/guides/platform/img/cnxk_packet_flow_hw_accelerators.svg create mode 100644 doc/guides/platform/img/cnxk_resource_virtualization.svg
MAINTAINERS +9 -0
@@ -732,6 +732,15 @@ F: drivers/net/ipn3ke/ F: doc/guides/nics/ipn3ke.rst F: doc/guides/nics/features/ipn3ke.ini +Marvell cnxk +M: Nithin Dabilpuram <[email protected]> +M: Kiran Kumar K <[email protected]> +M: Sunil Kumar Kori <[email protected]> +M: Satha Rao <[email protected]> +T: git://dpdk.org/next/dpdk-next-net-mrvl +F: drivers/common/cnxk/ +F: doc/guides/platform/cnxk.rst + Marvell mvpp2 M: Liron Himi <[email protected]> T: git://dpdk.org/next/dpdk-next-net-mrvl
doc/guides/platform/cnxk.rst new file +579 -0
579 lines not on this page · raw message
doc/guides/platform/img/cnxk_packet_flow_hw_accelerators.svg new file +2795 -0
2,406 lines not on this page · raw message
doc/guides/platform/img/cnxk_resource_virtualization.svg new file +2428 -0
2,428 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.8.4
Part of the diff is not shown here. View the raw message.
PATCH v5 2/52 common/cnxk: add build infrastructre and HW definition
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add meson build infrastructure along with HW definition header file.
This patch also adds cross-compile configs for arm for CN9K series and CN10K series of Marvell SoC's.
--- drivers/common/cnxk/hw/nix.h | 2191 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/hw/npa.h | 376 +++++++ drivers/common/cnxk/hw/npc.h | 525 +++++++++ drivers/common/cnxk/hw/rvu.h | 222 ++++ drivers/common/cnxk/hw/sdp.h | 182 +++ drivers/common/cnxk/hw/sso.h | 233 ++++ drivers/common/cnxk/hw/ssow.h | 70 ++ drivers/common/cnxk/hw/tim.h | 49 + drivers/common/cnxk/meson.build | 14 + drivers/common/cnxk/roc_api.h | 69 ++ drivers/common/cnxk/roc_bitfield.h | 15 + drivers/common/cnxk/roc_bits.h | 32 + drivers/common/cnxk/roc_platform.c | 5 + drivers/common/cnxk/roc_platform.h | 154 +++ drivers/common/cnxk/version.map | 4 + drivers/meson.build | 1 + 16 files changed, 4142 insertions(+) create mode 100644 drivers/common/cnxk/hw/nix.h create mode 100644 drivers/common/cnxk/hw/npa.h create mode 100644 drivers/common/cnxk/hw/npc.h create mode 100644 drivers/common/cnxk/hw/rvu.h create mode 100644 drivers/common/cnxk/hw/sdp.h create mode 100644 drivers/common/cnxk/hw/sso.h create mode 100644 drivers/common/cnxk/hw/ssow.h create mode 100644 drivers/common/cnxk/hw/tim.h create mode 100644 drivers/common/cnxk/meson.build create mode 100644 drivers/common/cnxk/roc_api.h create mode 100644 drivers/common/cnxk/roc_bitfield.h create mode 100644 drivers/common/cnxk/roc_bits.h create mode 100644 drivers/common/cnxk/roc_platform.c create mode 100644 drivers/common/cnxk/roc_platform.h create mode 100644 drivers/common/cnxk/version.map
drivers/common/cnxk/hw/nix.h new file +2191 -0
@@ -0,0 +1,2191 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef __NIX_HW_H__ +#define __NIX_HW_H__ + +/* Register offsets */ + +#define NIX_AF_CFG (0x0ull) +#define NIX_AF_STATUS (0x10ull) +#define NIX_AF_NDC_CFG (0x18ull) +#define NIX_AF_CONST (0x20ull) +#define NIX_AF_CONST1 (0x28ull) +#define NIX_AF_CONST2 (0x30ull) +#define NIX_AF_CONST3 (0x38ull) +#define NIX_AF_SQ_CONST (0x40ull) +#define NIX_AF_CQ_CONST (0x48ull) +#define NIX_AF_RQ_CONST (0x50ull) +#define NIX_AF_PL_CONST (0x58ull)/* [CN10K, .) */ +#define NIX_AF_PSE_CONST (0x60ull) +#define NIX_AF_TL1_CONST (0x70ull) +#define NIX_AF_TL2_CONST (0x78ull) +#define NIX_AF_TL3_CONST (0x80ull) +#define NIX_AF_TL4_CONST (0x88ull) +#define NIX_AF_MDQ_CONST (0x90ull) +#define NIX_AF_MC_MIRROR_CONST (0x98ull) +#define NIX_AF_LSO_CFG (0xa8ull) +#define NIX_AF_BLK_RST (0xb0ull) +#define NIX_AF_TX_TSTMP_CFG (0xc0ull) +#define NIX_AF_PL_TS (0xc8ull)/* [CN10K, .) */ +#define NIX_AF_RX_CFG (0xd0ull) +#define NIX_AF_AVG_DELAY (0xe0ull) +#define NIX_AF_CINT_DELAY (0xf0ull) +#define NIX_AF_VWQE_TIMER (0xf8ull)/* [CN10K, .) */ +#define NIX_AF_RX_MCAST_BASE (0x100ull) +#define NIX_AF_RX_MCAST_CFG (0x110ull) +#define NIX_AF_RX_MCAST_BUF_BASE (0x120ull) +#define NIX_AF_RX_MCAST_BUF_CFG (0x130ull) +#define NIX_AF_RX_MIRROR_BUF_BASE (0x140ull) +#define NIX_AF_RX_MIRROR_BUF_CFG (0x148ull) +#define NIX_AF_LF_RST (0x150ull) +#define NIX_AF_GEN_INT (0x160ull) +#define NIX_AF_GEN_INT_W1S (0x168ull) +#define NIX_AF_GEN_INT_ENA_W1S (0x170ull) +#define NIX_AF_GEN_INT_ENA_W1C (0x178ull) +#define NIX_AF_ERR_INT (0x180ull) +#define NIX_AF_ERR_INT_W1S (0x188ull) +#define NIX_AF_ERR_INT_ENA_W1S (0x190ull) +#define NIX_AF_ERR_INT_ENA_W1C (0x198ull) +#define NIX_AF_RAS (0x1a0ull) +#define NIX_AF_RAS_W1S (0x1a8ull) +#define NIX_AF_RAS_ENA_W1S (0x1b0ull) +#define NIX_AF_RAS_ENA_W1C (0x1b8ull) +#define NIX_AF_RVU_INT (0x1c0ull) +#define NIX_AF_RVU_INT_W1S (0x1c8ull) +#define NIX_AF_RVU_INT_ENA_W1S (0x1d0ull) +#define NIX_AF_RVU_INT_ENA_W1C (0x1d8ull) +#define NIX_AF_TCP_TIMER (0x1e0ull) +/* [CN10k, .) */ +#define NIX_AF_RX_DEF_ETX (a) (0x1f0ull | (uint64_t)(a) << 3) +#define NIX_AF_RX_DEF_OL2 (0x200ull) +#define NIX_AF_RX_DEF_GEN0_COLOR (0x208ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP4 (0x210ull) +#define NIX_AF_RX_DEF_GEN1_COLOR (0x218ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IIP4 (0x220ull) +#define NIX_AF_RX_DEF_VLAN0_PCP_DEI (0x228ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP6 (0x230ull) +#define NIX_AF_RX_DEF_VLAN1_PCP_DEI (0x238ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IIP6 (0x240ull) +#define NIX_AF_RX_DEF_OTCP (0x250ull) +#define NIX_AF_RX_DEF_ITCP (0x260ull) +#define NIX_AF_RX_DEF_OUDP (0x270ull) +#define NIX_AF_RX_DEF_IUDP (0x280ull) +#define NIX_AF_RX_DEF_OSCTP (0x290ull) +#define NIX_AF_RX_DEF_CST_APAD_0 (0x298ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_ISCTP (0x2a0ull) +#define NIX_AF_RX_DEF_CST_APAD_1 (0x2a8ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IPSECX (a) (0x2b0ull | (uint64_t)(a) << 3) +#define NIX_AF_RX_DEF_IIP4_DSCP (0x2e0ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP4_DSCP (0x2e8ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_IIP6_DSCP (0x2f0ull)/* [CN10K, .) */ +#define NIX_AF_RX_DEF_OIP6_DSCP (0x2f8ull)/* [CN10K, .) */ +#define NIX_AF_RX_IPSEC_GEN_CFG (0x300ull) +#define NIX_AF_RX_IPSEC_VWQE_GEN_CFG (0x310ull)/* [CN10K, .) */ +#define NIX_AF_RX_CPTX_INST_QSEL (a) (0x320ull | (uint64_t)(a) << 3) +#define NIX_AF_RX_CPTX_CREDIT (a) (0x360ull | (uint64_t)(a) << 3) +#define NIX_AF_NDC_RX_SYNC (0x3e0ull) +#define NIX_AF_NDC_TX_SYNC (0x3f0ull) +#define NIX_AF_AQ_CFG (0x400ull) +#define NIX_AF_AQ_BASE (0x410ull) +#define NIX_AF_AQ_STATUS (0x420ull) +#define NIX_AF_AQ_DOOR (0x430ull) +#define NIX_AF_AQ_DONE_WAIT (0x440ull) +#define NIX_AF_AQ_DONE (0x450ull) +#define NIX_AF_AQ_DONE_ACK (0x460ull) +#define NIX_AF_AQ_DONE_TIMER (0x470ull) +#define NIX_AF_AQ_DONE_ENA_W1S (0x490ull) +#define NIX_AF_AQ_DONE_ENA_W1C (0x498ull) +#define NIX_AF_RX_LINKX_CFG (a) (0x540ull | (uint64_t)(a) << 16) +#define NIX_AF_RX_SW_SYNC (0x550ull) +#define NIX_AF_RX_LINKX_WRR_CFG (a) (0x560ull | (uint64_t)(a) << 16) +#define NIX_AF_SEB_CFG (0x5f0ull)/* [CN10K, .) */ +#define NIX_AF_EXPR_TX_FIFO_STATUS (0x640ull)/* [CN9K, CN10K) */ +#define NIX_AF_NORM_TX_FIFO_STATUS (0x648ull) +#define NIX_AF_SDP_TX_FIFO_STATUS (0x650ull) +#define NIX_AF_TX_NPC_CAPTURE_CONFIG (0x660ull) +#define NIX_AF_TX_NPC_CAPTURE_INFO (0x668ull) +#define NIX_AF_TX_NPC_CAPTURE_RESPX (a) (0x680ull | (uint64_t)(a) << 3) +#define NIX_AF_SEB_ACTIVE_CYCLES_PCX (a) (0x6c0ull | (uint64_t)(a) << 3) +#define NIX_AF_SMQX_CFG (a) (0x700ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_HEAD (a) (0x710ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_TAIL (a) (0x720ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_STATUS (a) (0x730ull | (uint64_t)(a) << 16) +#define NIX_AF_SMQX_NXT_HEAD (a) (0x740ull | (uint64_t)(a) << 16) +#define NIX_AF_SQM_ACTIVE_CYCLES_PC (0x770ull) +#define NIX_AF_SQM_SCLK_CNT (0x780ull)/* [CN10K, .) */ +#define NIX_AF_DWRR_SDP_MTU (0x790ull)/* [CN10K, .) */ +#define NIX_AF_DWRR_RPM_MTU (0x7a0ull)/* [CN10K, .) */ +#define NIX_AF_PSE_CHANNEL_LEVEL (0x800ull) +#define NIX_AF_PSE_SHAPER_CFG (0x810ull) +#define NIX_AF_PSE_ACTIVE_CYCLES_PC (0x8c0ull) +#define NIX_AF_MARK_FORMATX_CTL (a) (0x900ull | (uint64_t)(a) << 18) +#define NIX_AF_TX_LINKX_NORM_CREDIT (a) (0xa00ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TX_LINKX_EXPR_CREDIT (a) (0xa10ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TX_LINKX_SW_XOFF (a) (0xa20ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TX_LINKX_NORM_CDT_ADJ (a) (0xa20ull | (uint64_t)(a) << 16) +#define NIX_AF_TX_LINKX_HW_XOFF (a) (0xa30ull | (uint64_t)(a) << 16) +#define NIX_AF_SDP_LINK_CREDIT (0xa40ull) +#define NIX_AF_SDP_LINK_CDT_ADJ (0xa50ull)/* [CN10K, .) */ +/* [CN9K, CN10K) */ +#define NIX_AF_SDP_SW_XOFFX (a) (0xa60ull | (uint64_t)(a) << 3) +#define NIX_AF_SDP_HW_XOFFX (a) (0xac0ull | (uint64_t)(a) << 3) +#define NIX_AF_TL4X_BP_STATUS (a) (0xb00ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SDP_LINK_CFG (a) (0xb10ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1_TW_ARB_CTL_DEBUG (0xbc0ull)/* [CN10K, .) */ +#define NIX_AF_TL1_TW_ARB_REQ_DEBUG (0xbc8ull)/* [CN10K, .) */ +#define NIX_AF_TL1X_SCHEDULE (a) (0xc00ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_SHAPE (a) (0xc10ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_CIR (a) (0xc20ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL1X_SHAPE_STATE (a) (0xc50ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL1X_SHAPE_STATE_CIR (a) (0xc50ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_SW_XOFF (a) (0xc70ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_TOPOLOGY (a) (0xc80ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_MD_DEBUG0 (a) (0xcc0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_MD_DEBUG1 (a) (0xcc8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL1X_MD_DEBUG2 (a) (0xcd0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL2X_SHAPE_STATE_CIR (a) (0xcd0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL1X_MD_DEBUG3 (a) (0xcd8ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_DROPPED_PACKETS (a) (0xd20ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_DROPPED_BYTES (a) (0xd30ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_RED_PACKETS (a) (0xd40ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_RED_BYTES (a) (0xd50ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_YELLOW_PACKETS (a) (0xd60ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_YELLOW_BYTES (a) (0xd70ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_GREEN_PACKETS (a) (0xd80ull | (uint64_t)(a) << 16) +#define NIX_AF_TL1X_GREEN_BYTES (a) (0xd90ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQ_MD_COUNT (0xda0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_MDQX_OUT_MD_COUNT (a) (0xdb0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2_TW_ARB_CTL_DEBUG (0xdc0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_TL2_TWX_ARB_REQ_DEBUG0 (a) (0xdc8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL2_TWX_ARB_REQ_DEBUG1 (a) (0xdd0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SCHEDULE (a) (0xe00ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SHAPE (a) (0xe10ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_CIR (a) (0xe20ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_PIR (a) (0xe30ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SCHED_STATE (a) (0xe40ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL2X_SHAPE_STATE (a) (0xe50ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL2X_SHAPE_STATE_PIR (a) (0xe50ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_SW_XOFF (a) (0xe70ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_TOPOLOGY (a) (0xe80ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_PARENT (a) (0xe88ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_MD_DEBUG0 (a) (0xec0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL2X_MD_DEBUG1 (a) (0xec8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL2X_MD_DEBUG2 (a) (0xed0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL3X_SHAPE_STATE_CIR (a) (0xed0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL2X_MD_DEBUG3 (a) (0xed8ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3_TW_ARB_CTL_DEBUG (0xfc0ull)/* [CN10K, .) */ +/* [CN10k, .) */ +#define NIX_AF_TL3_TWX_ARB_REQ_DEBUG0 (a) (0xfc8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL3_TWX_ARB_REQ_DEBUG1 (a) (0xfd0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SCHEDULE (a) (0x1000ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SHAPE (a) (0x1010ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_CIR (a) (0x1020ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_PIR (a) (0x1030ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SCHED_STATE (a) (0x1040ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3X_SHAPE_STATE (a) (0x1050ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL3X_SHAPE_STATE_PIR (a) (0x1050ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_SW_XOFF (a) (0x1070ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_TOPOLOGY (a) (0x1080ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_PARENT (a) (0x1088ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_MD_DEBUG0 (a) (0x10c0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3X_MD_DEBUG1 (a) (0x10c8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3X_MD_DEBUG2 (a) (0x10d0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL4X_SHAPE_STATE_CIR (a) (0x10d0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3X_MD_DEBUG3 (a) (0x10d8ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4_TW_ARB_CTL_DEBUG (0x11c0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_TL4_TWX_ARB_REQ_DEBUG0 (a) (0x11c8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_TL4_TWX_ARB_REQ_DEBUG1 (a) (0x11d0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SCHEDULE (a) (0x1200ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SHAPE (a) (0x1210ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_CIR (a) (0x1220ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_PIR (a) (0x1230ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SCHED_STATE (a) (0x1240ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SHAPE_STATE (a) (0x1250ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_SW_XOFF (a) (0x1270ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_TOPOLOGY (a) (0x1280ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_PARENT (a) (0x1288ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_MD_DEBUG0 (a) (0x12c0ull | (uint64_t)(a) << 16) +#define NIX_AF_TL4X_MD_DEBUG1 (a) (0x12c8ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL4X_MD_DEBUG2 (a) (0x12d0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQX_SHAPE_STATE_CIR (a) (0x12d0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL4X_MD_DEBUG3 (a) (0x12d8ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQ_TW_ARB_CTL_DEBUG (0x13c0ull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_AF_MDQ_TWX_ARB_REQ_DEBUG0 (a) (0x13c8ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQ_TWX_ARB_REQ_DEBUG1 (a) (0x13d0ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SCHEDULE (a) (0x1400ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SHAPE (a) (0x1410ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_CIR (a) (0x1420ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_PIR (a) (0x1430ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SCHED_STATE (a) (0x1440ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_MDQX_SHAPE_STATE (a) (0x1450ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQX_SHAPE_STATE_PIR (a) (0x1450ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_SW_XOFF (a) (0x1470ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_PARENT (a) (0x1480ull | (uint64_t)(a) << 16) +#define NIX_AF_MDQX_MD_DEBUG (a) (0x14c0ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_MDQX_IN_MD_COUNT (a) (0x14e0ull | (uint64_t)(a) << 16) +/* [CN9K, CN10K) */ +#define NIX_AF_TL3_TL2X_CFG (a) (0x1600ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3_TL2X_BP_STATUS (a) (0x1610ull | (uint64_t)(a) << 16) +#define NIX_AF_TL3_TL2X_LINKX_CFG (a, b) \ + (0x1700ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3) +#define NIX_AF_RX_FLOW_KEY_ALGX_FIELDX (a, b) \ + (0x1800ull | (uint64_t)(a) << 18 | (uint64_t)(b) << 3) +#define NIX_AF_TX_MCASTX (a) (0x1900ull | (uint64_t)(a) << 15) +#define NIX_AF_TX_VTAG_DEFX_CTL (a) (0x1a00ull | (uint64_t)(a) << 16) +#define NIX_AF_TX_VTAG_DEFX_DATA (a) (0x1a10ull | (uint64_t)(a) << 16) +#define NIX_AF_RX_BPIDX_STATUS (a) (0x1a20ull | (uint64_t)(a) << 17) +#define NIX_AF_RX_CHANX_CFG (a) (0x1a30ull | (uint64_t)(a) << 15) +#define NIX_AF_CINT_TIMERX (a) (0x1a40ull | (uint64_t)(a) << 18) +#define NIX_AF_LSO_FORMATX_FIELDX (a, b) \ + (0x1b00ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_CFG (a) (0x4000ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LINKX_CFG (a) (0x4010ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_SQS_CFG (a) (0x4020ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_CFG2 (a) (0x4028ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_SQS_BASE (a) (0x4030ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RQS_CFG (a) (0x4040ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RQS_BASE (a) (0x4050ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CQS_CFG (a) (0x4060ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CQS_BASE (a) (0x4070ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_CFG (a) (0x4080ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_PARSE_CFG (a) (0x4090ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_CFG (a) (0x40a0ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RSS_CFG (a) (0x40c0ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RSS_BASE (a) (0x40d0ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_QINTS_CFG (a) (0x4100ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_QINTS_BASE (a) (0x4110ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CINTS_CFG (a) (0x4120ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_CINTS_BASE (a) (0x4130ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_CFG0 (a) (0x4140ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_CFG1 (a) (0x4148ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_DYNO_CFG (a) (0x4150ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_DYNO_BASE (a) (0x4158ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_IPSEC_SA_BASE (a) (0x4170ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_TX_STATUS (a) (0x4180ull | (uint64_t)(a) << 17) +#define NIX_AF_LFX_RX_VTAG_TYPEX (a, b) \ + (0x4200ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_LOCKX (a, b) \ + (0x4300ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_TX_STATX (a, b) \ + (0x4400ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_RX_STATX (a, b) \ + (0x4500ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_LFX_RSS_GRPX (a, b) \ + (0x4600ull | (uint64_t)(a) << 17 | (uint64_t)(b) << 3) +#define NIX_AF_RX_NPC_MC_RCV (0x4700ull) +#define NIX_AF_RX_NPC_MC_DROP (0x4710ull) +#define NIX_AF_RX_NPC_MIRROR_RCV (0x4720ull) +#define NIX_AF_RX_NPC_MIRROR_DROP (0x4730ull) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_NORM_COMPL (a) (0x4740ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_RLS_TIMEOUT (a) (0x4750ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_HASH_FULL (a) (0x4760ull | (uint64_t)(a) << 17) +/* [CN10K, .) */ +#define NIX_AF_LFX_VWQE_SA_FULL (a) (0x4770ull | (uint64_t)(a) << 17) +#define NIX_AF_VWQE_HASH_FUNC_MASK (0x47a0ull)/* [CN10K, .) */ +#define NIX_AF_RX_ACTIVE_CYCLES_PCX (a) (0x4800ull | (uint64_t)(a) << 16) +/* [CN10K, .) */ +#define NIX_AF_RX_LINKX_WRR_OUT_CFG (a) (0x4a00ull | (uint64_t)(a) << 16) +#define NIX_PRIV_AF_INT_CFG (0x8000000ull) +#define NIX_PRIV_LFX_CFG (a) (0x8000010ull | (uint64_t)(a) << 8) +#define NIX_PRIV_LFX_INT_CFG (a) (0x8000020ull | (uint64_t)(a) << 8) +#define NIX_AF_RVU_LF_CFG_DEBUG (0x8000030ull) + +#define NIX_LF_RX_SECRETX (a) (0x0ull | (uint64_t)(a) << 3) +#define NIX_LF_CFG (0x100ull) +#define NIX_LF_GINT (0x200ull) +#define NIX_LF_GINT_W1S (0x208ull) +#define NIX_LF_GINT_ENA_W1C (0x210ull) +#define NIX_LF_GINT_ENA_W1S (0x218ull) +#define NIX_LF_ERR_INT (0x220ull) +#define NIX_LF_ERR_INT_W1S (0x228ull) +#define NIX_LF_ERR_INT_ENA_W1C (0x230ull) +#define NIX_LF_ERR_INT_ENA_W1S (0x238ull) +#define NIX_LF_RAS (0x240ull) +#define NIX_LF_RAS_W1S (0x248ull) +#define NIX_LF_RAS_ENA_W1C (0x250ull) +#define NIX_LF_RAS_ENA_W1S (0x258ull) +#define NIX_LF_SQ_OP_ERR_DBG (0x260ull) +#define NIX_LF_MNQ_ERR_DBG (0x270ull) +#define NIX_LF_SEND_ERR_DBG (0x280ull) +#define NIX_LF_TX_STATX (a) (0x300ull | (uint64_t)(a) << 3) +#define NIX_LF_RX_STATX (a) (0x400ull | (uint64_t)(a) << 3) +#define NIX_LF_OP_SENDX (a) (0x800ull | (uint64_t)(a) << 3) +#define NIX_LF_RQ_OP_INT (0x900ull) +#define NIX_LF_RQ_OP_OCTS (0x910ull) +#define NIX_LF_RQ_OP_PKTS (0x920ull) +#define NIX_LF_RQ_OP_DROP_OCTS (0x930ull) +#define NIX_LF_RQ_OP_DROP_PKTS (0x940ull) +#define NIX_LF_RQ_OP_RE_PKTS (0x950ull) +#define NIX_LF_OP_IPSEC_DYNO_CNT (0x980ull) +#define NIX_LF_OP_VWQE_FLUSH (0x9a0ull)/* [CN10K, .) */ +#define NIX_LF_PL_OP_BAND_PROF (0x9c0ull)/* [CN10K, .) */ +#define NIX_LF_SQ_OP_INT (0xa00ull) +#define NIX_LF_SQ_OP_OCTS (0xa10ull) +#define NIX_LF_SQ_OP_PKTS (0xa20ull) +#define NIX_LF_SQ_OP_STATUS (0xa30ull) +#define NIX_LF_SQ_OP_DROP_OCTS (0xa40ull) +#define NIX_LF_SQ_OP_DROP_PKTS (0xa50ull) +#define NIX_LF_CQ_OP_INT (0xb00ull) +#define NIX_LF_CQ_OP_DOOR (0xb30ull) +#define NIX_LF_CQ_OP_STATUS (0xb40ull) +#define NIX_LF_QINTX_CNT (a) (0xc00ull | (uint64_t)(a) << 12) +#define NIX_LF_QINTX_INT (a) (0xc10ull | (uint64_t)(a) << 12) +#define NIX_LF_QINTX_ENA_W1S (a) (0xc20ull | (uint64_t)(a) << 12) +#define NIX_LF_QINTX_ENA_W1C (a) (0xc30ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_CNT (a) (0xd00ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_WAIT (a) (0xd10ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_INT (a) (0xd20ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_INT_W1S (a) (0xd30ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_ENA_W1S (a) (0xd40ull | (uint64_t)(a) << 12) +#define NIX_LF_CINTX_ENA_W1C (a) (0xd50ull | (uint64_t)(a) << 12) +/* [CN10K, .) */ +#define NIX_LF_RX_GEN_COLOR_CONVX (a) (0x4740ull | (uint64_t)(a) << 3) +#define NIX_LF_RX_VLAN0_COLOR_CONV (0x4760ull)/* [CN10K, .) */ +#define NIX_LF_RX_VLAN1_COLOR_CONV (0x4768ull)/* [CN10K, .) */ +#define NIX_LF_RX_IIP_COLOR_CONV_LO (0x4770ull)/* [CN10K, .) */ +#define NIX_LF_RX_IIP_COLOR_CONV_HI (0x4778ull)/* [CN10K, .) */ +#define NIX_LF_RX_OIP_COLOR_CONV_LO (0x4780ull)/* [CN10K, .) */ +#define NIX_LF_RX_OIP_COLOR_CONV_HI (0x4788ull)/* [CN10K, .) */ + +/* Enum offsets */ + +#define NIX_STAT_LF_TX_TX_UCAST (0x0ull) +#define NIX_STAT_LF_TX_TX_BCAST (0x1ull) +#define NIX_STAT_LF_TX_TX_MCAST (0x2ull) +#define NIX_STAT_LF_TX_TX_DROP (0x3ull) +#define NIX_STAT_LF_TX_TX_OCTS (0x4ull) + +#define NIX_STAT_LF_RX_RX_OCTS (0x0ull) +#define NIX_STAT_LF_RX_RX_UCAST (0x1ull) +#define NIX_STAT_LF_RX_RX_BCAST (0x2ull) +#define NIX_STAT_LF_RX_RX_MCAST (0x3ull) +#define NIX_STAT_LF_RX_RX_DROP (0x4ull) +#define NIX_STAT_LF_RX_RX_DROP_OCTS (0x5ull) +#define NIX_STAT_LF_RX_RX_FCS (0x6ull) +#define NIX_STAT_LF_RX_RX_ERR (0x7ull) +#define NIX_STAT_LF_RX_RX_DRP_BCAST (0x8ull) +#define NIX_STAT_LF_RX_RX_DRP_MCAST (0x9ull) +#define NIX_STAT_LF_RX_RX_DRP_L3BCAST (0xaull) +#define NIX_STAT_LF_RX_RX_DRP_L3MCAST (0xbull) + +#define NIX_STAT_LF_RX_RX_GC_OCTS_PASSED (0xcull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_GC_PKTS_PASSED (0xdull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_OCTS_PASSED (0xeull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_PKTS_PASSED (0xfull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_OCTS_PASSED (0x10ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_PKTS_PASSED (0x11ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_GC_OCTS_DROP (0x12ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_GC_PKTS_DROP (0x13ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_OCTS_DROP (0x14ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_YC_PKTS_DROP (0x15ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_OCTS_DROP (0x16ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_RC_PKTS_DROP (0x17ull)/* [CN10K, .) */ +#define NIX_STAT_LF_RX_RX_CPT_DROP_PKTS (0x18ull)/* [CN10K, .) */ + +#define CGX_RX_PKT_CNT (0x0ull)/* [CN9K, CN10K) */ +#define CGX_RX_OCT_CNT (0x1ull)/* [CN9K, CN10K) */ +#define CGX_RX_PAUSE_PKT_CNT (0x2ull)/* [CN9K, CN10K) */ +#define CGX_RX_PAUSE_OCT_CNT (0x3ull)/* [CN9K, CN10K) */ +#define CGX_RX_DMAC_FILT_PKT_CNT (0x4ull)/* [CN9K, CN10K) */ +#define CGX_RX_DMAC_FILT_OCT_CNT (0x5ull)/* [CN9K, CN10K) */ +#define CGX_RX_FIFO_DROP_PKT_CNT (0x6ull)/* [CN9K, CN10K) */ +#define CGX_RX_FIFO_DROP_OCT_CNT (0x7ull)/* [CN9K, CN10K) */ +#define CGX_RX_ERR_CNT (0x8ull)/* [CN9K, CN10K) */ + +#define CGX_TX_COLLISION_DROP (0x0ull)/* [CN9K, CN10K) */ +#define CGX_TX_FRAME_DEFER_CNT (0x1ull)/* [CN9K, CN10K) */ +#define CGX_TX_MULTIPLE_COLLISION (0x2ull)/* [CN9K, CN10K) */ +#define CGX_TX_SINGLE_COLLISION (0x3ull)/* [CN9K, CN10K) */ +#define CGX_TX_OCT_CNT (0x4ull)/* [CN9K, CN10K) */ +#define CGX_TX_PKT_CNT (0x5ull)/* [CN9K, CN10K) */ +#define CGX_TX_1_63_PKT_CNT (0x6ull)/* [CN9K, CN10K) */ +#define CGX_TX_64_PKT_CNT (0x7ull)/* [CN9K, CN10K) */ +#define CGX_TX_65_127_PKT_CNT (0x8ull)/* [CN9K, CN10K) */ +#define CGX_TX_128_255_PKT_CNT (0x9ull)/* [CN9K, CN10K) */ +#define CGX_TX_256_511_PKT_CNT (0xaull)/* [CN9K, CN10K) */ +#define CGX_TX_512_1023_PKT_CNT (0xbull)/* [CN9K, CN10K) */ +#define CGX_TX_1024_1518_PKT_CNT (0xcull)/* [CN9K, CN10K) */ +#define CGX_TX_1519_MAX_PKT_CNT (0xdull)/* [CN9K, CN10K) */ +#define CGX_TX_BCAST_PKTS (0xeull)/* [CN9K, CN10K) */ +#define CGX_TX_MCAST_PKTS (0xfull)/* [CN9K, CN10K) */ +#define CGX_TX_UFLOW_PKTS (0x10ull)/* [CN9K, CN10K) */ +#define CGX_TX_PAUSE_PKTS (0x11ull)/* [CN9K, CN10K) */ + +#define RPM_MTI_STAT_RX_OCT_CNT (0x0ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_OCT_RECV_OK (0x1ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_ALIG_ERR (0x2ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CTRL_FRM_RECV (0x3ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_FRM_LONG (0x4ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_LEN_ERR (0x5ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_FRM_RECV (0x6ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_FRM_SEQ_ERR (0x7ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_VLAN_OK (0x8ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_ERR (0x9ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_UCAST_PKT (0xaull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_MCAST_PKT (0xbull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_IN_BCAST_PKT (0xcull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_DRP_EVENTS (0xdull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_PKT (0xeull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_UNDER_SIZE (0xfull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_1_64_PKT_CNT (0x10ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_65_127_PKT_CNT (0x11ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_128_255_PKT_CNT (0x12ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_256_511_PKT_CNT (0x13ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_512_1023_PKT_CNT (0x14ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_1024_1518_PKT_CNT (0x15ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_1519_MAX_PKT_CNT (0x16ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_OVER_SIZE (0x17ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_JABBER (0x18ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_ETH_FRAGS (0x19ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_0 (0x1aull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_1 (0x1bull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_2 (0x1cull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_3 (0x1dull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_4 (0x1eull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_5 (0x1full)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_6 (0x20ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_7 (0x21ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_8 (0x22ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_9 (0x23ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_10 (0x24ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_11 (0x25ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_12 (0x26ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_13 (0x27ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_14 (0x28ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_CBFC_CLASS_15 (0x29ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_RX_MAC_CONTROL (0x2aull)/* [CN10K, .) */ + +#define RPM_MTI_STAT_TX_OCT_CNT (0x0ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_OCT_TX_OK (0x1ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_PAUSE_MAC_CTRL (0x2ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_FRAMES_OK (0x3ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_VLAN_OK (0x4ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_OUT_ERR (0x5ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_UCAST_PKT_CNT (0x6ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_MCAST_PKT_CNT (0x7ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_BCAST_PKT_CNT (0x8ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_1_64_PKT_CNT (0x9ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_65_127_PKT_CNT (0xaull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_128_255_PKT_CNT (0xbull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_256_511_PKT_CNT (0xcull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_512_1023_PKT_CNT (0xdull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_1024_1518_PKT_CNT (0xeull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_1519_MAX_PKT_CNT (0xfull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_0 (0x10ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_1 (0x11ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_2 (0x12ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_3 (0x13ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_4 (0x14ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_5 (0x15ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_6 (0x16ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_7 (0x17ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_8 (0x18ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_9 (0x19ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_10 (0x1aull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_11 (0x1bull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_12 (0x1cull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_13 (0x1dull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_14 (0x1eull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_CBFC_CLASS_15 (0x1full)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_MAC_CONTROL_FRAMES (0x20ull)/* [CN10K, .) */ +#define RPM_MTI_STAT_TX_PKT_CNT (0x21ull)/* [CN10K, .) */ + +#define NIX_SQOPERR_SQ_OOR (0x0ull) +#define NIX_SQOPERR_SQ_CTX_FAULT (0x1ull) +#define NIX_SQOPERR_SQ_CTX_POISON (0x2ull) +#define NIX_SQOPERR_SQ_DISABLED (0x3ull) +#define NIX_SQOPERR_MAX_SQE_SIZE_ERR (0x4ull) +#define NIX_SQOPERR_SQE_OFLOW (0x5ull) +#define NIX_SQOPERR_SQB_NULL (0x6ull) +#define NIX_SQOPERR_SQB_FAULT (0x7ull) +#define NIX_SQOPERR_SQE_SIZEM1_ZERO (0x8ull)/* [CN10K, .) */ + +#define NIX_SQINT_LMT_ERR (0x0ull) +#define NIX_SQINT_MNQ_ERR (0x1ull) +#define NIX_SQINT_SEND_ERR (0x2ull) +#define NIX_SQINT_SQB_ALLOC_FAIL (0x3ull) + +#define NIX_SEND_STATUS_GOOD (0x0ull) +#define NIX_SEND_STATUS_SQ_CTX_FAULT (0x1ull) +#define NIX_SEND_STATUS_SQ_CTX_POISON (0x2ull) +#define NIX_SEND_STATUS_SQB_FAULT (0x3ull) +#define NIX_SEND_STATUS_SQB_POISON (0x4ull) +#define NIX_SEND_STATUS_SEND_HDR_ERR (0x5ull) +#define NIX_SEND_STATUS_SEND_EXT_ERR (0x6ull) +#define NIX_SEND_STATUS_JUMP_FAULT (0x7ull) +#define NIX_SEND_STATUS_JUMP_POISON (0x8ull) +#define NIX_SEND_STATUS_SEND_CRC_ERR (0x10ull) +#define NIX_SEND_STATUS_SEND_IMM_ERR (0x11ull) +#define NIX_SEND_STATUS_SEND_SG_ERR (0x12ull) +#define NIX_SEND_STATUS_SEND_MEM_ERR (0x13ull) +#define NIX_SEND_STATUS_INVALID_SUBDC (0x14ull) +#define NIX_SEND_STATUS_SUBDC_ORDER_ERR (0x15ull) +#define NIX_SEND_STATUS_DATA_FAULT (0x16ull) +#define NIX_SEND_STATUS_DATA_POISON (0x17ull) +#define NIX_SEND_STATUS_NPC_DROP_ACTION (0x20ull) +#define NIX_SEND_STATUS_LOCK_VIOL (0x21ull) +#define NIX_SEND_STATUS_NPC_UCAST_CHAN_ERR (0x22ull) +#define NIX_SEND_STATUS_NPC_MCAST_CHAN_ERR (0x23ull) +#define NIX_SEND_STATUS_NPC_MCAST_ABORT (0x24ull) +#define NIX_SEND_STATUS_NPC_VTAG_PTR_ERR (0x25ull) +#define NIX_SEND_STATUS_NPC_VTAG_SIZE_ERR (0x26ull) +#define NIX_SEND_STATUS_SEND_MEM_FAULT (0x27ull) +#define NIX_SEND_STATUS_SEND_STATS_ERR (0x28ull) + +#define NIX_SENDSTATSALG_NOP (0x0ull) +#define NIX_SENDSTATSALG_ADD_PKT_CNT (0x1ull) +#define NIX_SENDSTATSALG_ADD_BYTE_CNT (0x2ull) +#define NIX_SENDSTATSALG_ADD_PKT_BYTE_CNT (0x3ull) +#define NIX_SENDSTATSALG_UPDATE_PKT_CNT_ON_DROP (0x4ull) +#define NIX_SENDSTATSALG_UPDATE_BYTE_CNT_ON_DROP (0x5ull) +#define NIX_SENDSTATSALG_UPDATE_PKT_BYTE_CNT_ON_DROP (0x6ull) + +#define NIX_SENDMEMDSZ_B64 (0x0ull) +#define NIX_SENDMEMDSZ_B32 (0x1ull) +#define NIX_SENDMEMDSZ_B16 (0x2ull) +#define NIX_SENDMEMDSZ_B8 (0x3ull) + +#define NIX_SENDMEMALG_SET (0x0ull) +#define NIX_SENDMEMALG_SETTSTMP (0x1ull) +#define NIX_SENDMEMALG_SETRSLT (0x2ull) +#define NIX_SENDMEMALG_ADD (0x8ull) +#define NIX_SENDMEMALG_SUB (0x9ull) +#define NIX_SENDMEMALG_ADDLEN (0xaull) +#define NIX_SENDMEMALG_SUBLEN (0xbull) +#define NIX_SENDMEMALG_ADDMBUF (0xcull) +#define NIX_SENDMEMALG_SUBMBUF (0xdull) + +#define NIX_SUBDC_NOP (0x0ull) +#define NIX_SUBDC_EXT (0x1ull) +#define NIX_SUBDC_CRC (0x2ull) +#define NIX_SUBDC_IMM (0x3ull) +#define NIX_SUBDC_SG (0x4ull) +#define NIX_SUBDC_MEM (0x5ull) +#define NIX_SUBDC_JUMP (0x6ull) +#define NIX_SUBDC_WORK (0x7ull) +#define NIX_SUBDC_SG2 (0x8ull)/* [CN10K, .) */ +#define NIX_SUBDC_AGE_AND_STATS (0x9ull)/* [CN10K, .) */ +#define NIX_SUBDC_SOD (0xfull) + +#define NIX_STYPE_STF (0x0ull) +#define NIX_STYPE_STT (0x1ull) +#define NIX_STYPE_STP (0x2ull) + +#define NIX_RX_ACTIONOP_DROP (0x0ull) +#define NIX_RX_ACTIONOP_UCAST (0x1ull) +#define NIX_RX_ACTIONOP_UCAST_IPSEC (0x2ull) +#define NIX_RX_ACTIONOP_MCAST (0x3ull) +#define NIX_RX_ACTIONOP_RSS (0x4ull) +#define NIX_RX_ACTIONOP_PF_FUNC_DROP (0x5ull) +#define NIX_RX_ACTIONOP_MIRROR (0x6ull) + +#define NIX_RX_VTAGACTION_VTAG0_RELPTR (0x0ull) +#define NIX_RX_VTAGACTION_VTAG1_RELPTR (0x4ull) +#define NIX_RX_VTAGACTION_VTAG_VALID (0x1ull) +#define NIX_TX_VTAGACTION_VTAG0_RELPTR (sizeof(struct nix_inst_hdr_s) + 2 * 6) +#define NIX_TX_VTAGACTION_VTAG1_RELPTR \ + (sizeof(struct nix_inst_hdr_s) + 2 * 6 + 4) +#define NIX_RQINT_DROP (0x0ull) +#define NIX_RQINT_RED (0x1ull) +#define NIX_RQINT_R2 (0x2ull) +#define NIX_RQINT_R3 (0x3ull) +#define NIX_RQINT_R4 (0x4ull) +#define NIX_RQINT_R5 (0x5ull) +#define NIX_RQINT_R6 (0x6ull) +#define NIX_RQINT_R7 (0x7ull) + +#define NIX_MAXSQESZ_W16 (0x0ull) +#define NIX_MAXSQESZ_W8 (0x1ull) + +#define NIX_LSOALG_NOP (0x0ull) +#define NIX_LSOALG_ADD_SEGNUM (0x1ull) +#define NIX_LSOALG_ADD_PAYLEN (0x2ull) +#define NIX_LSOALG_ADD_OFFSET (0x3ull) +#define NIX_LSOALG_TCP_FLAGS (0x4ull) + +#define NIX_MNQERR_SQ_CTX_FAULT (0x0ull) +#define NIX_MNQERR_SQ_CTX_POISON (0x1ull) +#define NIX_MNQERR_SQB_FAULT (0x2ull) +#define NIX_MNQERR_SQB_POISON (0x3ull) +#define NIX_MNQERR_TOTAL_ERR (0x4ull) +#define NIX_MNQERR_LSO_ERR (0x5ull) +#define NIX_MNQERR_CQ_QUERY_ERR (0x6ull) +#define NIX_MNQERR_MAX_SQE_SIZE_ERR (0x7ull) +#define NIX_MNQERR_MAXLEN_ERR (0x8ull) +#define NIX_MNQERR_SQE_SIZEM1_ZERO (0x9ull) + +#define NIX_MDTYPE_RSVD (0x0ull) +#define NIX_MDTYPE_FLUSH (0x1ull) +#define NIX_MDTYPE_PMD (0x2ull) + +#define NIX_NDC_TX_PORT_LMT (0x0ull) +#define NIX_NDC_TX_PORT_ENQ (0x1ull) +#define NIX_NDC_TX_PORT_MNQ (0x2ull) +#define NIX_NDC_TX_PORT_DEQ (0x3ull) +#define NIX_NDC_TX_PORT_DMA (0x4ull) +#define NIX_NDC_TX_PORT_XQE (0x5ull) + +#define NIX_NDC_RX_PORT_AQ (0x0ull) +#define NIX_NDC_RX_PORT_CQ (0x1ull) +#define NIX_NDC_RX_PORT_CINT (0x2ull) +#define NIX_NDC_RX_PORT_MC (0x3ull) +#define NIX_NDC_RX_PORT_PKT (0x4ull) +#define NIX_NDC_RX_PORT_RQ (0x5ull) + +#define NIX_RE_OPCODE_RE_NONE (0x0ull) +#define NIX_RE_OPCODE_RE_PARTIAL (0x1ull) +#define NIX_RE_OPCODE_RE_JABBER (0x2ull) +#define NIX_RE_OPCODE_RE_FCS (0x7ull) +#define NIX_RE_OPCODE_RE_FCS_RCV (0x8ull) +#define NIX_RE_OPCODE_RE_TERMINATE (0x9ull) +#define NIX_RE_OPCODE_RE_RX_CTL (0xbull) +#define NIX_RE_OPCODE_RE_SKIP (0xcull) +#define NIX_RE_OPCODE_RE_DMAPKT (0xfull) +#define NIX_RE_OPCODE_UNDERSIZE (0x10ull) +#define NIX_RE_OPCODE_OVERSIZE (0x11ull) +#define NIX_RE_OPCODE_OL2_LENMISM (0x12ull) + +#define NIX_REDALG_STD (0x0ull) +#define NIX_REDALG_SEND (0x1ull) +#define NIX_REDALG_STALL (0x2ull) +#define NIX_REDALG_DISCARD (0x3ull) + +#define NIX_RX_BAND_PROF_ACTIONRESULT_PASS (0x0ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_ACTIONRESULT_DROP (0x1ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_ACTIONRESULT_RED (0x2ull)/* [CN10K, .) */ + +#define NIX_RX_BAND_PROF_LAYER_LEAF (0x0ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_LAYER_MIDDLE (0x1ull)/* [CN10K, .) */ +#define NIX_RX_BAND_PROF_LAYER_TOP (0x2ull)/* [CN10K, .) */ + +#define NIX_RX_COLORRESULT_GREEN (0x0ull)/* [CN10K, .) */ +#define NIX_RX_COLORRESULT_YELLOW (0x1ull)/* [CN10K, .) */ +#define NIX_RX_COLORRESULT_RED (0x2ull)/* [CN10K, .) */ + +#define NIX_RX_MCOP_RQ (0x0ull) +#define NIX_RX_MCOP_RSS (0x1ull) + +#define NIX_RX_PERRCODE_NPC_RESULT_ERR (0x2ull) +#define NIX_RX_PERRCODE_MCAST_FAULT (0x4ull) +#define NIX_RX_PERRCODE_MIRROR_FAULT (0x5ull) +#define NIX_RX_PERRCODE_MCAST_POISON (0x6ull) +#define NIX_RX_PERRCODE_MIRROR_POISON (0x7ull) +#define NIX_RX_PERRCODE_DATA_FAULT (0x8ull) +#define NIX_RX_PERRCODE_MEMOUT (0x9ull) +#define NIX_RX_PERRCODE_BUFS_OFLOW (0xaull) +#define NIX_RX_PERRCODE_OL3_LEN (0x10ull) +#define NIX_RX_PERRCODE_OL4_LEN (0x11ull) +#define NIX_RX_PERRCODE_OL4_CHK (0x12ull) +#define NIX_RX_PERRCODE_OL4_PORT (0x13ull) +#define NIX_RX_PERRCODE_IL3_LEN (0x20ull) +#define NIX_RX_PERRCODE_IL4_LEN (0x21ull) +#define NIX_RX_PERRCODE_IL4_CHK (0x22ull) +#define NIX_RX_PERRCODE_IL4_PORT (0x23ull) + +#define NIX_SA_ALG_NON_MS (0x0ull)/* [CN10K, .) */ +#define NIX_SA_ALG_MS_CISCO (0x1ull)/* [CN10K, .) */ +#define NIX_SA_ALG_MS_VIPTELA (0x2ull)/* [CN10K, .) */ + +#define NIX_SENDCRCALG_CRC32 (0x0ull) +#define NIX_SENDCRCALG_CRC32C (0x1ull) +#define NIX_SENDCRCALG_ONES16 (0x2ull) + +#define NIX_SENDL3TYPE_NONE (0x0ull) +#define NIX_SENDL3TYPE_IP4 (0x2ull) +#define NIX_SENDL3TYPE_IP4_CKSUM (0x3ull) +#define NIX_SENDL3TYPE_IP6 (0x4ull) + +#define NIX_SENDL4TYPE_NONE (0x0ull) +#define NIX_SENDL4TYPE_TCP_CKSUM (0x1ull) +#define NIX_SENDL4TYPE_SCTP_CKSUM (0x2ull) +#define NIX_SENDL4TYPE_UDP_CKSUM (0x3ull) + +#define NIX_SENDLDTYPE_LDD (0x0ull) +#define NIX_SENDLDTYPE_LDT (0x1ull) +#define NIX_SENDLDTYPE_LDWB (0x2ull) + +#define NIX_XQESZ_W64 (0x0ull) +#define NIX_XQESZ_W16 (0x1ull) + +#define NIX_XQE_TYPE_INVALID (0x0ull) +#define NIX_XQE_TYPE_RX (0x1ull) +#define NIX_XQE_TYPE_RX_IPSECS (0x2ull) +#define NIX_XQE_TYPE_RX_IPSECH (0x3ull) +#define NIX_XQE_TYPE_RX_IPSECD (0x4ull) +#define NIX_XQE_TYPE_RX_VWQE (0x5ull)/* [CN10K, .) */ +#define NIX_XQE_TYPE_RES_6 (0x6ull) +#define NIX_XQE_TYPE_RES_7 (0x7ull) +#define NIX_XQE_TYPE_SEND (0x8ull) +#define NIX_XQE_TYPE_RES_9 (0x9ull) +#define NIX_XQE_TYPE_RES_A (0xAull) +#define NIX_XQE_TYPE_RES_B (0xBull) +#define NIX_XQE_TYPE_RES_C (0xCull) +#define NIX_XQE_TYPE_RES_D (0xDull) +#define NIX_XQE_TYPE_RES_E (0xEull) +#define NIX_XQE_TYPE_RES_F (0xFull) + +#define NIX_TX_VTAGOP_NOP (0x0ull) +#define NIX_TX_VTAGOP_INSERT (0x1ull) +#define NIX_TX_VTAGOP_REPLACE (0x2ull) + +#define NIX_VTAGSIZE_T4 (0x0ull) +#define NIX_VTAGSIZE_T8 (0x1ull) + +#define NIX_TXLAYER_OL3 (0x0ull) +#define NIX_TXLAYER_OL4 (0x1ull) +#define NIX_TXLAYER_IL3 (0x2ull) +#define NIX_TXLAYER_IL4 (0x3ull) + +#define NIX_TX_ACTIONOP_DROP (0x0ull) +#define NIX_TX_ACTIONOP_UCAST_DEFAULT (0x1ull) +#define NIX_TX_ACTIONOP_UCAST_CHAN (0x2ull) +#define NIX_TX_ACTIONOP_MCAST (0x3ull) +#define NIX_TX_ACTIONOP_DROP_VIOL (0x5ull) + +#define NIX_AQ_COMP_NOTDONE (0x0ull) +#define NIX_AQ_COMP_GOOD (0x1ull) +#define NIX_AQ_COMP_SWERR (0x2ull) +#define NIX_AQ_COMP_CTX_POISON (0x3ull) +#define NIX_AQ_COMP_CTX_FAULT (0x4ull) +#define NIX_AQ_COMP_LOCKERR (0x5ull) +#define NIX_AQ_COMP_SQB_ALLOC_FAIL (0x6ull) + +#define NIX_AF_INT_VEC_RVU (0x0ull) +#define NIX_AF_INT_VEC_GEN (0x1ull) +#define NIX_AF_INT_VEC_AQ_DONE (0x2ull) +#define NIX_AF_INT_VEC_AF_ERR (0x3ull) +#define NIX_AF_INT_VEC_POISON (0x4ull) + +#define NIX_AQINT_GEN_RX_MCAST_DROP (0x0ull) +#define NIX_AQINT_GEN_RX_MIRROR_DROP (0x1ull) +#define NIX_AQINT_GEN_TL1_DRAIN (0x3ull) +#define NIX_AQINT_GEN_SMQ_FLUSH_DONE (0x4ull) + +#define NIX_AQ_INSTOP_NOP (0x0ull) +#define NIX_AQ_INSTOP_INIT (0x1ull) +#define NIX_AQ_INSTOP_WRITE (0x2ull) +#define NIX_AQ_INSTOP_READ (0x3ull) +#define NIX_AQ_INSTOP_LOCK (0x4ull) +#define NIX_AQ_INSTOP_UNLOCK (0x5ull) + +#define NIX_AQ_CTYPE_RQ (0x0ull) +#define NIX_AQ_CTYPE_SQ (0x1ull) +#define NIX_AQ_CTYPE_CQ (0x2ull) +#define NIX_AQ_CTYPE_MCE (0x3ull) +#define NIX_AQ_CTYPE_RSS (0x4ull) +#define NIX_AQ_CTYPE_DYNO (0x5ull) +#define NIX_AQ_CTYPE_BAND_PROF (0x6ull)/* [CN10K, .) */ + +#define NIX_COLORRESULT_GREEN (0x0ull) +#define NIX_COLORRESULT_YELLOW (0x1ull) +#define NIX_COLORRESULT_RED_SEND (0x2ull) +#define NIX_COLORRESULT_RED_DROP (0x3ull) + +#define NIX_CHAN_LBKX_CHX (a, b) \ + (0x000ull | ((uint64_t)(a) << 8) | (uint64_t)(b)) +#define NIX_CHAN_CPT_CH_END (0x4ffull)/* [CN10K, .) */ +#define NIX_CHAN_CPT_CH_START (0x400ull)/* [CN10K, .) */ +#define NIX_CHAN_R4 (0x400ull)/* [CN9K, CN10K) */ +#define NIX_CHAN_R5 (0x500ull) +#define NIX_CHAN_R6 (0x600ull) +#define NIX_CHAN_SDP_CH_END (0x7ffull) +#define NIX_CHAN_SDP_CH_START (0x700ull) +/* [CN9K, CN10K) */ +#define NIX_CHAN_CGXX_LMACX_CHX (a, b, c) \ + (0x800ull | ((uint64_t)(a) << 8) | ((uint64_t)(b) << 4) | (uint64_t)(c)) +/* [CN10K, .) */ +#define NIX_CHAN_RPMX_LMACX_CHX (a, b, c) \ + (0x800ull | ((uint64_t)(a) << 8) | ((uint64_t)(b) << 4) | (uint64_t)(c)) + +#define NIX_INTF_SDP (0x4ull) +#define NIX_INTF_CGX0 (0x0ull)/* [CN9K, CN10K) */ +#define NIX_INTF_CGX1 (0x1ull)/* [CN9K, CN10K) */ +#define NIX_INTF_CGX2 (0x2ull)/* [CN9K, CN10K) */ +#define NIX_INTF_RPM0 (0x0ull)/* [CN10K, .) */ +#define NIX_INTF_RPM1 (0x1ull)/* [CN10K, .) */ +#define NIX_INTF_RPM2 (0x2ull)/* [CN10K, .) */ +#define NIX_INTF_LBK0 (0x3ull) +#define NIX_INTF_CPT0 (0x5ull)/* [CN10K, .) */ + +#define NIX_CQERRINT_DOOR_ERR (0x0ull) +#define NIX_CQERRINT_WR_FULL (0x1ull) +#define NIX_CQERRINT_CQE_FAULT (0x2ull) + +#define NIX_LINK_SDP (0xdull)/* [CN10K, .) */ +#define NIX_LINK_CPT (0xeull)/* [CN10K, .) */ +#define NIX_LINK_MC (0xfull)/* [CN10K, .) */ +/* [CN10K, .) */ +#define NIX_LINK_RPMX_LMACX (a, b) \ + (0x00ull | ((uint64_t)(a) << 2) | (uint64_t)(b)) +#define NIX_LINK_LBK0 (0xcull) + +#define NIX_LF_INT_VEC_GINT (0x80ull) +#define NIX_LF_INT_VEC_ERR_INT (0x81ull) +#define NIX_LF_INT_VEC_POISON (0x82ull) +#define NIX_LF_INT_VEC_QINT_END (0x3full) +#define NIX_LF_INT_VEC_QINT_START (0x0ull) +#define NIX_LF_INT_VEC_CINT_END (0x7full) +#define NIX_LF_INT_VEC_CINT_START (0x40ull) + +#define NIX_INTF_RX (0x0ull) +#define NIX_INTF_TX (0x1ull) + +/* Enums definitions */ + +/* Structures definitions */ + +/* NIX aging and send stats subdescriptor structure */ +struct nix_age_and_send_stats_s { +uint64_t threshold :29 ; +uint64_t latency_drop :1 ; +uint64_t aging :1 ; +uint64_t wmem :1 ; +uint64_t ooffset :12 ; +uint64_t ioffset :12 ; +uint64_t sel :1 ; +uint64_t alg :3 ; +uint64_t subdc :4 ; +uint64_t addr :64 ;/* W1 */ +}; + +/* NIX admin queue instruction structure */ +struct nix_aq_inst_s { +uint64_t op :4 ; +uint64_t ctype :4 ; +uint64_t lf :7 ; +uint64_t rsvd_23_15 :9 ; +uint64_t cindex :20 ; +uint64_t rsvd_62_44 :19 ; +uint64_t doneint :1 ; +uint64_t res_addr :64 ;/* W1 */ +}; + +/* NIX admin queue result structure */ +struct nix_aq_res_s { +uint64_t op :4 ; +uint64_t ctype :4 ; +uint64_t compcode :8 ; +uint64_t doneint :1 ; +uint64_t rsvd_63_17 :47 ; +uint64_t rsvd_127_64 :64 ;/* W1 */ +}; + +/* NIX bandwidth profile structure */ +struct nix_band_prof_s { +uint64_t pc_mode :2 ; +uint64_t icolor :2 ; +uint64_t tnl_ena :1 ; +uint64_t rsvd_7_5 :3 ; +uint64_t peir_exponent :5 ; +uint64_t rsvd_15_13 :3 ; +uint64_t pebs_exponent :5 ; +uint64_t rsvd_23_21 :3 ; +uint64_t cir_exponent :5 ; +uint64_t rsvd_31_29 :3 ; +uint64_t cbs_exponent :5 ; +uint64_t rsvd_39_37 :3 ; +uint64_t peir_mantissa :8 ; +uint64_t pebs_mantissa :8 ; +uint64_t cir_mantissa :8 ; +uint64_t cbs_mantissa :8 ; +uint64_t lmode :1 ; +uint64_t l_sellect :3 ; +uint64_t rdiv :4 ; +uint64_t adjust_exponent :5 ; +uint64_t rsvd_86_85 :2 ; +uint64_t adjust_mantissa :9 ; +uint64_t gc_action :2 ; +uint64_t yc_action :2 ; +uint64_t rc_action :2 ; +uint64_t meter_algo :2 ; +uint64_t band_prof_id :7 ; +uint64_t rsvd_118_111 :8 ; +uint64_t hl_en :1 ; +uint64_t rsvd_127_120 :8 ; +uint64_t ts :48 ; +uint64_t rsvd_191_176 :16 ; +uint64_t pe_accum :32 ; +uint64_t c_accum :32 ; +uint64_t green_pkt_pass :48 ; +uint64_t rsvd_319_304 :16 ; +uint64_t yellow_pkt_pass :48 ; +uint64_t rsvd_383_368 :16 ; +uint64_t red_pkt_pass :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t green_octs_pass :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t yellow_octs_pass :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t red_octs_pass :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t green_pkt_drop :48 ; +uint64_t rsvd_703_688 :16 ; +uint64_t yellow_pkt_drop :48 ; +uint64_t rsvd_767_752 :16 ; +uint64_t red_pkt_drop :48 ; +uint64_t rsvd_831_816 :16 ; +uint64_t green_octs_drop :48 ; +uint64_t rsvd_895_880 :16 ; +uint64_t yellow_octs_drop :48 ; +uint64_t rsvd_959_944 :16 ; +uint64_t red_octs_drop :48 ; +uint64_t rsvd_1023_1008 :16 ; +}; + +/* NIX completion interrupt context hardware structure */ +struct nix_cint_hw_s { +uint64_t ecount :32 ; +uint64_t qcount :16 ; +uint64_t intr :1 ; +uint64_t ena :1 ; +uint64_t timer_idx :8 ; +uint64_t rsvd_63_58 :6 ; +uint64_t ecount_wait :32 ; +uint64_t qcount_wait :16 ; +uint64_t time_wait :8 ; +uint64_t rsvd_127_120 :8 ; +}; + +/* NIX completion queue entry header structure */ +struct nix_cqe_hdr_s { +uint64_t tag :32 ; +uint64_t q :20 ; +uint64_t rsvd_57_52 :6 ; +uint64_t node :2 ; +uint64_t cqe_type :4 ; +}; + +/* NIX completion queue context structure */ +struct nix_cq_ctx_s { +uint64_t base :64 ;/* W0 */ +uint64_t rsvd_67_64 :4 ; +uint64_t bp_ena :1 ; +uint64_t rsvd_71_69 :3 ; +uint64_t bpid :9 ; +uint64_t rsvd_83_81 :3 ; +uint64_t qint_idx :7 ; +uint64_t cq_err :1 ; +uint64_t cint_idx :7 ; +uint64_t avg_con :9 ; +uint64_t wrptr :20 ; +uint64_t tail :20 ; +uint64_t head :20 ; +uint64_t avg_level :8 ; +uint64_t update_time :16 ; +uint64_t bp :8 ; +uint64_t drop :8 ; +uint64_t drop_ena :1 ; +uint64_t ena :1 ; +uint64_t rsvd_211_210 :2 ; +uint64_t substream :20 ; +uint64_t caching :1 ; +uint64_t rsvd_235_233 :3 ; +uint64_t qsize :4 ; +uint64_t cq_err_int :8 ; +uint64_t cq_err_int_ena :8 ; +}; + +/* NIX instruction header structure */ +struct nix_inst_hdr_s { +uint64_t pf_func :16 ; +uint64_t sq :20 ; +uint64_t rsvd_63_36 :28 ; +}; + +/* NIX i/o virtual address structure */ +struct nix_iova_s { +uint64_t addr :64 ;/* W0 */ +}; + +/* NIX IPsec dynamic ordering counter structure */ +struct nix_ipsec_dyno_s { +uint32_t count :32 ;/* W0 */ +}; + +/* NIX memory value structure */ +struct nix_mem_result_s { +uint64_t v :1 ; +uint64_t color :2 ; +uint64_t rsvd_63_3 :61 ; +}; + +/* NIX statistics operation write data structure */ +struct nix_op_q_wdata_s { +uint64_t rsvd_31_0 :32 ; +uint64_t q :20 ; +uint64_t rsvd_63_52 :12 ; +}; + +/* NIX queue interrupt context hardware structure */ +struct nix_qint_hw_s { +uint32_t count :22 ; +uint32_t rsvd_30_22 :9 ; +uint32_t ena :1 ; +}; + +/* [CN10K, .) NIX receive queue context structure */ +struct nix_cn10k_rq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t rsvd_36_24 :13 ; +uint64_t lenerr_dis :1 ; +uint64_t csum_il4_dis :1 ; +uint64_t csum_ol4_dis :1 ; +uint64_t len_il4_dis :1 ; +uint64_t len_il3_dis :1 ; +uint64_t len_ol4_dis :1 ; +uint64_t len_ol3_dis :1 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t pb_stashing :1 ; +uint64_t ipsecd_drop_en :1 ; +uint64_t chi_ena :1 ; +uint64_t rsvd_127_125 :3 ; +uint64_t band_prof_id :10 ; +uint64_t rsvd_138 :1 ; +uint64_t policer_ena :1 ; +uint64_t spb_sizem1 :6 ; +uint64_t wqe_skip :2 ; +uint64_t spb_high_sizem1 :3 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_319_288 :32 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t ipsec_vwqe :1 ; +uint64_t vwqe_ena :1 ; +uint64_t vtime_wait :8 ; +uint64_t max_vsize_exp :4 ; +uint64_t vwqe_skip :2 ; +uint64_t rsvd_383_382 :2 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_702_688 :15 ; +uint64_t ena_copy :1 ; +uint64_t rsvd_739_704 :36 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_767_763 :5 ; +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* NIX receive queue context structure */ +struct nix_rq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t substream :20 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t wqe_skip :2 ; +uint64_t rsvd_127_124 :4 ; +uint64_t rsvd_139_128 :12 ; +uint64_t spb_sizem1 :6 ; +uint64_t rsvd_150_146 :5 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_319_288 :32 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t rsvd_383_366 :18 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_702_688 :15 ; +uint64_t ena_copy :1 ; +uint64_t rsvd_739_704 :36 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_767_763 :5 ; +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* [CN10K, .) NIX Receive queue context structure */ +struct nix_cn10k_rq_ctx_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t rsvd_36_24 :13 ; +uint64_t lenerr_dis :1 ; +uint64_t csum_il4_dis :1 ; +uint64_t csum_ol4_dis :1 ; +uint64_t len_il4_dis :1 ; +uint64_t len_il3_dis :1 ; +uint64_t len_ol4_dis :1 ; +uint64_t len_ol3_dis :1 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t pb_stashing :1 ; +uint64_t ipsecd_drop_en :1 ; +uint64_t chi_ena :1 ; +uint64_t rsvd_127_125 :3 ; +uint64_t band_prof_id :10 ; +uint64_t rsvd_138 :1 ; +uint64_t policer_ena :1 ; +uint64_t spb_sizem1 :6 ; +uint64_t wqe_skip :2 ; +uint64_t spb_high_sizem1 :3 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_291_288 :4 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_319_315 :5 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t ipsec_vwqe :1 ; +uint64_t vwqe_ena :1 ; +uint64_t vtime_wait :8 ; +uint64_t max_vsize_exp :4 ; +uint64_t vwqe_skip :2 ; +uint64_t rsvd_383_382 :2 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_703_688 :16 ; +uint64_t rsvd_767_704 :64 ;/* W11 */ +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* NIX receive queue context structure */ +struct nix_rq_ctx_s { +uint64_t ena :1 ; +uint64_t sso_ena :1 ; +uint64_t ipsech_ena :1 ; +uint64_t ena_wqwd :1 ; +uint64_t cq :20 ; +uint64_t substream :20 ; +uint64_t wqe_aura :20 ; +uint64_t spb_aura :20 ; +uint64_t lpb_aura :20 ; +uint64_t sso_grp :10 ; +uint64_t sso_tt :2 ; +uint64_t pb_caching :2 ; +uint64_t wqe_caching :1 ; +uint64_t xqe_drop_ena :1 ; +uint64_t spb_drop_ena :1 ; +uint64_t lpb_drop_ena :1 ; +uint64_t rsvd_127_122 :6 ; +uint64_t rsvd_139_128 :12 ; +uint64_t spb_sizem1 :6 ; +uint64_t wqe_skip :2 ; +uint64_t rsvd_150_148 :3 ; +uint64_t spb_ena :1 ; +uint64_t lpb_sizem1 :12 ; +uint64_t first_skip :7 ; +uint64_t rsvd_171 :1 ; +uint64_t later_skip :6 ; +uint64_t xqe_imm_size :6 ; +uint64_t rsvd_189_184 :6 ; +uint64_t xqe_imm_copy :1 ; +uint64_t xqe_hdr_split :1 ; +uint64_t xqe_drop :8 ; +uint64_t xqe_pass :8 ; +uint64_t wqe_pool_drop :8 ; +uint64_t wqe_pool_pass :8 ; +uint64_t spb_aura_drop :8 ; +uint64_t spb_aura_pass :8 ; +uint64_t spb_pool_drop :8 ; +uint64_t spb_pool_pass :8 ; +uint64_t lpb_aura_drop :8 ; +uint64_t lpb_aura_pass :8 ; +uint64_t lpb_pool_drop :8 ; +uint64_t lpb_pool_pass :8 ; +uint64_t rsvd_291_288 :4 ; +uint64_t rq_int :8 ; +uint64_t rq_int_ena :8 ; +uint64_t qint_idx :7 ; +uint64_t rsvd_319_315 :5 ; +uint64_t ltag :24 ; +uint64_t good_utag :8 ; +uint64_t bad_utag :8 ; +uint64_t flow_tagw :6 ; +uint64_t rsvd_383_366 :18 ; +uint64_t octs :48 ; +uint64_t rsvd_447_432 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_511_496 :16 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_575_560 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_639_624 :16 ; +uint64_t re_pkts :48 ; +uint64_t rsvd_703_688 :16 ; +uint64_t rsvd_767_704 :64 ;/* W11 */ +uint64_t rsvd_831_768 :64 ;/* W12 */ +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t rsvd_959_896 :64 ;/* W14 */ +uint64_t rsvd_1023_960 :64 ;/* W15 */ +}; + +/* NIX receive side scaling entry structure */ +struct nix_rsse_s { +uint32_t rq :20 ; +uint32_t rsvd_31_20 :12 ; +}; + +/* NIX receive action structure */ +struct nix_rx_action_s { +uint64_t op :4 ; +uint64_t pf_func :16 ; +uint64_t index :20 ; +uint64_t match_id :16 ; +uint64_t flow_key_alg :5 ; +uint64_t rsvd_63_61 :3 ; +}; + +/* NIX receive immediate sub descriptor structure */ +struct nix_rx_imm_s { +uint64_t size :16 ; +uint64_t apad :3 ; +uint64_t rsvd_59_19 :41 ; +uint64_t subdc :4 ; +}; + +/* NIX receive multicast/mirror entry structure */ +struct nix_rx_mce_s { +uint64_t op :2 ; +uint64_t rsvd_2 :1 ; +uint64_t eol :1 ; +uint64_t index :20 ; +uint64_t rsvd_31_24 :8 ; +uint64_t pf_func :16 ; +uint64_t next :16 ; +}; + +/* NIX receive parse structure */ +union nix_rx_parse_u { +struct { +uint64_t chan :12 ; +uint64_t desc_sizem1 :5 ; +uint64_t imm_copy :1 ; +uint64_t express :1 ; +uint64_t wqwd :1 ; +uint64_t errlev :4 ; +uint64_t errcode :8 ; +uint64_t latype :4 ; +uint64_t lbtype :4 ; +uint64_t lctype :4 ; +uint64_t ldtype :4 ; +uint64_t letype :4 ; +uint64_t lftype :4 ; +uint64_t lgtype :4 ; +uint64_t lhtype :4 ; +uint64_t pkt_lenm1 :16 ; +uint64_t l2m :1 ; +uint64_t l2b :1 ; +uint64_t l3m :1 ; +uint64_t l3b :1 ; +uint64_t vtag0_valid :1 ; +uint64_t vtag0_gone :1 ; +uint64_t vtag1_valid :1 ; +uint64_t vtag1_gone :1 ; +uint64_t pkind :6 ; +uint64_t nix_idx :2 ; +uint64_t vtag0_tci :16 ; +uint64_t vtag1_tci :16 ; +uint64_t laflags :8 ; +uint64_t lbflags :8 ; +uint64_t lcflags :8 ; +uint64_t ldflags :8 ; +uint64_t leflags :8 ; +uint64_t lfflags :8 ; +uint64_t lgflags :8 ; +uint64_t lhflags :8 ; +uint64_t eoh_ptr :8 ; +uint64_t wqe_aura :20 ; +uint64_t pb_aura :20 ; +uint64_t match_id :16 ; +uint64_t laptr :8 ; +uint64_t lbptr :8 ; +uint64_t lcptr :8 ; +uint64_t ldptr :8 ; +uint64_t leptr :8 ; +uint64_t lfptr :8 ; +uint64_t lgptr :8 ; +uint64_t lhptr :8 ; +uint64_t vtag0_ptr :8 ; +uint64_t vtag1_ptr :8 ; +uint64_t flow_key_alg :5 ; +uint64_t rsvd_341 :1 ; +uint64_t rsvd_349_342 :8 ; +uint64_t rsvd_353_350 :4 ; +uint64_t rsvd_359_354 :6 ; +uint64_t color :2 ; +uint64_t rsvd_381_362 :20 ; +uint64_t rsvd_382 :1 ; +uint64_t rsvd_383 :1 ; +uint64_t rsvd_447_384 :64 ;/* W6 */ + }; +struct { +uint64_t chan :12 ; +uint64_t desc_sizem1 :5 ; +uint64_t imm_copy :1 ; +uint64_t express :1 ; +uint64_t wqwd :1 ; +uint64_t errlev :4 ; +uint64_t errcode :8 ; +uint64_t latype :4 ; +uint64_t lbtype :4 ; +uint64_t lctype :4 ; +uint64_t ldtype :4 ; +uint64_t letype :4 ; +uint64_t lftype :4 ; +uint64_t lgtype :4 ; +uint64_t lhtype :4 ; +uint64_t pkt_lenm1 :16 ; +uint64_t l2m :1 ; +uint64_t l2b :1 ; +uint64_t l3m :1 ; +uint64_t l3b :1 ; +uint64_t vtag0_valid :1 ; +uint64_t vtag0_gone :1 ; +uint64_t vtag1_valid :1 ; +uint64_t vtag1_gone :1 ; +uint64_t pkind :6 ; +uint64_t rsvd_95_94 :2 ; +uint64_t vtag0_tci :16 ; +uint64_t vtag1_tci :16 ; +uint64_t laflags :8 ; +uint64_t lbflags :8 ; +uint64_t lcflags :8 ; +uint64_t ldflags :8 ; +uint64_t leflags :8 ; +uint64_t lfflags :8 ; +uint64_t lgflags :8 ; +uint64_t lhflags :8 ; +uint64_t eoh_ptr :8 ; +uint64_t wqe_aura :20 ; +uint64_t pb_aura :20 ; +uint64_t match_id :16 ; +uint64_t laptr :8 ; +uint64_t lbptr :8 ; +uint64_t lcptr :8 ; +uint64_t ldptr :8 ; +uint64_t leptr :8 ; +uint64_t lfptr :8 ; +uint64_t lgptr :8 ; +uint64_t lhptr :8 ; +uint64_t vtag0_ptr :8 ; +uint64_t vtag1_ptr :8 ; +uint64_t flow_key_alg :5 ; +uint64_t rsvd_383_341 :43 ; +uint64_t rsvd_447_384 :64 ;/* W6 */ + } cn9k; +}; + +/* NIX receive scatter/gather sub descriptor structure */ +struct nix_rx_sg_s { +uint64_t seg1_size :16 ; +uint64_t seg2_size :16 ; +uint64_t seg3_size :16 ; +uint64_t segs :2 ; +uint64_t rsvd_59_50 :10 ; +uint64_t subdc :4 ; +}; + +/* NIX receive vtag action structure */ +union nix_rx_vtag_action_u { +struct { +uint64_t vtag0_relptr :8 ; +uint64_t vtag0_lid :3 ; +uint64_t sa_xor :1 ; +uint64_t vtag0_type :3 ; +uint64_t vtag0_valid :1 ; +uint64_t sa_lo :16 ; +uint64_t vtag1_relptr :8 ; +uint64_t vtag1_lid :3 ; +uint64_t rsvd_43 :1 ; +uint64_t vtag1_type :3 ; +uint64_t vtag1_valid :1 ; +uint64_t sa_hi :16 ; + }; +struct { +uint64_t vtag0_relptr :8 ; +uint64_t vtag0_lid :3 ; +uint64_t rsvd_11 :1 ; +uint64_t vtag0_type :3 ; +uint64_t vtag0_valid :1 ; +uint64_t rsvd_31_16 :16 ; +uint64_t vtag1_relptr :8 ; +uint64_t vtag1_lid :3 ; +uint64_t rsvd_43 :1 ; +uint64_t vtag1_type :3 ; +uint64_t vtag1_valid :1 ; +uint64_t rsvd_63_48 :16 ; + } cn9k; +}; + +/* NIX send completion structure */ +struct nix_send_comp_s { +uint64_t status :8 ; +uint64_t sqe_id :16 ; +uint64_t rsvd_63_24 :40 ; +}; + +/* NIX send CRC sub descriptor structure */ +struct nix_send_crc_s { +uint64_t size :16 ; +uint64_t start :16 ; +uint64_t insert :16 ; +uint64_t rsvd_57_48 :10 ; +uint64_t alg :2 ; +uint64_t subdc :4 ; +uint64_t iv :32 ; +uint64_t rsvd_127_96 :32 ; +}; + +/* NIX send extended header sub descriptor structure */ +PLT_STD_C11 +union nix_send_ext_w0_u { +uint64_t u; +struct { +uint64_t lso_mps :14 ; +uint64_t lso :1 ; +uint64_t tstmp :1 ; +uint64_t lso_sb :8 ; +uint64_t lso_format :5 ; +uint64_t rsvd_31_29 :3 ; +uint64_t shp_chg :9 ; +uint64_t shp_dis :1 ; +uint64_t shp_ra :2 ; +uint64_t markptr :8 ; +uint64_t markform :7 ; +uint64_t mark_en :1 ; +uint64_t subdc :4 ; + }; +}; + +PLT_STD_C11 +union nix_send_ext_w1_u { +uint64_t u; +struct { +uint64_t vlan0_ins_ptr :8 ; +uint64_t vlan0_ins_tci :16 ; +uint64_t vlan1_ins_ptr :8 ; +uint64_t vlan1_ins_tci :16 ; +uint64_t vlan0_ins_ena :1 ; +uint64_t vlan1_ins_ena :1 ; +uint64_t init_color :2 ; +uint64_t rsvd_127_116 :12 ; + }; +struct { +uint64_t vlan0_ins_ptr :8 ; +uint64_t vlan0_ins_tci :16 ; +uint64_t vlan1_ins_ptr :8 ; +uint64_t vlan1_ins_tci :16 ; +uint64_t vlan0_ins_ena :1 ; +uint64_t vlan1_ins_ena :1 ; +uint64_t rsvd_127_114 :14 ; + } cn9k; +}; + +struct nix_send_ext_s { +union nix_send_ext_w0_u w0; +union nix_send_ext_w1_u w1; +}; + +/* NIX send header sub descriptor structure */ +PLT_STD_C11 +union nix_send_hdr_w0_u { +uint64_t u; +struct { +uint64_t total :18 ; +uint64_t rsvd_18 :1 ; +uint64_t df :1 ; +uint64_t aura :20 ; +uint64_t sizem1 :3 ; +uint64_t pnc :1 ; +uint64_t sq :20 ; + }; +}; + +PLT_STD_C11 +union nix_send_hdr_w1_u { +uint64_t u; +struct { +uint64_t ol3ptr :8 ; +uint64_t ol4ptr :8 ; +uint64_t il3ptr :8 ; +uint64_t il4ptr :8 ; +uint64_t ol3type :4 ; +uint64_t ol4type :4 ; +uint64_t il3type :4 ; +uint64_t il4type :4 ; +uint64_t sqe_id :16 ; + }; +}; + +struct nix_send_hdr_s { +union nix_send_hdr_w0_u w0; +union nix_send_hdr_w1_u w1; +}; + +/* NIX send immediate sub descriptor structure */ +struct nix_send_imm_s { +uint64_t size :16 ; +uint64_t apad :3 ; +uint64_t rsvd_59_19 :41 ; +uint64_t subdc :4 ; +}; + +/* NIX send jump sub descriptor structure */ +struct nix_send_jump_s { +uint64_t sizem1 :7 ; +uint64_t rsvd_13_7 :7 ; +uint64_t ld_type :2 ; +uint64_t aura :20 ; +uint64_t rsvd_58_36 :23 ; +uint64_t f :1 ; +uint64_t subdc :4 ; +uint64_t addr :64 ;/* W1 */ +}; + +/* NIX send memory sub descriptor structure */ +PLT_STD_C11 +union nix_send_mem_w0_u { +uint64_t u; +struct { +uint64_t offset :16 ; +uint64_t rsvd_51_16 :36 ; +uint64_t per_lso_seg :1 ; +uint64_t wmem :1 ; +uint64_t dsz :2 ; +uint64_t alg :4 ; +uint64_t subdc :4 ; + }; +struct { +uint64_t offset :16 ; +uint64_t rsvd_52_16 :37 ; +uint64_t wmem :1 ; +uint64_t dsz :2 ; +uint64_t alg :4 ; +uint64_t subdc :4 ; + } cn9k; +}; + +struct nix_send_mem_s { +union nix_send_mem_w0_u w0; +uint64_t addr :64 ;/* W1 */ +}; + +/* NIX send scatter/gather sub descriptor structure */ +PLT_STD_C11 +union nix_send_sg2_s { +uint64_t u; +struct { +uint64_t seg1_size :16 ; +uint64_t aura :20 ; +uint64_t i1 :1 ; +uint64_t fabs :1 ; +uint64_t foff :8 ; +uint64_t rsvd_57_46 :12 ; +uint64_t ld_type :2 ; +uint64_t subdc :4 ; + }; +}; + +PLT_STD_C11 +union nix_send_sg_s { +uint64_t u; +struct { +uint64_t seg1_size :16 ; +uint64_t seg2_size :16 ; +uint64_t seg3_size :16 ; +uint64_t segs :2 ; +uint64_t rsvd_54_50 :5 ; +uint64_t i1 :1 ; +uint64_t i2 :1 ; +uint64_t i3 :1 ; +uint64_t ld_type :2 ; +uint64_t subdc :4 ; + }; +}; + +/* NIX send work sub descriptor structure */ +struct nix_send_work_s { +uint64_t tag :32 ; +uint64_t tt :2 ; +uint64_t grp :10 ; +uint64_t rsvd_59_44 :16 ; +uint64_t subdc :4 ; +uint64_t addr :64 ;/* W1 */ +}; + +/* [CN10K, .) NIX sq context hardware structure */ +struct nix_cn10k_sq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t substream :20 ; +uint64_t max_sqe_size :2 ; +uint64_t sqe_way_mask :16 ; +uint64_t sqb_aura :20 ; +uint64_t gbl_rsvd1 :5 ; +uint64_t cq_id :20 ; +uint64_t cq_ena :1 ; +uint64_t qint_idx :6 ; +uint64_t gbl_rsvd2 :1 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t xoff :1 ; +uint64_t sqe_stype :2 ; +uint64_t gbl_rsvd :17 ; +uint64_t head_sqb :64 ;/* W2 */ +uint64_t head_offset :6 ; +uint64_t sqb_dequeue_count :16 ; +uint64_t default_chan :12 ; +uint64_t sdp_mcast :1 ; +uint64_t sso_ena :1 ; +uint64_t dse_rsvd1 :28 ; +uint64_t sqb_enqueue_count :16 ; +uint64_t tail_offset :6 ; +uint64_t lmt_dis :1 ; +uint64_t smq_rr_weight :14 ; +uint64_t dnq_rsvd1 :27 ; +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t next_sqb :64 ;/* W6 */ +uint64_t smq :10 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t mnq_dis :1 ; +uint64_t scm1_rsvd2 :31 ; +uint64_t smenq_sqb :64 ;/* W8 */ +uint64_t smenq_offset :6 ; +uint64_t cq_limit :8 ; +uint64_t smq_rr_count :32 ; +uint64_t scm_lso_rem :18 ; +uint64_t smq_lso_segnum :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t scm_dq_rsvd1 :9 ; +uint64_t smenq_next_sqb :64 ;/* W11 */ +uint64_t age_drop_octs :32 ; +uint64_t age_drop_pkts :32 ; +uint64_t drop_pkts :48 ; +uint64_t drop_octs_lsw :16 ; +uint64_t drop_octs_msw :32 ; +uint64_t pkts_lsw :32 ; +uint64_t pkts_msw :16 ; +uint64_t octs :48 ; +}; + +/* NIX sq context hardware structure */ +struct nix_sq_ctx_hw_s { +uint64_t ena :1 ; +uint64_t substream :20 ; +uint64_t max_sqe_size :2 ; +uint64_t sqe_way_mask :16 ; +uint64_t sqb_aura :20 ; +uint64_t gbl_rsvd1 :5 ; +uint64_t cq_id :20 ; +uint64_t cq_ena :1 ; +uint64_t qint_idx :6 ; +uint64_t gbl_rsvd2 :1 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t xoff :1 ; +uint64_t sqe_stype :2 ; +uint64_t gbl_rsvd :17 ; +uint64_t head_sqb :64 ;/* W2 */ +uint64_t head_offset :6 ; +uint64_t sqb_dequeue_count :16 ; +uint64_t default_chan :12 ; +uint64_t sdp_mcast :1 ; +uint64_t sso_ena :1 ; +uint64_t dse_rsvd1 :28 ; +uint64_t sqb_enqueue_count :16 ; +uint64_t tail_offset :6 ; +uint64_t lmt_dis :1 ; +uint64_t smq_rr_quantum :24 ; +uint64_t dnq_rsvd1 :17 ; +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t next_sqb :64 ;/* W6 */ +uint64_t mnq_dis :1 ; +uint64_t smq :9 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t scm1_rsvd2 :32 ; +uint64_t smenq_sqb :64 ;/* W8 */ +uint64_t smenq_offset :6 ; +uint64_t cq_limit :8 ; +uint64_t smq_rr_count :25 ; +uint64_t scm_lso_rem :18 ; +uint64_t scm_dq_rsvd0 :7 ; +uint64_t smq_lso_segnum :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t scm_dq_rsvd1 :9 ; +uint64_t smenq_next_sqb :64 ;/* W11 */ +uint64_t seb_rsvd1 :64 ;/* W12 */ +uint64_t drop_pkts :48 ; +uint64_t drop_octs_lsw :16 ; +uint64_t drop_octs_msw :32 ; +uint64_t pkts_lsw :32 ; +uint64_t pkts_msw :16 ; +uint64_t octs :48 ; +}; + +/* [CN10K, .) NIX Send queue context structure */ +struct nix_cn10k_sq_ctx_s { +uint64_t ena :1 ; +uint64_t qint_idx :6 ; +uint64_t substream :20 ; +uint64_t sdp_mcast :1 ; +uint64_t cq :20 ; +uint64_t sqe_way_mask :16 ; +uint64_t smq :10 ; +uint64_t cq_ena :1 ; +uint64_t xoff :1 ; +uint64_t sso_ena :1 ; +uint64_t smq_rr_weight :14 ; +uint64_t default_chan :12 ; +uint64_t sqb_count :16 ; +uint64_t rsvd_120_119 :2 ; +uint64_t smq_rr_count_lb :7 ; +uint64_t smq_rr_count_ub :25 ; +uint64_t sqb_aura :20 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t sqe_stype :2 ; +uint64_t rsvd_191 :1 ; +uint64_t max_sqe_size :2 ; +uint64_t cq_limit :8 ; +uint64_t lmt_dis :1 ; +uint64_t mnq_dis :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_lso_segnum :8 ; +uint64_t tail_offset :6 ; +uint64_t smenq_offset :6 ; +uint64_t head_offset :6 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t rsvd_255_253 :3 ; +uint64_t next_sqb :64 ;/* W4 */ +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t smenq_sqb :64 ;/* W6 */ +uint64_t smenq_next_sqb :64 ;/* W7 */ +uint64_t head_sqb :64 ;/* W8 */ +uint64_t rsvd_583_576 :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t rsvd_639_630 :10 ; +uint64_t scm_lso_rem :18 ; +uint64_t rsvd_703_658 :46 ; +uint64_t octs :48 ; +uint64_t rsvd_767_752 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_831_816 :16 ; +uint64_t aged_drop_octs :32 ; +uint64_t aged_drop_pkts :32 ; +uint64_t drop_octs :48 ; +uint64_t rsvd_959_944 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_1023_1008 :16 ; +}; + +/* NIX send queue context structure */ +struct nix_sq_ctx_s { +uint64_t ena :1 ; +uint64_t qint_idx :6 ; +uint64_t substream :20 ; +uint64_t sdp_mcast :1 ; +uint64_t cq :20 ; +uint64_t sqe_way_mask :16 ; +uint64_t smq :9 ; +uint64_t cq_ena :1 ; +uint64_t xoff :1 ; +uint64_t sso_ena :1 ; +uint64_t smq_rr_quantum :24 ; +uint64_t default_chan :12 ; +uint64_t sqb_count :16 ; +uint64_t smq_rr_count :25 ; +uint64_t sqb_aura :20 ; +uint64_t sq_int :8 ; +uint64_t sq_int_ena :8 ; +uint64_t sqe_stype :2 ; +uint64_t rsvd_191 :1 ; +uint64_t max_sqe_size :2 ; +uint64_t cq_limit :8 ; +uint64_t lmt_dis :1 ; +uint64_t mnq_dis :1 ; +uint64_t smq_next_sq :20 ; +uint64_t smq_lso_segnum :8 ; +uint64_t tail_offset :6 ; +uint64_t smenq_offset :6 ; +uint64_t head_offset :6 ; +uint64_t smenq_next_sqb_vld :1 ; +uint64_t smq_pend :1 ; +uint64_t smq_next_sq_vld :1 ; +uint64_t rsvd_255_253 :3 ; +uint64_t next_sqb :64 ;/* W4 */ +uint64_t tail_sqb :64 ;/* W5 */ +uint64_t smenq_sqb :64 ;/* W6 */ +uint64_t smenq_next_sqb :64 ;/* W7 */ +uint64_t head_sqb :64 ;/* W8 */ +uint64_t rsvd_583_576 :8 ; +uint64_t vfi_lso_total :18 ; +uint64_t vfi_lso_sizem1 :3 ; +uint64_t vfi_lso_sb :8 ; +uint64_t vfi_lso_mps :14 ; +uint64_t vfi_lso_vlan0_ins_ena :1 ; +uint64_t vfi_lso_vlan1_ins_ena :1 ; +uint64_t vfi_lso_vld :1 ; +uint64_t rsvd_639_630 :10 ; +uint64_t scm_lso_rem :18 ; +uint64_t rsvd_703_658 :46 ; +uint64_t octs :48 ; +uint64_t rsvd_767_752 :16 ; +uint64_t pkts :48 ; +uint64_t rsvd_831_816 :16 ; +uint64_t rsvd_895_832 :64 ;/* W13 */ +uint64_t drop_octs :48 ; +uint64_t rsvd_959_944 :16 ; +uint64_t drop_pkts :48 ; +uint64_t rsvd_1023_1008 :16 ; +}; + +/* NIX transmit action structure */ +struct nix_tx_action_s { +uint64_t op :4 ; +uint64_t rsvd_11_4 :8 ; +uint64_t index :20 ; +uint64_t match_id :16 ; +uint64_t rsvd_63_48 :16 ; +}; + +/* NIX transmit vtag action structure */ +struct nix_tx_vtag_action_s { +uint64_t vtag0_relptr :8 ; +uint64_t vtag0_lid :3 ; +uint64_t rsvd_11 :1 ; +uint64_t vtag0_op :2 ; +uint64_t rsvd_15_14 :2 ; +uint64_t vtag0_def :10 ; +uint64_t rsvd_31_26 :6 ; +uint64_t vtag1_relptr :8 ; +uint64_t vtag1_lid :3 ; +uint64_t rsvd_43 :1 ; +uint64_t vtag1_op :2 ; +uint64_t rsvd_47_46 :2 ; +uint64_t vtag1_def :10 ; +uint64_t rsvd_63_58 :6 ; +}; + +/* NIX work queue entry header structure */ +struct nix_wqe_hdr_s { +uint64_t tag :32 ; +uint64_t tt :2 ; +uint64_t grp :10 ; +uint64_t node :2 ; +uint64_t q :14 ; +uint64_t wqe_type :4 ; +}; + +/* NIX Rx flow key algorithm field structure */ +struct nix_rx_flowkey_alg { +uint64_t key_offset :6 ; +uint64_t ln_mask :1 ; +uint64_t fn_mask :1 ; +uint64_t hdr_offset :8 ; +uint64_t bytesm1 :5 ; +uint64_t lid :3 ; +uint64_t reserved_24_24 :1 ; +uint64_t ena :1 ; +uint64_t sel_chan :1 ; +uint64_t ltype_mask :4 ; +uint64_t ltype_match :4 ; +uint64_t reserved_35_63 :29 ; +}; + +/* NIX LSO format field structure */ +struct nix_lso_format { +uint64_t offset :8 ; +uint64_t layer :2 ; +uint64_t rsvd_10_11 :2 ; +uint64_t sizem1 :2 ; +uint64_t rsvd_14_15 :2 ; +uint64_t alg :3 ; +uint64_t rsvd_19_63 :45 ; +}; + +#define NIX_LSO_FIELD_MAX (8) +#define NIX_LSO_FIELD_ALG_MASK GENMASK(18, 16) +#define NIX_LSO_FIELD_SZ_MASK GENMASK(13, 12) +#define NIX_LSO_FIELD_LY_MASK GENMASK(9, 8) +#define NIX_LSO_FIELD_OFF_MASK GENMASK(7, 0) + +#define NIX_LSO_FIELD_MASK \ + (NIX_LSO_FIELD_OFF_MASK | NIX_LSO_FIELD_LY_MASK | \ + NIX_LSO_FIELD_SZ_MASK | NIX_LSO_FIELD_ALG_MASK) + +#define NIX_CN9K_MAX_HW_FRS 9212UL +#define NIX_LBK_MAX_HW_FRS 65535UL +#define NIX_RPM_MAX_HW_FRS 16380UL +#define NIX_MIN_HW_FRS 60UL + +/* NIX rate limits */ +#define NIX_TM_MAX_RATE_DIV_EXP 12 +#define NIX_TM_MAX_RATE_EXPONENT 0xf +#define NIX_TM_MAX_RATE_MANTISSA 0xff + +#define NIX_TM_SHAPER_RATE_CONST ((uint64_t)2E6) + +/* NIX rate calculation in Bits/Sec +* PIR_ADD = ((256 + NIX_*_PIR[RATE_MANTISSA]) +* << NIX_*_PIR[RATE_EXPONENT]) / 256 +* PIR = (2E6 * PIR_ADD / (1 << NIX_*_PIR[RATE_DIVIDER_EXPONENT])) +* +* CIR_ADD = ((256 + NIX_*_CIR[RATE_MANTISSA]) +* << NIX_*_CIR[RATE_EXPONENT]) / 256 +* CIR = (2E6 * CIR_ADD / (CCLK_TICKS << NIX_*_CIR[RATE_DIVIDER_EXPONENT])) +*/ +#define NIX_TM_SHAPER_RATE (exponent, mantissa, div_exp) \ + ((NIX_TM_SHAPER_RATE_CONST * ((256 + (mantissa)) << (exponent))) / \ + (((1ull << (div_exp)) * 256))) + +/* Rate limit in Bits/Sec */ +#define NIX_TM_MIN_SHAPER_RATE NIX_TM_SHAPER_RATE(0, 0, NIX_TM_MAX_RATE_DIV_EXP) + +#define NIX_TM_MAX_SHAPER_RATE \ + NIX_TM_SHAPER_RATE(NIX_TM_MAX_RATE_EXPONENT, NIX_TM_MAX_RATE_MANTISSA, \ + 0) + +/* NIX burst limits */ +#define NIX_TM_MAX_BURST_EXPONENT 0xf +#define NIX_TM_MAX_BURST_MANTISSA 0xff + +/* NIX burst calculation +* PIR_BURST = ((256 + NIX_*_PIR[BURST_MANTISSA]) +* << (NIX_*_PIR[BURST_EXPONENT] + 1)) +* / 256 +* +* CIR_BURST = ((256 + NIX_*_CIR[BURST_MANTISSA]) +* << (NIX_*_CIR[BURST_EXPONENT] + 1)) +* / 256 +*/ +#define NIX_TM_SHAPER_BURST (exponent, mantissa) \ + (((256 + (mantissa)) << ((exponent) + 1)) / 256) + +/* Burst limit in Bytes */ +#define NIX_TM_MIN_SHAPER_BURST NIX_TM_SHAPER_BURST(0, 0) + +#define NIX_TM_MAX_SHAPER_BURST \ + NIX_TM_SHAPER_BURST(NIX_TM_MAX_BURST_EXPONENT, \ + NIX_TM_MAX_BURST_MANTISSA) + +/* Min is limited so that NIX_AF_SMQX_CFG[MINLEN]+ADJUST is not -ve */ +#define NIX_TM_LENGTH_ADJUST_MIN ((int)-NIX_MIN_HW_FRS + 1) +#define NIX_TM_LENGTH_ADJUST_MAX 255 + +#define NIX_TM_TLX_SP_PRIO_MAX 10 +#define NIX_CN9K_TM_RR_QUANTUM_MAX (BIT_ULL(24) - 1) +#define NIX_TM_RR_QUANTUM_MAX (BIT_ULL(14) - 1) + +/* [CN9K, CN10K) */ +#define NIX_CN9K_TXSCH_LVL_SMQ_MAX 512 + +/* [CN10K, .) */ +#define NIX_TXSCH_LVL_SMQ_MAX 832 + +/* [CN9K, .) */ +#define NIX_TXSCH_LVL_TL4_MAX 512 +#define NIX_TXSCH_LVL_TL3_MAX 256 +#define NIX_TXSCH_LVL_TL2_MAX 256 +#define NIX_TXSCH_LVL_TL1_MAX 28 + +#define NIX_CQ_OP_STAT_OP_ERR 63 +#define NIX_CQ_OP_STAT_CQ_ERR 46 + +#define NIX_RQ_CN10K_SPB_MAX_SIZE 4096 + +/* [CN9K, .) */ +#define NIX_LSO_SEG_MAX 256 +#define NIX_LSO_MPS_MAX (BIT_ULL(14) - 1) + +/* Software defined LSO base format IDX */ +#define NIX_LSO_FORMAT_IDX_TSOV4 0 +#define NIX_LSO_FORMAT_IDX_TSOV6 1 + +#endif /* __NIX_HW_H__ */
drivers/common/cnxk/hw/npa.h new file +376 -0
376 lines not on this page · raw message
drivers/common/cnxk/hw/npc.h new file +525 -0
433 lines not on this page · raw message
drivers/common/cnxk/hw/rvu.h new file +222 -0
222 lines not on this page · raw message
drivers/common/cnxk/hw/sdp.h new file +182 -0
182 lines not on this page · raw message
drivers/common/cnxk/hw/sso.h new file +233 -0
233 lines not on this page · raw message
drivers/common/cnxk/hw/ssow.h new file +70 -0
70 lines not on this page · raw message
drivers/common/cnxk/hw/tim.h new file +49 -0
49 lines not on this page · raw message
drivers/common/cnxk/meson.build new file +14 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_api.h new file +69 -0
69 lines not on this page · raw message
drivers/common/cnxk/roc_bitfield.h new file +15 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_bits.h new file +32 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_platform.c new file +5 -0
Lines of this file are not shown. View the raw message.
drivers/common/cnxk/roc_platform.h new file +154 -0
154 lines not on this page · raw message
drivers/common/cnxk/version.map new file +4 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.8.4
Part of the diff is not shown here. View the raw message.
PATCH v5 3/52 common/cnxk: add model init and IO handling API
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add routines for SoC model identification and HW IO handling routines specific to CN9K and CN10K Marvell SoC's. These are based on arm64 ISA and behaviour specific to Marvell SoC's.
--- drivers/common/cnxk/meson.build | 4 +- drivers/common/cnxk/roc_api.h | 13 +++ drivers/common/cnxk/roc_io.h | 187 ++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_io_generic.h | 122 +++++++++++++++++++++ drivers/common/cnxk/roc_model.c | 204 +++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_model.h | 128 ++++++++++++++++++++++ drivers/common/cnxk/roc_platform.c | 28 +++++ drivers/common/cnxk/roc_platform.h | 10 ++ drivers/common/cnxk/roc_priv.h | 11 ++ drivers/common/cnxk/roc_util_priv.h | 14 +++ drivers/common/cnxk/roc_utils.c | 35 ++++++ drivers/common/cnxk/roc_utils.h | 13 +++ drivers/common/cnxk/version.map | 5 + 13 files changed, 773 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/roc_io.h create mode 100644 drivers/common/cnxk/roc_io_generic.h create mode 100644 drivers/common/cnxk/roc_model.c create mode 100644 drivers/common/cnxk/roc_model.h create mode 100644 drivers/common/cnxk/roc_priv.h create mode 100644 drivers/common/cnxk/roc_util_priv.h create mode 100644 drivers/common/cnxk/roc_utils.c create mode 100644 drivers/common/cnxk/roc_utils.h
drivers/common/cnxk/meson.build +3 -1
@@ -10,5 +10,7 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] -sources = files('roc_platform.c') +sources = files('roc_model.c', + 'roc_platform.c', + 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_api.h +13 -0
@@ -29,6 +29,13 @@#define ROC_LMT_BASE_PER_CORE_LOG2 \ (ROC_LMT_LINES_PER_CORE_LOG2 + ROC_LMT_LINE_SIZE_LOG2) +/* IO */ +#if defined(__aarch64__) +#include "roc_io.h" +#else +#include "roc_io_generic.h" +#endif +/* PCI IDs */ #define PCI_VENDOR_ID_CAVIUM 0x177D#define PCI_DEVID_CNXK_RVU_PF 0xA063
@@ -66,4 +73,10 @@#include "hw/ssow.h" #include "hw/tim.h" +/* Model */ +#include "roc_model.h" + +/* Utils */ +#include "roc_utils.h" +#endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_io.h new file +187 -0
187 lines not on this page · raw message
drivers/common/cnxk/roc_io_generic.h new file +122 -0
122 lines not on this page · raw message
drivers/common/cnxk/roc_model.c new file +204 -0
204 lines not on this page · raw message
drivers/common/cnxk/roc_model.h new file +128 -0
128 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +28 -0
@@ -3,3 +3,31 @@*/ #include "roc_api.h" + +int +roc_plt_init (void ) +{ +const struct rte_memzone *mz; + + mz =rte_memzone_lookup (PLT_MODEL_MZ_NAME ); +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { +if (mz ==NULL ) { + mz =rte_memzone_reserve (PLT_MODEL_MZ_NAME , +sizeof (struct roc_model ), +SOCKET_ID_ANY ,0 ); +if (mz ==NULL ) { +plt_err ("Failed to reserve mem for roc_model" ); +return -ENOMEM ; + } +roc_model_init (mz->addr); + } + }else { +if (mz ==NULL ) { +plt_err ("Failed to lookup mem for roc_model" ); +return -ENOMEM ; + } + roc_model = mz->addr; + } + +return 0 ; +}
drivers/common/cnxk/roc_platform.h +10 -0
@@ -131,6 +131,13 @@#define plt_strlcpy rte_strlcpy +/* Log */ +#define plt_err(fmt, args...) \ + RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args) +#define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) +#define plt_warn(fmt, args...) RTE_LOG(WARNING, PMD, fmt "\n", ##args) +#define plt_print(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) +#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \ { \
@@ -151,4 +158,7 @@ }#endif +__rte_internal +int roc_plt_init(void); +#endif /* _ROC_PLATFORM_H_ */
drivers/common/cnxk/roc_priv.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_PRIV_H_ +#define _ROC_PRIV_H_ + +/* Utils */ +#include "roc_util_priv.h" + +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/roc_util_priv.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_UTIL_PRIV_H_ +#define _ROC_UTIL_PRIV_H_ + +enum util_err_status { +UTIL_ERR_PARAM =-6000 , +UTIL_ERR_FS , +UTIL_ERR_INVALID_MODEL , +}; + +#endif /* _ROC_UTIL_PRIV_H_ */
drivers/common/cnxk/roc_utils.c new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#include "roc_api.h" +#include "roc_priv.h" + +const char * +roc_error_msg_get (int errorcode) +{ +const char *err_msg; + +switch (errorcode) { +case UTIL_ERR_PARAM : + err_msg ="Invalid parameter" ; +break ; +case UTIL_ERR_FS : + err_msg ="file operation failed" ; +break ; +case UTIL_ERR_INVALID_MODEL : + err_msg ="Invalid RoC model" ; +break ; +default : +/** +* Handle general error (as defined in linux errno.h) +*/ +if (abs (errorcode) <300 ) + err_msg =strerror (abs (errorcode)); +else + err_msg ="Unknown error code" ; +break ; + } + +return err_msg; +}
drivers/common/cnxk/roc_utils.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_UTILS_H_ +#define _ROC_UTILS_H_ + +#include "roc_platform.h" + +/* Utils */ +const char *__roc_api roc_error_msg_get(int errorcode); + +#endif /* _ROC_UTILS_H_ */
drivers/common/cnxk/version.map +5 -0
@@ -1,4 +1,9 @@ INTERNAL { + global: + + roc_error_msg_get; + roc_model; + roc_plt_init; local: *; };
Signature · 1 line
2.8.4
PATCH v5 4/52 common/cnxk: add roc plt init callback support
In reply to Nithin DabilpuramFrom: Ashwin Sekhar T K <[email protected]>
Add support for registering callbacks for roc plt init.
--- drivers/common/cnxk/roc_platform.c | 22 ++++++++++++++++++++++ drivers/common/cnxk/roc_platform.h | 4 ++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 27 insertions(+)
drivers/common/cnxk/roc_platform.c +22 -0
@@ -4,10 +4,26 @@#include "roc_api.h" +#define PLT_INIT_CB_MAX 8 + +static int plt_init_cb_num; +static roc_plt_init_cb_t plt_init_cbs[PLT_INIT_CB_MAX ]; + +int +roc_plt_init_cb_register (roc_plt_init_cb_t cb) +{ +if (plt_init_cb_num >=PLT_INIT_CB_MAX ) +return -ERANGE ; + + plt_init_cbs[plt_init_cb_num++] = cb; +return 0 ; +} +int roc_plt_init (void ) {const struct rte_memzone *mz; +int i, rc; mz =rte_memzone_lookup (PLT_MODEL_MZ_NAME );if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {
@@ -29,5 +45,11 @@ roc_plt_init(void) roc_model = mz->addr; } +for (i =0 ; i < plt_init_cb_num; i++) { + rc = (*plt_init_cbs[i])(); +if (rc) +return rc; + } +return 0 ; }
drivers/common/cnxk/roc_platform.h +4 -0
@@ -161,4 +161,8 @@__rte_internal int roc_plt_init(void); +/* Init callbacks */ +typedef int (*roc_plt_init_cb_t )(void ); +int __roc_api roc_plt_init_cb_register(roc_plt_init_cb_t cb); +#endif /* _ROC_PLATFORM_H_ */
drivers/common/cnxk/version.map +1 -0
@@ -4,6 +4,7 @@ INTERNAL { roc_error_msg_get; roc_model; roc_plt_init; + roc_plt_init_cb_register; local: *; };
Signature · 1 line
2.8.4
PATCH v5 5/52 common/cnxk: add interrupt helper API
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Add interrupt helper API's in common code to register and unregister for specific interrupt vectors. These API's will be used by all cnxk drivers.
--- drivers/common/cnxk/meson.build | 3 +- drivers/common/cnxk/roc_dev_priv.h | 14 +++ drivers/common/cnxk/roc_irq.c | 249 +++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_platform.c | 4 + drivers/common/cnxk/roc_platform.h | 11 ++ drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/version.map | 1 + 7 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/roc_dev_priv.h create mode 100644 drivers/common/cnxk/roc_irq.c
drivers/common/cnxk/meson.build +2 -1
@@ -10,7 +10,8 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] -sources = files('roc_model.c', +sources = files('roc_irq.c', + 'roc_model.c', 'roc_platform.c', 'roc_utils.c') includes += include_directories('../../bus/pci')
drivers/common/cnxk/roc_dev_priv.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_DEV_PRIV_H +#define _ROC_DEV_PRIV_H + +int dev_irq_register (struct plt_intr_handle *intr_handle, +plt_intr_callback_fn cb,void *data,unsigned int vec); +void dev_irq_unregister (struct plt_intr_handle *intr_handle, +plt_intr_callback_fn cb,void *data,unsigned int vec); +int dev_irqs_disable (struct plt_intr_handle *intr_handle); + +#endif /* _ROC_DEV_PRIV_H */
drivers/common/cnxk/roc_irq.c new file +249 -0
249 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +4 -0
@@ -2,6 +2,8 @@* Copyright(C) 2021 Marvell. */ +#include <rte_log.h> +#include "roc_api.h" #define PLT_INIT_CB_MAX 8
@@ -53,3 +55,5 @@ roc_plt_init(void)return 0 ; } + +RTE_LOG_REGISTER (cnxk_logtype_base, pmd.cnxk.base,NOTICE );
drivers/common/cnxk/roc_platform.h +11 -0
@@ -132,12 +132,23 @@#define plt_strlcpy rte_strlcpy/* Log */ +extern int cnxk_logtype_base; #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args) #define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) #define plt_warn(fmt, args...) RTE_LOG(WARNING, PMD, fmt "\n", ##args) #define plt_print(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args) +/** +* Log debug message if given subsystem logging is enabled. +*/ +#define plt_dbg(subsystem, fmt, args...) \ + rte_log(RTE_LOG_DEBUG, cnxk_logtype_##subsystem, \ + "[%s] %s():%u " fmt "\n", #subsystem, __func__, __LINE__, \ + ##args) + +#define plt_base_dbg (fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__) +#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \ { \
drivers/common/cnxk/roc_priv.h +3 -0
@@ -8,4 +8,7 @@/* Utils */ #include "roc_util_priv.h" +/* Dev */ +#include "roc_dev_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/version.map +1 -0
@@ -1,6 +1,7 @@ INTERNAL { global: + cnxk_logtype_base; roc_error_msg_get; roc_model; roc_plt_init;
Signature · 1 line
2.8.4
PATCH v5 6/52 common/cnxk: add mbox request and response definitions
In reply to Nithin DabilpuramFrom: 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/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_mbox.h | 1766 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1769 insertions(+) create mode 100644 drivers/common/cnxk/roc_mbox.h
drivers/common/cnxk/roc_api.h +3 -0
@@ -76,6 +76,9 @@/* Model */ #include "roc_model.h" +/* Mbox */ +#include "roc_mbox.h" +/* Utils */ #include "roc_utils.h"
drivers/common/cnxk/roc_mbox.h new file +1766 -0
1,766 lines not on this page · raw message
Signature · 1 line
2.8.4
PATCH v5 7/52 common/cnxk: add mailbox base infra
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
This patch adds mailbox infra API's to communicate with Kernel AF driver. These API's will be used by all the other cnxk drivers for mbox init/fini, send/recv functionality.
--- drivers/common/cnxk/meson.build | 1 + drivers/common/cnxk/roc_dev_priv.h | 3 + drivers/common/cnxk/roc_mbox.c | 483 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_mbox_priv.h | 215 ++++++++++++++++ drivers/common/cnxk/roc_platform.c | 1 + drivers/common/cnxk/roc_platform.h | 3 + drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/roc_utils.c | 7 + drivers/common/cnxk/roc_utils.h | 2 + drivers/common/cnxk/version.map | 2 + 10 files changed, 720 insertions(+) create mode 100644 drivers/common/cnxk/roc_mbox.c create mode 100644 drivers/common/cnxk/roc_mbox_priv.h
drivers/common/cnxk/meson.build +1 -0
@@ -11,6 +11,7 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] sources = files('roc_irq.c', + 'roc_mbox.c', 'roc_model.c', 'roc_platform.c', 'roc_utils.c')
drivers/common/cnxk/roc_dev_priv.h +3 -0
@@ -5,6 +5,9 @@#ifndef _ROC_DEV_PRIV_H#define _ROC_DEV_PRIV_H +extern uint16_t dev_rclk_freq; +extern uint16_t dev_sclk_freq; +int dev_irq_register (struct plt_intr_handle *intr_handle,plt_intr_callback_fn cb,void *data,unsigned int vec); void dev_irq_unregister(struct plt_intr_handle *intr_handle,
drivers/common/cnxk/roc_mbox.c new file +483 -0
483 lines not on this page · raw message
drivers/common/cnxk/roc_mbox_priv.h new file +215 -0
215 lines not on this page · raw message
drivers/common/cnxk/roc_platform.c +1 -0
@@ -57,3 +57,4 @@ roc_plt_init(void) }RTE_LOG_REGISTER (cnxk_logtype_base, pmd.cnxk.base,NOTICE ); +RTE_LOG_REGISTER (cnxk_logtype_mbox, pmd.cnxk.mbox,NOTICE );
drivers/common/cnxk/roc_platform.h +3 -0
@@ -133,6 +133,8 @@/* Log */ extern int cnxk_logtype_base; +extern int cnxk_logtype_mbox; + #define plt_err(fmt, args...) \ RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args) #define plt_info(fmt, args...) RTE_LOG(INFO, PMD, fmt "\n", ##args)
@@ -148,6 +150,7 @@ extern int cnxk_logtype_base; ##args)#define plt_base_dbg (fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__) +#define plt_mbox_dbg (fmt, ...) plt_dbg(mbox, fmt, ##__VA_ARGS__)#ifdef __cplusplus#define CNXK_PCI_ID (subsystem_dev, dev) \
drivers/common/cnxk/roc_priv.h +3 -0
@@ -8,6 +8,9 @@/* Utils */ #include "roc_util_priv.h" +/* Mbox */ +#include "roc_mbox_priv.h" +/* Dev */ #include "roc_dev_priv.h"
drivers/common/cnxk/roc_utils.c +7 -0
@@ -33,3 +33,10 @@ roc_error_msg_get(int errorcode)return err_msg; } + +void +roc_clk_freq_get (uint16_t *rclk_freq,uint16_t *sclk_freq) +{ + *rclk_freq = dev_rclk_freq; + *sclk_freq = dev_sclk_freq; +}
drivers/common/cnxk/roc_utils.h +2 -0
@@ -10,4 +10,6 @@/* Utils */ const char *__roc_api roc_error_msg_get(int errorcode); +void __roc_api roc_clk_freq_get(uint16_t *rclk_freq, uint16_t *sclk_freq); +#endif /* _ROC_UTILS_H_ */
drivers/common/cnxk/version.map +2 -0
@@ -2,6 +2,8 @@ INTERNAL { global: cnxk_logtype_base; + cnxk_logtype_mbox; + roc_clk_freq_get; roc_error_msg_get; roc_model; roc_plt_init;
Signature · 1 line
2.8.4
PATCH v5 8/52 common/cnxk: add base device class
In reply to Nithin DabilpuramFrom: Jerin Jacob <[email protected]>
Introduce 'dev' class to hold cnxk PCIe device specific information and operations.
All PCIe drivers(ethdev, mempool, cryptodev and eventdev) of cnxk inherits this base object to avail the common functionalities such as mailbox creation, interrupt registration, LMT setup, VF message mbox forwarding, etc.
--- drivers/common/cnxk/meson.build | 4 +- drivers/common/cnxk/roc_api.h | 3 + drivers/common/cnxk/roc_dev.c | 362 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_dev_priv.h | 42 +++++ drivers/common/cnxk/roc_idev.c | 77 ++++++++ drivers/common/cnxk/roc_idev.h | 12 ++ drivers/common/cnxk/roc_idev_priv.h | 22 +++ drivers/common/cnxk/roc_priv.h | 3 + drivers/common/cnxk/version.map | 2 + 9 files changed, 526 insertions(+), 1 deletion(-) create mode 100644 drivers/common/cnxk/roc_dev.c create mode 100644 drivers/common/cnxk/roc_idev.c create mode 100644 drivers/common/cnxk/roc_idev.h create mode 100644 drivers/common/cnxk/roc_idev_priv.h
drivers/common/cnxk/meson.build +3 -1
@@ -10,7 +10,9 @@ endif config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' deps = ['eal', 'pci', 'bus_pci', 'mbuf'] -sources = files('roc_irq.c', +sources = files('roc_dev.c', + 'roc_idev.c', + 'roc_irq.c', 'roc_mbox.c', 'roc_model.c', 'roc_platform.c',
drivers/common/cnxk/roc_api.h +3 -0
@@ -82,4 +82,7 @@/* Utils */ #include "roc_utils.h" +/* Idev */ +#include "roc_idev.h" +#endif /* _ROC_API_H_ */
drivers/common/cnxk/roc_dev.c new file +362 -0
362 lines not on this page · raw message
drivers/common/cnxk/roc_dev_priv.h +42 -0
51 lines not on this page · raw message
drivers/common/cnxk/roc_idev.c new file +77 -0
77 lines not on this page · raw message
drivers/common/cnxk/roc_idev.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_IDEV_H_ +#define _ROC_IDEV_H_ + +/* LMT */ +uint64_t __roc_api roc_idev_lmt_base_addr_get(void); +uint16_t __roc_api roc_idev_num_lmtlines_get(void); + +#endif /* _ROC_IDEV_H_ */
drivers/common/cnxk/roc_idev_priv.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2021 Marvell. +*/ + +#ifndef _ROC_IDEV_PRIV_H_ +#define _ROC_IDEV_PRIV_H_ + +/* Intra device related functions */ +struct idev_cfg { +uint16_t lmt_pf_func; +uint16_t num_lmtlines; +uint64_t lmt_base_addr; +}; + +/* Generic */ +struct idev_cfg *idev_get_cfg (void ); +void idev_set_defaults (struct idev_cfg *idev); + +/* idev lmt */ +uint16_t idev_lmt_pffunc_get (void ); + +#endif /* _ROC_IDEV_PRIV_H_ */
drivers/common/cnxk/roc_priv.h +3 -0
@@ -14,4 +14,7 @@/* Dev */ #include "roc_dev_priv.h" +/* idev */ +#include "roc_idev_priv.h" +#endif /* _ROC_PRIV_H_ */
drivers/common/cnxk/version.map +2 -0
@@ -5,6 +5,8 @@ INTERNAL { cnxk_logtype_mbox; roc_clk_freq_get; roc_error_msg_get; + roc_idev_lmt_base_addr_get; + roc_idev_num_lmtlines_get; roc_model; roc_plt_init; roc_plt_init_cb_register;
Signature · 1 line
2.8.4