1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ 2 /* Copyright (C) 2023 Corigine, Inc. */ 3 4 #ifndef __NFP_NIC_H__ 5 #define __NFP_NIC_H__ 1 6 7 #include <linux/netdevice.h> 8 9 #ifdef CONFIG_DCB 10 /* DCB feature definitions */ 11 #define NFP_NET_MAX_DSCP 4 12 #define NFP_NET_MAX_TC IEEE_8021QAZ_MAX_TCS 13 #define NFP_NET_MAX_PRIO 8 14 #define NFP_DCB_CFG_STRIDE 256 15 16 struct nfp_dcb { 17 u8 dscp2prio[NFP_NET_MAX_DSCP]; 18 u8 prio2tc[NFP_NET_MAX_PRIO]; 19 u8 tc2idx[IEEE_8021QAZ_MAX_TCS]; 20 u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; 21 u8 tc_tx_pct[IEEE_8021QAZ_MAX_TCS]; 22 u8 tc_tsa[IEEE_8021QAZ_MAX_TCS]; 23 u8 dscp_cnt; 24 u8 trust_status; 25 bool rate_init; 26 bool ets_init; 27 28 struct nfp_cpp_area *dcbcfg_tbl_area; 29 u8 __iomem *dcbcfg_tbl; 30 u32 cfg_offset; 31 }; 32 33 int nfp_nic_dcb_init(struct nfp_net *nn); 34 void nfp_nic_dcb_clean(struct nfp_net *nn); 35 #else 36 static inline int nfp_nic_dcb_init(struct nfp_net *nn) { return 0; } 37 static inline void nfp_nic_dcb_clean(struct nfp_net *nn) {} 38 #endif 39 40 struct nfp_app_nic_private { 41 #ifdef CONFIG_DCB 42 struct nfp_dcb dcb; 43 #endif 44 }; 45 46 #endif 47