2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
9 #ifndef __ECORE_DCBX_API_H__
10 #define __ECORE_DCBX_API_H__
12 #include "ecore_status.h"
14 #define DCBX_CONFIG_MAX_APP_PROTOCOL 4
16 enum ecore_mib_read_type {
17 ECORE_DCBX_OPERATIONAL_MIB,
18 ECORE_DCBX_REMOTE_MIB,
20 ECORE_DCBX_REMOTE_LLDP_MIB,
21 ECORE_DCBX_LOCAL_LLDP_MIB
24 struct ecore_dcbx_app_data {
25 bool enable; /* DCB enabled */
26 u8 update; /* Update indication */
27 u8 priority; /* Priority */
28 u8 tc; /* Traffic Class */
29 bool dscp_enable; /* DSCP enabled */
30 u8 dscp_val; /* DSCP value */
33 #ifndef __EXTRACT__LINUX__
34 enum dcbx_protocol_type {
38 DCBX_PROTOCOL_ROCE_V2,
40 DCBX_MAX_PROTOCOL_TYPE
43 #define ECORE_LLDP_CHASSIS_ID_STAT_LEN 4
44 #define ECORE_LLDP_PORT_ID_STAT_LEN 4
45 #define ECORE_DCBX_MAX_APP_PROTOCOL 32
46 #define ECORE_MAX_PFC_PRIORITIES 8
47 #define ECORE_DCBX_DSCP_SIZE 64
49 struct ecore_dcbx_lldp_remote {
50 u32 peer_chassis_id[ECORE_LLDP_CHASSIS_ID_STAT_LEN];
51 u32 peer_port_id[ECORE_LLDP_PORT_ID_STAT_LEN];
58 struct ecore_dcbx_lldp_local {
59 u32 local_chassis_id[ECORE_LLDP_CHASSIS_ID_STAT_LEN];
60 u32 local_port_id[ECORE_LLDP_PORT_ID_STAT_LEN];
63 struct ecore_dcbx_app_prio {
71 struct ecore_dbcx_pfc_params {
74 u8 prio[ECORE_MAX_PFC_PRIORITIES];
78 enum ecore_dcbx_sf_ieee_type {
79 ECORE_DCBX_SF_IEEE_ETHTYPE,
80 ECORE_DCBX_SF_IEEE_TCP_PORT,
81 ECORE_DCBX_SF_IEEE_UDP_PORT,
82 ECORE_DCBX_SF_IEEE_TCP_UDP_PORT
85 struct ecore_app_entry {
87 enum ecore_dcbx_sf_ieee_type sf_ieee;
91 enum dcbx_protocol_type proto_type;
94 struct ecore_dcbx_params {
95 struct ecore_app_entry app_entry[ECORE_DCBX_MAX_APP_PROTOCOL];
103 bool valid; /* Indicate validity of params */
104 u8 ets_pri_tc_tbl[ECORE_MAX_PFC_PRIORITIES];
105 u8 ets_tc_bw_tbl[ECORE_MAX_PFC_PRIORITIES];
106 u8 ets_tc_tsa_tbl[ECORE_MAX_PFC_PRIORITIES];
107 struct ecore_dbcx_pfc_params pfc;
111 struct ecore_dcbx_admin_params {
112 struct ecore_dcbx_params params;
113 bool valid; /* Indicate validity of params */
116 struct ecore_dcbx_remote_params {
117 struct ecore_dcbx_params params;
118 bool valid; /* Indicate validity of params */
121 struct ecore_dcbx_operational_params {
122 struct ecore_dcbx_app_prio app_prio;
123 struct ecore_dcbx_params params;
124 bool valid; /* Indicate validity of params */
132 struct ecore_dcbx_dscp_params {
134 u8 dscp_pri_map[ECORE_DCBX_DSCP_SIZE];
137 struct ecore_dcbx_get {
138 struct ecore_dcbx_operational_params operational;
139 struct ecore_dcbx_lldp_remote lldp_remote;
140 struct ecore_dcbx_lldp_local lldp_local;
141 struct ecore_dcbx_remote_params remote;
142 struct ecore_dcbx_admin_params local;
143 struct ecore_dcbx_dscp_params dscp;
147 #define ECORE_DCBX_VERSION_DISABLED 0
148 #define ECORE_DCBX_VERSION_IEEE 1
149 #define ECORE_DCBX_VERSION_CEE 2
151 struct ecore_dcbx_set {
152 #define ECORE_DCBX_OVERRIDE_STATE (1 << 0)
153 #define ECORE_DCBX_OVERRIDE_PFC_CFG (1 << 1)
154 #define ECORE_DCBX_OVERRIDE_ETS_CFG (1 << 2)
155 #define ECORE_DCBX_OVERRIDE_APP_CFG (1 << 3)
156 #define ECORE_DCBX_OVERRIDE_DSCP_CFG (1 << 4)
159 struct ecore_dcbx_admin_params config;
161 struct ecore_dcbx_dscp_params dscp;
164 struct ecore_dcbx_results {
167 struct ecore_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
170 struct ecore_dcbx_app_metadata {
171 enum dcbx_protocol_type id;
172 const char *name; /* @DPDK */
173 enum ecore_pci_personality personality;
176 enum _ecore_status_t ecore_dcbx_query_params(struct ecore_hwfn *,
177 struct ecore_dcbx_get *,
178 enum ecore_mib_read_type);
180 enum _ecore_status_t ecore_dcbx_get_config_params(struct ecore_hwfn *,
181 struct ecore_dcbx_set *);
183 enum _ecore_status_t ecore_dcbx_config_params(struct ecore_hwfn *,
185 struct ecore_dcbx_set *,
188 static const struct ecore_dcbx_app_metadata ecore_dcbx_app_update[] = {
189 {DCBX_PROTOCOL_ISCSI, "ISCSI", ECORE_PCI_ISCSI},
190 {DCBX_PROTOCOL_FCOE, "FCOE", ECORE_PCI_FCOE},
191 {DCBX_PROTOCOL_ROCE, "ROCE", ECORE_PCI_ETH_ROCE},
192 {DCBX_PROTOCOL_ROCE_V2, "ROCE_V2", ECORE_PCI_ETH_ROCE},
193 {DCBX_PROTOCOL_ETH, "ETH", ECORE_PCI_ETH}
196 #endif /* __ECORE_DCBX_API_H__ */