135b53f8cSChandrakanth patil /*- 235b53f8cSChandrakanth patil * Broadcom NetXtreme-C/E network driver. 335b53f8cSChandrakanth patil * 435b53f8cSChandrakanth patil * Copyright (c) 2024 Broadcom, All Rights Reserved. 535b53f8cSChandrakanth patil * The term Broadcom refers to Broadcom Limited and/or its subsidiaries 635b53f8cSChandrakanth patil * 735b53f8cSChandrakanth patil * Redistribution and use in source and binary forms, with or without 835b53f8cSChandrakanth patil * modification, are permitted provided that the following conditions 935b53f8cSChandrakanth patil * are met: 1035b53f8cSChandrakanth patil * 1. Redistributions of source code must retain the above copyright 1135b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer. 1235b53f8cSChandrakanth patil * 2. Redistributions in binary form must reproduce the above copyright 1335b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer in the 1435b53f8cSChandrakanth patil * documentation and/or other materials provided with the distribution. 1535b53f8cSChandrakanth patil * 1635b53f8cSChandrakanth patil * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 1735b53f8cSChandrakanth patil * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1835b53f8cSChandrakanth patil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1935b53f8cSChandrakanth patil * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 2035b53f8cSChandrakanth patil * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2135b53f8cSChandrakanth patil * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2235b53f8cSChandrakanth patil * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2335b53f8cSChandrakanth patil * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2435b53f8cSChandrakanth patil * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2535b53f8cSChandrakanth patil * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 2635b53f8cSChandrakanth patil * THE POSSIBILITY OF SUCH DAMAGE. 2735b53f8cSChandrakanth patil */ 2835b53f8cSChandrakanth patil 2935b53f8cSChandrakanth patil #ifndef _BNXT_DCB_H 3035b53f8cSChandrakanth patil #define _BNXT_DCB_H 3135b53f8cSChandrakanth patil 3235b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_MAX_TCS 8 3335b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_TSA_STRICT 0 3435b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_TSA_ETS 2 3535b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_TSA_VENDOR 255 3635b53f8cSChandrakanth patil 3735b53f8cSChandrakanth patil #define BNXT_DCB_CAP_DCBX_HOST 0x01 3835b53f8cSChandrakanth patil #define BNXT_DCB_CAP_DCBX_LLD_MANAGED 0x02 3935b53f8cSChandrakanth patil #define BNXT_DCB_CAP_DCBX_VER_CEE 0x04 4035b53f8cSChandrakanth patil #define BNXT_DCB_CAP_DCBX_VER_IEEE 0x08 4135b53f8cSChandrakanth patil #define BNXT_DCB_CAP_DCBX_STATIC 0x10 4235b53f8cSChandrakanth patil 43*152e6197SBjoern A. Zeeb #ifndef __struct_group 4435b53f8cSChandrakanth patil #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ 4535b53f8cSChandrakanth patil union { \ 4635b53f8cSChandrakanth patil struct { MEMBERS } ATTRS; \ 4735b53f8cSChandrakanth patil struct TAG { MEMBERS } ATTRS NAME; \ 4835b53f8cSChandrakanth patil } 49*152e6197SBjoern A. Zeeb #endif 50*152e6197SBjoern A. Zeeb #ifndef struct_group_attr 5135b53f8cSChandrakanth patil #define struct_group_attr(NAME, ATTRS, MEMBERS...) \ 5235b53f8cSChandrakanth patil __struct_group(/* no tag */, NAME, ATTRS, MEMBERS) 53*152e6197SBjoern A. Zeeb #endif 5435b53f8cSChandrakanth patil 5535b53f8cSChandrakanth patil struct bnxt_cos2bw_cfg { 5635b53f8cSChandrakanth patil uint8_t pad[3]; 5735b53f8cSChandrakanth patil struct_group_attr(cfg, __packed, 5835b53f8cSChandrakanth patil uint8_t queue_id; 5935b53f8cSChandrakanth patil uint32_t min_bw; 6035b53f8cSChandrakanth patil uint32_t max_bw; 6135b53f8cSChandrakanth patil #define BW_VALUE_UNIT_PERCENT1_100 (0x1UL << 29) 6235b53f8cSChandrakanth patil uint8_t tsa; 6335b53f8cSChandrakanth patil uint8_t pri_lvl; 6435b53f8cSChandrakanth patil uint8_t bw_weight; 6535b53f8cSChandrakanth patil ); 6635b53f8cSChandrakanth patil uint8_t unused; 6735b53f8cSChandrakanth patil }; 6835b53f8cSChandrakanth patil 6935b53f8cSChandrakanth patil struct bnxt_dscp2pri_entry { 7035b53f8cSChandrakanth patil uint8_t dscp; 7135b53f8cSChandrakanth patil uint8_t mask; 7235b53f8cSChandrakanth patil uint8_t pri; 7335b53f8cSChandrakanth patil }; 7435b53f8cSChandrakanth patil 7535b53f8cSChandrakanth patil struct bnxt_ieee_ets { 7635b53f8cSChandrakanth patil uint8_t willing; 7735b53f8cSChandrakanth patil uint8_t ets_cap; 7835b53f8cSChandrakanth patil uint8_t cbs; 7935b53f8cSChandrakanth patil uint8_t tc_tx_bw[BNXT_IEEE_8021QAZ_MAX_TCS]; 8035b53f8cSChandrakanth patil uint8_t tc_rx_bw[BNXT_IEEE_8021QAZ_MAX_TCS]; 8135b53f8cSChandrakanth patil uint8_t tc_tsa[BNXT_IEEE_8021QAZ_MAX_TCS]; 8235b53f8cSChandrakanth patil uint8_t prio_tc[BNXT_IEEE_8021QAZ_MAX_TCS]; 8335b53f8cSChandrakanth patil uint8_t tc_reco_bw[BNXT_IEEE_8021QAZ_MAX_TCS]; 8435b53f8cSChandrakanth patil uint8_t tc_reco_tsa[BNXT_IEEE_8021QAZ_MAX_TCS]; 8535b53f8cSChandrakanth patil uint8_t reco_prio_tc[BNXT_IEEE_8021QAZ_MAX_TCS]; 8635b53f8cSChandrakanth patil } __attribute__ ((__packed__)); 8735b53f8cSChandrakanth patil 8835b53f8cSChandrakanth patil struct bnxt_ieee_pfc { 8935b53f8cSChandrakanth patil uint8_t pfc_cap; 9035b53f8cSChandrakanth patil uint8_t pfc_en; 9135b53f8cSChandrakanth patil uint8_t mbc; 9235b53f8cSChandrakanth patil uint16_t delay; 9335b53f8cSChandrakanth patil uint64_t requests[BNXT_IEEE_8021QAZ_MAX_TCS]; 9435b53f8cSChandrakanth patil uint64_t indications[BNXT_IEEE_8021QAZ_MAX_TCS]; 9535b53f8cSChandrakanth patil } __attribute__ ((__packed__)); 9635b53f8cSChandrakanth patil 9735b53f8cSChandrakanth patil struct bnxt_dcb_app { 9835b53f8cSChandrakanth patil uint8_t selector; 9935b53f8cSChandrakanth patil uint8_t priority; 10035b53f8cSChandrakanth patil uint16_t protocol; 10135b53f8cSChandrakanth patil } __attribute__ ((__packed__)); 10235b53f8cSChandrakanth patil 10335b53f8cSChandrakanth patil struct bnxt_eee { 10435b53f8cSChandrakanth patil uint32_t cmd; 10535b53f8cSChandrakanth patil uint32_t supported; 10635b53f8cSChandrakanth patil uint32_t advertised; 10735b53f8cSChandrakanth patil uint32_t lp_advertised; 10835b53f8cSChandrakanth patil uint32_t eee_active; 10935b53f8cSChandrakanth patil uint32_t eee_enabled; 11035b53f8cSChandrakanth patil uint32_t tx_lpi_enabled; 11135b53f8cSChandrakanth patil uint32_t tx_lpi_timer; 11235b53f8cSChandrakanth patil uint32_t reserved[2]; 11335b53f8cSChandrakanth patil } __attribute__ ((__packed__)); 11435b53f8cSChandrakanth patil 11535b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_APP_SEL_ETHERTYPE 1 11635b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_APP_SEL_STREAM 2 11735b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_APP_SEL_DGRAM 3 11835b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_APP_SEL_ANY 4 11935b53f8cSChandrakanth patil #define BNXT_IEEE_8021QAZ_APP_SEL_DSCP 5 12035b53f8cSChandrakanth patil #define ETH_P_ROCE 0x8915 12135b53f8cSChandrakanth patil #define ROCE_V2_UDP_DPORT 4791 12235b53f8cSChandrakanth patil 12335b53f8cSChandrakanth patil #define BNXT_LLQ(q_profile) \ 12435b53f8cSChandrakanth patil ((q_profile) == HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS_ROCE || \ 12535b53f8cSChandrakanth patil (q_profile) == HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS_NIC) 12635b53f8cSChandrakanth patil #define BNXT_CNPQ(q_profile) \ 12735b53f8cSChandrakanth patil ((q_profile) == HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY_ROCE_CNP) 12835b53f8cSChandrakanth patil 12935b53f8cSChandrakanth patil #define HWRM_STRUCT_DATA_SUBTYPE_HOST_OPERATIONAL 0x0300 13035b53f8cSChandrakanth patil 13135b53f8cSChandrakanth patil #endif 132