]> git.proxmox.com Git - ceph.git/blob - ceph/src/dpdk/drivers/net/qede/base/ecore_dcbx_api.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / dpdk / drivers / net / qede / base / ecore_dcbx_api.h
1 /*
2 * Copyright (c) 2016 QLogic Corporation.
3 * All rights reserved.
4 * www.qlogic.com
5 *
6 * See LICENSE.qede_pmd for copyright and licensing details.
7 */
8
9 #ifndef __ECORE_DCBX_API_H__
10 #define __ECORE_DCBX_API_H__
11
12 #include "ecore_status.h"
13
14 #define DCBX_CONFIG_MAX_APP_PROTOCOL 4
15
16 enum ecore_mib_read_type {
17 ECORE_DCBX_OPERATIONAL_MIB,
18 ECORE_DCBX_REMOTE_MIB,
19 ECORE_DCBX_LOCAL_MIB,
20 ECORE_DCBX_REMOTE_LLDP_MIB,
21 ECORE_DCBX_LOCAL_LLDP_MIB
22 };
23
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 */
31 };
32
33 #ifndef __EXTRACT__LINUX__
34 enum dcbx_protocol_type {
35 DCBX_PROTOCOL_ISCSI,
36 DCBX_PROTOCOL_FCOE,
37 DCBX_PROTOCOL_ROCE,
38 DCBX_PROTOCOL_ROCE_V2,
39 DCBX_PROTOCOL_ETH,
40 DCBX_MAX_PROTOCOL_TYPE
41 };
42
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
48
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];
52 bool enable_rx;
53 bool enable_tx;
54 u32 tx_interval;
55 u32 max_credit;
56 };
57
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];
61 };
62
63 struct ecore_dcbx_app_prio {
64 u8 roce;
65 u8 roce_v2;
66 u8 fcoe;
67 u8 iscsi;
68 u8 eth;
69 };
70
71 struct ecore_dbcx_pfc_params {
72 bool willing;
73 bool enabled;
74 u8 prio[ECORE_MAX_PFC_PRIORITIES];
75 u8 max_tc;
76 };
77
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
83 };
84
85 struct ecore_app_entry {
86 bool ethtype;
87 enum ecore_dcbx_sf_ieee_type sf_ieee;
88 bool enabled;
89 u8 prio;
90 u16 proto_id;
91 enum dcbx_protocol_type proto_type;
92 };
93
94 struct ecore_dcbx_params {
95 struct ecore_app_entry app_entry[ECORE_DCBX_MAX_APP_PROTOCOL];
96 u16 num_app_entries;
97 bool app_willing;
98 bool app_valid;
99 bool app_error;
100 bool ets_willing;
101 bool ets_enabled;
102 bool ets_cbs;
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;
108 u8 max_ets_tc;
109 };
110
111 struct ecore_dcbx_admin_params {
112 struct ecore_dcbx_params params;
113 bool valid; /* Indicate validity of params */
114 };
115
116 struct ecore_dcbx_remote_params {
117 struct ecore_dcbx_params params;
118 bool valid; /* Indicate validity of params */
119 };
120
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 */
125 bool enabled;
126 bool ieee;
127 bool cee;
128 bool local;
129 u32 err;
130 };
131
132 struct ecore_dcbx_dscp_params {
133 bool enabled;
134 u8 dscp_pri_map[ECORE_DCBX_DSCP_SIZE];
135 };
136
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;
144 };
145 #endif
146
147 #define ECORE_DCBX_VERSION_DISABLED 0
148 #define ECORE_DCBX_VERSION_IEEE 1
149 #define ECORE_DCBX_VERSION_CEE 2
150
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)
157 u32 override_flags;
158 bool enabled;
159 struct ecore_dcbx_admin_params config;
160 u32 ver_num;
161 struct ecore_dcbx_dscp_params dscp;
162 };
163
164 struct ecore_dcbx_results {
165 bool dcbx_enabled;
166 u8 pf_id;
167 struct ecore_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
168 };
169
170 struct ecore_dcbx_app_metadata {
171 enum dcbx_protocol_type id;
172 const char *name; /* @DPDK */
173 enum ecore_pci_personality personality;
174 };
175
176 enum _ecore_status_t ecore_dcbx_query_params(struct ecore_hwfn *,
177 struct ecore_dcbx_get *,
178 enum ecore_mib_read_type);
179
180 enum _ecore_status_t ecore_dcbx_get_config_params(struct ecore_hwfn *,
181 struct ecore_dcbx_set *);
182
183 enum _ecore_status_t ecore_dcbx_config_params(struct ecore_hwfn *,
184 struct ecore_ptt *,
185 struct ecore_dcbx_set *,
186 bool);
187
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}
194 };
195
196 #endif /* __ECORE_DCBX_API_H__ */