1a252357eSChaoyong He /* SPDX-License-Identifier: BSD-3-Clause 2a252357eSChaoyong He * Copyright (c) 2023 Corigine, Inc. 3a252357eSChaoyong He * All rights reserved. 4a252357eSChaoyong He */ 5a252357eSChaoyong He 6a252357eSChaoyong He #ifndef __NFP_COMMON_CTRL_H__ 7a252357eSChaoyong He #define __NFP_COMMON_CTRL_H__ 8a252357eSChaoyong He 9a252357eSChaoyong He /* 10a252357eSChaoyong He * Configuration BAR size. 11a252357eSChaoyong He * 12a252357eSChaoyong He * On the NFP6000, due to THB-350, the configuration BAR is 32K in size. 13a252357eSChaoyong He */ 14a252357eSChaoyong He #define NFP_NET_CFG_BAR_SZ (32 * 1024) 15a252357eSChaoyong He 16a252357eSChaoyong He /* Offset in Freelist buffer where packet starts on RX */ 17a252357eSChaoyong He #define NFP_NET_RX_OFFSET 32 18a252357eSChaoyong He 19a252357eSChaoyong He /* Working with metadata api (NFD version > 3.0) */ 20a252357eSChaoyong He #define NFP_NET_META_FIELD_SIZE 4 21a252357eSChaoyong He #define NFP_NET_META_FIELD_MASK ((1 << NFP_NET_META_FIELD_SIZE) - 1) 22a252357eSChaoyong He #define NFP_NET_META_HEADER_SIZE 4 23a252357eSChaoyong He #define NFP_NET_META_NFDK_LENGTH 8 24a252357eSChaoyong He 25a252357eSChaoyong He /* Working with metadata vlan api (NFD version >= 2.0) */ 26a252357eSChaoyong He #define NFP_NET_META_VLAN_INFO 16 27a252357eSChaoyong He #define NFP_NET_META_VLAN_OFFLOAD 31 28a252357eSChaoyong He #define NFP_NET_META_VLAN_TPID 3 29a252357eSChaoyong He #define NFP_NET_META_VLAN_MASK ((1 << NFP_NET_META_VLAN_INFO) - 1) 30a252357eSChaoyong He #define NFP_NET_META_VLAN_TPID_MASK ((1 << NFP_NET_META_VLAN_TPID) - 1) 31a252357eSChaoyong He #define NFP_NET_META_TPID(d) (((d) >> NFP_NET_META_VLAN_INFO) & \ 32a252357eSChaoyong He NFP_NET_META_VLAN_TPID_MASK) 33a252357eSChaoyong He 34a252357eSChaoyong He /* Prepend field types */ 35a252357eSChaoyong He #define NFP_NET_META_HASH 1 /* Next field carries hash type */ 369c5cfc10SChaoyong He #define NFP_NET_META_MARK 2 37a252357eSChaoyong He #define NFP_NET_META_VLAN 4 38a252357eSChaoyong He #define NFP_NET_META_PORTID 5 39a252357eSChaoyong He #define NFP_NET_META_IPSEC 9 40a252357eSChaoyong He 41a252357eSChaoyong He #define NFP_META_PORT_ID_CTRL ~0U 42a252357eSChaoyong He 43a252357eSChaoyong He /* Hash type prepended when a RSS hash was computed */ 44a252357eSChaoyong He #define NFP_NET_RSS_NONE 0 45a252357eSChaoyong He #define NFP_NET_RSS_IPV4 1 46a252357eSChaoyong He #define NFP_NET_RSS_IPV6 2 47a252357eSChaoyong He #define NFP_NET_RSS_IPV6_EX 3 48a252357eSChaoyong He #define NFP_NET_RSS_IPV4_TCP 4 49a252357eSChaoyong He #define NFP_NET_RSS_IPV6_TCP 5 50a252357eSChaoyong He #define NFP_NET_RSS_IPV6_EX_TCP 6 51a252357eSChaoyong He #define NFP_NET_RSS_IPV4_UDP 7 52a252357eSChaoyong He #define NFP_NET_RSS_IPV6_UDP 8 53a252357eSChaoyong He #define NFP_NET_RSS_IPV6_EX_UDP 9 54a252357eSChaoyong He #define NFP_NET_RSS_IPV4_SCTP 10 55a252357eSChaoyong He #define NFP_NET_RSS_IPV6_SCTP 11 56a252357eSChaoyong He 57a252357eSChaoyong He /* 58a252357eSChaoyong He * @NFP_NET_TXR_MAX: Maximum number of TX rings 59a252357eSChaoyong He * @NFP_NET_TXR_MASK: Mask for TX rings 60a252357eSChaoyong He * @NFP_NET_RXR_MAX: Maximum number of RX rings 61a252357eSChaoyong He * @NFP_NET_RXR_MASK: Mask for RX rings 62a252357eSChaoyong He */ 63a252357eSChaoyong He #define NFP_NET_TXR_MAX 64 64a252357eSChaoyong He #define NFP_NET_TXR_MASK (NFP_NET_TXR_MAX - 1) 65a252357eSChaoyong He #define NFP_NET_RXR_MAX 64 66a252357eSChaoyong He #define NFP_NET_RXR_MASK (NFP_NET_RXR_MAX - 1) 67a252357eSChaoyong He 68a252357eSChaoyong He /* 69a252357eSChaoyong He * Read/Write config words (0x0000 - 0x002c) 70a252357eSChaoyong He * @NFP_NET_CFG_CTRL: Global control 71a252357eSChaoyong He * @NFP_NET_CFG_UPDATE: Indicate which fields are updated 72a252357eSChaoyong He * @NFP_NET_CFG_TXRS_ENABLE: Bitmask of enabled TX rings 73a252357eSChaoyong He * @NFP_NET_CFG_RXRS_ENABLE: Bitmask of enabled RX rings 74a252357eSChaoyong He * @NFP_NET_CFG_MTU: Set MTU size 75a252357eSChaoyong He * @NFP_NET_CFG_FLBUFSZ: Set freelist buffer size (must be larger than MTU) 76a252357eSChaoyong He * @NFP_NET_CFG_EXN: MSI-X table entry for exceptions 77a252357eSChaoyong He * @NFP_NET_CFG_LSC: MSI-X table entry for link state changes 78a252357eSChaoyong He * @NFP_NET_CFG_MACADDR: MAC address 79a252357eSChaoyong He * 80a252357eSChaoyong He * TODO: 81a252357eSChaoyong He * - define Error details in UPDATE 82a252357eSChaoyong He */ 83a252357eSChaoyong He #define NFP_NET_CFG_CTRL 0x0000 84a252357eSChaoyong He #define NFP_NET_CFG_CTRL_ENABLE (0x1 << 0) /* Global enable */ 85a252357eSChaoyong He #define NFP_NET_CFG_CTRL_PROMISC (0x1 << 1) /* Enable Promisc mode */ 86a252357eSChaoyong He #define NFP_NET_CFG_CTRL_L2BC (0x1 << 2) /* Allow L2 Broadcast */ 87a252357eSChaoyong He #define NFP_NET_CFG_CTRL_L2MC (0x1 << 3) /* Allow L2 Multicast */ 88a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RXCSUM (0x1 << 4) /* Enable RX Checksum */ 89a252357eSChaoyong He #define NFP_NET_CFG_CTRL_TXCSUM (0x1 << 5) /* Enable TX Checksum */ 90a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RXVLAN (0x1 << 6) /* Enable VLAN strip */ 91a252357eSChaoyong He #define NFP_NET_CFG_CTRL_TXVLAN (0x1 << 7) /* Enable VLAN insert */ 92a252357eSChaoyong He #define NFP_NET_CFG_CTRL_SCATTER (0x1 << 8) /* Scatter DMA */ 93a252357eSChaoyong He #define NFP_NET_CFG_CTRL_GATHER (0x1 << 9) /* Gather DMA */ 94a252357eSChaoyong He #define NFP_NET_CFG_CTRL_LSO (0x1 << 10) /* LSO/TSO */ 95a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RXQINQ (0x1 << 13) /* Enable QINQ strip */ 96a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RXVLAN_V2 (0x1 << 15) /* Enable VLAN strip with metadata */ 97a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RINGCFG (0x1 << 16) /* Ring runtime changes */ 98a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RSS (0x1 << 17) /* RSS */ 99a252357eSChaoyong He #define NFP_NET_CFG_CTRL_IRQMOD (0x1 << 18) /* Interrupt moderation */ 100a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RINGPRIO (0x1 << 19) /* Ring priorities */ 101a252357eSChaoyong He #define NFP_NET_CFG_CTRL_MSIXAUTO (0x1 << 20) /* MSI-X auto-masking */ 102a252357eSChaoyong He #define NFP_NET_CFG_CTRL_TXRWB (0x1 << 21) /* Write-back of TX ring */ 103a252357eSChaoyong He #define NFP_NET_CFG_CTRL_L2SWITCH (0x1 << 22) /* L2 Switch */ 104a252357eSChaoyong He #define NFP_NET_CFG_CTRL_TXVLAN_V2 (0x1 << 23) /* Enable VLAN insert with metadata */ 105a252357eSChaoyong He #define NFP_NET_CFG_CTRL_VXLAN (0x1 << 24) /* Enable VXLAN */ 106a252357eSChaoyong He #define NFP_NET_CFG_CTRL_NVGRE (0x1 << 25) /* Enable NVGRE */ 107a252357eSChaoyong He #define NFP_NET_CFG_CTRL_MSIX_TX_OFF (0x1 << 26) /* Disable MSIX for TX */ 108a252357eSChaoyong He #define NFP_NET_CFG_CTRL_LSO2 (0x1 << 28) /* LSO/TSO (version 2) */ 109a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RSS2 (0x1 << 29) /* RSS (version 2) */ 110a252357eSChaoyong He #define NFP_NET_CFG_CTRL_CSUM_COMPLETE (0x1 << 30) /* Checksum complete */ 111a252357eSChaoyong He #define NFP_NET_CFG_CTRL_LIVE_ADDR (0x1U << 31) /* Live MAC addr change */ 112a252357eSChaoyong He #define NFP_NET_CFG_UPDATE 0x0004 113a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_GEN (0x1 << 0) /* General update */ 114a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_RING (0x1 << 1) /* Ring config change */ 115a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_RSS (0x1 << 2) /* RSS config change */ 116a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_TXRPRIO (0x1 << 3) /* TX Ring prio change */ 117a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_RXRPRIO (0x1 << 4) /* RX Ring prio change */ 118a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_MSIX (0x1 << 5) /* MSI-X change */ 119a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_L2SWITCH (0x1 << 6) /* Switch changes */ 120a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_RESET (0x1 << 7) /* Update due to FLR */ 121a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_IRQMOD (0x1 << 8) /* IRQ mod change */ 122a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_VXLAN (0x1 << 9) /* VXLAN port change */ 123a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_MACADDR (0x1 << 11) /* MAC address change */ 124a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_MBOX (0x1 << 12) /* Mailbox update */ 125a252357eSChaoyong He #define NFP_NET_CFG_UPDATE_ERR (0x1U << 31) /* A error occurred */ 126a252357eSChaoyong He #define NFP_NET_CFG_TXRS_ENABLE 0x0008 127a252357eSChaoyong He #define NFP_NET_CFG_RXRS_ENABLE 0x0010 128a252357eSChaoyong He #define NFP_NET_CFG_MTU 0x0018 129a252357eSChaoyong He #define NFP_NET_CFG_FLBUFSZ 0x001c 130a252357eSChaoyong He #define NFP_NET_CFG_EXN 0x001f 131a252357eSChaoyong He #define NFP_NET_CFG_LSC 0x0020 132a252357eSChaoyong He #define NFP_NET_CFG_MACADDR 0x0024 133a252357eSChaoyong He 134a252357eSChaoyong He #define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) 135a252357eSChaoyong He #define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2) 136a252357eSChaoyong He 137a252357eSChaoyong He #define NFP_NET_CFG_CTRL_CHAIN_META (NFP_NET_CFG_CTRL_RSS2 | \ 138a252357eSChaoyong He NFP_NET_CFG_CTRL_CSUM_COMPLETE) 139a252357eSChaoyong He 140a252357eSChaoyong He /* Version number helper defines */ 141a252357eSChaoyong He struct nfp_net_fw_ver { 142a252357eSChaoyong He uint8_t minor; 143a252357eSChaoyong He uint8_t major; 144a252357eSChaoyong He uint8_t class; 145a252357eSChaoyong He /** 146a252357eSChaoyong He * This byte can be extended for more use. 147a252357eSChaoyong He * BIT0: NFD dp type, refer NFP_NET_CFG_VERSION_DP_NFDx 148a252357eSChaoyong He * BIT[7:1]: reserved 149a252357eSChaoyong He */ 150a252357eSChaoyong He uint8_t extend; 151a252357eSChaoyong He }; 152a252357eSChaoyong He 153a252357eSChaoyong He /* 154a252357eSChaoyong He * Read-only words (0x0030 - 0x0050): 155a252357eSChaoyong He * @NFP_NET_CFG_VERSION: Firmware version number 156a252357eSChaoyong He * @NFP_NET_CFG_STS: Status 157a252357eSChaoyong He * @NFP_NET_CFG_CAP: Capabilities (same bits as @NFP_NET_CFG_CTRL) 158a252357eSChaoyong He * @NFP_NET_MAX_TXRINGS: Maximum number of TX rings 159a252357eSChaoyong He * @NFP_NET_MAX_RXRINGS: Maximum number of RX rings 160a252357eSChaoyong He * @NFP_NET_MAX_MTU: Maximum support MTU 161a252357eSChaoyong He * @NFP_NET_CFG_START_TXQ: Start Queue Control Queue to use for TX (PF only) 162a252357eSChaoyong He * @NFP_NET_CFG_START_RXQ: Start Queue Control Queue to use for RX (PF only) 163a252357eSChaoyong He * 164a252357eSChaoyong He * TODO: 165a252357eSChaoyong He * - define more STS bits 166a252357eSChaoyong He */ 167a252357eSChaoyong He #define NFP_NET_CFG_VERSION 0x0030 168a252357eSChaoyong He #define NFP_NET_CFG_VERSION_DP_NFD3 0 169a252357eSChaoyong He #define NFP_NET_CFG_VERSION_DP_NFDK 1 170a252357eSChaoyong He #define NFP_NET_CFG_STS 0x0034 171a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK (0x1 << 0) /* Link up or down */ 172a252357eSChaoyong He /* Link rate */ 173a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_SHIFT 1 174a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_MASK 0xF 175a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_UNSUPPORTED 0 176a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_UNKNOWN 1 177a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_1G 2 178a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_10G 3 179a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_25G 4 180a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_40G 5 181a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_50G 6 182a252357eSChaoyong He #define NFP_NET_CFG_STS_LINK_RATE_100G 7 183a252357eSChaoyong He 184a252357eSChaoyong He /* 185a252357eSChaoyong He * NSP Link rate is a 16-bit word. It is no longer determined by 186a252357eSChaoyong He * firmware, instead it is read from the nfp_eth_table of the 187a252357eSChaoyong He * associated pf_dev and written to the NFP_NET_CFG_STS_NSP_LINK_RATE 188a252357eSChaoyong He * address by the PMD each time the port is reconfigured. 189a252357eSChaoyong He */ 190a252357eSChaoyong He #define NFP_NET_CFG_STS_NSP_LINK_RATE 0x0036 191a252357eSChaoyong He 192a252357eSChaoyong He #define NFP_NET_CFG_CAP 0x0038 193a252357eSChaoyong He #define NFP_NET_CFG_MAX_TXRINGS 0x003c 194a252357eSChaoyong He #define NFP_NET_CFG_MAX_RXRINGS 0x0040 195a252357eSChaoyong He #define NFP_NET_CFG_MAX_MTU 0x0044 196a252357eSChaoyong He /* Next two words are being used by VFs for solving THB350 issue */ 197a252357eSChaoyong He #define NFP_NET_CFG_START_TXQ 0x0048 198a252357eSChaoyong He #define NFP_NET_CFG_START_RXQ 0x004c 199a252357eSChaoyong He 200a252357eSChaoyong He /* 201a252357eSChaoyong He * NFP6000/NFP4000 - Prepend configuration 202a252357eSChaoyong He */ 203a252357eSChaoyong He #define NFP_NET_CFG_RX_OFFSET 0x0050 204a252357eSChaoyong He #define NFP_NET_CFG_RX_OFFSET_DYNAMIC 0 /* Prepend mode */ 205a252357eSChaoyong He 206a252357eSChaoyong He /* Start anchor of the TLV area */ 207a252357eSChaoyong He #define NFP_NET_CFG_TLV_BASE 0x0058 208a252357eSChaoyong He 209a252357eSChaoyong He #define NFP_NET_CFG_VXLAN_PORT 0x0060 210a252357eSChaoyong He #define NFP_NET_CFG_VXLAN_SZ 0x0008 211a252357eSChaoyong He 212a252357eSChaoyong He /* Offload definitions */ 213a252357eSChaoyong He #define NFP_NET_N_VXLAN_PORTS (NFP_NET_CFG_VXLAN_SZ / sizeof(uint16_t)) 214a252357eSChaoyong He 215a252357eSChaoyong He /* 216a252357eSChaoyong He * 3 words reserved for extended ctrl words (0x0098 - 0x00a4) 217a252357eSChaoyong He * 3 words reserved for extended cap words (0x00a4 - 0x00b0) 218a252357eSChaoyong He * Currently only one word is used, can be extended in future. 219a252357eSChaoyong He */ 220a252357eSChaoyong He #define NFP_NET_CFG_CTRL_WORD1 0x0098 221a252357eSChaoyong He #define NFP_NET_CFG_CTRL_PKT_TYPE (0x1 << 0) 222a252357eSChaoyong He #define NFP_NET_CFG_CTRL_IPSEC (0x1 << 1) /**< IPsec offload */ 2234a86c36bSQin Ke #define NFP_NET_CFG_CTRL_MCAST_FILTER (0x1 << 2) /**< Multicast Filter */ 224a252357eSChaoyong He #define NFP_NET_CFG_CTRL_IPSEC_SM_LOOKUP (0x1 << 3) /**< SA short match lookup */ 225a252357eSChaoyong He #define NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP (0x1 << 4) /**< SA long match lookup */ 22695f978efSPeng Zhang #define NFP_NET_CFG_CTRL_MULTI_PF (0x1 << 5) 2278153bc6fSChaoyong He #define NFP_NET_CFG_CTRL_FLOW_STEER (0x1 << 8) /**< Flow Steering */ 228b47a0373SChaoyong He #define NFP_NET_CFG_CTRL_IN_ORDER (0x1 << 11) /**< Virtio in-order flag */ 229df77f704SChaoyong He #define NFP_NET_CFG_CTRL_USO (0x1 << 16) /**< UDP segmentation offload */ 230a252357eSChaoyong He 231a252357eSChaoyong He #define NFP_NET_CFG_CAP_WORD1 0x00a4 232a252357eSChaoyong He 233a252357eSChaoyong He /* 16B reserved for future use (0x00b0 - 0x00c0). */ 234a252357eSChaoyong He #define NFP_NET_CFG_RESERVED 0x00b0 235a252357eSChaoyong He #define NFP_NET_CFG_RESERVED_SZ 0x0010 236a252357eSChaoyong He 237a252357eSChaoyong He /* 238a252357eSChaoyong He * RSS configuration (0x0100 - 0x01ac): 239a252357eSChaoyong He * Used only when NFP_NET_CFG_CTRL_RSS_ANY is enabled 240a252357eSChaoyong He * @NFP_NET_CFG_RSS_CFG: RSS configuration word 241a252357eSChaoyong He * @NFP_NET_CFG_RSS_KEY: RSS "secret" key 242a252357eSChaoyong He * @NFP_NET_CFG_RSS_ITBL: RSS indirection table 243a252357eSChaoyong He */ 244a252357eSChaoyong He #define NFP_NET_CFG_RSS_BASE 0x0100 245a252357eSChaoyong He #define NFP_NET_CFG_RSS_CTRL NFP_NET_CFG_RSS_BASE 246a252357eSChaoyong He #define NFP_NET_CFG_RSS_MASK (0x7f) 247a252357eSChaoyong He #define NFP_NET_CFG_RSS_MASK_of(_x) ((_x) & 0x7f) 248a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV4 (1 << 8) /* RSS for IPv4 */ 249a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV6 (1 << 9) /* RSS for IPv6 */ 250a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV4_TCP (1 << 10) /* RSS for IPv4/TCP */ 251a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV4_UDP (1 << 11) /* RSS for IPv4/UDP */ 252a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV6_TCP (1 << 12) /* RSS for IPv6/TCP */ 253a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV6_UDP (1 << 13) /* RSS for IPv6/UDP */ 254a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV4_SCTP (1 << 14) /* RSS for IPv4/SCTP */ 255a252357eSChaoyong He #define NFP_NET_CFG_RSS_IPV6_SCTP (1 << 15) /* RSS for IPv6/SCTP */ 256a252357eSChaoyong He #define NFP_NET_CFG_RSS_TOEPLITZ (1 << 24) /* Use Toeplitz hash */ 257*b458a2a0SLong Wu #define NFP_NET_CFG_RSS_CRC32 (1 << 26) /* Use CRC32 hash */ 258a252357eSChaoyong He #define NFP_NET_CFG_RSS_KEY (NFP_NET_CFG_RSS_BASE + 0x4) 259a252357eSChaoyong He #define NFP_NET_CFG_RSS_KEY_SZ 0x28 260a252357eSChaoyong He #define NFP_NET_CFG_RSS_ITBL (NFP_NET_CFG_RSS_BASE + 0x4 + \ 261a252357eSChaoyong He NFP_NET_CFG_RSS_KEY_SZ) 262a252357eSChaoyong He #define NFP_NET_CFG_RSS_ITBL_SZ 0x80 263a252357eSChaoyong He 264a252357eSChaoyong He /* 265a252357eSChaoyong He * TX ring configuration (0x200 - 0x800) 266a252357eSChaoyong He * @NFP_NET_CFG_TXR_BASE: Base offset for TX ring configuration 267a252357eSChaoyong He * @NFP_NET_CFG_TXR_ADDR: Per TX ring DMA address (8B entries) 268a252357eSChaoyong He * @NFP_NET_CFG_TXR_WB_ADDR: Per TX ring write back DMA address (8B entries) 269a252357eSChaoyong He * @NFP_NET_CFG_TXR_SZ: Per TX ring size (1B entries) 270a252357eSChaoyong He * @NFP_NET_CFG_TXR_VEC: Per TX ring MSI-X table entry (1B entries) 271a252357eSChaoyong He * @NFP_NET_CFG_TXR_PRIO: Per TX ring priority (1B entries) 272a252357eSChaoyong He * @NFP_NET_CFG_TXR_IRQ_MOD: Per TX ring interrupt moderation (4B entries) 273a252357eSChaoyong He */ 274a252357eSChaoyong He #define NFP_NET_CFG_TXR_BASE 0x0200 275a252357eSChaoyong He #define NFP_NET_CFG_TXR_ADDR(_x) (NFP_NET_CFG_TXR_BASE + ((_x) * 0x8)) 276a252357eSChaoyong He #define NFP_NET_CFG_TXR_WB_ADDR(_x) (NFP_NET_CFG_TXR_BASE + 0x200 + \ 277a252357eSChaoyong He ((_x) * 0x8)) 278a252357eSChaoyong He #define NFP_NET_CFG_TXR_SZ(_x) (NFP_NET_CFG_TXR_BASE + 0x400 + (_x)) 279a252357eSChaoyong He #define NFP_NET_CFG_TXR_VEC(_x) (NFP_NET_CFG_TXR_BASE + 0x440 + (_x)) 280a252357eSChaoyong He #define NFP_NET_CFG_TXR_PRIO(_x) (NFP_NET_CFG_TXR_BASE + 0x480 + (_x)) 281a252357eSChaoyong He #define NFP_NET_CFG_TXR_IRQ_MOD(_x) (NFP_NET_CFG_TXR_BASE + 0x500 + \ 282a252357eSChaoyong He ((_x) * 0x4)) 283a252357eSChaoyong He 284a252357eSChaoyong He /* 285a252357eSChaoyong He * RX ring configuration (0x0800 - 0x0c00) 286a252357eSChaoyong He * @NFP_NET_CFG_RXR_BASE: Base offset for RX ring configuration 287a252357eSChaoyong He * @NFP_NET_CFG_RXR_ADDR: Per TX ring DMA address (8B entries) 288a252357eSChaoyong He * @NFP_NET_CFG_RXR_SZ: Per TX ring size (1B entries) 289a252357eSChaoyong He * @NFP_NET_CFG_RXR_VEC: Per TX ring MSI-X table entry (1B entries) 290a252357eSChaoyong He * @NFP_NET_CFG_RXR_PRIO: Per TX ring priority (1B entries) 291a252357eSChaoyong He * @NFP_NET_CFG_RXR_IRQ_MOD: Per TX ring interrupt moderation (4B entries) 292a252357eSChaoyong He */ 293a252357eSChaoyong He #define NFP_NET_CFG_RXR_BASE 0x0800 294a252357eSChaoyong He #define NFP_NET_CFG_RXR_ADDR(_x) (NFP_NET_CFG_RXR_BASE + ((_x) * 0x8)) 295a252357eSChaoyong He #define NFP_NET_CFG_RXR_SZ(_x) (NFP_NET_CFG_RXR_BASE + 0x200 + (_x)) 296a252357eSChaoyong He #define NFP_NET_CFG_RXR_VEC(_x) (NFP_NET_CFG_RXR_BASE + 0x240 + (_x)) 297a252357eSChaoyong He #define NFP_NET_CFG_RXR_PRIO(_x) (NFP_NET_CFG_RXR_BASE + 0x280 + (_x)) 298a252357eSChaoyong He #define NFP_NET_CFG_RXR_IRQ_MOD(_x) (NFP_NET_CFG_RXR_BASE + 0x300 + \ 299a252357eSChaoyong He ((_x) * 0x4)) 300a252357eSChaoyong He 301a252357eSChaoyong He /* 302a252357eSChaoyong He * Interrupt Control/Cause registers (0x0c00 - 0x0d00) 303a252357eSChaoyong He * These registers are only used when MSI-X auto-masking is not 304a252357eSChaoyong He * enabled (@NFP_NET_CFG_CTRL_MSIXAUTO not set). The array is index 305a252357eSChaoyong He * by MSI-X entry and are 1B in size. If an entry is zero, the 306a252357eSChaoyong He * corresponding entry is enabled. If the FW generates an interrupt, 307a252357eSChaoyong He * it writes a cause into the corresponding field. This also masks 308a252357eSChaoyong He * the MSI-X entry and the host driver must clear the register to 309a252357eSChaoyong He * re-enable the interrupt. 310a252357eSChaoyong He */ 311a252357eSChaoyong He #define NFP_NET_CFG_ICR_BASE 0x0c00 312a252357eSChaoyong He #define NFP_NET_CFG_ICR(_x) (NFP_NET_CFG_ICR_BASE + (_x)) 313a252357eSChaoyong He #define NFP_NET_CFG_ICR_UNMASKED 0x0 314a252357eSChaoyong He #define NFP_NET_CFG_ICR_RXTX 0x1 315a252357eSChaoyong He #define NFP_NET_CFG_ICR_LSC 0x2 316a252357eSChaoyong He 317a252357eSChaoyong He /* 318a252357eSChaoyong He * General device stats (0x0d00 - 0x0d90) 319a252357eSChaoyong He * All counters are 64bit. 320a252357eSChaoyong He */ 321a252357eSChaoyong He #define NFP_NET_CFG_STATS_BASE 0x0d00 322a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_DISCARDS (NFP_NET_CFG_STATS_BASE + 0x00) 323a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_ERRORS (NFP_NET_CFG_STATS_BASE + 0x08) 324a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_OCTETS (NFP_NET_CFG_STATS_BASE + 0x10) 325a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_UC_OCTETS (NFP_NET_CFG_STATS_BASE + 0x18) 326a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_MC_OCTETS (NFP_NET_CFG_STATS_BASE + 0x20) 327a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_BC_OCTETS (NFP_NET_CFG_STATS_BASE + 0x28) 328a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_FRAMES (NFP_NET_CFG_STATS_BASE + 0x30) 329a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_MC_FRAMES (NFP_NET_CFG_STATS_BASE + 0x38) 330a252357eSChaoyong He #define NFP_NET_CFG_STATS_RX_BC_FRAMES (NFP_NET_CFG_STATS_BASE + 0x40) 331a252357eSChaoyong He 332a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_DISCARDS (NFP_NET_CFG_STATS_BASE + 0x48) 333a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_ERRORS (NFP_NET_CFG_STATS_BASE + 0x50) 334a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_OCTETS (NFP_NET_CFG_STATS_BASE + 0x58) 335a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_UC_OCTETS (NFP_NET_CFG_STATS_BASE + 0x60) 336a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_MC_OCTETS (NFP_NET_CFG_STATS_BASE + 0x68) 337a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_BC_OCTETS (NFP_NET_CFG_STATS_BASE + 0x70) 338a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_FRAMES (NFP_NET_CFG_STATS_BASE + 0x78) 339a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_MC_FRAMES (NFP_NET_CFG_STATS_BASE + 0x80) 340a252357eSChaoyong He #define NFP_NET_CFG_STATS_TX_BC_FRAMES (NFP_NET_CFG_STATS_BASE + 0x88) 341a252357eSChaoyong He 342a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP0_FRAMES (NFP_NET_CFG_STATS_BASE + 0x90) 343a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP0_BYTES (NFP_NET_CFG_STATS_BASE + 0x98) 344a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP1_FRAMES (NFP_NET_CFG_STATS_BASE + 0xa0) 345a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP1_BYTES (NFP_NET_CFG_STATS_BASE + 0xa8) 346a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP2_FRAMES (NFP_NET_CFG_STATS_BASE + 0xb0) 347a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP2_BYTES (NFP_NET_CFG_STATS_BASE + 0xb8) 348a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP3_FRAMES (NFP_NET_CFG_STATS_BASE + 0xc0) 349a252357eSChaoyong He #define NFP_NET_CFG_STATS_APP3_BYTES (NFP_NET_CFG_STATS_BASE + 0xc8) 350a252357eSChaoyong He 351a252357eSChaoyong He /* 352a252357eSChaoyong He * Per ring stats (0x1000 - 0x1800) 353a252357eSChaoyong He * Options, 64bit per entry 354a252357eSChaoyong He * @NFP_NET_CFG_TXR_STATS: TX ring statistics (Packet and Byte count) 355a252357eSChaoyong He * @NFP_NET_CFG_RXR_STATS: RX ring statistics (Packet and Byte count) 356a252357eSChaoyong He */ 357a252357eSChaoyong He #define NFP_NET_CFG_TXR_STATS_BASE 0x1000 358a252357eSChaoyong He #define NFP_NET_CFG_TXR_STATS(_x) (NFP_NET_CFG_TXR_STATS_BASE + \ 359a252357eSChaoyong He ((_x) * 0x10)) 360a252357eSChaoyong He #define NFP_NET_CFG_RXR_STATS_BASE 0x1400 361a252357eSChaoyong He #define NFP_NET_CFG_RXR_STATS(_x) (NFP_NET_CFG_RXR_STATS_BASE + \ 362a252357eSChaoyong He ((_x) * 0x10)) 363a252357eSChaoyong He 364a252357eSChaoyong He #endif /* __NFP_COMMON_CTRL_H__ */ 365