18c2ecf20Sopenharmony_ci/* Broadcom NetXtreme-C/E network driver. 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Copyright (c) 2014-2016 Broadcom Corporation 48c2ecf20Sopenharmony_ci * Copyright (c) 2016-2018 Broadcom Limited 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 78c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 88c2ecf20Sopenharmony_ci * the Free Software Foundation. 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef BNXT_H 128c2ecf20Sopenharmony_ci#define BNXT_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define DRV_MODULE_NAME "bnxt_en" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* DO NOT CHANGE DRV_VER_* defines 178c2ecf20Sopenharmony_ci * FIXME: Delete them 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci#define DRV_VER_MAJ 1 208c2ecf20Sopenharmony_ci#define DRV_VER_MIN 10 218c2ecf20Sopenharmony_ci#define DRV_VER_UPD 1 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 248c2ecf20Sopenharmony_ci#include <linux/rhashtable.h> 258c2ecf20Sopenharmony_ci#include <linux/crash_dump.h> 268c2ecf20Sopenharmony_ci#include <net/devlink.h> 278c2ecf20Sopenharmony_ci#include <net/dst_metadata.h> 288c2ecf20Sopenharmony_ci#include <net/xdp.h> 298c2ecf20Sopenharmony_ci#include <linux/dim.h> 308c2ecf20Sopenharmony_ci#ifdef CONFIG_TEE_BNXT_FW 318c2ecf20Sopenharmony_ci#include <linux/firmware/broadcom/tee_bnxt_fw.h> 328c2ecf20Sopenharmony_ci#endif 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciextern struct list_head bnxt_block_cb_list; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct page_pool; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistruct tx_bd { 398c2ecf20Sopenharmony_ci __le32 tx_bd_len_flags_type; 408c2ecf20Sopenharmony_ci #define TX_BD_TYPE (0x3f << 0) 418c2ecf20Sopenharmony_ci #define TX_BD_TYPE_SHORT_TX_BD (0x00 << 0) 428c2ecf20Sopenharmony_ci #define TX_BD_TYPE_LONG_TX_BD (0x10 << 0) 438c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_PACKET_END (1 << 6) 448c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_NO_CMPL (1 << 7) 458c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_BD_CNT (0x1f << 8) 468c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_BD_CNT_SHIFT 8 478c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LHINT (3 << 13) 488c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LHINT_SHIFT 13 498c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LHINT_512_AND_SMALLER (0 << 13) 508c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LHINT_512_TO_1023 (1 << 13) 518c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LHINT_1024_TO_2047 (2 << 13) 528c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LHINT_2048_AND_LARGER (3 << 13) 538c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_COAL_NOW (1 << 15) 548c2ecf20Sopenharmony_ci #define TX_BD_LEN (0xffff << 16) 558c2ecf20Sopenharmony_ci #define TX_BD_LEN_SHIFT 16 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci u32 tx_bd_opaque; 588c2ecf20Sopenharmony_ci __le64 tx_bd_haddr; 598c2ecf20Sopenharmony_ci} __packed; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistruct tx_bd_ext { 628c2ecf20Sopenharmony_ci __le32 tx_bd_hsize_lflags; 638c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_TCP_UDP_CHKSUM (1 << 0) 648c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_IP_CKSUM (1 << 1) 658c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_NO_CRC (1 << 2) 668c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_STAMP (1 << 3) 678c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_T_IP_CHKSUM (1 << 4) 688c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_LSO (1 << 5) 698c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_IPID_FMT (1 << 6) 708c2ecf20Sopenharmony_ci #define TX_BD_FLAGS_T_IPID (1 << 7) 718c2ecf20Sopenharmony_ci #define TX_BD_HSIZE (0xff << 16) 728c2ecf20Sopenharmony_ci #define TX_BD_HSIZE_SHIFT 16 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci __le32 tx_bd_mss; 758c2ecf20Sopenharmony_ci __le32 tx_bd_cfa_action; 768c2ecf20Sopenharmony_ci #define TX_BD_CFA_ACTION (0xffff << 16) 778c2ecf20Sopenharmony_ci #define TX_BD_CFA_ACTION_SHIFT 16 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci __le32 tx_bd_cfa_meta; 808c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_MASK 0xfffffff 818c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_VID_MASK 0xfff 828c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_PRI_MASK (0xf << 12) 838c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_PRI_SHIFT 12 848c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_TPID_MASK (3 << 16) 858c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_TPID_SHIFT 16 868c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_KEY (0xf << 28) 878c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_KEY_SHIFT 28 888c2ecf20Sopenharmony_ci #define TX_BD_CFA_META_KEY_VLAN (1 << 28) 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistruct rx_bd { 928c2ecf20Sopenharmony_ci __le32 rx_bd_len_flags_type; 938c2ecf20Sopenharmony_ci #define RX_BD_TYPE (0x3f << 0) 948c2ecf20Sopenharmony_ci #define RX_BD_TYPE_RX_PACKET_BD 0x4 958c2ecf20Sopenharmony_ci #define RX_BD_TYPE_RX_BUFFER_BD 0x5 968c2ecf20Sopenharmony_ci #define RX_BD_TYPE_RX_AGG_BD 0x6 978c2ecf20Sopenharmony_ci #define RX_BD_TYPE_16B_BD_SIZE (0 << 4) 988c2ecf20Sopenharmony_ci #define RX_BD_TYPE_32B_BD_SIZE (1 << 4) 998c2ecf20Sopenharmony_ci #define RX_BD_TYPE_48B_BD_SIZE (2 << 4) 1008c2ecf20Sopenharmony_ci #define RX_BD_TYPE_64B_BD_SIZE (3 << 4) 1018c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_SOP (1 << 6) 1028c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_EOP (1 << 7) 1038c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_BUFFERS (3 << 8) 1048c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_1_BUFFER_PACKET (0 << 8) 1058c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_2_BUFFER_PACKET (1 << 8) 1068c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_3_BUFFER_PACKET (2 << 8) 1078c2ecf20Sopenharmony_ci #define RX_BD_FLAGS_4_BUFFER_PACKET (3 << 8) 1088c2ecf20Sopenharmony_ci #define RX_BD_LEN (0xffff << 16) 1098c2ecf20Sopenharmony_ci #define RX_BD_LEN_SHIFT 16 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci u32 rx_bd_opaque; 1128c2ecf20Sopenharmony_ci __le64 rx_bd_haddr; 1138c2ecf20Sopenharmony_ci}; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_cistruct tx_cmp { 1168c2ecf20Sopenharmony_ci __le32 tx_cmp_flags_type; 1178c2ecf20Sopenharmony_ci #define CMP_TYPE (0x3f << 0) 1188c2ecf20Sopenharmony_ci #define CMP_TYPE_TX_L2_CMP 0 1198c2ecf20Sopenharmony_ci #define CMP_TYPE_RX_L2_CMP 17 1208c2ecf20Sopenharmony_ci #define CMP_TYPE_RX_AGG_CMP 18 1218c2ecf20Sopenharmony_ci #define CMP_TYPE_RX_L2_TPA_START_CMP 19 1228c2ecf20Sopenharmony_ci #define CMP_TYPE_RX_L2_TPA_END_CMP 21 1238c2ecf20Sopenharmony_ci #define CMP_TYPE_RX_TPA_AGG_CMP 22 1248c2ecf20Sopenharmony_ci #define CMP_TYPE_STATUS_CMP 32 1258c2ecf20Sopenharmony_ci #define CMP_TYPE_REMOTE_DRIVER_REQ 34 1268c2ecf20Sopenharmony_ci #define CMP_TYPE_REMOTE_DRIVER_RESP 36 1278c2ecf20Sopenharmony_ci #define CMP_TYPE_ERROR_STATUS 48 1288c2ecf20Sopenharmony_ci #define CMPL_BASE_TYPE_STAT_EJECT 0x1aUL 1298c2ecf20Sopenharmony_ci #define CMPL_BASE_TYPE_HWRM_DONE 0x20UL 1308c2ecf20Sopenharmony_ci #define CMPL_BASE_TYPE_HWRM_FWD_REQ 0x22UL 1318c2ecf20Sopenharmony_ci #define CMPL_BASE_TYPE_HWRM_FWD_RESP 0x24UL 1328c2ecf20Sopenharmony_ci #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT 0x2eUL 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci #define TX_CMP_FLAGS_ERROR (1 << 6) 1358c2ecf20Sopenharmony_ci #define TX_CMP_FLAGS_PUSH (1 << 7) 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci u32 tx_cmp_opaque; 1388c2ecf20Sopenharmony_ci __le32 tx_cmp_errors_v; 1398c2ecf20Sopenharmony_ci #define TX_CMP_V (1 << 0) 1408c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_BUFFER_ERROR (7 << 1) 1418c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_BUFFER_ERROR_NO_ERROR 0 1428c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_BUFFER_ERROR_BAD_FORMAT 2 1438c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_BUFFER_ERROR_INVALID_STAG 4 1448c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_BUFFER_ERROR_STAG_BOUNDS 5 1458c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_ZERO_LENGTH_PKT (1 << 4) 1468c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_EXCESSIVE_BD_LEN (1 << 5) 1478c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_DMA_ERROR (1 << 6) 1488c2ecf20Sopenharmony_ci #define TX_CMP_ERRORS_HINT_TOO_SHORT (1 << 7) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci __le32 tx_cmp_unsed_3; 1518c2ecf20Sopenharmony_ci}; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_cistruct rx_cmp { 1548c2ecf20Sopenharmony_ci __le32 rx_cmp_len_flags_type; 1558c2ecf20Sopenharmony_ci #define RX_CMP_CMP_TYPE (0x3f << 0) 1568c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ERROR (1 << 6) 1578c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_PLACEMENT (7 << 7) 1588c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_RSS_VALID (1 << 10) 1598c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_UNUSED (1 << 11) 1608c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPES_SHIFT 12 1618c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_UNKNOWN (0 << 12) 1628c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_IP (1 << 12) 1638c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_TCP (2 << 12) 1648c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_UDP (3 << 12) 1658c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_FCOE (4 << 12) 1668c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_ROCE (5 << 12) 1678c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_PTP_WO_TS (8 << 12) 1688c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS_ITYPE_PTP_W_TS (9 << 12) 1698c2ecf20Sopenharmony_ci #define RX_CMP_LEN (0xffff << 16) 1708c2ecf20Sopenharmony_ci #define RX_CMP_LEN_SHIFT 16 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci u32 rx_cmp_opaque; 1738c2ecf20Sopenharmony_ci __le32 rx_cmp_misc_v1; 1748c2ecf20Sopenharmony_ci #define RX_CMP_V1 (1 << 0) 1758c2ecf20Sopenharmony_ci #define RX_CMP_AGG_BUFS (0x1f << 1) 1768c2ecf20Sopenharmony_ci #define RX_CMP_AGG_BUFS_SHIFT 1 1778c2ecf20Sopenharmony_ci #define RX_CMP_RSS_HASH_TYPE (0x7f << 9) 1788c2ecf20Sopenharmony_ci #define RX_CMP_RSS_HASH_TYPE_SHIFT 9 1798c2ecf20Sopenharmony_ci #define RX_CMP_PAYLOAD_OFFSET (0xff << 16) 1808c2ecf20Sopenharmony_ci #define RX_CMP_PAYLOAD_OFFSET_SHIFT 16 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci __le32 rx_cmp_rss_hash; 1838c2ecf20Sopenharmony_ci}; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define RX_CMP_HASH_VALID(rxcmp) \ 1868c2ecf20Sopenharmony_ci ((rxcmp)->rx_cmp_len_flags_type & cpu_to_le32(RX_CMP_FLAGS_RSS_VALID)) 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define RSS_PROFILE_ID_MASK 0x1f 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#define RX_CMP_HASH_TYPE(rxcmp) \ 1918c2ecf20Sopenharmony_ci (((le32_to_cpu((rxcmp)->rx_cmp_misc_v1) & RX_CMP_RSS_HASH_TYPE) >>\ 1928c2ecf20Sopenharmony_ci RX_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK) 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cistruct rx_cmp_ext { 1958c2ecf20Sopenharmony_ci __le32 rx_cmp_flags2; 1968c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_IP_CS_CALC 0x1 1978c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_L4_CS_CALC (0x1 << 1) 1988c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_T_IP_CS_CALC (0x1 << 2) 1998c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_T_L4_CS_CALC (0x1 << 3) 2008c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_META_FORMAT_VLAN (0x1 << 4) 2018c2ecf20Sopenharmony_ci __le32 rx_cmp_meta_data; 2028c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_METADATA_TCI_MASK 0xffff 2038c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_METADATA_VID_MASK 0xfff 2048c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_METADATA_TPID_MASK 0xffff0000 2058c2ecf20Sopenharmony_ci #define RX_CMP_FLAGS2_METADATA_TPID_SFT 16 2068c2ecf20Sopenharmony_ci __le32 rx_cmp_cfa_code_errors_v2; 2078c2ecf20Sopenharmony_ci #define RX_CMP_V (1 << 0) 2088c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_MASK (0x7fff << 1) 2098c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_SFT 1 2108c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_BUFFER_ERROR_MASK (0x7 << 1) 2118c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER (0x0 << 1) 2128c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT (0x1 << 1) 2138c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP (0x2 << 1) 2148c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT (0x3 << 1) 2158c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_IP_CS_ERROR (0x1 << 4) 2168c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_L4_CS_ERROR (0x1 << 5) 2178c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_IP_CS_ERROR (0x1 << 6) 2188c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_L4_CS_ERROR (0x1 << 7) 2198c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_CRC_ERROR (0x1 << 8) 2208c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_MASK (0x7 << 9) 2218c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (0x0 << 9) 2228c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION (0x1 << 9) 2238c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN (0x2 << 9) 2248c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR (0x3 << 9) 2258c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR (0x4 << 9) 2268c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR (0x5 << 9) 2278c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL (0x6 << 9) 2288c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_MASK (0xf << 12) 2298c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_NO_ERROR (0x0 << 12) 2308c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION (0x1 << 12) 2318c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN (0x2 << 12) 2328c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (0x3 << 12) 2338c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR (0x4 << 12) 2348c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR (0x5 << 12) 2358c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN (0x6 << 12) 2368c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL (0x7 << 12) 2378c2ecf20Sopenharmony_ci #define RX_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN (0x8 << 12) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci #define RX_CMPL_CFA_CODE_MASK (0xffff << 16) 2408c2ecf20Sopenharmony_ci #define RX_CMPL_CFA_CODE_SFT 16 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci __le32 rx_cmp_unused3; 2438c2ecf20Sopenharmony_ci}; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci#define RX_CMP_L2_ERRORS \ 2468c2ecf20Sopenharmony_ci cpu_to_le32(RX_CMPL_ERRORS_BUFFER_ERROR_MASK | RX_CMPL_ERRORS_CRC_ERROR) 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci#define RX_CMP_L4_CS_BITS \ 2498c2ecf20Sopenharmony_ci (cpu_to_le32(RX_CMP_FLAGS2_L4_CS_CALC | RX_CMP_FLAGS2_T_L4_CS_CALC)) 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci#define RX_CMP_L4_CS_ERR_BITS \ 2528c2ecf20Sopenharmony_ci (cpu_to_le32(RX_CMPL_ERRORS_L4_CS_ERROR | RX_CMPL_ERRORS_T_L4_CS_ERROR)) 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci#define RX_CMP_L4_CS_OK(rxcmp1) \ 2558c2ecf20Sopenharmony_ci (((rxcmp1)->rx_cmp_flags2 & RX_CMP_L4_CS_BITS) && \ 2568c2ecf20Sopenharmony_ci !((rxcmp1)->rx_cmp_cfa_code_errors_v2 & RX_CMP_L4_CS_ERR_BITS)) 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci#define RX_CMP_ENCAP(rxcmp1) \ 2598c2ecf20Sopenharmony_ci ((le32_to_cpu((rxcmp1)->rx_cmp_flags2) & \ 2608c2ecf20Sopenharmony_ci RX_CMP_FLAGS2_T_L4_CS_CALC) >> 3) 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci#define RX_CMP_CFA_CODE(rxcmpl1) \ 2638c2ecf20Sopenharmony_ci ((le32_to_cpu((rxcmpl1)->rx_cmp_cfa_code_errors_v2) & \ 2648c2ecf20Sopenharmony_ci RX_CMPL_CFA_CODE_MASK) >> RX_CMPL_CFA_CODE_SFT) 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_cistruct rx_agg_cmp { 2678c2ecf20Sopenharmony_ci __le32 rx_agg_cmp_len_flags_type; 2688c2ecf20Sopenharmony_ci #define RX_AGG_CMP_TYPE (0x3f << 0) 2698c2ecf20Sopenharmony_ci #define RX_AGG_CMP_LEN (0xffff << 16) 2708c2ecf20Sopenharmony_ci #define RX_AGG_CMP_LEN_SHIFT 16 2718c2ecf20Sopenharmony_ci u32 rx_agg_cmp_opaque; 2728c2ecf20Sopenharmony_ci __le32 rx_agg_cmp_v; 2738c2ecf20Sopenharmony_ci #define RX_AGG_CMP_V (1 << 0) 2748c2ecf20Sopenharmony_ci #define RX_AGG_CMP_AGG_ID (0xffff << 16) 2758c2ecf20Sopenharmony_ci #define RX_AGG_CMP_AGG_ID_SHIFT 16 2768c2ecf20Sopenharmony_ci __le32 rx_agg_cmp_unused; 2778c2ecf20Sopenharmony_ci}; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci#define TPA_AGG_AGG_ID(rx_agg) \ 2808c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_agg)->rx_agg_cmp_v) & \ 2818c2ecf20Sopenharmony_ci RX_AGG_CMP_AGG_ID) >> RX_AGG_CMP_AGG_ID_SHIFT) 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cistruct rx_tpa_start_cmp { 2848c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_len_flags_type; 2858c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_TYPE (0x3f << 0) 2868c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS (0x3ff << 6) 2878c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_SHIFT 6 2888c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_ERROR (0x1 << 6) 2898c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_PLACEMENT (0x7 << 7) 2908c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_PLACEMENT_SHIFT 7 2918c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_PLACEMENT_JUMBO (0x1 << 7) 2928c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_PLACEMENT_HDS (0x2 << 7) 2938c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_PLACEMENT_GRO_JUMBO (0x5 << 7) 2948c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_PLACEMENT_GRO_HDS (0x6 << 7) 2958c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_RSS_VALID (0x1 << 10) 2968c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_TIMESTAMP (0x1 << 11) 2978c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_ITYPES (0xf << 12) 2988c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_ITYPES_SHIFT 12 2998c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS_ITYPE_TCP (0x2 << 12) 3008c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_LEN (0xffff << 16) 3018c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_LEN_SHIFT 16 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci u32 rx_tpa_start_cmp_opaque; 3048c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_misc_v1; 3058c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_V1 (0x1 << 0) 3068c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_RSS_HASH_TYPE (0x7f << 9) 3078c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT 9 3088c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_AGG_ID (0x7f << 25) 3098c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_AGG_ID_SHIFT 25 3108c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_AGG_ID_P5 (0xffff << 16) 3118c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_AGG_ID_SHIFT_P5 16 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_rss_hash; 3148c2ecf20Sopenharmony_ci}; 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci#define TPA_START_HASH_VALID(rx_tpa_start) \ 3178c2ecf20Sopenharmony_ci ((rx_tpa_start)->rx_tpa_start_cmp_len_flags_type & \ 3188c2ecf20Sopenharmony_ci cpu_to_le32(RX_TPA_START_CMP_FLAGS_RSS_VALID)) 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci#define TPA_START_HASH_TYPE(rx_tpa_start) \ 3218c2ecf20Sopenharmony_ci (((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \ 3228c2ecf20Sopenharmony_ci RX_TPA_START_CMP_RSS_HASH_TYPE) >> \ 3238c2ecf20Sopenharmony_ci RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK) 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci#define TPA_START_AGG_ID(rx_tpa_start) \ 3268c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \ 3278c2ecf20Sopenharmony_ci RX_TPA_START_CMP_AGG_ID) >> RX_TPA_START_CMP_AGG_ID_SHIFT) 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci#define TPA_START_AGG_ID_P5(rx_tpa_start) \ 3308c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \ 3318c2ecf20Sopenharmony_ci RX_TPA_START_CMP_AGG_ID_P5) >> RX_TPA_START_CMP_AGG_ID_SHIFT_P5) 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci#define TPA_START_ERROR(rx_tpa_start) \ 3348c2ecf20Sopenharmony_ci ((rx_tpa_start)->rx_tpa_start_cmp_len_flags_type & \ 3358c2ecf20Sopenharmony_ci cpu_to_le32(RX_TPA_START_CMP_FLAGS_ERROR)) 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_cistruct rx_tpa_start_cmp_ext { 3388c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_flags2; 3398c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_IP_CS_CALC (0x1 << 0) 3408c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_L4_CS_CALC (0x1 << 1) 3418c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_T_IP_CS_CALC (0x1 << 2) 3428c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_T_L4_CS_CALC (0x1 << 3) 3438c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_IP_TYPE (0x1 << 8) 3448c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_CSUM_CMPL_VALID (0x1 << 9) 3458c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_EXT_META_FORMAT (0x3 << 10) 3468c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_EXT_META_FORMAT_SHIFT 10 3478c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_CSUM_CMPL (0xffff << 16) 3488c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_FLAGS2_CSUM_CMPL_SHIFT 16 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_metadata; 3518c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_cfa_code_v2; 3528c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_V2 (0x1 << 0) 3538c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_MASK (0x7 << 1) 3548c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_SHIFT 1 3558c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_NO_BUFFER (0x0 << 1) 3568c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_BAD_FORMAT (0x3 << 1) 3578c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_FLUSH (0x5 << 1) 3588c2ecf20Sopenharmony_ci #define RX_TPA_START_CMP_CFA_CODE (0xffff << 16) 3598c2ecf20Sopenharmony_ci #define RX_TPA_START_CMPL_CFA_CODE_SHIFT 16 3608c2ecf20Sopenharmony_ci __le32 rx_tpa_start_cmp_hdr_info; 3618c2ecf20Sopenharmony_ci}; 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci#define TPA_START_CFA_CODE(rx_tpa_start) \ 3648c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_cfa_code_v2) & \ 3658c2ecf20Sopenharmony_ci RX_TPA_START_CMP_CFA_CODE) >> RX_TPA_START_CMPL_CFA_CODE_SHIFT) 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci#define TPA_START_IS_IPV6(rx_tpa_start) \ 3688c2ecf20Sopenharmony_ci (!!((rx_tpa_start)->rx_tpa_start_cmp_flags2 & \ 3698c2ecf20Sopenharmony_ci cpu_to_le32(RX_TPA_START_CMP_FLAGS2_IP_TYPE))) 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci#define TPA_START_ERROR_CODE(rx_tpa_start) \ 3728c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_cfa_code_v2) & \ 3738c2ecf20Sopenharmony_ci RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_MASK) >> \ 3748c2ecf20Sopenharmony_ci RX_TPA_START_CMP_ERRORS_BUFFER_ERROR_SHIFT) 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_cistruct rx_tpa_end_cmp { 3778c2ecf20Sopenharmony_ci __le32 rx_tpa_end_cmp_len_flags_type; 3788c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_TYPE (0x3f << 0) 3798c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS (0x3ff << 6) 3808c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_SHIFT 6 3818c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_PLACEMENT (0x7 << 7) 3828c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_PLACEMENT_SHIFT 7 3838c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_PLACEMENT_JUMBO (0x1 << 7) 3848c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_PLACEMENT_HDS (0x2 << 7) 3858c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_JUMBO (0x5 << 7) 3868c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_HDS (0x6 << 7) 3878c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_RSS_VALID (0x1 << 10) 3888c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_ITYPES (0xf << 12) 3898c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_ITYPES_SHIFT 12 3908c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_FLAGS_ITYPE_TCP (0x2 << 12) 3918c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_LEN (0xffff << 16) 3928c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_LEN_SHIFT 16 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci u32 rx_tpa_end_cmp_opaque; 3958c2ecf20Sopenharmony_ci __le32 rx_tpa_end_cmp_misc_v1; 3968c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_V1 (0x1 << 0) 3978c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_BUFS (0x3f << 1) 3988c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_BUFS_SHIFT 1 3998c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_TPA_SEGS (0xff << 8) 4008c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_TPA_SEGS_SHIFT 8 4018c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_PAYLOAD_OFFSET (0xff << 16) 4028c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT 16 4038c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_ID (0x7f << 25) 4048c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_ID_SHIFT 25 4058c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_ID_P5 (0xffff << 16) 4068c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_ID_SHIFT_P5 16 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci __le32 rx_tpa_end_cmp_tsdelta; 4098c2ecf20Sopenharmony_ci #define RX_TPA_END_GRO_TS (0x1 << 31) 4108c2ecf20Sopenharmony_ci}; 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci#define TPA_END_AGG_ID(rx_tpa_end) \ 4138c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ 4148c2ecf20Sopenharmony_ci RX_TPA_END_CMP_AGG_ID) >> RX_TPA_END_CMP_AGG_ID_SHIFT) 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci#define TPA_END_AGG_ID_P5(rx_tpa_end) \ 4178c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ 4188c2ecf20Sopenharmony_ci RX_TPA_END_CMP_AGG_ID_P5) >> RX_TPA_END_CMP_AGG_ID_SHIFT_P5) 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci#define TPA_END_PAYLOAD_OFF(rx_tpa_end) \ 4218c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ 4228c2ecf20Sopenharmony_ci RX_TPA_END_CMP_PAYLOAD_OFFSET) >> RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT) 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci#define TPA_END_AGG_BUFS(rx_tpa_end) \ 4258c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ 4268c2ecf20Sopenharmony_ci RX_TPA_END_CMP_AGG_BUFS) >> RX_TPA_END_CMP_AGG_BUFS_SHIFT) 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_ci#define TPA_END_TPA_SEGS(rx_tpa_end) \ 4298c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end)->rx_tpa_end_cmp_misc_v1) & \ 4308c2ecf20Sopenharmony_ci RX_TPA_END_CMP_TPA_SEGS) >> RX_TPA_END_CMP_TPA_SEGS_SHIFT) 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci#define RX_TPA_END_CMP_FLAGS_PLACEMENT_ANY_GRO \ 4338c2ecf20Sopenharmony_ci cpu_to_le32(RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_JUMBO & \ 4348c2ecf20Sopenharmony_ci RX_TPA_END_CMP_FLAGS_PLACEMENT_GRO_HDS) 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ci#define TPA_END_GRO(rx_tpa_end) \ 4378c2ecf20Sopenharmony_ci ((rx_tpa_end)->rx_tpa_end_cmp_len_flags_type & \ 4388c2ecf20Sopenharmony_ci RX_TPA_END_CMP_FLAGS_PLACEMENT_ANY_GRO) 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci#define TPA_END_GRO_TS(rx_tpa_end) \ 4418c2ecf20Sopenharmony_ci (!!((rx_tpa_end)->rx_tpa_end_cmp_tsdelta & \ 4428c2ecf20Sopenharmony_ci cpu_to_le32(RX_TPA_END_GRO_TS))) 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_cistruct rx_tpa_end_cmp_ext { 4458c2ecf20Sopenharmony_ci __le32 rx_tpa_end_cmp_dup_acks; 4468c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_TPA_DUP_ACKS (0xf << 0) 4478c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_PAYLOAD_OFFSET_P5 (0xff << 16) 4488c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT_P5 16 4498c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_BUFS_P5 (0xff << 24) 4508c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_AGG_BUFS_SHIFT_P5 24 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci __le32 rx_tpa_end_cmp_seg_len; 4538c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_TPA_SEG_LEN (0xffff << 0) 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci __le32 rx_tpa_end_cmp_errors_v2; 4568c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_V2 (0x1 << 0) 4578c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS (0x3 << 1) 4588c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS_P5 (0x7 << 1) 4598c2ecf20Sopenharmony_ci #define RX_TPA_END_CMPL_ERRORS_SHIFT 1 4608c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_NO_BUFFER (0x0 << 1) 4618c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_NOT_ON_CHIP (0x2 << 1) 4628c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_BAD_FORMAT (0x3 << 1) 4638c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_RSV_ERROR (0x4 << 1) 4648c2ecf20Sopenharmony_ci #define RX_TPA_END_CMP_ERRORS_BUFFER_ERROR_FLUSH (0x5 << 1) 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci u32 rx_tpa_end_cmp_start_opaque; 4678c2ecf20Sopenharmony_ci}; 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci#define TPA_END_ERRORS(rx_tpa_end_ext) \ 4708c2ecf20Sopenharmony_ci ((rx_tpa_end_ext)->rx_tpa_end_cmp_errors_v2 & \ 4718c2ecf20Sopenharmony_ci cpu_to_le32(RX_TPA_END_CMP_ERRORS)) 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_ci#define TPA_END_PAYLOAD_OFF_P5(rx_tpa_end_ext) \ 4748c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end_ext)->rx_tpa_end_cmp_dup_acks) & \ 4758c2ecf20Sopenharmony_ci RX_TPA_END_CMP_PAYLOAD_OFFSET_P5) >> \ 4768c2ecf20Sopenharmony_ci RX_TPA_END_CMP_PAYLOAD_OFFSET_SHIFT_P5) 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci#define TPA_END_AGG_BUFS_P5(rx_tpa_end_ext) \ 4798c2ecf20Sopenharmony_ci ((le32_to_cpu((rx_tpa_end_ext)->rx_tpa_end_cmp_dup_acks) & \ 4808c2ecf20Sopenharmony_ci RX_TPA_END_CMP_AGG_BUFS_P5) >> RX_TPA_END_CMP_AGG_BUFS_SHIFT_P5) 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci#define EVENT_DATA1_RESET_NOTIFY_FATAL(data1) \ 4838c2ecf20Sopenharmony_ci (((data1) & \ 4848c2ecf20Sopenharmony_ci ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_MASK) ==\ 4858c2ecf20Sopenharmony_ci ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL) 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci#define EVENT_DATA1_RECOVERY_MASTER_FUNC(data1) \ 4888c2ecf20Sopenharmony_ci !!((data1) & \ 4898c2ecf20Sopenharmony_ci ASYNC_EVENT_CMPL_ERROR_RECOVERY_EVENT_DATA1_FLAGS_MASTER_FUNC) 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci#define EVENT_DATA1_RECOVERY_ENABLED(data1) \ 4928c2ecf20Sopenharmony_ci !!((data1) & \ 4938c2ecf20Sopenharmony_ci ASYNC_EVENT_CMPL_ERROR_RECOVERY_EVENT_DATA1_FLAGS_RECOVERY_ENABLED) 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_cistruct nqe_cn { 4968c2ecf20Sopenharmony_ci __le16 type; 4978c2ecf20Sopenharmony_ci #define NQ_CN_TYPE_MASK 0x3fUL 4988c2ecf20Sopenharmony_ci #define NQ_CN_TYPE_SFT 0 4998c2ecf20Sopenharmony_ci #define NQ_CN_TYPE_CQ_NOTIFICATION 0x30UL 5008c2ecf20Sopenharmony_ci #define NQ_CN_TYPE_LAST NQ_CN_TYPE_CQ_NOTIFICATION 5018c2ecf20Sopenharmony_ci __le16 reserved16; 5028c2ecf20Sopenharmony_ci __le32 cq_handle_low; 5038c2ecf20Sopenharmony_ci __le32 v; 5048c2ecf20Sopenharmony_ci #define NQ_CN_V 0x1UL 5058c2ecf20Sopenharmony_ci __le32 cq_handle_high; 5068c2ecf20Sopenharmony_ci}; 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ci#define DB_IDX_MASK 0xffffff 5098c2ecf20Sopenharmony_ci#define DB_IDX_VALID (0x1 << 26) 5108c2ecf20Sopenharmony_ci#define DB_IRQ_DIS (0x1 << 27) 5118c2ecf20Sopenharmony_ci#define DB_KEY_TX (0x0 << 28) 5128c2ecf20Sopenharmony_ci#define DB_KEY_RX (0x1 << 28) 5138c2ecf20Sopenharmony_ci#define DB_KEY_CP (0x2 << 28) 5148c2ecf20Sopenharmony_ci#define DB_KEY_ST (0x3 << 28) 5158c2ecf20Sopenharmony_ci#define DB_KEY_TX_PUSH (0x4 << 28) 5168c2ecf20Sopenharmony_ci#define DB_LONG_TX_PUSH (0x2 << 24) 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci#define BNXT_MIN_ROCE_CP_RINGS 2 5198c2ecf20Sopenharmony_ci#define BNXT_MIN_ROCE_STAT_CTXS 1 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci/* 64-bit doorbell */ 5228c2ecf20Sopenharmony_ci#define DBR_INDEX_MASK 0x0000000000ffffffULL 5238c2ecf20Sopenharmony_ci#define DBR_XID_MASK 0x000fffff00000000ULL 5248c2ecf20Sopenharmony_ci#define DBR_XID_SFT 32 5258c2ecf20Sopenharmony_ci#define DBR_PATH_L2 (0x1ULL << 56) 5268c2ecf20Sopenharmony_ci#define DBR_TYPE_SQ (0x0ULL << 60) 5278c2ecf20Sopenharmony_ci#define DBR_TYPE_RQ (0x1ULL << 60) 5288c2ecf20Sopenharmony_ci#define DBR_TYPE_SRQ (0x2ULL << 60) 5298c2ecf20Sopenharmony_ci#define DBR_TYPE_SRQ_ARM (0x3ULL << 60) 5308c2ecf20Sopenharmony_ci#define DBR_TYPE_CQ (0x4ULL << 60) 5318c2ecf20Sopenharmony_ci#define DBR_TYPE_CQ_ARMSE (0x5ULL << 60) 5328c2ecf20Sopenharmony_ci#define DBR_TYPE_CQ_ARMALL (0x6ULL << 60) 5338c2ecf20Sopenharmony_ci#define DBR_TYPE_CQ_ARMENA (0x7ULL << 60) 5348c2ecf20Sopenharmony_ci#define DBR_TYPE_SRQ_ARMENA (0x8ULL << 60) 5358c2ecf20Sopenharmony_ci#define DBR_TYPE_CQ_CUTOFF_ACK (0x9ULL << 60) 5368c2ecf20Sopenharmony_ci#define DBR_TYPE_NQ (0xaULL << 60) 5378c2ecf20Sopenharmony_ci#define DBR_TYPE_NQ_ARM (0xbULL << 60) 5388c2ecf20Sopenharmony_ci#define DBR_TYPE_NULL (0xfULL << 60) 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci#define DB_PF_OFFSET_P5 0x10000 5418c2ecf20Sopenharmony_ci#define DB_VF_OFFSET_P5 0x4000 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci#define INVALID_HW_RING_ID ((u16)-1) 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci/* The hardware supports certain page sizes. Use the supported page sizes 5468c2ecf20Sopenharmony_ci * to allocate the rings. 5478c2ecf20Sopenharmony_ci */ 5488c2ecf20Sopenharmony_ci#if (PAGE_SHIFT < 12) 5498c2ecf20Sopenharmony_ci#define BNXT_PAGE_SHIFT 12 5508c2ecf20Sopenharmony_ci#elif (PAGE_SHIFT <= 13) 5518c2ecf20Sopenharmony_ci#define BNXT_PAGE_SHIFT PAGE_SHIFT 5528c2ecf20Sopenharmony_ci#elif (PAGE_SHIFT < 16) 5538c2ecf20Sopenharmony_ci#define BNXT_PAGE_SHIFT 13 5548c2ecf20Sopenharmony_ci#else 5558c2ecf20Sopenharmony_ci#define BNXT_PAGE_SHIFT 16 5568c2ecf20Sopenharmony_ci#endif 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT) 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci/* The RXBD length is 16-bit so we can only support page sizes < 64K */ 5618c2ecf20Sopenharmony_ci#if (PAGE_SHIFT > 15) 5628c2ecf20Sopenharmony_ci#define BNXT_RX_PAGE_SHIFT 15 5638c2ecf20Sopenharmony_ci#else 5648c2ecf20Sopenharmony_ci#define BNXT_RX_PAGE_SHIFT PAGE_SHIFT 5658c2ecf20Sopenharmony_ci#endif 5668c2ecf20Sopenharmony_ci 5678c2ecf20Sopenharmony_ci#define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT) 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_ci#define BNXT_MAX_MTU 9500 5708c2ecf20Sopenharmony_ci#define BNXT_MAX_PAGE_MODE_MTU \ 5718c2ecf20Sopenharmony_ci ((unsigned int)PAGE_SIZE - VLAN_ETH_HLEN - NET_IP_ALIGN - \ 5728c2ecf20Sopenharmony_ci XDP_PACKET_HEADROOM - \ 5738c2ecf20Sopenharmony_ci SKB_DATA_ALIGN((unsigned int)sizeof(struct skb_shared_info))) 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci#define BNXT_MIN_PKT_SIZE 52 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci#define BNXT_DEFAULT_RX_RING_SIZE 511 5788c2ecf20Sopenharmony_ci#define BNXT_DEFAULT_TX_RING_SIZE 511 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci#define MAX_TPA 64 5818c2ecf20Sopenharmony_ci#define MAX_TPA_P5 256 5828c2ecf20Sopenharmony_ci#define MAX_TPA_P5_MASK (MAX_TPA_P5 - 1) 5838c2ecf20Sopenharmony_ci#define MAX_TPA_SEGS_P5 0x3f 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_ci#if (BNXT_PAGE_SHIFT == 16) 5868c2ecf20Sopenharmony_ci#define MAX_RX_PAGES 1 5878c2ecf20Sopenharmony_ci#define MAX_RX_AGG_PAGES 4 5888c2ecf20Sopenharmony_ci#define MAX_TX_PAGES 1 5898c2ecf20Sopenharmony_ci#define MAX_CP_PAGES 8 5908c2ecf20Sopenharmony_ci#else 5918c2ecf20Sopenharmony_ci#define MAX_RX_PAGES 8 5928c2ecf20Sopenharmony_ci#define MAX_RX_AGG_PAGES 32 5938c2ecf20Sopenharmony_ci#define MAX_TX_PAGES 8 5948c2ecf20Sopenharmony_ci#define MAX_CP_PAGES 64 5958c2ecf20Sopenharmony_ci#endif 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci#define RX_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct rx_bd)) 5988c2ecf20Sopenharmony_ci#define TX_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct tx_bd)) 5998c2ecf20Sopenharmony_ci#define CP_DESC_CNT (BNXT_PAGE_SIZE / sizeof(struct tx_cmp)) 6008c2ecf20Sopenharmony_ci 6018c2ecf20Sopenharmony_ci#define SW_RXBD_RING_SIZE (sizeof(struct bnxt_sw_rx_bd) * RX_DESC_CNT) 6028c2ecf20Sopenharmony_ci#define HW_RXBD_RING_SIZE (sizeof(struct rx_bd) * RX_DESC_CNT) 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_ci#define SW_RXBD_AGG_RING_SIZE (sizeof(struct bnxt_sw_rx_agg_bd) * RX_DESC_CNT) 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_ci#define SW_TXBD_RING_SIZE (sizeof(struct bnxt_sw_tx_bd) * TX_DESC_CNT) 6078c2ecf20Sopenharmony_ci#define HW_TXBD_RING_SIZE (sizeof(struct tx_bd) * TX_DESC_CNT) 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ci#define HW_CMPD_RING_SIZE (sizeof(struct tx_cmp) * CP_DESC_CNT) 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ci#define BNXT_MAX_RX_DESC_CNT (RX_DESC_CNT * MAX_RX_PAGES - 1) 6128c2ecf20Sopenharmony_ci#define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) 6138c2ecf20Sopenharmony_ci#define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra 6168c2ecf20Sopenharmony_ci * BD because the first TX BD is always a long BD. 6178c2ecf20Sopenharmony_ci */ 6188c2ecf20Sopenharmony_ci#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2) 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci#define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) 6218c2ecf20Sopenharmony_ci#define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) 6228c2ecf20Sopenharmony_ci 6238c2ecf20Sopenharmony_ci#define TX_RING(x) (((x) & ~(TX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) 6248c2ecf20Sopenharmony_ci#define TX_IDX(x) ((x) & (TX_DESC_CNT - 1)) 6258c2ecf20Sopenharmony_ci 6268c2ecf20Sopenharmony_ci#define CP_RING(x) (((x) & ~(CP_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) 6278c2ecf20Sopenharmony_ci#define CP_IDX(x) ((x) & (CP_DESC_CNT - 1)) 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci#define TX_CMP_VALID(txcmp, raw_cons) \ 6308c2ecf20Sopenharmony_ci (!!((txcmp)->tx_cmp_errors_v & cpu_to_le32(TX_CMP_V)) == \ 6318c2ecf20Sopenharmony_ci !((raw_cons) & bp->cp_bit)) 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci#define RX_CMP_VALID(rxcmp1, raw_cons) \ 6348c2ecf20Sopenharmony_ci (!!((rxcmp1)->rx_cmp_cfa_code_errors_v2 & cpu_to_le32(RX_CMP_V)) ==\ 6358c2ecf20Sopenharmony_ci !((raw_cons) & bp->cp_bit)) 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_ci#define RX_AGG_CMP_VALID(agg, raw_cons) \ 6388c2ecf20Sopenharmony_ci (!!((agg)->rx_agg_cmp_v & cpu_to_le32(RX_AGG_CMP_V)) == \ 6398c2ecf20Sopenharmony_ci !((raw_cons) & bp->cp_bit)) 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_ci#define NQ_CMP_VALID(nqcmp, raw_cons) \ 6428c2ecf20Sopenharmony_ci (!!((nqcmp)->v & cpu_to_le32(NQ_CN_V)) == !((raw_cons) & bp->cp_bit)) 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_ci#define TX_CMP_TYPE(txcmp) \ 6458c2ecf20Sopenharmony_ci (le32_to_cpu((txcmp)->tx_cmp_flags_type) & CMP_TYPE) 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ci#define RX_CMP_TYPE(rxcmp) \ 6488c2ecf20Sopenharmony_ci (le32_to_cpu((rxcmp)->rx_cmp_len_flags_type) & RX_CMP_CMP_TYPE) 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_ci#define NEXT_RX(idx) (((idx) + 1) & bp->rx_ring_mask) 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci#define NEXT_RX_AGG(idx) (((idx) + 1) & bp->rx_agg_ring_mask) 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_ci#define NEXT_TX(idx) (((idx) + 1) & bp->tx_ring_mask) 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci#define ADV_RAW_CMP(idx, n) ((idx) + (n)) 6578c2ecf20Sopenharmony_ci#define NEXT_RAW_CMP(idx) ADV_RAW_CMP(idx, 1) 6588c2ecf20Sopenharmony_ci#define RING_CMP(idx) ((idx) & bp->cp_ring_mask) 6598c2ecf20Sopenharmony_ci#define NEXT_CMP(idx) RING_CMP(ADV_RAW_CMP(idx, 1)) 6608c2ecf20Sopenharmony_ci 6618c2ecf20Sopenharmony_ci#define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len) 6628c2ecf20Sopenharmony_ci#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) 6638c2ecf20Sopenharmony_ci#define DFLT_HWRM_CMD_TIMEOUT 500 6648c2ecf20Sopenharmony_ci#define SHORT_HWRM_CMD_TIMEOUT 20 6658c2ecf20Sopenharmony_ci#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout) 6668c2ecf20Sopenharmony_ci#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4) 6678c2ecf20Sopenharmony_ci#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12) 6688c2ecf20Sopenharmony_ci#define BNXT_HWRM_REQ_MAX_SIZE 128 6698c2ecf20Sopenharmony_ci#define BNXT_HWRM_REQS_PER_PAGE (BNXT_PAGE_SIZE / \ 6708c2ecf20Sopenharmony_ci BNXT_HWRM_REQ_MAX_SIZE) 6718c2ecf20Sopenharmony_ci#define HWRM_SHORT_MIN_TIMEOUT 3 6728c2ecf20Sopenharmony_ci#define HWRM_SHORT_MAX_TIMEOUT 10 6738c2ecf20Sopenharmony_ci#define HWRM_SHORT_TIMEOUT_COUNTER 5 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ci#define HWRM_MIN_TIMEOUT 25 6768c2ecf20Sopenharmony_ci#define HWRM_MAX_TIMEOUT 40 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_ci#define HWRM_TOTAL_TIMEOUT(n) (((n) <= HWRM_SHORT_TIMEOUT_COUNTER) ? \ 6798c2ecf20Sopenharmony_ci ((n) * HWRM_SHORT_MIN_TIMEOUT) : \ 6808c2ecf20Sopenharmony_ci (HWRM_SHORT_TIMEOUT_COUNTER * HWRM_SHORT_MIN_TIMEOUT + \ 6818c2ecf20Sopenharmony_ci ((n) - HWRM_SHORT_TIMEOUT_COUNTER) * HWRM_MIN_TIMEOUT)) 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci#define HWRM_VALID_BIT_DELAY_USEC 150 6848c2ecf20Sopenharmony_ci 6858c2ecf20Sopenharmony_ci#define BNXT_HWRM_CHNL_CHIMP 0 6868c2ecf20Sopenharmony_ci#define BNXT_HWRM_CHNL_KONG 1 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci#define BNXT_RX_EVENT 1 6898c2ecf20Sopenharmony_ci#define BNXT_AGG_EVENT 2 6908c2ecf20Sopenharmony_ci#define BNXT_TX_EVENT 4 6918c2ecf20Sopenharmony_ci#define BNXT_REDIRECT_EVENT 8 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_cistruct bnxt_sw_tx_bd { 6948c2ecf20Sopenharmony_ci union { 6958c2ecf20Sopenharmony_ci struct sk_buff *skb; 6968c2ecf20Sopenharmony_ci struct xdp_frame *xdpf; 6978c2ecf20Sopenharmony_ci }; 6988c2ecf20Sopenharmony_ci DEFINE_DMA_UNMAP_ADDR(mapping); 6998c2ecf20Sopenharmony_ci DEFINE_DMA_UNMAP_LEN(len); 7008c2ecf20Sopenharmony_ci u8 is_gso; 7018c2ecf20Sopenharmony_ci u8 is_push; 7028c2ecf20Sopenharmony_ci u8 action; 7038c2ecf20Sopenharmony_ci union { 7048c2ecf20Sopenharmony_ci unsigned short nr_frags; 7058c2ecf20Sopenharmony_ci u16 rx_prod; 7068c2ecf20Sopenharmony_ci }; 7078c2ecf20Sopenharmony_ci}; 7088c2ecf20Sopenharmony_ci 7098c2ecf20Sopenharmony_cistruct bnxt_sw_rx_bd { 7108c2ecf20Sopenharmony_ci void *data; 7118c2ecf20Sopenharmony_ci u8 *data_ptr; 7128c2ecf20Sopenharmony_ci dma_addr_t mapping; 7138c2ecf20Sopenharmony_ci}; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_cistruct bnxt_sw_rx_agg_bd { 7168c2ecf20Sopenharmony_ci struct page *page; 7178c2ecf20Sopenharmony_ci unsigned int offset; 7188c2ecf20Sopenharmony_ci dma_addr_t mapping; 7198c2ecf20Sopenharmony_ci}; 7208c2ecf20Sopenharmony_ci 7218c2ecf20Sopenharmony_cistruct bnxt_ring_mem_info { 7228c2ecf20Sopenharmony_ci int nr_pages; 7238c2ecf20Sopenharmony_ci int page_size; 7248c2ecf20Sopenharmony_ci u16 flags; 7258c2ecf20Sopenharmony_ci#define BNXT_RMEM_VALID_PTE_FLAG 1 7268c2ecf20Sopenharmony_ci#define BNXT_RMEM_RING_PTE_FLAG 2 7278c2ecf20Sopenharmony_ci#define BNXT_RMEM_USE_FULL_PAGE_FLAG 4 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci u16 depth; 7308c2ecf20Sopenharmony_ci u8 init_val; 7318c2ecf20Sopenharmony_ci 7328c2ecf20Sopenharmony_ci void **pg_arr; 7338c2ecf20Sopenharmony_ci dma_addr_t *dma_arr; 7348c2ecf20Sopenharmony_ci 7358c2ecf20Sopenharmony_ci __le64 *pg_tbl; 7368c2ecf20Sopenharmony_ci dma_addr_t pg_tbl_map; 7378c2ecf20Sopenharmony_ci 7388c2ecf20Sopenharmony_ci int vmem_size; 7398c2ecf20Sopenharmony_ci void **vmem; 7408c2ecf20Sopenharmony_ci}; 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_cistruct bnxt_ring_struct { 7438c2ecf20Sopenharmony_ci struct bnxt_ring_mem_info ring_mem; 7448c2ecf20Sopenharmony_ci 7458c2ecf20Sopenharmony_ci u16 fw_ring_id; /* Ring id filled by Chimp FW */ 7468c2ecf20Sopenharmony_ci union { 7478c2ecf20Sopenharmony_ci u16 grp_idx; 7488c2ecf20Sopenharmony_ci u16 map_idx; /* Used by cmpl rings */ 7498c2ecf20Sopenharmony_ci }; 7508c2ecf20Sopenharmony_ci u32 handle; 7518c2ecf20Sopenharmony_ci u8 queue_id; 7528c2ecf20Sopenharmony_ci}; 7538c2ecf20Sopenharmony_ci 7548c2ecf20Sopenharmony_cistruct tx_push_bd { 7558c2ecf20Sopenharmony_ci __le32 doorbell; 7568c2ecf20Sopenharmony_ci __le32 tx_bd_len_flags_type; 7578c2ecf20Sopenharmony_ci u32 tx_bd_opaque; 7588c2ecf20Sopenharmony_ci struct tx_bd_ext txbd2; 7598c2ecf20Sopenharmony_ci}; 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_cistruct tx_push_buffer { 7628c2ecf20Sopenharmony_ci struct tx_push_bd push_bd; 7638c2ecf20Sopenharmony_ci u32 data[25]; 7648c2ecf20Sopenharmony_ci}; 7658c2ecf20Sopenharmony_ci 7668c2ecf20Sopenharmony_cistruct bnxt_db_info { 7678c2ecf20Sopenharmony_ci void __iomem *doorbell; 7688c2ecf20Sopenharmony_ci union { 7698c2ecf20Sopenharmony_ci u64 db_key64; 7708c2ecf20Sopenharmony_ci u32 db_key32; 7718c2ecf20Sopenharmony_ci }; 7728c2ecf20Sopenharmony_ci}; 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_cistruct bnxt_tx_ring_info { 7758c2ecf20Sopenharmony_ci struct bnxt_napi *bnapi; 7768c2ecf20Sopenharmony_ci u16 tx_prod; 7778c2ecf20Sopenharmony_ci u16 tx_cons; 7788c2ecf20Sopenharmony_ci u16 txq_index; 7798c2ecf20Sopenharmony_ci u8 kick_pending; 7808c2ecf20Sopenharmony_ci struct bnxt_db_info tx_db; 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_ci struct tx_bd *tx_desc_ring[MAX_TX_PAGES]; 7838c2ecf20Sopenharmony_ci struct bnxt_sw_tx_bd *tx_buf_ring; 7848c2ecf20Sopenharmony_ci 7858c2ecf20Sopenharmony_ci dma_addr_t tx_desc_mapping[MAX_TX_PAGES]; 7868c2ecf20Sopenharmony_ci 7878c2ecf20Sopenharmony_ci struct tx_push_buffer *tx_push; 7888c2ecf20Sopenharmony_ci dma_addr_t tx_push_mapping; 7898c2ecf20Sopenharmony_ci __le64 data_mapping; 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_ci#define BNXT_DEV_STATE_CLOSING 0x1 7928c2ecf20Sopenharmony_ci u32 dev_state; 7938c2ecf20Sopenharmony_ci 7948c2ecf20Sopenharmony_ci struct bnxt_ring_struct tx_ring_struct; 7958c2ecf20Sopenharmony_ci}; 7968c2ecf20Sopenharmony_ci 7978c2ecf20Sopenharmony_ci#define BNXT_LEGACY_COAL_CMPL_PARAMS \ 7988c2ecf20Sopenharmony_ci (RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_INT_LAT_TMR_MIN | \ 7998c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_INT_LAT_TMR_MAX | \ 8008c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_TIMER_RESET | \ 8018c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_RING_IDLE | \ 8028c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_NUM_CMPL_DMA_AGGR | \ 8038c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_NUM_CMPL_DMA_AGGR_DURING_INT | \ 8048c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_CMPL_AGGR_DMA_TMR | \ 8058c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_CMPL_AGGR_DMA_TMR_DURING_INT | \ 8068c2ecf20Sopenharmony_ci RING_AGGINT_QCAPS_RESP_CMPL_PARAMS_NUM_CMPL_AGGR_INT) 8078c2ecf20Sopenharmony_ci 8088c2ecf20Sopenharmony_ci#define BNXT_COAL_CMPL_ENABLES \ 8098c2ecf20Sopenharmony_ci (RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_NUM_CMPL_DMA_AGGR | \ 8108c2ecf20Sopenharmony_ci RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_CMPL_AGGR_DMA_TMR | \ 8118c2ecf20Sopenharmony_ci RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_INT_LAT_TMR_MAX | \ 8128c2ecf20Sopenharmony_ci RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_NUM_CMPL_AGGR_INT) 8138c2ecf20Sopenharmony_ci 8148c2ecf20Sopenharmony_ci#define BNXT_COAL_CMPL_MIN_TMR_ENABLE \ 8158c2ecf20Sopenharmony_ci RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_INT_LAT_TMR_MIN 8168c2ecf20Sopenharmony_ci 8178c2ecf20Sopenharmony_ci#define BNXT_COAL_CMPL_AGGR_TMR_DURING_INT_ENABLE \ 8188c2ecf20Sopenharmony_ci RING_CMPL_RING_CFG_AGGINT_PARAMS_REQ_ENABLES_NUM_CMPL_DMA_AGGR_DURING_INT 8198c2ecf20Sopenharmony_ci 8208c2ecf20Sopenharmony_cistruct bnxt_coal_cap { 8218c2ecf20Sopenharmony_ci u32 cmpl_params; 8228c2ecf20Sopenharmony_ci u32 nq_params; 8238c2ecf20Sopenharmony_ci u16 num_cmpl_dma_aggr_max; 8248c2ecf20Sopenharmony_ci u16 num_cmpl_dma_aggr_during_int_max; 8258c2ecf20Sopenharmony_ci u16 cmpl_aggr_dma_tmr_max; 8268c2ecf20Sopenharmony_ci u16 cmpl_aggr_dma_tmr_during_int_max; 8278c2ecf20Sopenharmony_ci u16 int_lat_tmr_min_max; 8288c2ecf20Sopenharmony_ci u16 int_lat_tmr_max_max; 8298c2ecf20Sopenharmony_ci u16 num_cmpl_aggr_int_max; 8308c2ecf20Sopenharmony_ci u16 timer_units; 8318c2ecf20Sopenharmony_ci}; 8328c2ecf20Sopenharmony_ci 8338c2ecf20Sopenharmony_cistruct bnxt_coal { 8348c2ecf20Sopenharmony_ci u16 coal_ticks; 8358c2ecf20Sopenharmony_ci u16 coal_ticks_irq; 8368c2ecf20Sopenharmony_ci u16 coal_bufs; 8378c2ecf20Sopenharmony_ci u16 coal_bufs_irq; 8388c2ecf20Sopenharmony_ci /* RING_IDLE enabled when coal ticks < idle_thresh */ 8398c2ecf20Sopenharmony_ci u16 idle_thresh; 8408c2ecf20Sopenharmony_ci u8 bufs_per_record; 8418c2ecf20Sopenharmony_ci u8 budget; 8428c2ecf20Sopenharmony_ci}; 8438c2ecf20Sopenharmony_ci 8448c2ecf20Sopenharmony_cistruct bnxt_tpa_info { 8458c2ecf20Sopenharmony_ci void *data; 8468c2ecf20Sopenharmony_ci u8 *data_ptr; 8478c2ecf20Sopenharmony_ci dma_addr_t mapping; 8488c2ecf20Sopenharmony_ci u16 len; 8498c2ecf20Sopenharmony_ci unsigned short gso_type; 8508c2ecf20Sopenharmony_ci u32 flags2; 8518c2ecf20Sopenharmony_ci u32 metadata; 8528c2ecf20Sopenharmony_ci enum pkt_hash_types hash_type; 8538c2ecf20Sopenharmony_ci u32 rss_hash; 8548c2ecf20Sopenharmony_ci u32 hdr_info; 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_ci#define BNXT_TPA_L4_SIZE(hdr_info) \ 8578c2ecf20Sopenharmony_ci (((hdr_info) & 0xf8000000) ? ((hdr_info) >> 27) : 32) 8588c2ecf20Sopenharmony_ci 8598c2ecf20Sopenharmony_ci#define BNXT_TPA_INNER_L3_OFF(hdr_info) \ 8608c2ecf20Sopenharmony_ci (((hdr_info) >> 18) & 0x1ff) 8618c2ecf20Sopenharmony_ci 8628c2ecf20Sopenharmony_ci#define BNXT_TPA_INNER_L2_OFF(hdr_info) \ 8638c2ecf20Sopenharmony_ci (((hdr_info) >> 9) & 0x1ff) 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ci#define BNXT_TPA_OUTER_L3_OFF(hdr_info) \ 8668c2ecf20Sopenharmony_ci ((hdr_info) & 0x1ff) 8678c2ecf20Sopenharmony_ci 8688c2ecf20Sopenharmony_ci u16 cfa_code; /* cfa_code in TPA start compl */ 8698c2ecf20Sopenharmony_ci u8 agg_count; 8708c2ecf20Sopenharmony_ci struct rx_agg_cmp *agg_arr; 8718c2ecf20Sopenharmony_ci}; 8728c2ecf20Sopenharmony_ci 8738c2ecf20Sopenharmony_ci#define BNXT_AGG_IDX_BMAP_SIZE (MAX_TPA_P5 / BITS_PER_LONG) 8748c2ecf20Sopenharmony_ci 8758c2ecf20Sopenharmony_cistruct bnxt_tpa_idx_map { 8768c2ecf20Sopenharmony_ci u16 agg_id_tbl[1024]; 8778c2ecf20Sopenharmony_ci unsigned long agg_idx_bmap[BNXT_AGG_IDX_BMAP_SIZE]; 8788c2ecf20Sopenharmony_ci}; 8798c2ecf20Sopenharmony_ci 8808c2ecf20Sopenharmony_cistruct bnxt_rx_ring_info { 8818c2ecf20Sopenharmony_ci struct bnxt_napi *bnapi; 8828c2ecf20Sopenharmony_ci u16 rx_prod; 8838c2ecf20Sopenharmony_ci u16 rx_agg_prod; 8848c2ecf20Sopenharmony_ci u16 rx_sw_agg_prod; 8858c2ecf20Sopenharmony_ci u16 rx_next_cons; 8868c2ecf20Sopenharmony_ci struct bnxt_db_info rx_db; 8878c2ecf20Sopenharmony_ci struct bnxt_db_info rx_agg_db; 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_ci struct bpf_prog *xdp_prog; 8908c2ecf20Sopenharmony_ci 8918c2ecf20Sopenharmony_ci struct rx_bd *rx_desc_ring[MAX_RX_PAGES]; 8928c2ecf20Sopenharmony_ci struct bnxt_sw_rx_bd *rx_buf_ring; 8938c2ecf20Sopenharmony_ci 8948c2ecf20Sopenharmony_ci struct rx_bd *rx_agg_desc_ring[MAX_RX_AGG_PAGES]; 8958c2ecf20Sopenharmony_ci struct bnxt_sw_rx_agg_bd *rx_agg_ring; 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_ci unsigned long *rx_agg_bmap; 8988c2ecf20Sopenharmony_ci u16 rx_agg_bmap_size; 8998c2ecf20Sopenharmony_ci 9008c2ecf20Sopenharmony_ci struct page *rx_page; 9018c2ecf20Sopenharmony_ci unsigned int rx_page_offset; 9028c2ecf20Sopenharmony_ci 9038c2ecf20Sopenharmony_ci dma_addr_t rx_desc_mapping[MAX_RX_PAGES]; 9048c2ecf20Sopenharmony_ci dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES]; 9058c2ecf20Sopenharmony_ci 9068c2ecf20Sopenharmony_ci struct bnxt_tpa_info *rx_tpa; 9078c2ecf20Sopenharmony_ci struct bnxt_tpa_idx_map *rx_tpa_idx_map; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_ci struct bnxt_ring_struct rx_ring_struct; 9108c2ecf20Sopenharmony_ci struct bnxt_ring_struct rx_agg_ring_struct; 9118c2ecf20Sopenharmony_ci struct xdp_rxq_info xdp_rxq; 9128c2ecf20Sopenharmony_ci struct page_pool *page_pool; 9138c2ecf20Sopenharmony_ci}; 9148c2ecf20Sopenharmony_ci 9158c2ecf20Sopenharmony_cistruct bnxt_rx_sw_stats { 9168c2ecf20Sopenharmony_ci u64 rx_l4_csum_errors; 9178c2ecf20Sopenharmony_ci u64 rx_resets; 9188c2ecf20Sopenharmony_ci u64 rx_buf_errors; 9198c2ecf20Sopenharmony_ci}; 9208c2ecf20Sopenharmony_ci 9218c2ecf20Sopenharmony_cistruct bnxt_cmn_sw_stats { 9228c2ecf20Sopenharmony_ci u64 missed_irqs; 9238c2ecf20Sopenharmony_ci}; 9248c2ecf20Sopenharmony_ci 9258c2ecf20Sopenharmony_cistruct bnxt_sw_stats { 9268c2ecf20Sopenharmony_ci struct bnxt_rx_sw_stats rx; 9278c2ecf20Sopenharmony_ci struct bnxt_cmn_sw_stats cmn; 9288c2ecf20Sopenharmony_ci}; 9298c2ecf20Sopenharmony_ci 9308c2ecf20Sopenharmony_cistruct bnxt_stats_mem { 9318c2ecf20Sopenharmony_ci u64 *sw_stats; 9328c2ecf20Sopenharmony_ci u64 *hw_masks; 9338c2ecf20Sopenharmony_ci void *hw_stats; 9348c2ecf20Sopenharmony_ci dma_addr_t hw_stats_map; 9358c2ecf20Sopenharmony_ci int len; 9368c2ecf20Sopenharmony_ci}; 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_cistruct bnxt_cp_ring_info { 9398c2ecf20Sopenharmony_ci struct bnxt_napi *bnapi; 9408c2ecf20Sopenharmony_ci u32 cp_raw_cons; 9418c2ecf20Sopenharmony_ci struct bnxt_db_info cp_db; 9428c2ecf20Sopenharmony_ci 9438c2ecf20Sopenharmony_ci u8 had_work_done:1; 9448c2ecf20Sopenharmony_ci u8 has_more_work:1; 9458c2ecf20Sopenharmony_ci 9468c2ecf20Sopenharmony_ci u32 last_cp_raw_cons; 9478c2ecf20Sopenharmony_ci 9488c2ecf20Sopenharmony_ci struct bnxt_coal rx_ring_coal; 9498c2ecf20Sopenharmony_ci u64 rx_packets; 9508c2ecf20Sopenharmony_ci u64 rx_bytes; 9518c2ecf20Sopenharmony_ci u64 event_ctr; 9528c2ecf20Sopenharmony_ci 9538c2ecf20Sopenharmony_ci struct dim dim; 9548c2ecf20Sopenharmony_ci 9558c2ecf20Sopenharmony_ci union { 9568c2ecf20Sopenharmony_ci struct tx_cmp *cp_desc_ring[MAX_CP_PAGES]; 9578c2ecf20Sopenharmony_ci struct nqe_cn *nq_desc_ring[MAX_CP_PAGES]; 9588c2ecf20Sopenharmony_ci }; 9598c2ecf20Sopenharmony_ci 9608c2ecf20Sopenharmony_ci dma_addr_t cp_desc_mapping[MAX_CP_PAGES]; 9618c2ecf20Sopenharmony_ci 9628c2ecf20Sopenharmony_ci struct bnxt_stats_mem stats; 9638c2ecf20Sopenharmony_ci u32 hw_stats_ctx_id; 9648c2ecf20Sopenharmony_ci 9658c2ecf20Sopenharmony_ci struct bnxt_sw_stats sw_stats; 9668c2ecf20Sopenharmony_ci 9678c2ecf20Sopenharmony_ci struct bnxt_ring_struct cp_ring_struct; 9688c2ecf20Sopenharmony_ci 9698c2ecf20Sopenharmony_ci struct bnxt_cp_ring_info *cp_ring_arr[2]; 9708c2ecf20Sopenharmony_ci#define BNXT_RX_HDL 0 9718c2ecf20Sopenharmony_ci#define BNXT_TX_HDL 1 9728c2ecf20Sopenharmony_ci}; 9738c2ecf20Sopenharmony_ci 9748c2ecf20Sopenharmony_cistruct bnxt_napi { 9758c2ecf20Sopenharmony_ci struct napi_struct napi; 9768c2ecf20Sopenharmony_ci struct bnxt *bp; 9778c2ecf20Sopenharmony_ci 9788c2ecf20Sopenharmony_ci int index; 9798c2ecf20Sopenharmony_ci struct bnxt_cp_ring_info cp_ring; 9808c2ecf20Sopenharmony_ci struct bnxt_rx_ring_info *rx_ring; 9818c2ecf20Sopenharmony_ci struct bnxt_tx_ring_info *tx_ring; 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci void (*tx_int)(struct bnxt *, struct bnxt_napi *, 9848c2ecf20Sopenharmony_ci int); 9858c2ecf20Sopenharmony_ci int tx_pkts; 9868c2ecf20Sopenharmony_ci u8 events; 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_ci u32 flags; 9898c2ecf20Sopenharmony_ci#define BNXT_NAPI_FLAG_XDP 0x1 9908c2ecf20Sopenharmony_ci 9918c2ecf20Sopenharmony_ci bool in_reset; 9928c2ecf20Sopenharmony_ci}; 9938c2ecf20Sopenharmony_ci 9948c2ecf20Sopenharmony_cistruct bnxt_irq { 9958c2ecf20Sopenharmony_ci irq_handler_t handler; 9968c2ecf20Sopenharmony_ci unsigned int vector; 9978c2ecf20Sopenharmony_ci u8 requested:1; 9988c2ecf20Sopenharmony_ci u8 have_cpumask:1; 9998c2ecf20Sopenharmony_ci char name[IFNAMSIZ + 2]; 10008c2ecf20Sopenharmony_ci cpumask_var_t cpu_mask; 10018c2ecf20Sopenharmony_ci}; 10028c2ecf20Sopenharmony_ci 10038c2ecf20Sopenharmony_ci#define HWRM_RING_ALLOC_TX 0x1 10048c2ecf20Sopenharmony_ci#define HWRM_RING_ALLOC_RX 0x2 10058c2ecf20Sopenharmony_ci#define HWRM_RING_ALLOC_AGG 0x4 10068c2ecf20Sopenharmony_ci#define HWRM_RING_ALLOC_CMPL 0x8 10078c2ecf20Sopenharmony_ci#define HWRM_RING_ALLOC_NQ 0x10 10088c2ecf20Sopenharmony_ci 10098c2ecf20Sopenharmony_ci#define INVALID_STATS_CTX_ID -1 10108c2ecf20Sopenharmony_ci 10118c2ecf20Sopenharmony_cistruct bnxt_ring_grp_info { 10128c2ecf20Sopenharmony_ci u16 fw_stats_ctx; 10138c2ecf20Sopenharmony_ci u16 fw_grp_id; 10148c2ecf20Sopenharmony_ci u16 rx_fw_ring_id; 10158c2ecf20Sopenharmony_ci u16 agg_fw_ring_id; 10168c2ecf20Sopenharmony_ci u16 cp_fw_ring_id; 10178c2ecf20Sopenharmony_ci}; 10188c2ecf20Sopenharmony_ci 10198c2ecf20Sopenharmony_cistruct bnxt_vnic_info { 10208c2ecf20Sopenharmony_ci u16 fw_vnic_id; /* returned by Chimp during alloc */ 10218c2ecf20Sopenharmony_ci#define BNXT_MAX_CTX_PER_VNIC 8 10228c2ecf20Sopenharmony_ci u16 fw_rss_cos_lb_ctx[BNXT_MAX_CTX_PER_VNIC]; 10238c2ecf20Sopenharmony_ci u16 fw_l2_ctx_id; 10248c2ecf20Sopenharmony_ci#define BNXT_MAX_UC_ADDRS 4 10258c2ecf20Sopenharmony_ci __le64 fw_l2_filter_id[BNXT_MAX_UC_ADDRS]; 10268c2ecf20Sopenharmony_ci /* index 0 always dev_addr */ 10278c2ecf20Sopenharmony_ci u16 uc_filter_count; 10288c2ecf20Sopenharmony_ci u8 *uc_list; 10298c2ecf20Sopenharmony_ci 10308c2ecf20Sopenharmony_ci u16 *fw_grp_ids; 10318c2ecf20Sopenharmony_ci dma_addr_t rss_table_dma_addr; 10328c2ecf20Sopenharmony_ci __le16 *rss_table; 10338c2ecf20Sopenharmony_ci dma_addr_t rss_hash_key_dma_addr; 10348c2ecf20Sopenharmony_ci u64 *rss_hash_key; 10358c2ecf20Sopenharmony_ci int rss_table_size; 10368c2ecf20Sopenharmony_ci#define BNXT_RSS_TABLE_ENTRIES_P5 64 10378c2ecf20Sopenharmony_ci#define BNXT_RSS_TABLE_SIZE_P5 (BNXT_RSS_TABLE_ENTRIES_P5 * 4) 10388c2ecf20Sopenharmony_ci#define BNXT_RSS_TABLE_MAX_TBL_P5 8 10398c2ecf20Sopenharmony_ci#define BNXT_MAX_RSS_TABLE_SIZE_P5 \ 10408c2ecf20Sopenharmony_ci (BNXT_RSS_TABLE_SIZE_P5 * BNXT_RSS_TABLE_MAX_TBL_P5) 10418c2ecf20Sopenharmony_ci#define BNXT_MAX_RSS_TABLE_ENTRIES_P5 \ 10428c2ecf20Sopenharmony_ci (BNXT_RSS_TABLE_ENTRIES_P5 * BNXT_RSS_TABLE_MAX_TBL_P5) 10438c2ecf20Sopenharmony_ci 10448c2ecf20Sopenharmony_ci u32 rx_mask; 10458c2ecf20Sopenharmony_ci 10468c2ecf20Sopenharmony_ci u8 *mc_list; 10478c2ecf20Sopenharmony_ci int mc_list_size; 10488c2ecf20Sopenharmony_ci int mc_list_count; 10498c2ecf20Sopenharmony_ci dma_addr_t mc_list_mapping; 10508c2ecf20Sopenharmony_ci#define BNXT_MAX_MC_ADDRS 16 10518c2ecf20Sopenharmony_ci 10528c2ecf20Sopenharmony_ci u32 flags; 10538c2ecf20Sopenharmony_ci#define BNXT_VNIC_RSS_FLAG 1 10548c2ecf20Sopenharmony_ci#define BNXT_VNIC_RFS_FLAG 2 10558c2ecf20Sopenharmony_ci#define BNXT_VNIC_MCAST_FLAG 4 10568c2ecf20Sopenharmony_ci#define BNXT_VNIC_UCAST_FLAG 8 10578c2ecf20Sopenharmony_ci#define BNXT_VNIC_RFS_NEW_RSS_FLAG 0x10 10588c2ecf20Sopenharmony_ci}; 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_cistruct bnxt_hw_resc { 10618c2ecf20Sopenharmony_ci u16 min_rsscos_ctxs; 10628c2ecf20Sopenharmony_ci u16 max_rsscos_ctxs; 10638c2ecf20Sopenharmony_ci u16 min_cp_rings; 10648c2ecf20Sopenharmony_ci u16 max_cp_rings; 10658c2ecf20Sopenharmony_ci u16 resv_cp_rings; 10668c2ecf20Sopenharmony_ci u16 min_tx_rings; 10678c2ecf20Sopenharmony_ci u16 max_tx_rings; 10688c2ecf20Sopenharmony_ci u16 resv_tx_rings; 10698c2ecf20Sopenharmony_ci u16 max_tx_sch_inputs; 10708c2ecf20Sopenharmony_ci u16 min_rx_rings; 10718c2ecf20Sopenharmony_ci u16 max_rx_rings; 10728c2ecf20Sopenharmony_ci u16 resv_rx_rings; 10738c2ecf20Sopenharmony_ci u16 min_hw_ring_grps; 10748c2ecf20Sopenharmony_ci u16 max_hw_ring_grps; 10758c2ecf20Sopenharmony_ci u16 resv_hw_ring_grps; 10768c2ecf20Sopenharmony_ci u16 min_l2_ctxs; 10778c2ecf20Sopenharmony_ci u16 max_l2_ctxs; 10788c2ecf20Sopenharmony_ci u16 min_vnics; 10798c2ecf20Sopenharmony_ci u16 max_vnics; 10808c2ecf20Sopenharmony_ci u16 resv_vnics; 10818c2ecf20Sopenharmony_ci u16 min_stat_ctxs; 10828c2ecf20Sopenharmony_ci u16 max_stat_ctxs; 10838c2ecf20Sopenharmony_ci u16 resv_stat_ctxs; 10848c2ecf20Sopenharmony_ci u16 max_nqs; 10858c2ecf20Sopenharmony_ci u16 max_irqs; 10868c2ecf20Sopenharmony_ci u16 resv_irqs; 10878c2ecf20Sopenharmony_ci}; 10888c2ecf20Sopenharmony_ci 10898c2ecf20Sopenharmony_ci#if defined(CONFIG_BNXT_SRIOV) 10908c2ecf20Sopenharmony_cistruct bnxt_vf_info { 10918c2ecf20Sopenharmony_ci u16 fw_fid; 10928c2ecf20Sopenharmony_ci u8 mac_addr[ETH_ALEN]; /* PF assigned MAC Address */ 10938c2ecf20Sopenharmony_ci u8 vf_mac_addr[ETH_ALEN]; /* VF assigned MAC address, only 10948c2ecf20Sopenharmony_ci * stored by PF. 10958c2ecf20Sopenharmony_ci */ 10968c2ecf20Sopenharmony_ci u16 vlan; 10978c2ecf20Sopenharmony_ci u16 func_qcfg_flags; 10988c2ecf20Sopenharmony_ci u32 flags; 10998c2ecf20Sopenharmony_ci#define BNXT_VF_QOS 0x1 11008c2ecf20Sopenharmony_ci#define BNXT_VF_SPOOFCHK 0x2 11018c2ecf20Sopenharmony_ci#define BNXT_VF_LINK_FORCED 0x4 11028c2ecf20Sopenharmony_ci#define BNXT_VF_LINK_UP 0x8 11038c2ecf20Sopenharmony_ci#define BNXT_VF_TRUST 0x10 11048c2ecf20Sopenharmony_ci u32 min_tx_rate; 11058c2ecf20Sopenharmony_ci u32 max_tx_rate; 11068c2ecf20Sopenharmony_ci void *hwrm_cmd_req_addr; 11078c2ecf20Sopenharmony_ci dma_addr_t hwrm_cmd_req_dma_addr; 11088c2ecf20Sopenharmony_ci}; 11098c2ecf20Sopenharmony_ci#endif 11108c2ecf20Sopenharmony_ci 11118c2ecf20Sopenharmony_cistruct bnxt_pf_info { 11128c2ecf20Sopenharmony_ci#define BNXT_FIRST_PF_FID 1 11138c2ecf20Sopenharmony_ci#define BNXT_FIRST_VF_FID 128 11148c2ecf20Sopenharmony_ci u16 fw_fid; 11158c2ecf20Sopenharmony_ci u16 port_id; 11168c2ecf20Sopenharmony_ci u8 mac_addr[ETH_ALEN]; 11178c2ecf20Sopenharmony_ci u32 first_vf_id; 11188c2ecf20Sopenharmony_ci u16 active_vfs; 11198c2ecf20Sopenharmony_ci u16 registered_vfs; 11208c2ecf20Sopenharmony_ci u16 max_vfs; 11218c2ecf20Sopenharmony_ci u32 max_encap_records; 11228c2ecf20Sopenharmony_ci u32 max_decap_records; 11238c2ecf20Sopenharmony_ci u32 max_tx_em_flows; 11248c2ecf20Sopenharmony_ci u32 max_tx_wm_flows; 11258c2ecf20Sopenharmony_ci u32 max_rx_em_flows; 11268c2ecf20Sopenharmony_ci u32 max_rx_wm_flows; 11278c2ecf20Sopenharmony_ci unsigned long *vf_event_bmap; 11288c2ecf20Sopenharmony_ci u16 hwrm_cmd_req_pages; 11298c2ecf20Sopenharmony_ci u8 vf_resv_strategy; 11308c2ecf20Sopenharmony_ci#define BNXT_VF_RESV_STRATEGY_MAXIMAL 0 11318c2ecf20Sopenharmony_ci#define BNXT_VF_RESV_STRATEGY_MINIMAL 1 11328c2ecf20Sopenharmony_ci#define BNXT_VF_RESV_STRATEGY_MINIMAL_STATIC 2 11338c2ecf20Sopenharmony_ci void *hwrm_cmd_req_addr[4]; 11348c2ecf20Sopenharmony_ci dma_addr_t hwrm_cmd_req_dma_addr[4]; 11358c2ecf20Sopenharmony_ci struct bnxt_vf_info *vf; 11368c2ecf20Sopenharmony_ci}; 11378c2ecf20Sopenharmony_ci 11388c2ecf20Sopenharmony_cistruct bnxt_ntuple_filter { 11398c2ecf20Sopenharmony_ci struct hlist_node hash; 11408c2ecf20Sopenharmony_ci u8 dst_mac_addr[ETH_ALEN]; 11418c2ecf20Sopenharmony_ci u8 src_mac_addr[ETH_ALEN]; 11428c2ecf20Sopenharmony_ci struct flow_keys fkeys; 11438c2ecf20Sopenharmony_ci __le64 filter_id; 11448c2ecf20Sopenharmony_ci u16 sw_id; 11458c2ecf20Sopenharmony_ci u8 l2_fltr_idx; 11468c2ecf20Sopenharmony_ci u16 rxq; 11478c2ecf20Sopenharmony_ci u32 flow_id; 11488c2ecf20Sopenharmony_ci unsigned long state; 11498c2ecf20Sopenharmony_ci#define BNXT_FLTR_VALID 0 11508c2ecf20Sopenharmony_ci#define BNXT_FLTR_UPDATE 1 11518c2ecf20Sopenharmony_ci}; 11528c2ecf20Sopenharmony_ci 11538c2ecf20Sopenharmony_cistruct bnxt_link_info { 11548c2ecf20Sopenharmony_ci u8 phy_type; 11558c2ecf20Sopenharmony_ci u8 media_type; 11568c2ecf20Sopenharmony_ci u8 transceiver; 11578c2ecf20Sopenharmony_ci u8 phy_addr; 11588c2ecf20Sopenharmony_ci u8 phy_link_status; 11598c2ecf20Sopenharmony_ci#define BNXT_LINK_NO_LINK PORT_PHY_QCFG_RESP_LINK_NO_LINK 11608c2ecf20Sopenharmony_ci#define BNXT_LINK_SIGNAL PORT_PHY_QCFG_RESP_LINK_SIGNAL 11618c2ecf20Sopenharmony_ci#define BNXT_LINK_LINK PORT_PHY_QCFG_RESP_LINK_LINK 11628c2ecf20Sopenharmony_ci u8 wire_speed; 11638c2ecf20Sopenharmony_ci u8 phy_state; 11648c2ecf20Sopenharmony_ci#define BNXT_PHY_STATE_ENABLED 0 11658c2ecf20Sopenharmony_ci#define BNXT_PHY_STATE_DISABLED 1 11668c2ecf20Sopenharmony_ci 11678c2ecf20Sopenharmony_ci u8 link_up; 11688c2ecf20Sopenharmony_ci u8 duplex; 11698c2ecf20Sopenharmony_ci#define BNXT_LINK_DUPLEX_HALF PORT_PHY_QCFG_RESP_DUPLEX_STATE_HALF 11708c2ecf20Sopenharmony_ci#define BNXT_LINK_DUPLEX_FULL PORT_PHY_QCFG_RESP_DUPLEX_STATE_FULL 11718c2ecf20Sopenharmony_ci u8 pause; 11728c2ecf20Sopenharmony_ci#define BNXT_LINK_PAUSE_TX PORT_PHY_QCFG_RESP_PAUSE_TX 11738c2ecf20Sopenharmony_ci#define BNXT_LINK_PAUSE_RX PORT_PHY_QCFG_RESP_PAUSE_RX 11748c2ecf20Sopenharmony_ci#define BNXT_LINK_PAUSE_BOTH (PORT_PHY_QCFG_RESP_PAUSE_RX | \ 11758c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_PAUSE_TX) 11768c2ecf20Sopenharmony_ci u8 lp_pause; 11778c2ecf20Sopenharmony_ci u8 auto_pause_setting; 11788c2ecf20Sopenharmony_ci u8 force_pause_setting; 11798c2ecf20Sopenharmony_ci u8 duplex_setting; 11808c2ecf20Sopenharmony_ci u8 auto_mode; 11818c2ecf20Sopenharmony_ci#define BNXT_AUTO_MODE(mode) ((mode) > BNXT_LINK_AUTO_NONE && \ 11828c2ecf20Sopenharmony_ci (mode) <= BNXT_LINK_AUTO_MSK) 11838c2ecf20Sopenharmony_ci#define BNXT_LINK_AUTO_NONE PORT_PHY_QCFG_RESP_AUTO_MODE_NONE 11848c2ecf20Sopenharmony_ci#define BNXT_LINK_AUTO_ALLSPDS PORT_PHY_QCFG_RESP_AUTO_MODE_ALL_SPEEDS 11858c2ecf20Sopenharmony_ci#define BNXT_LINK_AUTO_ONESPD PORT_PHY_QCFG_RESP_AUTO_MODE_ONE_SPEED 11868c2ecf20Sopenharmony_ci#define BNXT_LINK_AUTO_ONEORBELOW PORT_PHY_QCFG_RESP_AUTO_MODE_ONE_OR_BELOW 11878c2ecf20Sopenharmony_ci#define BNXT_LINK_AUTO_MSK PORT_PHY_QCFG_RESP_AUTO_MODE_SPEED_MASK 11888c2ecf20Sopenharmony_ci#define PHY_VER_LEN 3 11898c2ecf20Sopenharmony_ci u8 phy_ver[PHY_VER_LEN]; 11908c2ecf20Sopenharmony_ci u16 link_speed; 11918c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_100MB PORT_PHY_QCFG_RESP_LINK_SPEED_100MB 11928c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_1GB PORT_PHY_QCFG_RESP_LINK_SPEED_1GB 11938c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_2GB PORT_PHY_QCFG_RESP_LINK_SPEED_2GB 11948c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_2_5GB PORT_PHY_QCFG_RESP_LINK_SPEED_2_5GB 11958c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_10GB PORT_PHY_QCFG_RESP_LINK_SPEED_10GB 11968c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_20GB PORT_PHY_QCFG_RESP_LINK_SPEED_20GB 11978c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_25GB PORT_PHY_QCFG_RESP_LINK_SPEED_25GB 11988c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_40GB PORT_PHY_QCFG_RESP_LINK_SPEED_40GB 11998c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_50GB PORT_PHY_QCFG_RESP_LINK_SPEED_50GB 12008c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_100GB PORT_PHY_QCFG_RESP_LINK_SPEED_100GB 12018c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_200GB PORT_PHY_QCFG_RESP_LINK_SPEED_200GB 12028c2ecf20Sopenharmony_ci u16 support_speeds; 12038c2ecf20Sopenharmony_ci u16 support_pam4_speeds; 12048c2ecf20Sopenharmony_ci u16 auto_link_speeds; /* fw adv setting */ 12058c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_100MB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_100MB 12068c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_1GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_1GB 12078c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_2GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_2GB 12088c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_10GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_10GB 12098c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_2_5GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_2_5GB 12108c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_20GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_20GB 12118c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_25GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_25GB 12128c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_40GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_40GB 12138c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_50GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_50GB 12148c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_MSK_100GB PORT_PHY_QCFG_RESP_SUPPORT_SPEEDS_100GB 12158c2ecf20Sopenharmony_ci u16 auto_pam4_link_speeds; 12168c2ecf20Sopenharmony_ci#define BNXT_LINK_PAM4_SPEED_MSK_50GB PORT_PHY_QCFG_RESP_SUPPORT_PAM4_SPEEDS_50G 12178c2ecf20Sopenharmony_ci#define BNXT_LINK_PAM4_SPEED_MSK_100GB PORT_PHY_QCFG_RESP_SUPPORT_PAM4_SPEEDS_100G 12188c2ecf20Sopenharmony_ci#define BNXT_LINK_PAM4_SPEED_MSK_200GB PORT_PHY_QCFG_RESP_SUPPORT_PAM4_SPEEDS_200G 12198c2ecf20Sopenharmony_ci u16 support_auto_speeds; 12208c2ecf20Sopenharmony_ci u16 support_pam4_auto_speeds; 12218c2ecf20Sopenharmony_ci u16 lp_auto_link_speeds; 12228c2ecf20Sopenharmony_ci u16 lp_auto_pam4_link_speeds; 12238c2ecf20Sopenharmony_ci u16 force_link_speed; 12248c2ecf20Sopenharmony_ci u16 force_pam4_link_speed; 12258c2ecf20Sopenharmony_ci u32 preemphasis; 12268c2ecf20Sopenharmony_ci u8 module_status; 12278c2ecf20Sopenharmony_ci u8 active_fec_sig_mode; 12288c2ecf20Sopenharmony_ci u16 fec_cfg; 12298c2ecf20Sopenharmony_ci#define BNXT_FEC_NONE PORT_PHY_QCFG_RESP_FEC_CFG_FEC_NONE_SUPPORTED 12308c2ecf20Sopenharmony_ci#define BNXT_FEC_AUTONEG_CAP PORT_PHY_QCFG_RESP_FEC_CFG_FEC_AUTONEG_SUPPORTED 12318c2ecf20Sopenharmony_ci#define BNXT_FEC_AUTONEG PORT_PHY_QCFG_RESP_FEC_CFG_FEC_AUTONEG_ENABLED 12328c2ecf20Sopenharmony_ci#define BNXT_FEC_ENC_BASE_R_CAP \ 12338c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_FEC_CFG_FEC_CLAUSE74_SUPPORTED 12348c2ecf20Sopenharmony_ci#define BNXT_FEC_ENC_BASE_R PORT_PHY_QCFG_RESP_FEC_CFG_FEC_CLAUSE74_ENABLED 12358c2ecf20Sopenharmony_ci#define BNXT_FEC_ENC_RS_CAP \ 12368c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_FEC_CFG_FEC_CLAUSE91_SUPPORTED 12378c2ecf20Sopenharmony_ci#define BNXT_FEC_ENC_LLRS_CAP \ 12388c2ecf20Sopenharmony_ci (PORT_PHY_QCFG_RESP_FEC_CFG_FEC_RS272_1XN_SUPPORTED | \ 12398c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_FEC_CFG_FEC_RS272_IEEE_SUPPORTED) 12408c2ecf20Sopenharmony_ci#define BNXT_FEC_ENC_RS \ 12418c2ecf20Sopenharmony_ci (PORT_PHY_QCFG_RESP_FEC_CFG_FEC_CLAUSE91_ENABLED | \ 12428c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_FEC_CFG_FEC_RS544_1XN_ENABLED | \ 12438c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_FEC_CFG_FEC_RS544_IEEE_ENABLED) 12448c2ecf20Sopenharmony_ci#define BNXT_FEC_ENC_LLRS \ 12458c2ecf20Sopenharmony_ci (PORT_PHY_QCFG_RESP_FEC_CFG_FEC_RS272_1XN_ENABLED | \ 12468c2ecf20Sopenharmony_ci PORT_PHY_QCFG_RESP_FEC_CFG_FEC_RS272_IEEE_ENABLED) 12478c2ecf20Sopenharmony_ci 12488c2ecf20Sopenharmony_ci /* copy of requested setting from ethtool cmd */ 12498c2ecf20Sopenharmony_ci u8 autoneg; 12508c2ecf20Sopenharmony_ci#define BNXT_AUTONEG_SPEED 1 12518c2ecf20Sopenharmony_ci#define BNXT_AUTONEG_FLOW_CTRL 2 12528c2ecf20Sopenharmony_ci u8 req_signal_mode; 12538c2ecf20Sopenharmony_ci#define BNXT_SIG_MODE_NRZ PORT_PHY_QCFG_RESP_SIGNAL_MODE_NRZ 12548c2ecf20Sopenharmony_ci#define BNXT_SIG_MODE_PAM4 PORT_PHY_QCFG_RESP_SIGNAL_MODE_PAM4 12558c2ecf20Sopenharmony_ci u8 req_duplex; 12568c2ecf20Sopenharmony_ci u8 req_flow_ctrl; 12578c2ecf20Sopenharmony_ci u16 req_link_speed; 12588c2ecf20Sopenharmony_ci u16 advertising; /* user adv setting */ 12598c2ecf20Sopenharmony_ci u16 advertising_pam4; 12608c2ecf20Sopenharmony_ci bool force_link_chng; 12618c2ecf20Sopenharmony_ci 12628c2ecf20Sopenharmony_ci bool phy_retry; 12638c2ecf20Sopenharmony_ci unsigned long phy_retry_expires; 12648c2ecf20Sopenharmony_ci 12658c2ecf20Sopenharmony_ci /* a copy of phy_qcfg output used to report link 12668c2ecf20Sopenharmony_ci * info to VF 12678c2ecf20Sopenharmony_ci */ 12688c2ecf20Sopenharmony_ci struct hwrm_port_phy_qcfg_output phy_qcfg_resp; 12698c2ecf20Sopenharmony_ci}; 12708c2ecf20Sopenharmony_ci 12718c2ecf20Sopenharmony_ci#define BNXT_FEC_RS544_ON \ 12728c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_RS544_1XN_ENABLE | \ 12738c2ecf20Sopenharmony_ci PORT_PHY_CFG_REQ_FLAGS_FEC_RS544_IEEE_ENABLE) 12748c2ecf20Sopenharmony_ci 12758c2ecf20Sopenharmony_ci#define BNXT_FEC_RS544_OFF \ 12768c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_RS544_1XN_DISABLE | \ 12778c2ecf20Sopenharmony_ci PORT_PHY_CFG_REQ_FLAGS_FEC_RS544_IEEE_DISABLE) 12788c2ecf20Sopenharmony_ci 12798c2ecf20Sopenharmony_ci#define BNXT_FEC_RS272_ON \ 12808c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_RS272_1XN_ENABLE | \ 12818c2ecf20Sopenharmony_ci PORT_PHY_CFG_REQ_FLAGS_FEC_RS272_IEEE_ENABLE) 12828c2ecf20Sopenharmony_ci 12838c2ecf20Sopenharmony_ci#define BNXT_FEC_RS272_OFF \ 12848c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_RS272_1XN_DISABLE | \ 12858c2ecf20Sopenharmony_ci PORT_PHY_CFG_REQ_FLAGS_FEC_RS272_IEEE_DISABLE) 12868c2ecf20Sopenharmony_ci 12878c2ecf20Sopenharmony_ci#define BNXT_PAM4_SUPPORTED(link_info) \ 12888c2ecf20Sopenharmony_ci ((link_info)->support_pam4_speeds) 12898c2ecf20Sopenharmony_ci 12908c2ecf20Sopenharmony_ci#define BNXT_FEC_RS_ON(link_info) \ 12918c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE91_ENABLE | \ 12928c2ecf20Sopenharmony_ci PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE74_DISABLE | \ 12938c2ecf20Sopenharmony_ci (BNXT_PAM4_SUPPORTED(link_info) ? \ 12948c2ecf20Sopenharmony_ci (BNXT_FEC_RS544_ON | BNXT_FEC_RS272_OFF) : 0)) 12958c2ecf20Sopenharmony_ci 12968c2ecf20Sopenharmony_ci#define BNXT_FEC_LLRS_ON \ 12978c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE91_ENABLE | \ 12988c2ecf20Sopenharmony_ci PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE74_DISABLE | \ 12998c2ecf20Sopenharmony_ci BNXT_FEC_RS272_ON | BNXT_FEC_RS544_OFF) 13008c2ecf20Sopenharmony_ci 13018c2ecf20Sopenharmony_ci#define BNXT_FEC_RS_OFF(link_info) \ 13028c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE91_DISABLE | \ 13038c2ecf20Sopenharmony_ci (BNXT_PAM4_SUPPORTED(link_info) ? \ 13048c2ecf20Sopenharmony_ci (BNXT_FEC_RS544_OFF | BNXT_FEC_RS272_OFF) : 0)) 13058c2ecf20Sopenharmony_ci 13068c2ecf20Sopenharmony_ci#define BNXT_FEC_BASE_R_ON(link_info) \ 13078c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE74_ENABLE | \ 13088c2ecf20Sopenharmony_ci BNXT_FEC_RS_OFF(link_info)) 13098c2ecf20Sopenharmony_ci 13108c2ecf20Sopenharmony_ci#define BNXT_FEC_ALL_OFF(link_info) \ 13118c2ecf20Sopenharmony_ci (PORT_PHY_CFG_REQ_FLAGS_FEC_CLAUSE74_DISABLE | \ 13128c2ecf20Sopenharmony_ci BNXT_FEC_RS_OFF(link_info)) 13138c2ecf20Sopenharmony_ci 13148c2ecf20Sopenharmony_ci#define BNXT_MAX_QUEUE 8 13158c2ecf20Sopenharmony_ci 13168c2ecf20Sopenharmony_cistruct bnxt_queue_info { 13178c2ecf20Sopenharmony_ci u8 queue_id; 13188c2ecf20Sopenharmony_ci u8 queue_profile; 13198c2ecf20Sopenharmony_ci}; 13208c2ecf20Sopenharmony_ci 13218c2ecf20Sopenharmony_ci#define BNXT_MAX_LED 4 13228c2ecf20Sopenharmony_ci 13238c2ecf20Sopenharmony_cistruct bnxt_led_info { 13248c2ecf20Sopenharmony_ci u8 led_id; 13258c2ecf20Sopenharmony_ci u8 led_type; 13268c2ecf20Sopenharmony_ci u8 led_group_id; 13278c2ecf20Sopenharmony_ci u8 unused; 13288c2ecf20Sopenharmony_ci __le16 led_state_caps; 13298c2ecf20Sopenharmony_ci#define BNXT_LED_ALT_BLINK_CAP(x) ((x) & \ 13308c2ecf20Sopenharmony_ci cpu_to_le16(PORT_LED_QCAPS_RESP_LED0_STATE_CAPS_BLINK_ALT_SUPPORTED)) 13318c2ecf20Sopenharmony_ci 13328c2ecf20Sopenharmony_ci __le16 led_color_caps; 13338c2ecf20Sopenharmony_ci}; 13348c2ecf20Sopenharmony_ci 13358c2ecf20Sopenharmony_ci#define BNXT_MAX_TEST 8 13368c2ecf20Sopenharmony_ci 13378c2ecf20Sopenharmony_cistruct bnxt_test_info { 13388c2ecf20Sopenharmony_ci u8 offline_mask; 13398c2ecf20Sopenharmony_ci u8 flags; 13408c2ecf20Sopenharmony_ci#define BNXT_TEST_FL_EXT_LPBK 0x1 13418c2ecf20Sopenharmony_ci#define BNXT_TEST_FL_AN_PHY_LPBK 0x2 13428c2ecf20Sopenharmony_ci u16 timeout; 13438c2ecf20Sopenharmony_ci char string[BNXT_MAX_TEST][ETH_GSTRING_LEN]; 13448c2ecf20Sopenharmony_ci}; 13458c2ecf20Sopenharmony_ci 13468c2ecf20Sopenharmony_ci#define CHIMP_REG_VIEW_ADDR \ 13478c2ecf20Sopenharmony_ci ((bp->flags & BNXT_FLAG_CHIP_P5) ? 0x80000000 : 0xb1000000) 13488c2ecf20Sopenharmony_ci 13498c2ecf20Sopenharmony_ci#define BNXT_GRCPF_REG_CHIMP_COMM 0x0 13508c2ecf20Sopenharmony_ci#define BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER 0x100 13518c2ecf20Sopenharmony_ci#define BNXT_GRCPF_REG_WINDOW_BASE_OUT 0x400 13528c2ecf20Sopenharmony_ci#define BNXT_CAG_REG_LEGACY_INT_STATUS 0x4014 13538c2ecf20Sopenharmony_ci#define BNXT_CAG_REG_BASE 0x300000 13548c2ecf20Sopenharmony_ci 13558c2ecf20Sopenharmony_ci#define BNXT_GRCPF_REG_KONG_COMM 0xA00 13568c2ecf20Sopenharmony_ci#define BNXT_GRCPF_REG_KONG_COMM_TRIGGER 0xB00 13578c2ecf20Sopenharmony_ci 13588c2ecf20Sopenharmony_ci#define BNXT_GRC_BASE_MASK 0xfffff000 13598c2ecf20Sopenharmony_ci#define BNXT_GRC_OFFSET_MASK 0x00000ffc 13608c2ecf20Sopenharmony_ci 13618c2ecf20Sopenharmony_cistruct bnxt_tc_flow_stats { 13628c2ecf20Sopenharmony_ci u64 packets; 13638c2ecf20Sopenharmony_ci u64 bytes; 13648c2ecf20Sopenharmony_ci}; 13658c2ecf20Sopenharmony_ci 13668c2ecf20Sopenharmony_ci#ifdef CONFIG_BNXT_FLOWER_OFFLOAD 13678c2ecf20Sopenharmony_cistruct bnxt_flower_indr_block_cb_priv { 13688c2ecf20Sopenharmony_ci struct net_device *tunnel_netdev; 13698c2ecf20Sopenharmony_ci struct bnxt *bp; 13708c2ecf20Sopenharmony_ci struct list_head list; 13718c2ecf20Sopenharmony_ci}; 13728c2ecf20Sopenharmony_ci#endif 13738c2ecf20Sopenharmony_ci 13748c2ecf20Sopenharmony_cistruct bnxt_tc_info { 13758c2ecf20Sopenharmony_ci bool enabled; 13768c2ecf20Sopenharmony_ci 13778c2ecf20Sopenharmony_ci /* hash table to store TC offloaded flows */ 13788c2ecf20Sopenharmony_ci struct rhashtable flow_table; 13798c2ecf20Sopenharmony_ci struct rhashtable_params flow_ht_params; 13808c2ecf20Sopenharmony_ci 13818c2ecf20Sopenharmony_ci /* hash table to store L2 keys of TC flows */ 13828c2ecf20Sopenharmony_ci struct rhashtable l2_table; 13838c2ecf20Sopenharmony_ci struct rhashtable_params l2_ht_params; 13848c2ecf20Sopenharmony_ci /* hash table to store L2 keys for TC tunnel decap */ 13858c2ecf20Sopenharmony_ci struct rhashtable decap_l2_table; 13868c2ecf20Sopenharmony_ci struct rhashtable_params decap_l2_ht_params; 13878c2ecf20Sopenharmony_ci /* hash table to store tunnel decap entries */ 13888c2ecf20Sopenharmony_ci struct rhashtable decap_table; 13898c2ecf20Sopenharmony_ci struct rhashtable_params decap_ht_params; 13908c2ecf20Sopenharmony_ci /* hash table to store tunnel encap entries */ 13918c2ecf20Sopenharmony_ci struct rhashtable encap_table; 13928c2ecf20Sopenharmony_ci struct rhashtable_params encap_ht_params; 13938c2ecf20Sopenharmony_ci 13948c2ecf20Sopenharmony_ci /* lock to atomically add/del an l2 node when a flow is 13958c2ecf20Sopenharmony_ci * added or deleted. 13968c2ecf20Sopenharmony_ci */ 13978c2ecf20Sopenharmony_ci struct mutex lock; 13988c2ecf20Sopenharmony_ci 13998c2ecf20Sopenharmony_ci /* Fields used for batching stats query */ 14008c2ecf20Sopenharmony_ci struct rhashtable_iter iter; 14018c2ecf20Sopenharmony_ci#define BNXT_FLOW_STATS_BATCH_MAX 10 14028c2ecf20Sopenharmony_ci struct bnxt_tc_stats_batch { 14038c2ecf20Sopenharmony_ci void *flow_node; 14048c2ecf20Sopenharmony_ci struct bnxt_tc_flow_stats hw_stats; 14058c2ecf20Sopenharmony_ci } stats_batch[BNXT_FLOW_STATS_BATCH_MAX]; 14068c2ecf20Sopenharmony_ci 14078c2ecf20Sopenharmony_ci /* Stat counter mask (width) */ 14088c2ecf20Sopenharmony_ci u64 bytes_mask; 14098c2ecf20Sopenharmony_ci u64 packets_mask; 14108c2ecf20Sopenharmony_ci}; 14118c2ecf20Sopenharmony_ci 14128c2ecf20Sopenharmony_cistruct bnxt_vf_rep_stats { 14138c2ecf20Sopenharmony_ci u64 packets; 14148c2ecf20Sopenharmony_ci u64 bytes; 14158c2ecf20Sopenharmony_ci u64 dropped; 14168c2ecf20Sopenharmony_ci}; 14178c2ecf20Sopenharmony_ci 14188c2ecf20Sopenharmony_cistruct bnxt_vf_rep { 14198c2ecf20Sopenharmony_ci struct bnxt *bp; 14208c2ecf20Sopenharmony_ci struct net_device *dev; 14218c2ecf20Sopenharmony_ci struct metadata_dst *dst; 14228c2ecf20Sopenharmony_ci u16 vf_idx; 14238c2ecf20Sopenharmony_ci u16 tx_cfa_action; 14248c2ecf20Sopenharmony_ci u16 rx_cfa_code; 14258c2ecf20Sopenharmony_ci 14268c2ecf20Sopenharmony_ci struct bnxt_vf_rep_stats rx_stats; 14278c2ecf20Sopenharmony_ci struct bnxt_vf_rep_stats tx_stats; 14288c2ecf20Sopenharmony_ci}; 14298c2ecf20Sopenharmony_ci 14308c2ecf20Sopenharmony_ci#define PTU_PTE_VALID 0x1UL 14318c2ecf20Sopenharmony_ci#define PTU_PTE_LAST 0x2UL 14328c2ecf20Sopenharmony_ci#define PTU_PTE_NEXT_TO_LAST 0x4UL 14338c2ecf20Sopenharmony_ci 14348c2ecf20Sopenharmony_ci#define MAX_CTX_PAGES (BNXT_PAGE_SIZE / 8) 14358c2ecf20Sopenharmony_ci#define MAX_CTX_TOTAL_PAGES (MAX_CTX_PAGES * MAX_CTX_PAGES) 14368c2ecf20Sopenharmony_ci 14378c2ecf20Sopenharmony_cistruct bnxt_ctx_pg_info { 14388c2ecf20Sopenharmony_ci u32 entries; 14398c2ecf20Sopenharmony_ci u32 nr_pages; 14408c2ecf20Sopenharmony_ci void *ctx_pg_arr[MAX_CTX_PAGES]; 14418c2ecf20Sopenharmony_ci dma_addr_t ctx_dma_arr[MAX_CTX_PAGES]; 14428c2ecf20Sopenharmony_ci struct bnxt_ring_mem_info ring_mem; 14438c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info **ctx_pg_tbl; 14448c2ecf20Sopenharmony_ci}; 14458c2ecf20Sopenharmony_ci 14468c2ecf20Sopenharmony_ci#define BNXT_MAX_TQM_SP_RINGS 1 14478c2ecf20Sopenharmony_ci#define BNXT_MAX_TQM_FP_RINGS 8 14488c2ecf20Sopenharmony_ci#define BNXT_MAX_TQM_RINGS \ 14498c2ecf20Sopenharmony_ci (BNXT_MAX_TQM_SP_RINGS + BNXT_MAX_TQM_FP_RINGS) 14508c2ecf20Sopenharmony_ci 14518c2ecf20Sopenharmony_ci#define BNXT_SET_CTX_PAGE_ATTR(attr) \ 14528c2ecf20Sopenharmony_cido { \ 14538c2ecf20Sopenharmony_ci if (BNXT_PAGE_SIZE == 0x2000) \ 14548c2ecf20Sopenharmony_ci attr = FUNC_BACKING_STORE_CFG_REQ_SRQ_PG_SIZE_PG_8K; \ 14558c2ecf20Sopenharmony_ci else if (BNXT_PAGE_SIZE == 0x10000) \ 14568c2ecf20Sopenharmony_ci attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_64K; \ 14578c2ecf20Sopenharmony_ci else \ 14588c2ecf20Sopenharmony_ci attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_4K; \ 14598c2ecf20Sopenharmony_ci} while (0) 14608c2ecf20Sopenharmony_ci 14618c2ecf20Sopenharmony_cistruct bnxt_ctx_mem_info { 14628c2ecf20Sopenharmony_ci u32 qp_max_entries; 14638c2ecf20Sopenharmony_ci u16 qp_min_qp1_entries; 14648c2ecf20Sopenharmony_ci u16 qp_max_l2_entries; 14658c2ecf20Sopenharmony_ci u16 qp_entry_size; 14668c2ecf20Sopenharmony_ci u16 srq_max_l2_entries; 14678c2ecf20Sopenharmony_ci u32 srq_max_entries; 14688c2ecf20Sopenharmony_ci u16 srq_entry_size; 14698c2ecf20Sopenharmony_ci u16 cq_max_l2_entries; 14708c2ecf20Sopenharmony_ci u32 cq_max_entries; 14718c2ecf20Sopenharmony_ci u16 cq_entry_size; 14728c2ecf20Sopenharmony_ci u16 vnic_max_vnic_entries; 14738c2ecf20Sopenharmony_ci u16 vnic_max_ring_table_entries; 14748c2ecf20Sopenharmony_ci u16 vnic_entry_size; 14758c2ecf20Sopenharmony_ci u32 stat_max_entries; 14768c2ecf20Sopenharmony_ci u16 stat_entry_size; 14778c2ecf20Sopenharmony_ci u16 tqm_entry_size; 14788c2ecf20Sopenharmony_ci u32 tqm_min_entries_per_ring; 14798c2ecf20Sopenharmony_ci u32 tqm_max_entries_per_ring; 14808c2ecf20Sopenharmony_ci u32 mrav_max_entries; 14818c2ecf20Sopenharmony_ci u16 mrav_entry_size; 14828c2ecf20Sopenharmony_ci u16 tim_entry_size; 14838c2ecf20Sopenharmony_ci u32 tim_max_entries; 14848c2ecf20Sopenharmony_ci u16 mrav_num_entries_units; 14858c2ecf20Sopenharmony_ci u8 tqm_entries_multiple; 14868c2ecf20Sopenharmony_ci u8 ctx_kind_initializer; 14878c2ecf20Sopenharmony_ci u8 tqm_fp_rings_count; 14888c2ecf20Sopenharmony_ci 14898c2ecf20Sopenharmony_ci u32 flags; 14908c2ecf20Sopenharmony_ci #define BNXT_CTX_FLAG_INITED 0x01 14918c2ecf20Sopenharmony_ci 14928c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info qp_mem; 14938c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info srq_mem; 14948c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info cq_mem; 14958c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info vnic_mem; 14968c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info stat_mem; 14978c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info mrav_mem; 14988c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info tim_mem; 14998c2ecf20Sopenharmony_ci struct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TQM_RINGS]; 15008c2ecf20Sopenharmony_ci}; 15018c2ecf20Sopenharmony_ci 15028c2ecf20Sopenharmony_cistruct bnxt_fw_health { 15038c2ecf20Sopenharmony_ci u32 flags; 15048c2ecf20Sopenharmony_ci u32 polling_dsecs; 15058c2ecf20Sopenharmony_ci u32 master_func_wait_dsecs; 15068c2ecf20Sopenharmony_ci u32 normal_func_wait_dsecs; 15078c2ecf20Sopenharmony_ci u32 post_reset_wait_dsecs; 15088c2ecf20Sopenharmony_ci u32 post_reset_max_wait_dsecs; 15098c2ecf20Sopenharmony_ci u32 regs[4]; 15108c2ecf20Sopenharmony_ci u32 mapped_regs[4]; 15118c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG 0 15128c2ecf20Sopenharmony_ci#define BNXT_FW_HEARTBEAT_REG 1 15138c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_CNT_REG 2 15148c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_INPROG_REG 3 15158c2ecf20Sopenharmony_ci u32 fw_reset_inprog_reg_mask; 15168c2ecf20Sopenharmony_ci u32 last_fw_heartbeat; 15178c2ecf20Sopenharmony_ci u32 last_fw_reset_cnt; 15188c2ecf20Sopenharmony_ci u8 enabled:1; 15198c2ecf20Sopenharmony_ci u8 master:1; 15208c2ecf20Sopenharmony_ci u8 fatal:1; 15218c2ecf20Sopenharmony_ci u8 status_reliable:1; 15228c2ecf20Sopenharmony_ci u8 tmr_multiplier; 15238c2ecf20Sopenharmony_ci u8 tmr_counter; 15248c2ecf20Sopenharmony_ci u8 fw_reset_seq_cnt; 15258c2ecf20Sopenharmony_ci u32 fw_reset_seq_regs[16]; 15268c2ecf20Sopenharmony_ci u32 fw_reset_seq_vals[16]; 15278c2ecf20Sopenharmony_ci u32 fw_reset_seq_delay_msec[16]; 15288c2ecf20Sopenharmony_ci struct devlink_health_reporter *fw_reporter; 15298c2ecf20Sopenharmony_ci struct devlink_health_reporter *fw_reset_reporter; 15308c2ecf20Sopenharmony_ci struct devlink_health_reporter *fw_fatal_reporter; 15318c2ecf20Sopenharmony_ci}; 15328c2ecf20Sopenharmony_ci 15338c2ecf20Sopenharmony_cistruct bnxt_fw_reporter_ctx { 15348c2ecf20Sopenharmony_ci unsigned long sp_event; 15358c2ecf20Sopenharmony_ci}; 15368c2ecf20Sopenharmony_ci 15378c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_TYPE_MASK 3 15388c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_TYPE_CFG 0 15398c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_TYPE_GRC 1 15408c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_TYPE_BAR0 2 15418c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_TYPE_BAR1 3 15428c2ecf20Sopenharmony_ci 15438c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_TYPE(reg) ((reg) & BNXT_FW_HEALTH_REG_TYPE_MASK) 15448c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_REG_OFF(reg) ((reg) & ~BNXT_FW_HEALTH_REG_TYPE_MASK) 15458c2ecf20Sopenharmony_ci 15468c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_WIN_BASE 0x3000 15478c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_WIN_MAP_OFF 8 15488c2ecf20Sopenharmony_ci 15498c2ecf20Sopenharmony_ci#define BNXT_FW_HEALTH_WIN_OFF(reg) (BNXT_FW_HEALTH_WIN_BASE + \ 15508c2ecf20Sopenharmony_ci ((reg) & BNXT_GRC_OFFSET_MASK)) 15518c2ecf20Sopenharmony_ci 15528c2ecf20Sopenharmony_ci#define BNXT_FW_STATUS_HEALTHY 0x8000 15538c2ecf20Sopenharmony_ci#define BNXT_FW_STATUS_SHUTDOWN 0x100000 15548c2ecf20Sopenharmony_ci 15558c2ecf20Sopenharmony_cistruct bnxt { 15568c2ecf20Sopenharmony_ci void __iomem *bar0; 15578c2ecf20Sopenharmony_ci void __iomem *bar1; 15588c2ecf20Sopenharmony_ci void __iomem *bar2; 15598c2ecf20Sopenharmony_ci 15608c2ecf20Sopenharmony_ci u32 reg_base; 15618c2ecf20Sopenharmony_ci u16 chip_num; 15628c2ecf20Sopenharmony_ci#define CHIP_NUM_57301 0x16c8 15638c2ecf20Sopenharmony_ci#define CHIP_NUM_57302 0x16c9 15648c2ecf20Sopenharmony_ci#define CHIP_NUM_57304 0x16ca 15658c2ecf20Sopenharmony_ci#define CHIP_NUM_58700 0x16cd 15668c2ecf20Sopenharmony_ci#define CHIP_NUM_57402 0x16d0 15678c2ecf20Sopenharmony_ci#define CHIP_NUM_57404 0x16d1 15688c2ecf20Sopenharmony_ci#define CHIP_NUM_57406 0x16d2 15698c2ecf20Sopenharmony_ci#define CHIP_NUM_57407 0x16d5 15708c2ecf20Sopenharmony_ci 15718c2ecf20Sopenharmony_ci#define CHIP_NUM_57311 0x16ce 15728c2ecf20Sopenharmony_ci#define CHIP_NUM_57312 0x16cf 15738c2ecf20Sopenharmony_ci#define CHIP_NUM_57314 0x16df 15748c2ecf20Sopenharmony_ci#define CHIP_NUM_57317 0x16e0 15758c2ecf20Sopenharmony_ci#define CHIP_NUM_57412 0x16d6 15768c2ecf20Sopenharmony_ci#define CHIP_NUM_57414 0x16d7 15778c2ecf20Sopenharmony_ci#define CHIP_NUM_57416 0x16d8 15788c2ecf20Sopenharmony_ci#define CHIP_NUM_57417 0x16d9 15798c2ecf20Sopenharmony_ci#define CHIP_NUM_57412L 0x16da 15808c2ecf20Sopenharmony_ci#define CHIP_NUM_57414L 0x16db 15818c2ecf20Sopenharmony_ci 15828c2ecf20Sopenharmony_ci#define CHIP_NUM_5745X 0xd730 15838c2ecf20Sopenharmony_ci#define CHIP_NUM_57452 0xc452 15848c2ecf20Sopenharmony_ci#define CHIP_NUM_57454 0xc454 15858c2ecf20Sopenharmony_ci 15868c2ecf20Sopenharmony_ci#define CHIP_NUM_57508 0x1750 15878c2ecf20Sopenharmony_ci#define CHIP_NUM_57504 0x1751 15888c2ecf20Sopenharmony_ci#define CHIP_NUM_57502 0x1752 15898c2ecf20Sopenharmony_ci 15908c2ecf20Sopenharmony_ci#define CHIP_NUM_58802 0xd802 15918c2ecf20Sopenharmony_ci#define CHIP_NUM_58804 0xd804 15928c2ecf20Sopenharmony_ci#define CHIP_NUM_58808 0xd808 15938c2ecf20Sopenharmony_ci 15948c2ecf20Sopenharmony_ci u8 chip_rev; 15958c2ecf20Sopenharmony_ci 15968c2ecf20Sopenharmony_ci#define CHIP_NUM_58818 0xd818 15978c2ecf20Sopenharmony_ci 15988c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_5730X(chip_num) \ 15998c2ecf20Sopenharmony_ci ((chip_num) >= CHIP_NUM_57301 && \ 16008c2ecf20Sopenharmony_ci (chip_num) <= CHIP_NUM_57304) 16018c2ecf20Sopenharmony_ci 16028c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_5740X(chip_num) \ 16038c2ecf20Sopenharmony_ci (((chip_num) >= CHIP_NUM_57402 && \ 16048c2ecf20Sopenharmony_ci (chip_num) <= CHIP_NUM_57406) || \ 16058c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_57407) 16068c2ecf20Sopenharmony_ci 16078c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_5731X(chip_num) \ 16088c2ecf20Sopenharmony_ci ((chip_num) == CHIP_NUM_57311 || \ 16098c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_57312 || \ 16108c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_57314 || \ 16118c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_57317) 16128c2ecf20Sopenharmony_ci 16138c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_5741X(chip_num) \ 16148c2ecf20Sopenharmony_ci ((chip_num) >= CHIP_NUM_57412 && \ 16158c2ecf20Sopenharmony_ci (chip_num) <= CHIP_NUM_57414L) 16168c2ecf20Sopenharmony_ci 16178c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_58700(chip_num) \ 16188c2ecf20Sopenharmony_ci ((chip_num) == CHIP_NUM_58700) 16198c2ecf20Sopenharmony_ci 16208c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_5745X(chip_num) \ 16218c2ecf20Sopenharmony_ci ((chip_num) == CHIP_NUM_5745X || \ 16228c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_57452 || \ 16238c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_57454) 16248c2ecf20Sopenharmony_ci 16258c2ecf20Sopenharmony_ci 16268c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_57X0X(chip_num) \ 16278c2ecf20Sopenharmony_ci (BNXT_CHIP_NUM_5730X(chip_num) || BNXT_CHIP_NUM_5740X(chip_num)) 16288c2ecf20Sopenharmony_ci 16298c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_57X1X(chip_num) \ 16308c2ecf20Sopenharmony_ci (BNXT_CHIP_NUM_5731X(chip_num) || BNXT_CHIP_NUM_5741X(chip_num)) 16318c2ecf20Sopenharmony_ci 16328c2ecf20Sopenharmony_ci#define BNXT_CHIP_NUM_588XX(chip_num) \ 16338c2ecf20Sopenharmony_ci ((chip_num) == CHIP_NUM_58802 || \ 16348c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_58804 || \ 16358c2ecf20Sopenharmony_ci (chip_num) == CHIP_NUM_58808) 16368c2ecf20Sopenharmony_ci 16378c2ecf20Sopenharmony_ci#define BNXT_VPD_FLD_LEN 32 16388c2ecf20Sopenharmony_ci char board_partno[BNXT_VPD_FLD_LEN]; 16398c2ecf20Sopenharmony_ci char board_serialno[BNXT_VPD_FLD_LEN]; 16408c2ecf20Sopenharmony_ci 16418c2ecf20Sopenharmony_ci struct net_device *dev; 16428c2ecf20Sopenharmony_ci struct pci_dev *pdev; 16438c2ecf20Sopenharmony_ci 16448c2ecf20Sopenharmony_ci atomic_t intr_sem; 16458c2ecf20Sopenharmony_ci 16468c2ecf20Sopenharmony_ci u32 flags; 16478c2ecf20Sopenharmony_ci #define BNXT_FLAG_CHIP_P5 0x1 16488c2ecf20Sopenharmony_ci #define BNXT_FLAG_VF 0x2 16498c2ecf20Sopenharmony_ci #define BNXT_FLAG_LRO 0x4 16508c2ecf20Sopenharmony_ci#ifdef CONFIG_INET 16518c2ecf20Sopenharmony_ci #define BNXT_FLAG_GRO 0x8 16528c2ecf20Sopenharmony_ci#else 16538c2ecf20Sopenharmony_ci /* Cannot support hardware GRO if CONFIG_INET is not set */ 16548c2ecf20Sopenharmony_ci #define BNXT_FLAG_GRO 0x0 16558c2ecf20Sopenharmony_ci#endif 16568c2ecf20Sopenharmony_ci #define BNXT_FLAG_TPA (BNXT_FLAG_LRO | BNXT_FLAG_GRO) 16578c2ecf20Sopenharmony_ci #define BNXT_FLAG_JUMBO 0x10 16588c2ecf20Sopenharmony_ci #define BNXT_FLAG_STRIP_VLAN 0x20 16598c2ecf20Sopenharmony_ci #define BNXT_FLAG_AGG_RINGS (BNXT_FLAG_JUMBO | BNXT_FLAG_GRO | \ 16608c2ecf20Sopenharmony_ci BNXT_FLAG_LRO) 16618c2ecf20Sopenharmony_ci #define BNXT_FLAG_USING_MSIX 0x40 16628c2ecf20Sopenharmony_ci #define BNXT_FLAG_MSIX_CAP 0x80 16638c2ecf20Sopenharmony_ci #define BNXT_FLAG_RFS 0x100 16648c2ecf20Sopenharmony_ci #define BNXT_FLAG_SHARED_RINGS 0x200 16658c2ecf20Sopenharmony_ci #define BNXT_FLAG_PORT_STATS 0x400 16668c2ecf20Sopenharmony_ci #define BNXT_FLAG_UDP_RSS_CAP 0x800 16678c2ecf20Sopenharmony_ci #define BNXT_FLAG_EEE_CAP 0x1000 16688c2ecf20Sopenharmony_ci #define BNXT_FLAG_NEW_RSS_CAP 0x2000 16698c2ecf20Sopenharmony_ci #define BNXT_FLAG_WOL_CAP 0x4000 16708c2ecf20Sopenharmony_ci #define BNXT_FLAG_ROCEV1_CAP 0x8000 16718c2ecf20Sopenharmony_ci #define BNXT_FLAG_ROCEV2_CAP 0x10000 16728c2ecf20Sopenharmony_ci #define BNXT_FLAG_ROCE_CAP (BNXT_FLAG_ROCEV1_CAP | \ 16738c2ecf20Sopenharmony_ci BNXT_FLAG_ROCEV2_CAP) 16748c2ecf20Sopenharmony_ci #define BNXT_FLAG_NO_AGG_RINGS 0x20000 16758c2ecf20Sopenharmony_ci #define BNXT_FLAG_RX_PAGE_MODE 0x40000 16768c2ecf20Sopenharmony_ci #define BNXT_FLAG_CHIP_SR2 0x80000 16778c2ecf20Sopenharmony_ci #define BNXT_FLAG_MULTI_HOST 0x100000 16788c2ecf20Sopenharmony_ci #define BNXT_FLAG_DSN_VALID 0x200000 16798c2ecf20Sopenharmony_ci #define BNXT_FLAG_DOUBLE_DB 0x400000 16808c2ecf20Sopenharmony_ci #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 16818c2ecf20Sopenharmony_ci #define BNXT_FLAG_DIM 0x2000000 16828c2ecf20Sopenharmony_ci #define BNXT_FLAG_ROCE_MIRROR_CAP 0x4000000 16838c2ecf20Sopenharmony_ci #define BNXT_FLAG_PORT_STATS_EXT 0x10000000 16848c2ecf20Sopenharmony_ci 16858c2ecf20Sopenharmony_ci #define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \ 16868c2ecf20Sopenharmony_ci BNXT_FLAG_RFS | \ 16878c2ecf20Sopenharmony_ci BNXT_FLAG_STRIP_VLAN) 16888c2ecf20Sopenharmony_ci 16898c2ecf20Sopenharmony_ci#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF)) 16908c2ecf20Sopenharmony_ci#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF) 16918c2ecf20Sopenharmony_ci#define BNXT_NPAR(bp) ((bp)->port_partition_type) 16928c2ecf20Sopenharmony_ci#define BNXT_MH(bp) ((bp)->flags & BNXT_FLAG_MULTI_HOST) 16938c2ecf20Sopenharmony_ci#define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp)) 16948c2ecf20Sopenharmony_ci#define BNXT_PHY_CFG_ABLE(bp) ((BNXT_SINGLE_PF(bp) || \ 16958c2ecf20Sopenharmony_ci ((bp)->fw_cap & BNXT_FW_CAP_SHARED_PORT_CFG)) && \ 16968c2ecf20Sopenharmony_ci (bp)->link_info.phy_state == BNXT_PHY_STATE_ENABLED) 16978c2ecf20Sopenharmony_ci#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0) 16988c2ecf20Sopenharmony_ci#define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE) 16998c2ecf20Sopenharmony_ci#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \ 17008c2ecf20Sopenharmony_ci (!((bp)->flags & BNXT_FLAG_CHIP_P5) || \ 17018c2ecf20Sopenharmony_ci (bp)->max_tpa_v2) && !is_kdump_kernel()) 17028c2ecf20Sopenharmony_ci 17038c2ecf20Sopenharmony_ci#define BNXT_CHIP_SR2(bp) \ 17048c2ecf20Sopenharmony_ci ((bp)->chip_num == CHIP_NUM_58818) 17058c2ecf20Sopenharmony_ci 17068c2ecf20Sopenharmony_ci#define BNXT_CHIP_P5_THOR(bp) \ 17078c2ecf20Sopenharmony_ci ((bp)->chip_num == CHIP_NUM_57508 || \ 17088c2ecf20Sopenharmony_ci (bp)->chip_num == CHIP_NUM_57504 || \ 17098c2ecf20Sopenharmony_ci (bp)->chip_num == CHIP_NUM_57502) 17108c2ecf20Sopenharmony_ci 17118c2ecf20Sopenharmony_ci/* Chip class phase 5 */ 17128c2ecf20Sopenharmony_ci#define BNXT_CHIP_P5(bp) \ 17138c2ecf20Sopenharmony_ci (BNXT_CHIP_P5_THOR(bp) || BNXT_CHIP_SR2(bp)) 17148c2ecf20Sopenharmony_ci 17158c2ecf20Sopenharmony_ci/* Chip class phase 4.x */ 17168c2ecf20Sopenharmony_ci#define BNXT_CHIP_P4(bp) \ 17178c2ecf20Sopenharmony_ci (BNXT_CHIP_NUM_57X1X((bp)->chip_num) || \ 17188c2ecf20Sopenharmony_ci BNXT_CHIP_NUM_5745X((bp)->chip_num) || \ 17198c2ecf20Sopenharmony_ci BNXT_CHIP_NUM_588XX((bp)->chip_num) || \ 17208c2ecf20Sopenharmony_ci (BNXT_CHIP_NUM_58700((bp)->chip_num) && \ 17218c2ecf20Sopenharmony_ci !BNXT_CHIP_TYPE_NITRO_A0(bp))) 17228c2ecf20Sopenharmony_ci 17238c2ecf20Sopenharmony_ci#define BNXT_CHIP_P4_PLUS(bp) \ 17248c2ecf20Sopenharmony_ci (BNXT_CHIP_P4(bp) || BNXT_CHIP_P5(bp)) 17258c2ecf20Sopenharmony_ci 17268c2ecf20Sopenharmony_ci struct bnxt_en_dev *edev; 17278c2ecf20Sopenharmony_ci struct bnxt_en_dev * (*ulp_probe)(struct net_device *); 17288c2ecf20Sopenharmony_ci 17298c2ecf20Sopenharmony_ci struct bnxt_napi **bnapi; 17308c2ecf20Sopenharmony_ci 17318c2ecf20Sopenharmony_ci struct bnxt_rx_ring_info *rx_ring; 17328c2ecf20Sopenharmony_ci struct bnxt_tx_ring_info *tx_ring; 17338c2ecf20Sopenharmony_ci u16 *tx_ring_map; 17348c2ecf20Sopenharmony_ci 17358c2ecf20Sopenharmony_ci struct sk_buff * (*gro_func)(struct bnxt_tpa_info *, int, int, 17368c2ecf20Sopenharmony_ci struct sk_buff *); 17378c2ecf20Sopenharmony_ci 17388c2ecf20Sopenharmony_ci struct sk_buff * (*rx_skb_func)(struct bnxt *, 17398c2ecf20Sopenharmony_ci struct bnxt_rx_ring_info *, 17408c2ecf20Sopenharmony_ci u16, void *, u8 *, dma_addr_t, 17418c2ecf20Sopenharmony_ci unsigned int); 17428c2ecf20Sopenharmony_ci 17438c2ecf20Sopenharmony_ci u16 max_tpa_v2; 17448c2ecf20Sopenharmony_ci u16 max_tpa; 17458c2ecf20Sopenharmony_ci u32 rx_buf_size; 17468c2ecf20Sopenharmony_ci u32 rx_buf_use_size; /* useable size */ 17478c2ecf20Sopenharmony_ci u16 rx_offset; 17488c2ecf20Sopenharmony_ci u16 rx_dma_offset; 17498c2ecf20Sopenharmony_ci enum dma_data_direction rx_dir; 17508c2ecf20Sopenharmony_ci u32 rx_ring_size; 17518c2ecf20Sopenharmony_ci u32 rx_agg_ring_size; 17528c2ecf20Sopenharmony_ci u32 rx_copy_thresh; 17538c2ecf20Sopenharmony_ci u32 rx_ring_mask; 17548c2ecf20Sopenharmony_ci u32 rx_agg_ring_mask; 17558c2ecf20Sopenharmony_ci int rx_nr_pages; 17568c2ecf20Sopenharmony_ci int rx_agg_nr_pages; 17578c2ecf20Sopenharmony_ci int rx_nr_rings; 17588c2ecf20Sopenharmony_ci int rsscos_nr_ctxs; 17598c2ecf20Sopenharmony_ci 17608c2ecf20Sopenharmony_ci u32 tx_ring_size; 17618c2ecf20Sopenharmony_ci u32 tx_ring_mask; 17628c2ecf20Sopenharmony_ci int tx_nr_pages; 17638c2ecf20Sopenharmony_ci int tx_nr_rings; 17648c2ecf20Sopenharmony_ci int tx_nr_rings_per_tc; 17658c2ecf20Sopenharmony_ci int tx_nr_rings_xdp; 17668c2ecf20Sopenharmony_ci 17678c2ecf20Sopenharmony_ci int tx_wake_thresh; 17688c2ecf20Sopenharmony_ci int tx_push_thresh; 17698c2ecf20Sopenharmony_ci int tx_push_size; 17708c2ecf20Sopenharmony_ci 17718c2ecf20Sopenharmony_ci u32 cp_ring_size; 17728c2ecf20Sopenharmony_ci u32 cp_ring_mask; 17738c2ecf20Sopenharmony_ci u32 cp_bit; 17748c2ecf20Sopenharmony_ci int cp_nr_pages; 17758c2ecf20Sopenharmony_ci int cp_nr_rings; 17768c2ecf20Sopenharmony_ci 17778c2ecf20Sopenharmony_ci /* grp_info indexed by completion ring index */ 17788c2ecf20Sopenharmony_ci struct bnxt_ring_grp_info *grp_info; 17798c2ecf20Sopenharmony_ci struct bnxt_vnic_info *vnic_info; 17808c2ecf20Sopenharmony_ci int nr_vnics; 17818c2ecf20Sopenharmony_ci u16 *rss_indir_tbl; 17828c2ecf20Sopenharmony_ci u16 rss_indir_tbl_entries; 17838c2ecf20Sopenharmony_ci u32 rss_hash_cfg; 17848c2ecf20Sopenharmony_ci 17858c2ecf20Sopenharmony_ci u16 max_mtu; 17868c2ecf20Sopenharmony_ci u8 max_tc; 17878c2ecf20Sopenharmony_ci u8 max_lltc; /* lossless TCs */ 17888c2ecf20Sopenharmony_ci struct bnxt_queue_info q_info[BNXT_MAX_QUEUE]; 17898c2ecf20Sopenharmony_ci u8 tc_to_qidx[BNXT_MAX_QUEUE]; 17908c2ecf20Sopenharmony_ci u8 q_ids[BNXT_MAX_QUEUE]; 17918c2ecf20Sopenharmony_ci u8 max_q; 17928c2ecf20Sopenharmony_ci 17938c2ecf20Sopenharmony_ci unsigned int current_interval; 17948c2ecf20Sopenharmony_ci#define BNXT_TIMER_INTERVAL HZ 17958c2ecf20Sopenharmony_ci 17968c2ecf20Sopenharmony_ci struct timer_list timer; 17978c2ecf20Sopenharmony_ci 17988c2ecf20Sopenharmony_ci unsigned long state; 17998c2ecf20Sopenharmony_ci#define BNXT_STATE_OPEN 0 18008c2ecf20Sopenharmony_ci#define BNXT_STATE_IN_SP_TASK 1 18018c2ecf20Sopenharmony_ci#define BNXT_STATE_READ_STATS 2 18028c2ecf20Sopenharmony_ci#define BNXT_STATE_FW_RESET_DET 3 18038c2ecf20Sopenharmony_ci#define BNXT_STATE_IN_FW_RESET 4 18048c2ecf20Sopenharmony_ci#define BNXT_STATE_ABORT_ERR 5 18058c2ecf20Sopenharmony_ci#define BNXT_STATE_FW_FATAL_COND 6 18068c2ecf20Sopenharmony_ci#define BNXT_STATE_DRV_REGISTERED 7 18078c2ecf20Sopenharmony_ci#define BNXT_STATE_PCI_CHANNEL_IO_FROZEN 8 18088c2ecf20Sopenharmony_ci 18098c2ecf20Sopenharmony_ci#define BNXT_NO_FW_ACCESS(bp) \ 18108c2ecf20Sopenharmony_ci (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \ 18118c2ecf20Sopenharmony_ci pci_channel_offline((bp)->pdev)) 18128c2ecf20Sopenharmony_ci 18138c2ecf20Sopenharmony_ci struct bnxt_irq *irq_tbl; 18148c2ecf20Sopenharmony_ci int total_irqs; 18158c2ecf20Sopenharmony_ci u8 mac_addr[ETH_ALEN]; 18168c2ecf20Sopenharmony_ci 18178c2ecf20Sopenharmony_ci#ifdef CONFIG_BNXT_DCB 18188c2ecf20Sopenharmony_ci struct ieee_pfc *ieee_pfc; 18198c2ecf20Sopenharmony_ci struct ieee_ets *ieee_ets; 18208c2ecf20Sopenharmony_ci u8 dcbx_cap; 18218c2ecf20Sopenharmony_ci u8 default_pri; 18228c2ecf20Sopenharmony_ci u8 max_dscp_value; 18238c2ecf20Sopenharmony_ci#endif /* CONFIG_BNXT_DCB */ 18248c2ecf20Sopenharmony_ci 18258c2ecf20Sopenharmony_ci u32 msg_enable; 18268c2ecf20Sopenharmony_ci 18278c2ecf20Sopenharmony_ci u32 fw_cap; 18288c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_SHORT_CMD 0x00000001 18298c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_LLDP_AGENT 0x00000002 18308c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_DCBX_AGENT 0x00000004 18318c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_NEW_RM 0x00000008 18328c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_IF_CHANGE 0x00000010 18338c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_KONG_MB_CHNL 0x00000080 18348c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_OVS_64BIT_HANDLE 0x00000400 18358c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_TRUSTED_VF 0x00000800 18368c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_ERROR_RECOVERY 0x00002000 18378c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_PKG_VER 0x00004000 18388c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_CFA_ADV_FLOW 0x00008000 18398c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V2 0x00010000 18408c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_PCIE_STATS_SUPPORTED 0x00020000 18418c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_EXT_STATS_SUPPORTED 0x00040000 18428c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000 18438c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_HOT_RESET 0x00200000 18448c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_SHARED_PORT_CFG 0x00400000 18458c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_VLAN_RX_STRIP 0x01000000 18468c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_VLAN_TX_INSERT 0x02000000 18478c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED 0x04000000 18488c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_PORT_STATS_NO_RESET 0x10000000 18498c2ecf20Sopenharmony_ci #define BNXT_FW_CAP_RING_MONITOR 0x40000000 18508c2ecf20Sopenharmony_ci 18518c2ecf20Sopenharmony_ci#define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM) 18528c2ecf20Sopenharmony_ci u32 hwrm_spec_code; 18538c2ecf20Sopenharmony_ci u16 hwrm_cmd_seq; 18548c2ecf20Sopenharmony_ci u16 hwrm_cmd_kong_seq; 18558c2ecf20Sopenharmony_ci u16 hwrm_intr_seq_id; 18568c2ecf20Sopenharmony_ci void *hwrm_short_cmd_req_addr; 18578c2ecf20Sopenharmony_ci dma_addr_t hwrm_short_cmd_req_dma_addr; 18588c2ecf20Sopenharmony_ci void *hwrm_cmd_resp_addr; 18598c2ecf20Sopenharmony_ci dma_addr_t hwrm_cmd_resp_dma_addr; 18608c2ecf20Sopenharmony_ci void *hwrm_cmd_kong_resp_addr; 18618c2ecf20Sopenharmony_ci dma_addr_t hwrm_cmd_kong_resp_dma_addr; 18628c2ecf20Sopenharmony_ci 18638c2ecf20Sopenharmony_ci struct rtnl_link_stats64 net_stats_prev; 18648c2ecf20Sopenharmony_ci struct bnxt_stats_mem port_stats; 18658c2ecf20Sopenharmony_ci struct bnxt_stats_mem rx_port_stats_ext; 18668c2ecf20Sopenharmony_ci struct bnxt_stats_mem tx_port_stats_ext; 18678c2ecf20Sopenharmony_ci u16 fw_rx_stats_ext_size; 18688c2ecf20Sopenharmony_ci u16 fw_tx_stats_ext_size; 18698c2ecf20Sopenharmony_ci u16 hw_ring_stats_size; 18708c2ecf20Sopenharmony_ci u8 pri2cos_idx[8]; 18718c2ecf20Sopenharmony_ci u8 pri2cos_valid; 18728c2ecf20Sopenharmony_ci 18738c2ecf20Sopenharmony_ci u16 hwrm_max_req_len; 18748c2ecf20Sopenharmony_ci u16 hwrm_max_ext_req_len; 18758c2ecf20Sopenharmony_ci int hwrm_cmd_timeout; 18768c2ecf20Sopenharmony_ci struct mutex hwrm_cmd_lock; /* serialize hwrm messages */ 18778c2ecf20Sopenharmony_ci struct hwrm_ver_get_output ver_resp; 18788c2ecf20Sopenharmony_ci#define FW_VER_STR_LEN 32 18798c2ecf20Sopenharmony_ci#define BC_HWRM_STR_LEN 21 18808c2ecf20Sopenharmony_ci#define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN) 18818c2ecf20Sopenharmony_ci char fw_ver_str[FW_VER_STR_LEN]; 18828c2ecf20Sopenharmony_ci char hwrm_ver_supp[FW_VER_STR_LEN]; 18838c2ecf20Sopenharmony_ci char nvm_cfg_ver[FW_VER_STR_LEN]; 18848c2ecf20Sopenharmony_ci u64 fw_ver_code; 18858c2ecf20Sopenharmony_ci#define BNXT_FW_VER_CODE(maj, min, bld, rsv) \ 18868c2ecf20Sopenharmony_ci ((u64)(maj) << 48 | (u64)(min) << 32 | (u64)(bld) << 16 | (rsv)) 18878c2ecf20Sopenharmony_ci#define BNXT_FW_MAJ(bp) ((bp)->fw_ver_code >> 48) 18888c2ecf20Sopenharmony_ci 18898c2ecf20Sopenharmony_ci u16 vxlan_fw_dst_port_id; 18908c2ecf20Sopenharmony_ci u16 nge_fw_dst_port_id; 18918c2ecf20Sopenharmony_ci u8 port_partition_type; 18928c2ecf20Sopenharmony_ci u8 port_count; 18938c2ecf20Sopenharmony_ci u16 br_mode; 18948c2ecf20Sopenharmony_ci 18958c2ecf20Sopenharmony_ci struct bnxt_coal_cap coal_cap; 18968c2ecf20Sopenharmony_ci struct bnxt_coal rx_coal; 18978c2ecf20Sopenharmony_ci struct bnxt_coal tx_coal; 18988c2ecf20Sopenharmony_ci 18998c2ecf20Sopenharmony_ci u32 stats_coal_ticks; 19008c2ecf20Sopenharmony_ci#define BNXT_DEF_STATS_COAL_TICKS 1000000 19018c2ecf20Sopenharmony_ci#define BNXT_MIN_STATS_COAL_TICKS 250000 19028c2ecf20Sopenharmony_ci#define BNXT_MAX_STATS_COAL_TICKS 1000000 19038c2ecf20Sopenharmony_ci 19048c2ecf20Sopenharmony_ci struct work_struct sp_task; 19058c2ecf20Sopenharmony_ci unsigned long sp_event; 19068c2ecf20Sopenharmony_ci#define BNXT_RX_MASK_SP_EVENT 0 19078c2ecf20Sopenharmony_ci#define BNXT_RX_NTP_FLTR_SP_EVENT 1 19088c2ecf20Sopenharmony_ci#define BNXT_LINK_CHNG_SP_EVENT 2 19098c2ecf20Sopenharmony_ci#define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT 3 19108c2ecf20Sopenharmony_ci#define BNXT_RESET_TASK_SP_EVENT 6 19118c2ecf20Sopenharmony_ci#define BNXT_RST_RING_SP_EVENT 7 19128c2ecf20Sopenharmony_ci#define BNXT_HWRM_PF_UNLOAD_SP_EVENT 8 19138c2ecf20Sopenharmony_ci#define BNXT_PERIODIC_STATS_SP_EVENT 9 19148c2ecf20Sopenharmony_ci#define BNXT_HWRM_PORT_MODULE_SP_EVENT 10 19158c2ecf20Sopenharmony_ci#define BNXT_RESET_TASK_SILENT_SP_EVENT 11 19168c2ecf20Sopenharmony_ci#define BNXT_LINK_SPEED_CHNG_SP_EVENT 14 19178c2ecf20Sopenharmony_ci#define BNXT_FLOW_STATS_SP_EVENT 15 19188c2ecf20Sopenharmony_ci#define BNXT_UPDATE_PHY_SP_EVENT 16 19198c2ecf20Sopenharmony_ci#define BNXT_RING_COAL_NOW_SP_EVENT 17 19208c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_NOTIFY_SP_EVENT 18 19218c2ecf20Sopenharmony_ci#define BNXT_FW_EXCEPTION_SP_EVENT 19 19228c2ecf20Sopenharmony_ci#define BNXT_LINK_CFG_CHANGE_SP_EVENT 21 19238c2ecf20Sopenharmony_ci 19248c2ecf20Sopenharmony_ci struct delayed_work fw_reset_task; 19258c2ecf20Sopenharmony_ci int fw_reset_state; 19268c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_STATE_POLL_VF 1 19278c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_STATE_RESET_FW 2 19288c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_STATE_ENABLE_DEV 3 19298c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_STATE_POLL_FW 4 19308c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_STATE_OPENING 5 19318c2ecf20Sopenharmony_ci#define BNXT_FW_RESET_STATE_POLL_FW_DOWN 6 19328c2ecf20Sopenharmony_ci 19338c2ecf20Sopenharmony_ci u16 fw_reset_min_dsecs; 19348c2ecf20Sopenharmony_ci#define BNXT_DFLT_FW_RST_MIN_DSECS 20 19358c2ecf20Sopenharmony_ci u16 fw_reset_max_dsecs; 19368c2ecf20Sopenharmony_ci#define BNXT_DFLT_FW_RST_MAX_DSECS 60 19378c2ecf20Sopenharmony_ci unsigned long fw_reset_timestamp; 19388c2ecf20Sopenharmony_ci 19398c2ecf20Sopenharmony_ci struct bnxt_fw_health *fw_health; 19408c2ecf20Sopenharmony_ci 19418c2ecf20Sopenharmony_ci struct bnxt_hw_resc hw_resc; 19428c2ecf20Sopenharmony_ci struct bnxt_pf_info pf; 19438c2ecf20Sopenharmony_ci struct bnxt_ctx_mem_info *ctx; 19448c2ecf20Sopenharmony_ci#ifdef CONFIG_BNXT_SRIOV 19458c2ecf20Sopenharmony_ci int nr_vfs; 19468c2ecf20Sopenharmony_ci struct bnxt_vf_info vf; 19478c2ecf20Sopenharmony_ci wait_queue_head_t sriov_cfg_wait; 19488c2ecf20Sopenharmony_ci bool sriov_cfg; 19498c2ecf20Sopenharmony_ci#define BNXT_SRIOV_CFG_WAIT_TMO msecs_to_jiffies(10000) 19508c2ecf20Sopenharmony_ci 19518c2ecf20Sopenharmony_ci /* lock to protect VF-rep creation/cleanup via 19528c2ecf20Sopenharmony_ci * multiple paths such as ->sriov_configure() and 19538c2ecf20Sopenharmony_ci * devlink ->eswitch_mode_set() 19548c2ecf20Sopenharmony_ci */ 19558c2ecf20Sopenharmony_ci struct mutex sriov_lock; 19568c2ecf20Sopenharmony_ci#endif 19578c2ecf20Sopenharmony_ci 19588c2ecf20Sopenharmony_ci#if BITS_PER_LONG == 32 19598c2ecf20Sopenharmony_ci /* ensure atomic 64-bit doorbell writes on 32-bit systems. */ 19608c2ecf20Sopenharmony_ci spinlock_t db_lock; 19618c2ecf20Sopenharmony_ci#endif 19628c2ecf20Sopenharmony_ci int db_size; 19638c2ecf20Sopenharmony_ci 19648c2ecf20Sopenharmony_ci#define BNXT_NTP_FLTR_MAX_FLTR 4096 19658c2ecf20Sopenharmony_ci#define BNXT_NTP_FLTR_HASH_SIZE 512 19668c2ecf20Sopenharmony_ci#define BNXT_NTP_FLTR_HASH_MASK (BNXT_NTP_FLTR_HASH_SIZE - 1) 19678c2ecf20Sopenharmony_ci struct hlist_head ntp_fltr_hash_tbl[BNXT_NTP_FLTR_HASH_SIZE]; 19688c2ecf20Sopenharmony_ci spinlock_t ntp_fltr_lock; /* for hash table add, del */ 19698c2ecf20Sopenharmony_ci 19708c2ecf20Sopenharmony_ci unsigned long *ntp_fltr_bmap; 19718c2ecf20Sopenharmony_ci int ntp_fltr_count; 19728c2ecf20Sopenharmony_ci 19738c2ecf20Sopenharmony_ci /* To protect link related settings during link changes and 19748c2ecf20Sopenharmony_ci * ethtool settings changes. 19758c2ecf20Sopenharmony_ci */ 19768c2ecf20Sopenharmony_ci struct mutex link_lock; 19778c2ecf20Sopenharmony_ci struct bnxt_link_info link_info; 19788c2ecf20Sopenharmony_ci struct ethtool_eee eee; 19798c2ecf20Sopenharmony_ci u32 lpi_tmr_lo; 19808c2ecf20Sopenharmony_ci u32 lpi_tmr_hi; 19818c2ecf20Sopenharmony_ci 19828c2ecf20Sopenharmony_ci u8 num_tests; 19838c2ecf20Sopenharmony_ci struct bnxt_test_info *test_info; 19848c2ecf20Sopenharmony_ci 19858c2ecf20Sopenharmony_ci u8 wol_filter_id; 19868c2ecf20Sopenharmony_ci u8 wol; 19878c2ecf20Sopenharmony_ci 19888c2ecf20Sopenharmony_ci u8 num_leds; 19898c2ecf20Sopenharmony_ci struct bnxt_led_info leds[BNXT_MAX_LED]; 19908c2ecf20Sopenharmony_ci u16 dump_flag; 19918c2ecf20Sopenharmony_ci#define BNXT_DUMP_LIVE 0 19928c2ecf20Sopenharmony_ci#define BNXT_DUMP_CRASH 1 19938c2ecf20Sopenharmony_ci 19948c2ecf20Sopenharmony_ci struct bpf_prog *xdp_prog; 19958c2ecf20Sopenharmony_ci 19968c2ecf20Sopenharmony_ci /* devlink interface and vf-rep structs */ 19978c2ecf20Sopenharmony_ci struct devlink *dl; 19988c2ecf20Sopenharmony_ci struct devlink_port dl_port; 19998c2ecf20Sopenharmony_ci enum devlink_eswitch_mode eswitch_mode; 20008c2ecf20Sopenharmony_ci struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */ 20018c2ecf20Sopenharmony_ci u16 *cfa_code_map; /* cfa_code -> vf_idx map */ 20028c2ecf20Sopenharmony_ci u8 dsn[8]; 20038c2ecf20Sopenharmony_ci struct bnxt_tc_info *tc_info; 20048c2ecf20Sopenharmony_ci struct list_head tc_indr_block_list; 20058c2ecf20Sopenharmony_ci struct dentry *debugfs_pdev; 20068c2ecf20Sopenharmony_ci struct device *hwmon_dev; 20078c2ecf20Sopenharmony_ci}; 20088c2ecf20Sopenharmony_ci 20098c2ecf20Sopenharmony_ci#define BNXT_NUM_RX_RING_STATS 8 20108c2ecf20Sopenharmony_ci#define BNXT_NUM_TX_RING_STATS 8 20118c2ecf20Sopenharmony_ci#define BNXT_NUM_TPA_RING_STATS 4 20128c2ecf20Sopenharmony_ci#define BNXT_NUM_TPA_RING_STATS_P5 5 20138c2ecf20Sopenharmony_ci#define BNXT_NUM_TPA_RING_STATS_P5_SR2 6 20148c2ecf20Sopenharmony_ci 20158c2ecf20Sopenharmony_ci#define BNXT_RING_STATS_SIZE_P5 \ 20168c2ecf20Sopenharmony_ci ((BNXT_NUM_RX_RING_STATS + BNXT_NUM_TX_RING_STATS + \ 20178c2ecf20Sopenharmony_ci BNXT_NUM_TPA_RING_STATS_P5) * 8) 20188c2ecf20Sopenharmony_ci 20198c2ecf20Sopenharmony_ci#define BNXT_RING_STATS_SIZE_P5_SR2 \ 20208c2ecf20Sopenharmony_ci ((BNXT_NUM_RX_RING_STATS + BNXT_NUM_TX_RING_STATS + \ 20218c2ecf20Sopenharmony_ci BNXT_NUM_TPA_RING_STATS_P5_SR2) * 8) 20228c2ecf20Sopenharmony_ci 20238c2ecf20Sopenharmony_ci#define BNXT_GET_RING_STATS64(sw, counter) \ 20248c2ecf20Sopenharmony_ci (*((sw) + offsetof(struct ctx_hw_stats, counter) / 8)) 20258c2ecf20Sopenharmony_ci 20268c2ecf20Sopenharmony_ci#define BNXT_GET_RX_PORT_STATS64(sw, counter) \ 20278c2ecf20Sopenharmony_ci (*((sw) + offsetof(struct rx_port_stats, counter) / 8)) 20288c2ecf20Sopenharmony_ci 20298c2ecf20Sopenharmony_ci#define BNXT_GET_TX_PORT_STATS64(sw, counter) \ 20308c2ecf20Sopenharmony_ci (*((sw) + offsetof(struct tx_port_stats, counter) / 8)) 20318c2ecf20Sopenharmony_ci 20328c2ecf20Sopenharmony_ci#define BNXT_PORT_STATS_SIZE \ 20338c2ecf20Sopenharmony_ci (sizeof(struct rx_port_stats) + sizeof(struct tx_port_stats) + 1024) 20348c2ecf20Sopenharmony_ci 20358c2ecf20Sopenharmony_ci#define BNXT_TX_PORT_STATS_BYTE_OFFSET \ 20368c2ecf20Sopenharmony_ci (sizeof(struct rx_port_stats) + 512) 20378c2ecf20Sopenharmony_ci 20388c2ecf20Sopenharmony_ci#define BNXT_RX_STATS_OFFSET(counter) \ 20398c2ecf20Sopenharmony_ci (offsetof(struct rx_port_stats, counter) / 8) 20408c2ecf20Sopenharmony_ci 20418c2ecf20Sopenharmony_ci#define BNXT_TX_STATS_OFFSET(counter) \ 20428c2ecf20Sopenharmony_ci ((offsetof(struct tx_port_stats, counter) + \ 20438c2ecf20Sopenharmony_ci BNXT_TX_PORT_STATS_BYTE_OFFSET) / 8) 20448c2ecf20Sopenharmony_ci 20458c2ecf20Sopenharmony_ci#define BNXT_RX_STATS_EXT_OFFSET(counter) \ 20468c2ecf20Sopenharmony_ci (offsetof(struct rx_port_stats_ext, counter) / 8) 20478c2ecf20Sopenharmony_ci 20488c2ecf20Sopenharmony_ci#define BNXT_TX_STATS_EXT_OFFSET(counter) \ 20498c2ecf20Sopenharmony_ci (offsetof(struct tx_port_stats_ext, counter) / 8) 20508c2ecf20Sopenharmony_ci 20518c2ecf20Sopenharmony_ci#define BNXT_HW_FEATURE_VLAN_ALL_RX \ 20528c2ecf20Sopenharmony_ci (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX) 20538c2ecf20Sopenharmony_ci#define BNXT_HW_FEATURE_VLAN_ALL_TX \ 20548c2ecf20Sopenharmony_ci (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX) 20558c2ecf20Sopenharmony_ci 20568c2ecf20Sopenharmony_ci#define I2C_DEV_ADDR_A0 0xa0 20578c2ecf20Sopenharmony_ci#define I2C_DEV_ADDR_A2 0xa2 20588c2ecf20Sopenharmony_ci#define SFF_DIAG_SUPPORT_OFFSET 0x5c 20598c2ecf20Sopenharmony_ci#define SFF_MODULE_ID_SFP 0x3 20608c2ecf20Sopenharmony_ci#define SFF_MODULE_ID_QSFP 0xc 20618c2ecf20Sopenharmony_ci#define SFF_MODULE_ID_QSFP_PLUS 0xd 20628c2ecf20Sopenharmony_ci#define SFF_MODULE_ID_QSFP28 0x11 20638c2ecf20Sopenharmony_ci#define BNXT_MAX_PHY_I2C_RESP_SIZE 64 20648c2ecf20Sopenharmony_ci 20658c2ecf20Sopenharmony_cistatic inline u32 bnxt_tx_avail(struct bnxt *bp, struct bnxt_tx_ring_info *txr) 20668c2ecf20Sopenharmony_ci{ 20678c2ecf20Sopenharmony_ci /* Tell compiler to fetch tx indices from memory. */ 20688c2ecf20Sopenharmony_ci barrier(); 20698c2ecf20Sopenharmony_ci 20708c2ecf20Sopenharmony_ci return bp->tx_ring_size - 20718c2ecf20Sopenharmony_ci ((txr->tx_prod - txr->tx_cons) & bp->tx_ring_mask); 20728c2ecf20Sopenharmony_ci} 20738c2ecf20Sopenharmony_ci 20748c2ecf20Sopenharmony_ci#if BITS_PER_LONG == 32 20758c2ecf20Sopenharmony_ci#define writeq(val64, db) \ 20768c2ecf20Sopenharmony_cido { \ 20778c2ecf20Sopenharmony_ci spin_lock(&bp->db_lock); \ 20788c2ecf20Sopenharmony_ci writel((val64) & 0xffffffff, db); \ 20798c2ecf20Sopenharmony_ci writel((val64) >> 32, (db) + 4); \ 20808c2ecf20Sopenharmony_ci spin_unlock(&bp->db_lock); \ 20818c2ecf20Sopenharmony_ci} while (0) 20828c2ecf20Sopenharmony_ci 20838c2ecf20Sopenharmony_ci#define writeq_relaxed writeq 20848c2ecf20Sopenharmony_ci#endif 20858c2ecf20Sopenharmony_ci 20868c2ecf20Sopenharmony_ci/* For TX and RX ring doorbells with no ordering guarantee*/ 20878c2ecf20Sopenharmony_cistatic inline void bnxt_db_write_relaxed(struct bnxt *bp, 20888c2ecf20Sopenharmony_ci struct bnxt_db_info *db, u32 idx) 20898c2ecf20Sopenharmony_ci{ 20908c2ecf20Sopenharmony_ci if (bp->flags & BNXT_FLAG_CHIP_P5) { 20918c2ecf20Sopenharmony_ci writeq_relaxed(db->db_key64 | idx, db->doorbell); 20928c2ecf20Sopenharmony_ci } else { 20938c2ecf20Sopenharmony_ci u32 db_val = db->db_key32 | idx; 20948c2ecf20Sopenharmony_ci 20958c2ecf20Sopenharmony_ci writel_relaxed(db_val, db->doorbell); 20968c2ecf20Sopenharmony_ci if (bp->flags & BNXT_FLAG_DOUBLE_DB) 20978c2ecf20Sopenharmony_ci writel_relaxed(db_val, db->doorbell); 20988c2ecf20Sopenharmony_ci } 20998c2ecf20Sopenharmony_ci} 21008c2ecf20Sopenharmony_ci 21018c2ecf20Sopenharmony_ci/* For TX and RX ring doorbells */ 21028c2ecf20Sopenharmony_cistatic inline void bnxt_db_write(struct bnxt *bp, struct bnxt_db_info *db, 21038c2ecf20Sopenharmony_ci u32 idx) 21048c2ecf20Sopenharmony_ci{ 21058c2ecf20Sopenharmony_ci if (bp->flags & BNXT_FLAG_CHIP_P5) { 21068c2ecf20Sopenharmony_ci writeq(db->db_key64 | idx, db->doorbell); 21078c2ecf20Sopenharmony_ci } else { 21088c2ecf20Sopenharmony_ci u32 db_val = db->db_key32 | idx; 21098c2ecf20Sopenharmony_ci 21108c2ecf20Sopenharmony_ci writel(db_val, db->doorbell); 21118c2ecf20Sopenharmony_ci if (bp->flags & BNXT_FLAG_DOUBLE_DB) 21128c2ecf20Sopenharmony_ci writel(db_val, db->doorbell); 21138c2ecf20Sopenharmony_ci } 21148c2ecf20Sopenharmony_ci} 21158c2ecf20Sopenharmony_ci 21168c2ecf20Sopenharmony_cistatic inline bool bnxt_cfa_hwrm_message(u16 req_type) 21178c2ecf20Sopenharmony_ci{ 21188c2ecf20Sopenharmony_ci switch (req_type) { 21198c2ecf20Sopenharmony_ci case HWRM_CFA_ENCAP_RECORD_ALLOC: 21208c2ecf20Sopenharmony_ci case HWRM_CFA_ENCAP_RECORD_FREE: 21218c2ecf20Sopenharmony_ci case HWRM_CFA_DECAP_FILTER_ALLOC: 21228c2ecf20Sopenharmony_ci case HWRM_CFA_DECAP_FILTER_FREE: 21238c2ecf20Sopenharmony_ci case HWRM_CFA_EM_FLOW_ALLOC: 21248c2ecf20Sopenharmony_ci case HWRM_CFA_EM_FLOW_FREE: 21258c2ecf20Sopenharmony_ci case HWRM_CFA_EM_FLOW_CFG: 21268c2ecf20Sopenharmony_ci case HWRM_CFA_FLOW_ALLOC: 21278c2ecf20Sopenharmony_ci case HWRM_CFA_FLOW_FREE: 21288c2ecf20Sopenharmony_ci case HWRM_CFA_FLOW_INFO: 21298c2ecf20Sopenharmony_ci case HWRM_CFA_FLOW_FLUSH: 21308c2ecf20Sopenharmony_ci case HWRM_CFA_FLOW_STATS: 21318c2ecf20Sopenharmony_ci case HWRM_CFA_METER_PROFILE_ALLOC: 21328c2ecf20Sopenharmony_ci case HWRM_CFA_METER_PROFILE_FREE: 21338c2ecf20Sopenharmony_ci case HWRM_CFA_METER_PROFILE_CFG: 21348c2ecf20Sopenharmony_ci case HWRM_CFA_METER_INSTANCE_ALLOC: 21358c2ecf20Sopenharmony_ci case HWRM_CFA_METER_INSTANCE_FREE: 21368c2ecf20Sopenharmony_ci return true; 21378c2ecf20Sopenharmony_ci default: 21388c2ecf20Sopenharmony_ci return false; 21398c2ecf20Sopenharmony_ci } 21408c2ecf20Sopenharmony_ci} 21418c2ecf20Sopenharmony_ci 21428c2ecf20Sopenharmony_cistatic inline bool bnxt_kong_hwrm_message(struct bnxt *bp, struct input *req) 21438c2ecf20Sopenharmony_ci{ 21448c2ecf20Sopenharmony_ci return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL && 21458c2ecf20Sopenharmony_ci bnxt_cfa_hwrm_message(le16_to_cpu(req->req_type))); 21468c2ecf20Sopenharmony_ci} 21478c2ecf20Sopenharmony_ci 21488c2ecf20Sopenharmony_cistatic inline bool bnxt_hwrm_kong_chnl(struct bnxt *bp, struct input *req) 21498c2ecf20Sopenharmony_ci{ 21508c2ecf20Sopenharmony_ci return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL && 21518c2ecf20Sopenharmony_ci req->resp_addr == cpu_to_le64(bp->hwrm_cmd_kong_resp_dma_addr)); 21528c2ecf20Sopenharmony_ci} 21538c2ecf20Sopenharmony_ci 21548c2ecf20Sopenharmony_cistatic inline void *bnxt_get_hwrm_resp_addr(struct bnxt *bp, void *req) 21558c2ecf20Sopenharmony_ci{ 21568c2ecf20Sopenharmony_ci if (bnxt_hwrm_kong_chnl(bp, (struct input *)req)) 21578c2ecf20Sopenharmony_ci return bp->hwrm_cmd_kong_resp_addr; 21588c2ecf20Sopenharmony_ci else 21598c2ecf20Sopenharmony_ci return bp->hwrm_cmd_resp_addr; 21608c2ecf20Sopenharmony_ci} 21618c2ecf20Sopenharmony_ci 21628c2ecf20Sopenharmony_cistatic inline u16 bnxt_get_hwrm_seq_id(struct bnxt *bp, u16 dst) 21638c2ecf20Sopenharmony_ci{ 21648c2ecf20Sopenharmony_ci u16 seq_id; 21658c2ecf20Sopenharmony_ci 21668c2ecf20Sopenharmony_ci if (dst == BNXT_HWRM_CHNL_CHIMP) 21678c2ecf20Sopenharmony_ci seq_id = bp->hwrm_cmd_seq++; 21688c2ecf20Sopenharmony_ci else 21698c2ecf20Sopenharmony_ci seq_id = bp->hwrm_cmd_kong_seq++; 21708c2ecf20Sopenharmony_ci return seq_id; 21718c2ecf20Sopenharmony_ci} 21728c2ecf20Sopenharmony_ci 21738c2ecf20Sopenharmony_ciextern const u16 bnxt_lhint_arr[]; 21748c2ecf20Sopenharmony_ci 21758c2ecf20Sopenharmony_ciint bnxt_alloc_rx_data(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, 21768c2ecf20Sopenharmony_ci u16 prod, gfp_t gfp); 21778c2ecf20Sopenharmony_civoid bnxt_reuse_rx_data(struct bnxt_rx_ring_info *rxr, u16 cons, void *data); 21788c2ecf20Sopenharmony_ciu32 bnxt_fw_health_readl(struct bnxt *bp, int reg_idx); 21798c2ecf20Sopenharmony_civoid bnxt_set_tpa_flags(struct bnxt *bp); 21808c2ecf20Sopenharmony_civoid bnxt_set_ring_params(struct bnxt *); 21818c2ecf20Sopenharmony_ciint bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode); 21828c2ecf20Sopenharmony_civoid bnxt_hwrm_cmd_hdr_init(struct bnxt *, void *, u16, u16, u16); 21838c2ecf20Sopenharmony_ciint _hwrm_send_message(struct bnxt *, void *, u32, int); 21848c2ecf20Sopenharmony_ciint _hwrm_send_message_silent(struct bnxt *bp, void *msg, u32 len, int timeout); 21858c2ecf20Sopenharmony_ciint hwrm_send_message(struct bnxt *, void *, u32, int); 21868c2ecf20Sopenharmony_ciint hwrm_send_message_silent(struct bnxt *, void *, u32, int); 21878c2ecf20Sopenharmony_ciint bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap, 21888c2ecf20Sopenharmony_ci int bmap_size, bool async_only); 21898c2ecf20Sopenharmony_ciint bnxt_get_nr_rss_ctxs(struct bnxt *bp, int rx_rings); 21908c2ecf20Sopenharmony_ciint bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id); 21918c2ecf20Sopenharmony_ciint __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings); 21928c2ecf20Sopenharmony_ciint bnxt_nq_rings_in_use(struct bnxt *bp); 21938c2ecf20Sopenharmony_ciint bnxt_hwrm_set_coal(struct bnxt *); 21948c2ecf20Sopenharmony_ciunsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp); 21958c2ecf20Sopenharmony_ciunsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp); 21968c2ecf20Sopenharmony_ciunsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); 21978c2ecf20Sopenharmony_ciunsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp); 21988c2ecf20Sopenharmony_ciint bnxt_get_avail_msix(struct bnxt *bp, int num); 21998c2ecf20Sopenharmony_ciint bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init); 22008c2ecf20Sopenharmony_civoid bnxt_tx_disable(struct bnxt *bp); 22018c2ecf20Sopenharmony_civoid bnxt_tx_enable(struct bnxt *bp); 22028c2ecf20Sopenharmony_ciint bnxt_update_link(struct bnxt *bp, bool chng_link_state); 22038c2ecf20Sopenharmony_ciint bnxt_hwrm_set_pause(struct bnxt *); 22048c2ecf20Sopenharmony_ciint bnxt_hwrm_set_link_setting(struct bnxt *, bool, bool); 22058c2ecf20Sopenharmony_ciint bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp); 22068c2ecf20Sopenharmony_ciint bnxt_hwrm_free_wol_fltr(struct bnxt *bp); 22078c2ecf20Sopenharmony_ciint bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); 22088c2ecf20Sopenharmony_ciint bnxt_hwrm_fw_set_time(struct bnxt *); 22098c2ecf20Sopenharmony_ciint bnxt_open_nic(struct bnxt *, bool, bool); 22108c2ecf20Sopenharmony_ciint bnxt_half_open_nic(struct bnxt *bp); 22118c2ecf20Sopenharmony_civoid bnxt_half_close_nic(struct bnxt *bp); 22128c2ecf20Sopenharmony_ciint bnxt_close_nic(struct bnxt *, bool, bool); 22138c2ecf20Sopenharmony_ciint bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words, 22148c2ecf20Sopenharmony_ci u32 *reg_buf); 22158c2ecf20Sopenharmony_civoid bnxt_fw_exception(struct bnxt *bp); 22168c2ecf20Sopenharmony_civoid bnxt_fw_reset(struct bnxt *bp); 22178c2ecf20Sopenharmony_ciint bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, 22188c2ecf20Sopenharmony_ci int tx_xdp); 22198c2ecf20Sopenharmony_ciint bnxt_setup_mq_tc(struct net_device *dev, u8 tc); 22208c2ecf20Sopenharmony_ciint bnxt_get_max_rings(struct bnxt *, int *, int *, bool); 22218c2ecf20Sopenharmony_ciint bnxt_restore_pf_fw_resources(struct bnxt *bp); 22228c2ecf20Sopenharmony_ciint bnxt_get_port_parent_id(struct net_device *dev, 22238c2ecf20Sopenharmony_ci struct netdev_phys_item_id *ppid); 22248c2ecf20Sopenharmony_civoid bnxt_dim_work(struct work_struct *work); 22258c2ecf20Sopenharmony_ciint bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi); 22268c2ecf20Sopenharmony_ci 22278c2ecf20Sopenharmony_ci#endif 2228