1 /* bnx2x_dcb.c: QLogic Everest network driver.
3 * Copyright 2009-2013 Broadcom Corporation
4 * Copyright 2014 QLogic Corporation
7 * Unless you and QLogic execute a separate written software license
8 * agreement governing use of this software, this software is licensed to you
9 * under the terms of the GNU General Public License version 2, available
10 * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
12 * Notwithstanding the above, under no circumstances may you combine this
13 * software in any way with any other QLogic software provided under a
14 * license other than the GPL, without QLogic's express prior written
17 * Maintained by: Ariel Elior <ariel.elior@qlogic.com>
18 * Written by: Dmitry Kravkov
22 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24 #include <linux/netdevice.h>
25 #include <linux/types.h>
26 #include <linux/errno.h>
27 #include <linux/rtnetlink.h>
28 #include <net/dcbnl.h>
31 #include "bnx2x_cmn.h"
32 #include "bnx2x_dcb.h"
34 /* forward declarations of dcbx related functions */
35 static void bnx2x_pfc_set_pfc(struct bnx2x *bp);
36 static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp);
37 static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp,
38 u32 *set_configuration_ets_pg,
40 static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp,
41 u32 *pg_pri_orginal_spread,
42 struct pg_help_data *help_data);
43 static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp,
44 struct pg_help_data *help_data,
45 struct dcbx_ets_feature *ets,
46 u32 *pg_pri_orginal_spread);
47 static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp,
48 struct cos_help_data *cos_data,
49 u32 *pg_pri_orginal_spread,
50 struct dcbx_ets_feature *ets);
51 static void bnx2x_dcbx_fw_struct(struct bnx2x *bp,
52 struct bnx2x_func_tx_start_params*);
54 /* helpers: read/write len bytes from addr into buff by REG_RD/REG_WR */
55 static void bnx2x_read_data(struct bnx2x *bp, u32 *buff,
59 for (i = 0; i < len; i += 4, buff++)
60 *buff = REG_RD(bp, addr + i);
63 static void bnx2x_write_data(struct bnx2x *bp, u32 *buff,
67 for (i = 0; i < len; i += 4, buff++)
68 REG_WR(bp, addr + i, *buff);
71 static void bnx2x_pfc_set(struct bnx2x *bp)
73 struct bnx2x_nig_brb_pfc_port_params pfc_params = {0};
77 pfc_params.num_of_rx_cos_priority_mask =
78 bp->dcbx_port_params.ets.num_of_cos;
80 /* Tx COS configuration */
81 for (i = 0; i < bp->dcbx_port_params.ets.num_of_cos; i++)
83 * We configure only the pauseable bits (non pauseable aren't
84 * configured at all) it's done to avoid false pauses from
87 pfc_params.rx_cos_priority_mask[i] =
88 bp->dcbx_port_params.ets.cos_params[i].pri_bitmask
89 & DCBX_PFC_PRI_PAUSE_MASK(bp);
92 * Rx COS configuration
93 * Changing PFC RX configuration .
94 * In RX COS0 will always be configured to lossless and COS1 to lossy
96 for (i = 0 ; i < MAX_PFC_PRIORITIES ; i++) {
99 if (!(pri_bit & DCBX_PFC_PRI_PAUSE_MASK(bp)))
103 pfc_params.pkt_priority_to_cos = val;
106 pfc_params.llfc_low_priority_classes = DCBX_PFC_PRI_PAUSE_MASK(bp);
108 pfc_params.llfc_high_priority_classes = 0;
110 bnx2x_acquire_phy_lock(bp);
111 bp->link_params.feature_config_flags |= FEATURE_CONFIG_PFC_ENABLED;
112 bnx2x_update_pfc(&bp->link_params, &bp->link_vars, &pfc_params);
113 bnx2x_release_phy_lock(bp);
116 static void bnx2x_pfc_clear(struct bnx2x *bp)
118 struct bnx2x_nig_brb_pfc_port_params nig_params = {0};
119 nig_params.pause_enable = 1;
120 bnx2x_acquire_phy_lock(bp);
121 bp->link_params.feature_config_flags &= ~FEATURE_CONFIG_PFC_ENABLED;
122 bnx2x_update_pfc(&bp->link_params, &bp->link_vars, &nig_params);
123 bnx2x_release_phy_lock(bp);
126 static void bnx2x_dump_dcbx_drv_param(struct bnx2x *bp,
127 struct dcbx_features *features,
131 DP(NETIF_MSG_LINK, "local_mib.error %x\n", error);
135 "local_mib.features.ets.enabled %x\n", features->ets.enabled);
136 for (i = 0; i < DCBX_MAX_NUM_PG_BW_ENTRIES; i++)
138 "local_mib.features.ets.pg_bw_tbl[%d] %d\n", i,
139 DCBX_PG_BW_GET(features->ets.pg_bw_tbl, i));
140 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES; i++)
142 "local_mib.features.ets.pri_pg_tbl[%d] %d\n", i,
143 DCBX_PRI_PG_GET(features->ets.pri_pg_tbl, i));
146 DP(BNX2X_MSG_DCB, "dcbx_features.pfc.pri_en_bitmap %x\n",
147 features->pfc.pri_en_bitmap);
148 DP(BNX2X_MSG_DCB, "dcbx_features.pfc.pfc_caps %x\n",
149 features->pfc.pfc_caps);
150 DP(BNX2X_MSG_DCB, "dcbx_features.pfc.enabled %x\n",
151 features->pfc.enabled);
153 DP(BNX2X_MSG_DCB, "dcbx_features.app.default_pri %x\n",
154 features->app.default_pri);
155 DP(BNX2X_MSG_DCB, "dcbx_features.app.tc_supported %x\n",
156 features->app.tc_supported);
157 DP(BNX2X_MSG_DCB, "dcbx_features.app.enabled %x\n",
158 features->app.enabled);
159 for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) {
161 "dcbx_features.app.app_pri_tbl[%x].app_id %x\n",
162 i, features->app.app_pri_tbl[i].app_id);
164 "dcbx_features.app.app_pri_tbl[%x].pri_bitmap %x\n",
165 i, features->app.app_pri_tbl[i].pri_bitmap);
167 "dcbx_features.app.app_pri_tbl[%x].appBitfield %x\n",
168 i, features->app.app_pri_tbl[i].appBitfield);
172 static void bnx2x_dcbx_get_ap_priority(struct bnx2x *bp,
176 u32 pri = MAX_PFC_PRIORITIES;
177 u32 index = MAX_PFC_PRIORITIES - 1;
179 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
181 /* Choose the highest priority */
182 while ((MAX_PFC_PRIORITIES == pri) && (0 != index)) {
183 pri_mask = 1 << index;
184 if (GET_FLAGS(pri_bitmap, pri_mask))
189 if (pri < MAX_PFC_PRIORITIES)
190 ttp[llfc_traf_type] = max_t(u32, ttp[llfc_traf_type], pri);
193 static void bnx2x_dcbx_get_ap_feature(struct bnx2x *bp,
194 struct dcbx_app_priority_feature *app,
197 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
199 if (GET_FLAGS(error, DCBX_LOCAL_APP_ERROR))
200 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_APP_ERROR\n");
202 if (GET_FLAGS(error, DCBX_LOCAL_APP_MISMATCH))
203 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_APP_MISMATCH\n");
205 if (GET_FLAGS(error, DCBX_REMOTE_APP_TLV_NOT_FOUND))
206 DP(BNX2X_MSG_DCB, "DCBX_REMOTE_APP_TLV_NOT_FOUND\n");
208 !GET_FLAGS(error, DCBX_LOCAL_APP_ERROR | DCBX_LOCAL_APP_MISMATCH |
209 DCBX_REMOTE_APP_TLV_NOT_FOUND)) {
211 bp->dcbx_port_params.app.enabled = true;
213 for (index = 0 ; index < LLFC_DRIVER_TRAFFIC_TYPE_MAX; index++)
216 if (app->default_pri < MAX_PFC_PRIORITIES)
217 ttp[LLFC_TRAFFIC_TYPE_NW] = app->default_pri;
219 for (index = 0 ; index < DCBX_MAX_APP_PROTOCOL; index++) {
220 struct dcbx_app_priority_entry *entry =
223 if (GET_FLAGS(entry[index].appBitfield,
224 DCBX_APP_SF_ETH_TYPE) &&
225 ETH_TYPE_FCOE == entry[index].app_id)
226 bnx2x_dcbx_get_ap_priority(bp,
227 entry[index].pri_bitmap,
228 LLFC_TRAFFIC_TYPE_FCOE);
230 if (GET_FLAGS(entry[index].appBitfield,
232 TCP_PORT_ISCSI == entry[index].app_id)
233 bnx2x_dcbx_get_ap_priority(bp,
234 entry[index].pri_bitmap,
235 LLFC_TRAFFIC_TYPE_ISCSI);
238 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_APP_DISABLED\n");
239 bp->dcbx_port_params.app.enabled = false;
240 for (index = 0 ; index < LLFC_DRIVER_TRAFFIC_TYPE_MAX; index++)
241 ttp[index] = INVALID_TRAFFIC_TYPE_PRIORITY;
245 static void bnx2x_dcbx_get_ets_feature(struct bnx2x *bp,
246 struct dcbx_ets_feature *ets,
249 u32 pg_pri_orginal_spread[DCBX_MAX_NUM_PG_BW_ENTRIES] = {0};
250 struct pg_help_data pg_help_data;
251 struct bnx2x_dcbx_cos_params *cos_params =
252 bp->dcbx_port_params.ets.cos_params;
254 memset(&pg_help_data, 0, sizeof(struct pg_help_data));
256 if (GET_FLAGS(error, DCBX_LOCAL_ETS_ERROR))
257 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_ETS_ERROR\n");
259 if (GET_FLAGS(error, DCBX_REMOTE_ETS_TLV_NOT_FOUND))
260 DP(BNX2X_MSG_DCB, "DCBX_REMOTE_ETS_TLV_NOT_FOUND\n");
262 /* Clean up old settings of ets on COS */
263 for (i = 0; i < ARRAY_SIZE(bp->dcbx_port_params.ets.cos_params) ; i++) {
264 cos_params[i].pauseable = false;
265 cos_params[i].strict = BNX2X_DCBX_STRICT_INVALID;
266 cos_params[i].bw_tbl = DCBX_INVALID_COS_BW;
267 cos_params[i].pri_bitmask = 0;
270 if (bp->dcbx_port_params.app.enabled && ets->enabled &&
272 DCBX_LOCAL_ETS_ERROR | DCBX_REMOTE_ETS_TLV_NOT_FOUND)) {
273 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_ETS_ENABLE\n");
274 bp->dcbx_port_params.ets.enabled = true;
276 bnx2x_dcbx_get_ets_pri_pg_tbl(bp,
277 pg_pri_orginal_spread,
280 bnx2x_dcbx_get_num_pg_traf_type(bp,
281 pg_pri_orginal_spread,
284 bnx2x_dcbx_fill_cos_params(bp, &pg_help_data,
285 ets, pg_pri_orginal_spread);
288 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_ETS_DISABLED\n");
289 bp->dcbx_port_params.ets.enabled = false;
290 ets->pri_pg_tbl[0] = 0;
292 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES ; i++)
293 DCBX_PG_BW_SET(ets->pg_bw_tbl, i, 1);
297 static void bnx2x_dcbx_get_pfc_feature(struct bnx2x *bp,
298 struct dcbx_pfc_feature *pfc, u32 error)
300 if (GET_FLAGS(error, DCBX_LOCAL_PFC_ERROR))
301 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_PFC_ERROR\n");
303 if (GET_FLAGS(error, DCBX_REMOTE_PFC_TLV_NOT_FOUND))
304 DP(BNX2X_MSG_DCB, "DCBX_REMOTE_PFC_TLV_NOT_FOUND\n");
305 if (bp->dcbx_port_params.app.enabled && pfc->enabled &&
306 !GET_FLAGS(error, DCBX_LOCAL_PFC_ERROR | DCBX_LOCAL_PFC_MISMATCH |
307 DCBX_REMOTE_PFC_TLV_NOT_FOUND)) {
308 bp->dcbx_port_params.pfc.enabled = true;
309 bp->dcbx_port_params.pfc.priority_non_pauseable_mask =
310 ~(pfc->pri_en_bitmap);
312 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_PFC_DISABLED\n");
313 bp->dcbx_port_params.pfc.enabled = false;
314 bp->dcbx_port_params.pfc.priority_non_pauseable_mask = 0;
318 /* maps unmapped priorities to to the same COS as L2 */
319 static void bnx2x_dcbx_map_nw(struct bnx2x *bp)
322 u32 unmapped = (1 << MAX_PFC_PRIORITIES) - 1; /* all ones */
323 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
324 u32 nw_prio = 1 << ttp[LLFC_TRAFFIC_TYPE_NW];
325 struct bnx2x_dcbx_cos_params *cos_params =
326 bp->dcbx_port_params.ets.cos_params;
328 /* get unmapped priorities by clearing mapped bits */
329 for (i = 0; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++)
330 unmapped &= ~(1 << ttp[i]);
332 /* find cos for nw prio and extend it with unmapped */
333 for (i = 0; i < ARRAY_SIZE(bp->dcbx_port_params.ets.cos_params); i++) {
334 if (cos_params[i].pri_bitmask & nw_prio) {
335 /* extend the bitmask with unmapped */
337 "cos %d extended with 0x%08x\n", i, unmapped);
338 cos_params[i].pri_bitmask |= unmapped;
344 static void bnx2x_get_dcbx_drv_param(struct bnx2x *bp,
345 struct dcbx_features *features,
348 bnx2x_dcbx_get_ap_feature(bp, &features->app, error);
350 bnx2x_dcbx_get_pfc_feature(bp, &features->pfc, error);
352 bnx2x_dcbx_get_ets_feature(bp, &features->ets, error);
354 bnx2x_dcbx_map_nw(bp);
357 #define DCBX_LOCAL_MIB_MAX_TRY_READ (100)
358 static int bnx2x_dcbx_read_mib(struct bnx2x *bp,
363 int max_try_read = 0;
364 u32 mib_size, prefix_seq_num, suffix_seq_num;
365 struct lldp_remote_mib *remote_mib ;
366 struct lldp_local_mib *local_mib;
368 switch (read_mib_type) {
369 case DCBX_READ_LOCAL_MIB:
370 mib_size = sizeof(struct lldp_local_mib);
372 case DCBX_READ_REMOTE_MIB:
373 mib_size = sizeof(struct lldp_remote_mib);
379 offset += BP_PORT(bp) * mib_size;
382 bnx2x_read_data(bp, base_mib_addr, offset, mib_size);
386 switch (read_mib_type) {
387 case DCBX_READ_LOCAL_MIB:
388 local_mib = (struct lldp_local_mib *) base_mib_addr;
389 prefix_seq_num = local_mib->prefix_seq_num;
390 suffix_seq_num = local_mib->suffix_seq_num;
392 case DCBX_READ_REMOTE_MIB:
393 remote_mib = (struct lldp_remote_mib *) base_mib_addr;
394 prefix_seq_num = remote_mib->prefix_seq_num;
395 suffix_seq_num = remote_mib->suffix_seq_num;
400 } while ((prefix_seq_num != suffix_seq_num) &&
401 (max_try_read < DCBX_LOCAL_MIB_MAX_TRY_READ));
403 if (max_try_read >= DCBX_LOCAL_MIB_MAX_TRY_READ) {
404 BNX2X_ERR("MIB could not be read\n");
411 static void bnx2x_pfc_set_pfc(struct bnx2x *bp)
413 int mfw_configured = SHMEM2_HAS(bp, drv_flags) &&
414 GET_FLAGS(SHMEM2_RD(bp, drv_flags),
415 1 << DRV_FLAGS_DCB_MFW_CONFIGURED);
417 if (bp->dcbx_port_params.pfc.enabled &&
418 (!(bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) || mfw_configured))
420 * 1. Fills up common PFC structures if required
421 * 2. Configure NIG, MAC and BRB via the elink
428 int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp)
430 struct bnx2x_func_state_params func_params = {NULL};
433 func_params.f_obj = &bp->func_obj;
434 func_params.cmd = BNX2X_F_CMD_TX_STOP;
436 __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags);
437 __set_bit(RAMROD_RETRY, &func_params.ramrod_flags);
439 DP(BNX2X_MSG_DCB, "STOP TRAFFIC\n");
441 rc = bnx2x_func_state_change(bp, &func_params);
443 BNX2X_ERR("Unable to hold traffic for HW configuration\n");
450 int bnx2x_dcbx_resume_hw_tx(struct bnx2x *bp)
452 struct bnx2x_func_state_params func_params = {NULL};
453 struct bnx2x_func_tx_start_params *tx_params =
454 &func_params.params.tx_start;
457 func_params.f_obj = &bp->func_obj;
458 func_params.cmd = BNX2X_F_CMD_TX_START;
460 __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags);
461 __set_bit(RAMROD_RETRY, &func_params.ramrod_flags);
463 bnx2x_dcbx_fw_struct(bp, tx_params);
465 DP(BNX2X_MSG_DCB, "START TRAFFIC\n");
467 rc = bnx2x_func_state_change(bp, &func_params);
469 BNX2X_ERR("Unable to resume traffic after HW configuration\n");
476 static void bnx2x_dcbx_2cos_limit_update_ets_config(struct bnx2x *bp)
478 struct bnx2x_dcbx_pg_params *ets = &(bp->dcbx_port_params.ets);
481 if (ets->num_of_cos == 0 || ets->num_of_cos > DCBX_COS_MAX_NUM_E2) {
482 BNX2X_ERR("Illegal number of COSes %d\n", ets->num_of_cos);
486 /* valid COS entries */
487 if (ets->num_of_cos == 1) /* no ETS */
491 if (((BNX2X_DCBX_STRICT_INVALID == ets->cos_params[0].strict) &&
492 (DCBX_INVALID_COS_BW == ets->cos_params[0].bw_tbl)) ||
493 ((BNX2X_DCBX_STRICT_INVALID == ets->cos_params[1].strict) &&
494 (DCBX_INVALID_COS_BW == ets->cos_params[1].bw_tbl))) {
495 BNX2X_ERR("all COS should have at least bw_limit or strict"
496 "ets->cos_params[0].strict= %x"
497 "ets->cos_params[0].bw_tbl= %x"
498 "ets->cos_params[1].strict= %x"
499 "ets->cos_params[1].bw_tbl= %x",
500 ets->cos_params[0].strict,
501 ets->cos_params[0].bw_tbl,
502 ets->cos_params[1].strict,
503 ets->cos_params[1].bw_tbl);
506 /* If we join a group and there is bw_tbl and strict then bw rules */
507 if ((DCBX_INVALID_COS_BW != ets->cos_params[0].bw_tbl) &&
508 (DCBX_INVALID_COS_BW != ets->cos_params[1].bw_tbl)) {
509 u32 bw_tbl_0 = ets->cos_params[0].bw_tbl;
510 u32 bw_tbl_1 = ets->cos_params[1].bw_tbl;
511 /* Do not allow 0-100 configuration
512 * since PBF does not support it
518 } else if (bw_tbl_1 == 0) {
523 bnx2x_ets_bw_limit(&bp->link_params, bw_tbl_0, bw_tbl_1);
525 if (ets->cos_params[0].strict == BNX2X_DCBX_STRICT_COS_HIGHEST)
526 rc = bnx2x_ets_strict(&bp->link_params, 0);
527 else if (ets->cos_params[1].strict
528 == BNX2X_DCBX_STRICT_COS_HIGHEST)
529 rc = bnx2x_ets_strict(&bp->link_params, 1);
531 BNX2X_ERR("update_ets_params failed\n");
536 * In E3B0 the configuration may have more than 2 COS.
538 static void bnx2x_dcbx_update_ets_config(struct bnx2x *bp)
540 struct bnx2x_dcbx_pg_params *ets = &(bp->dcbx_port_params.ets);
541 struct bnx2x_ets_params ets_params = { 0 };
544 ets_params.num_of_cos = ets->num_of_cos;
546 for (i = 0; i < ets->num_of_cos; i++) {
548 if (ets->cos_params[i].strict != BNX2X_DCBX_STRICT_INVALID) {
549 if (ets->cos_params[i].bw_tbl != DCBX_INVALID_COS_BW) {
550 BNX2X_ERR("COS can't be not BW and not SP\n");
554 ets_params.cos[i].state = bnx2x_cos_state_strict;
555 ets_params.cos[i].params.sp_params.pri =
556 ets->cos_params[i].strict;
557 } else { /* COS is BW */
558 if (ets->cos_params[i].bw_tbl == DCBX_INVALID_COS_BW) {
559 BNX2X_ERR("COS can't be not BW and not SP\n");
562 ets_params.cos[i].state = bnx2x_cos_state_bw;
563 ets_params.cos[i].params.bw_params.bw =
564 (u8)ets->cos_params[i].bw_tbl;
568 /* Configure the ETS in HW */
569 if (bnx2x_ets_e3b0_config(&bp->link_params, &bp->link_vars,
571 BNX2X_ERR("bnx2x_ets_e3b0_config failed\n");
572 bnx2x_ets_disabled(&bp->link_params, &bp->link_vars);
576 static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp)
578 int mfw_configured = SHMEM2_HAS(bp, drv_flags) &&
579 GET_FLAGS(SHMEM2_RD(bp, drv_flags),
580 1 << DRV_FLAGS_DCB_MFW_CONFIGURED);
582 bnx2x_ets_disabled(&bp->link_params, &bp->link_vars);
584 if (!bp->dcbx_port_params.ets.enabled ||
585 ((bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) && !mfw_configured))
588 if (CHIP_IS_E3B0(bp))
589 bnx2x_dcbx_update_ets_config(bp);
591 bnx2x_dcbx_2cos_limit_update_ets_config(bp);
595 static int bnx2x_dcbx_read_shmem_remote_mib(struct bnx2x *bp)
597 struct lldp_remote_mib remote_mib = {0};
598 u32 dcbx_remote_mib_offset = SHMEM2_RD(bp, dcbx_remote_mib_offset);
601 DP(BNX2X_MSG_DCB, "dcbx_remote_mib_offset 0x%x\n",
602 dcbx_remote_mib_offset);
604 if (SHMEM_DCBX_REMOTE_MIB_NONE == dcbx_remote_mib_offset) {
605 BNX2X_ERR("FW doesn't support dcbx_remote_mib_offset\n");
609 rc = bnx2x_dcbx_read_mib(bp, (u32 *)&remote_mib, dcbx_remote_mib_offset,
610 DCBX_READ_REMOTE_MIB);
613 BNX2X_ERR("Failed to read remote mib from FW\n");
617 /* save features and flags */
618 bp->dcbx_remote_feat = remote_mib.features;
619 bp->dcbx_remote_flags = remote_mib.flags;
624 static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp)
626 struct lldp_local_mib local_mib = {0};
627 u32 dcbx_neg_res_offset = SHMEM2_RD(bp, dcbx_neg_res_offset);
630 DP(BNX2X_MSG_DCB, "dcbx_neg_res_offset 0x%x\n", dcbx_neg_res_offset);
632 if (SHMEM_DCBX_NEG_RES_NONE == dcbx_neg_res_offset) {
633 BNX2X_ERR("FW doesn't support dcbx_neg_res_offset\n");
637 rc = bnx2x_dcbx_read_mib(bp, (u32 *)&local_mib, dcbx_neg_res_offset,
638 DCBX_READ_LOCAL_MIB);
641 BNX2X_ERR("Failed to read local mib from FW\n");
645 /* save features and error */
646 bp->dcbx_local_feat = local_mib.features;
647 bp->dcbx_error = local_mib.error;
653 u8 bnx2x_dcbx_dcbnl_app_up(struct dcbx_app_priority_entry *ent)
657 /* Choose the highest priority */
658 for (pri = MAX_PFC_PRIORITIES - 1; pri > 0; pri--)
659 if (ent->pri_bitmap & (1 << pri))
665 u8 bnx2x_dcbx_dcbnl_app_idtype(struct dcbx_app_priority_entry *ent)
667 return ((ent->appBitfield & DCBX_APP_ENTRY_SF_MASK) ==
668 DCBX_APP_SF_PORT) ? DCB_APP_IDTYPE_PORTNUM :
669 DCB_APP_IDTYPE_ETHTYPE;
672 int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall)
676 for (i = 0; i < DCBX_MAX_APP_PROTOCOL && err == 0; i++) {
677 struct dcbx_app_priority_entry *ent =
678 &bp->dcbx_local_feat.app.app_pri_tbl[i];
680 if (ent->appBitfield & DCBX_APP_ENTRY_VALID) {
681 u8 up = bnx2x_dcbx_dcbnl_app_up(ent);
683 /* avoid invalid user-priority */
686 app.selector = bnx2x_dcbx_dcbnl_app_idtype(ent);
687 app.protocol = ent->app_id;
688 app.priority = delall ? 0 : up;
689 err = dcb_setapp(bp->dev, &app);
697 static inline void bnx2x_dcbx_update_tc_mapping(struct bnx2x *bp)
700 for (cos = 0; cos < bp->dcbx_port_params.ets.num_of_cos; cos++) {
701 for (prio = 0; prio < BNX2X_MAX_PRIORITY; prio++) {
702 if (bp->dcbx_port_params.ets.cos_params[cos].pri_bitmask
704 bp->prio_to_cos[prio] = cos;
706 "tx_mapping %d --> %d\n", prio, cos);
711 /* setup tc must be called under rtnl lock, but we can't take it here
712 * as we are handling an attention on a work queue which must be
713 * flushed at some rtnl-locked contexts (e.g. if down)
715 bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_SETUP_TC, 0);
718 void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
721 case BNX2X_DCBX_STATE_NEG_RECEIVED:
723 DP(BNX2X_MSG_DCB, "BNX2X_DCBX_STATE_NEG_RECEIVED\n");
726 * Delete app tlvs from dcbnl before reading new
727 * negotiation results
729 bnx2x_dcbnl_update_applist(bp, true);
731 /* Read remote mib if dcbx is in the FW */
732 if (bnx2x_dcbx_read_shmem_remote_mib(bp))
735 /* Read neg results if dcbx is in the FW */
736 if (bnx2x_dcbx_read_shmem_neg_results(bp))
739 bnx2x_dump_dcbx_drv_param(bp, &bp->dcbx_local_feat,
742 bnx2x_get_dcbx_drv_param(bp, &bp->dcbx_local_feat,
745 /* mark DCBX result for PMF migration */
746 bnx2x_update_drv_flags(bp,
747 1 << DRV_FLAGS_DCB_CONFIGURED,
751 * Add new app tlvs to dcbnl
753 bnx2x_dcbnl_update_applist(bp, false);
756 * reconfigure the netdevice with the results of the new
759 bnx2x_dcbx_update_tc_mapping(bp);
762 * allow other functions to update their netdevices
766 bnx2x_link_sync_notify(bp);
768 bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_TX_STOP, 0);
771 case BNX2X_DCBX_STATE_TX_PAUSED:
772 DP(BNX2X_MSG_DCB, "BNX2X_DCBX_STATE_TX_PAUSED\n");
773 bnx2x_pfc_set_pfc(bp);
775 bnx2x_dcbx_update_ets_params(bp);
777 /* ets may affect cmng configuration: reinit it in hw */
778 bnx2x_set_local_cmng(bp);
780 case BNX2X_DCBX_STATE_TX_RELEASED:
781 DP(BNX2X_MSG_DCB, "BNX2X_DCBX_STATE_TX_RELEASED\n");
782 bnx2x_fw_command(bp, DRV_MSG_CODE_DCBX_PMF_DRV_OK, 0);
785 * Send a notification for the new negotiated parameters
787 dcbnl_cee_notify(bp->dev, RTM_GETDCB, DCB_CMD_CEE_GET, 0, 0);
791 BNX2X_ERR("Unknown DCBX_STATE\n");
795 #define LLDP_ADMIN_MIB_OFFSET(bp) (PORT_MAX*sizeof(struct lldp_params) + \
796 BP_PORT(bp)*sizeof(struct lldp_admin_mib))
798 static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp,
799 u32 dcbx_lldp_params_offset)
801 struct lldp_admin_mib admin_mib;
802 u32 i, other_traf_type = PREDEFINED_APP_IDX_MAX, traf_type = 0;
803 u32 offset = dcbx_lldp_params_offset + LLDP_ADMIN_MIB_OFFSET(bp);
806 struct dcbx_features *af = &admin_mib.features;
807 struct bnx2x_config_dcbx_params *dp = &bp->dcbx_config_params;
809 memset(&admin_mib, 0, sizeof(struct lldp_admin_mib));
811 /* Read the data first */
812 bnx2x_read_data(bp, (u32 *)&admin_mib, offset,
813 sizeof(struct lldp_admin_mib));
815 if (bp->dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_ON)
816 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_DCBX_ENABLED);
818 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_DCBX_ENABLED);
820 if (dp->overwrite_settings == BNX2X_DCBX_OVERWRITE_SETTINGS_ENABLE) {
822 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_CEE_VERSION_MASK);
823 admin_mib.ver_cfg_flags |=
824 (dp->admin_dcbx_version << DCBX_CEE_VERSION_SHIFT) &
825 DCBX_CEE_VERSION_MASK;
827 af->ets.enabled = (u8)dp->admin_ets_enable;
829 af->pfc.enabled = (u8)dp->admin_pfc_enable;
831 /* FOR IEEE dp->admin_tc_supported_tx_enable */
832 if (dp->admin_ets_configuration_tx_enable)
833 SET_FLAGS(admin_mib.ver_cfg_flags,
834 DCBX_ETS_CONFIG_TX_ENABLED);
836 RESET_FLAGS(admin_mib.ver_cfg_flags,
837 DCBX_ETS_CONFIG_TX_ENABLED);
838 /* For IEEE admin_ets_recommendation_tx_enable */
839 if (dp->admin_pfc_tx_enable)
840 SET_FLAGS(admin_mib.ver_cfg_flags,
841 DCBX_PFC_CONFIG_TX_ENABLED);
843 RESET_FLAGS(admin_mib.ver_cfg_flags,
844 DCBX_PFC_CONFIG_TX_ENABLED);
846 if (dp->admin_application_priority_tx_enable)
847 SET_FLAGS(admin_mib.ver_cfg_flags,
848 DCBX_APP_CONFIG_TX_ENABLED);
850 RESET_FLAGS(admin_mib.ver_cfg_flags,
851 DCBX_APP_CONFIG_TX_ENABLED);
853 if (dp->admin_ets_willing)
854 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_ETS_WILLING);
856 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_ETS_WILLING);
857 /* For IEEE admin_ets_reco_valid */
858 if (dp->admin_pfc_willing)
859 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_PFC_WILLING);
861 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_PFC_WILLING);
863 if (dp->admin_app_priority_willing)
864 SET_FLAGS(admin_mib.ver_cfg_flags, DCBX_APP_WILLING);
866 RESET_FLAGS(admin_mib.ver_cfg_flags, DCBX_APP_WILLING);
868 for (i = 0 ; i < DCBX_MAX_NUM_PG_BW_ENTRIES; i++) {
869 DCBX_PG_BW_SET(af->ets.pg_bw_tbl, i,
870 (u8)dp->admin_configuration_bw_precentage[i]);
872 DP(BNX2X_MSG_DCB, "pg_bw_tbl[%d] = %02x\n",
873 i, DCBX_PG_BW_GET(af->ets.pg_bw_tbl, i));
876 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES; i++) {
877 DCBX_PRI_PG_SET(af->ets.pri_pg_tbl, i,
878 (u8)dp->admin_configuration_ets_pg[i]);
880 DP(BNX2X_MSG_DCB, "pri_pg_tbl[%d] = %02x\n",
881 i, DCBX_PRI_PG_GET(af->ets.pri_pg_tbl, i));
884 /*For IEEE admin_recommendation_bw_percentage
885 *For IEEE admin_recommendation_ets_pg */
886 af->pfc.pri_en_bitmap = (u8)dp->admin_pfc_bitmap;
887 for (i = 0; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
888 if (dp->admin_priority_app_table[i].valid) {
889 struct bnx2x_admin_priority_app_table *table =
890 dp->admin_priority_app_table;
891 if ((ETH_TYPE_FCOE == table[i].app_id) &&
892 (TRAFFIC_TYPE_ETH == table[i].traffic_type))
893 traf_type = FCOE_APP_IDX;
894 else if ((TCP_PORT_ISCSI == table[i].app_id) &&
895 (TRAFFIC_TYPE_PORT == table[i].traffic_type))
896 traf_type = ISCSI_APP_IDX;
898 traf_type = other_traf_type++;
900 af->app.app_pri_tbl[traf_type].app_id =
903 af->app.app_pri_tbl[traf_type].pri_bitmap =
904 (u8)(1 << table[i].priority);
906 af->app.app_pri_tbl[traf_type].appBitfield =
907 (DCBX_APP_ENTRY_VALID);
909 af->app.app_pri_tbl[traf_type].appBitfield |=
910 (TRAFFIC_TYPE_ETH == table[i].traffic_type) ?
911 DCBX_APP_SF_ETH_TYPE : DCBX_APP_SF_PORT;
915 af->app.default_pri = (u8)dp->admin_default_priority;
918 /* Write the data. */
919 bnx2x_write_data(bp, (u32 *)&admin_mib, offset,
920 sizeof(struct lldp_admin_mib));
923 void bnx2x_dcbx_set_state(struct bnx2x *bp, bool dcb_on, u32 dcbx_enabled)
925 if (!CHIP_IS_E1x(bp)) {
926 bp->dcb_state = dcb_on;
927 bp->dcbx_enabled = dcbx_enabled;
929 bp->dcb_state = false;
930 bp->dcbx_enabled = BNX2X_DCBX_ENABLED_INVALID;
932 DP(BNX2X_MSG_DCB, "DCB state [%s:%s]\n",
933 dcb_on ? "ON" : "OFF",
934 dcbx_enabled == BNX2X_DCBX_ENABLED_OFF ? "user-mode" :
935 dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_OFF ? "on-chip static" :
936 dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_ON ?
937 "on-chip with negotiation" : "invalid");
940 void bnx2x_dcbx_init_params(struct bnx2x *bp)
942 bp->dcbx_config_params.admin_dcbx_version = 0x0; /* 0 - CEE; 1 - IEEE */
943 bp->dcbx_config_params.admin_ets_willing = 1;
944 bp->dcbx_config_params.admin_pfc_willing = 1;
945 bp->dcbx_config_params.overwrite_settings = 1;
946 bp->dcbx_config_params.admin_ets_enable = 1;
947 bp->dcbx_config_params.admin_pfc_enable = 1;
948 bp->dcbx_config_params.admin_tc_supported_tx_enable = 1;
949 bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1;
950 bp->dcbx_config_params.admin_pfc_tx_enable = 1;
951 bp->dcbx_config_params.admin_application_priority_tx_enable = 1;
952 bp->dcbx_config_params.admin_ets_reco_valid = 1;
953 bp->dcbx_config_params.admin_app_priority_willing = 1;
954 bp->dcbx_config_params.admin_configuration_bw_precentage[0] = 100;
955 bp->dcbx_config_params.admin_configuration_bw_precentage[1] = 0;
956 bp->dcbx_config_params.admin_configuration_bw_precentage[2] = 0;
957 bp->dcbx_config_params.admin_configuration_bw_precentage[3] = 0;
958 bp->dcbx_config_params.admin_configuration_bw_precentage[4] = 0;
959 bp->dcbx_config_params.admin_configuration_bw_precentage[5] = 0;
960 bp->dcbx_config_params.admin_configuration_bw_precentage[6] = 0;
961 bp->dcbx_config_params.admin_configuration_bw_precentage[7] = 0;
962 bp->dcbx_config_params.admin_configuration_ets_pg[0] = 0;
963 bp->dcbx_config_params.admin_configuration_ets_pg[1] = 0;
964 bp->dcbx_config_params.admin_configuration_ets_pg[2] = 0;
965 bp->dcbx_config_params.admin_configuration_ets_pg[3] = 0;
966 bp->dcbx_config_params.admin_configuration_ets_pg[4] = 0;
967 bp->dcbx_config_params.admin_configuration_ets_pg[5] = 0;
968 bp->dcbx_config_params.admin_configuration_ets_pg[6] = 0;
969 bp->dcbx_config_params.admin_configuration_ets_pg[7] = 0;
970 bp->dcbx_config_params.admin_recommendation_bw_precentage[0] = 100;
971 bp->dcbx_config_params.admin_recommendation_bw_precentage[1] = 0;
972 bp->dcbx_config_params.admin_recommendation_bw_precentage[2] = 0;
973 bp->dcbx_config_params.admin_recommendation_bw_precentage[3] = 0;
974 bp->dcbx_config_params.admin_recommendation_bw_precentage[4] = 0;
975 bp->dcbx_config_params.admin_recommendation_bw_precentage[5] = 0;
976 bp->dcbx_config_params.admin_recommendation_bw_precentage[6] = 0;
977 bp->dcbx_config_params.admin_recommendation_bw_precentage[7] = 0;
978 bp->dcbx_config_params.admin_recommendation_ets_pg[0] = 0;
979 bp->dcbx_config_params.admin_recommendation_ets_pg[1] = 1;
980 bp->dcbx_config_params.admin_recommendation_ets_pg[2] = 2;
981 bp->dcbx_config_params.admin_recommendation_ets_pg[3] = 3;
982 bp->dcbx_config_params.admin_recommendation_ets_pg[4] = 4;
983 bp->dcbx_config_params.admin_recommendation_ets_pg[5] = 5;
984 bp->dcbx_config_params.admin_recommendation_ets_pg[6] = 6;
985 bp->dcbx_config_params.admin_recommendation_ets_pg[7] = 7;
986 bp->dcbx_config_params.admin_pfc_bitmap = 0x0;
987 bp->dcbx_config_params.admin_priority_app_table[0].valid = 0;
988 bp->dcbx_config_params.admin_priority_app_table[1].valid = 0;
989 bp->dcbx_config_params.admin_priority_app_table[2].valid = 0;
990 bp->dcbx_config_params.admin_priority_app_table[3].valid = 0;
991 bp->dcbx_config_params.admin_default_priority = 0;
994 void bnx2x_dcbx_init(struct bnx2x *bp, bool update_shmem)
996 u32 dcbx_lldp_params_offset = SHMEM_LLDP_DCBX_PARAMS_NONE;
998 /* only PMF can send ADMIN msg to MFW in old MFW versions */
999 if ((!bp->port.pmf) && (!(bp->flags & BC_SUPPORTS_DCBX_MSG_NON_PMF)))
1002 if (bp->dcbx_enabled <= 0)
1006 * chip of good for dcbx version,
1008 * shmem2 contains DCBX support fields
1010 DP(BNX2X_MSG_DCB, "dcb_state %d bp->port.pmf %d\n",
1011 bp->dcb_state, bp->port.pmf);
1013 if (bp->dcb_state == BNX2X_DCB_STATE_ON &&
1014 SHMEM2_HAS(bp, dcbx_lldp_params_offset)) {
1015 dcbx_lldp_params_offset =
1016 SHMEM2_RD(bp, dcbx_lldp_params_offset);
1018 DP(BNX2X_MSG_DCB, "dcbx_lldp_params_offset 0x%x\n",
1019 dcbx_lldp_params_offset);
1021 bnx2x_update_drv_flags(bp, 1 << DRV_FLAGS_DCB_CONFIGURED, 0);
1023 if (SHMEM_LLDP_DCBX_PARAMS_NONE != dcbx_lldp_params_offset) {
1024 /* need HW lock to avoid scenario of two drivers
1025 * writing in parallel to shmem
1027 bnx2x_acquire_hw_lock(bp,
1028 HW_LOCK_RESOURCE_DCBX_ADMIN_MIB);
1030 bnx2x_dcbx_admin_mib_updated_params(bp,
1031 dcbx_lldp_params_offset);
1033 /* Let HW start negotiation */
1034 bnx2x_fw_command(bp,
1035 DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG, 0);
1036 /* release HW lock only after MFW acks that it finished
1037 * reading values from shmem
1039 bnx2x_release_hw_lock(bp,
1040 HW_LOCK_RESOURCE_DCBX_ADMIN_MIB);
1045 bnx2x_dcbx_print_cos_params(struct bnx2x *bp,
1046 struct bnx2x_func_tx_start_params *pfc_fw_cfg)
1052 "pfc_fw_cfg->dcb_version %x\n", pfc_fw_cfg->dcb_version);
1054 "pdev->params.dcbx_port_params.pfc.priority_non_pauseable_mask %x\n",
1055 bp->dcbx_port_params.pfc.priority_non_pauseable_mask);
1057 for (cos = 0 ; cos < bp->dcbx_port_params.ets.num_of_cos ; cos++) {
1059 "pdev->params.dcbx_port_params.ets.cos_params[%d].pri_bitmask %x\n",
1060 cos, bp->dcbx_port_params.ets.cos_params[cos].pri_bitmask);
1063 "pdev->params.dcbx_port_params.ets.cos_params[%d].bw_tbl %x\n",
1064 cos, bp->dcbx_port_params.ets.cos_params[cos].bw_tbl);
1067 "pdev->params.dcbx_port_params.ets.cos_params[%d].strict %x\n",
1068 cos, bp->dcbx_port_params.ets.cos_params[cos].strict);
1071 "pdev->params.dcbx_port_params.ets.cos_params[%d].pauseable %x\n",
1072 cos, bp->dcbx_port_params.ets.cos_params[cos].pauseable);
1075 for (pri = 0; pri < LLFC_DRIVER_TRAFFIC_TYPE_MAX; pri++) {
1077 "pfc_fw_cfg->traffic_type_to_priority_cos[%d].priority %x\n",
1078 pri, pfc_fw_cfg->traffic_type_to_priority_cos[pri].priority);
1081 "pfc_fw_cfg->traffic_type_to_priority_cos[%d].cos %x\n",
1082 pri, pfc_fw_cfg->traffic_type_to_priority_cos[pri].cos);
1086 /* fills help_data according to pg_info */
1087 static void bnx2x_dcbx_get_num_pg_traf_type(struct bnx2x *bp,
1088 u32 *pg_pri_orginal_spread,
1089 struct pg_help_data *help_data)
1091 bool pg_found = false;
1092 u32 i, traf_type, add_traf_type, add_pg;
1093 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1094 struct pg_entry_help_data *data = help_data->data; /*shortcut*/
1096 /* Set to invalid */
1097 for (i = 0; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++)
1098 data[i].pg = DCBX_ILLEGAL_PG;
1100 for (add_traf_type = 0;
1101 add_traf_type < LLFC_DRIVER_TRAFFIC_TYPE_MAX; add_traf_type++) {
1103 if (ttp[add_traf_type] < MAX_PFC_PRIORITIES) {
1104 add_pg = (u8)pg_pri_orginal_spread[ttp[add_traf_type]];
1106 traf_type < LLFC_DRIVER_TRAFFIC_TYPE_MAX;
1108 if (data[traf_type].pg == add_pg) {
1109 if (!(data[traf_type].pg_priority &
1110 (1 << ttp[add_traf_type])))
1113 data[traf_type].pg_priority |=
1114 (1 << ttp[add_traf_type]);
1119 if (false == pg_found) {
1120 data[help_data->num_of_pg].pg = add_pg;
1121 data[help_data->num_of_pg].pg_priority =
1122 (1 << ttp[add_traf_type]);
1123 data[help_data->num_of_pg].num_of_dif_pri = 1;
1124 help_data->num_of_pg++;
1128 "add_traf_type %d pg_found %s num_of_pg %d\n",
1129 add_traf_type, (false == pg_found) ? "NO" : "YES",
1130 help_data->num_of_pg);
1134 static void bnx2x_dcbx_ets_disabled_entry_data(struct bnx2x *bp,
1135 struct cos_help_data *cos_data,
1138 /* Only one priority than only one COS */
1139 cos_data->data[0].pausable =
1140 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1141 cos_data->data[0].pri_join_mask = pri_join_mask;
1142 cos_data->data[0].cos_bw = 100;
1143 cos_data->num_of_cos = 1;
1146 static inline void bnx2x_dcbx_add_to_cos_bw(struct bnx2x *bp,
1147 struct cos_entry_help_data *data,
1150 if (data->cos_bw == DCBX_INVALID_COS_BW)
1151 data->cos_bw = pg_bw;
1153 data->cos_bw += pg_bw;
1156 static void bnx2x_dcbx_separate_pauseable_from_non(struct bnx2x *bp,
1157 struct cos_help_data *cos_data,
1158 u32 *pg_pri_orginal_spread,
1159 struct dcbx_ets_feature *ets)
1165 u8 num_of_pri = LLFC_DRIVER_TRAFFIC_TYPE_MAX;
1167 cos_data->data[0].pausable = true;
1168 cos_data->data[1].pausable = false;
1169 cos_data->data[0].pri_join_mask = cos_data->data[1].pri_join_mask = 0;
1171 for (i = 0 ; i < num_of_pri ; i++) {
1172 pri_tested = 1 << bp->dcbx_port_params.
1173 app.traffic_type_priority[i];
1175 if (pri_tested & DCBX_PFC_PRI_NON_PAUSE_MASK(bp)) {
1176 cos_data->data[1].pri_join_mask |= pri_tested;
1179 cos_data->data[0].pri_join_mask |= pri_tested;
1182 pg_entry = (u8)pg_pri_orginal_spread[bp->dcbx_port_params.
1183 app.traffic_type_priority[i]];
1184 /* There can be only one strict pg */
1185 if (pg_entry < DCBX_MAX_NUM_PG_BW_ENTRIES)
1186 bnx2x_dcbx_add_to_cos_bw(bp, &cos_data->data[entry],
1187 DCBX_PG_BW_GET(ets->pg_bw_tbl, pg_entry));
1189 /* If we join a group and one is strict
1192 cos_data->data[entry].strict =
1193 BNX2X_DCBX_STRICT_COS_HIGHEST;
1195 if ((0 == cos_data->data[0].pri_join_mask) &&
1196 (0 == cos_data->data[1].pri_join_mask))
1197 BNX2X_ERR("dcbx error: Both groups must have priorities\n");
1201 #define POWER_OF_2(x) ((0 != x) && (0 == (x & (x-1))))
1204 static void bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(struct bnx2x *bp,
1205 struct pg_help_data *pg_help_data,
1206 struct cos_help_data *cos_data,
1212 u32 pri_mask_without_pri = 0;
1213 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1215 if (num_of_dif_pri == 1) {
1216 bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data, pri_join_mask);
1219 /* single priority group */
1220 if (pg_help_data->data[0].pg < DCBX_MAX_NUM_PG_BW_ENTRIES) {
1221 /* If there are both pauseable and non-pauseable priorities,
1222 * the pauseable priorities go to the first queue and
1223 * the non-pauseable priorities go to the second queue.
1225 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask)) {
1227 cos_data->data[0].pausable = true;
1229 cos_data->data[1].pausable = false;
1231 if (2 == num_of_dif_pri) {
1232 cos_data->data[0].cos_bw = 50;
1233 cos_data->data[1].cos_bw = 50;
1236 if (3 == num_of_dif_pri) {
1237 if (POWER_OF_2(DCBX_PFC_PRI_GET_PAUSE(bp,
1239 cos_data->data[0].cos_bw = 33;
1240 cos_data->data[1].cos_bw = 67;
1242 cos_data->data[0].cos_bw = 67;
1243 cos_data->data[1].cos_bw = 33;
1247 } else if (IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask)) {
1248 /* If there are only pauseable priorities,
1249 * then one/two priorities go to the first queue
1250 * and one priority goes to the second queue.
1252 if (2 == num_of_dif_pri) {
1253 cos_data->data[0].cos_bw = 50;
1254 cos_data->data[1].cos_bw = 50;
1256 cos_data->data[0].cos_bw = 67;
1257 cos_data->data[1].cos_bw = 33;
1259 cos_data->data[1].pausable = true;
1260 cos_data->data[0].pausable = true;
1261 /* All priorities except FCOE */
1262 cos_data->data[0].pri_join_mask = (pri_join_mask &
1263 ((u8)~(1 << ttp[LLFC_TRAFFIC_TYPE_FCOE])));
1264 /* Only FCOE priority.*/
1265 cos_data->data[1].pri_join_mask =
1266 (1 << ttp[LLFC_TRAFFIC_TYPE_FCOE]);
1268 /* If there are only non-pauseable priorities,
1269 * they will all go to the same queue.
1271 bnx2x_dcbx_ets_disabled_entry_data(bp,
1272 cos_data, pri_join_mask);
1274 /* priority group which is not BW limited (PG#15):*/
1275 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask)) {
1276 /* If there are both pauseable and non-pauseable
1277 * priorities, the pauseable priorities go to the first
1278 * queue and the non-pauseable priorities
1279 * go to the second queue.
1281 if (DCBX_PFC_PRI_GET_PAUSE(bp, pri_join_mask) >
1282 DCBX_PFC_PRI_GET_NON_PAUSE(bp, pri_join_mask)) {
1283 cos_data->data[0].strict =
1284 BNX2X_DCBX_STRICT_COS_HIGHEST;
1285 cos_data->data[1].strict =
1286 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(
1287 BNX2X_DCBX_STRICT_COS_HIGHEST);
1289 cos_data->data[0].strict =
1290 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(
1291 BNX2X_DCBX_STRICT_COS_HIGHEST);
1292 cos_data->data[1].strict =
1293 BNX2X_DCBX_STRICT_COS_HIGHEST;
1296 cos_data->data[0].pausable = true;
1297 /* Non pause-able.*/
1298 cos_data->data[1].pausable = false;
1300 /* If there are only pauseable priorities or
1301 * only non-pauseable,* the lower priorities go
1302 * to the first queue and the higher priorities go
1303 * to the second queue.
1305 cos_data->data[0].pausable =
1306 cos_data->data[1].pausable =
1307 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1309 for (i = 0 ; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++) {
1310 pri_tested = 1 << bp->dcbx_port_params.
1311 app.traffic_type_priority[i];
1312 /* Remove priority tested */
1313 pri_mask_without_pri =
1314 (pri_join_mask & ((u8)(~pri_tested)));
1315 if (pri_mask_without_pri < pri_tested)
1319 if (i == LLFC_DRIVER_TRAFFIC_TYPE_MAX)
1320 BNX2X_ERR("Invalid value for pri_join_mask - could not find a priority\n");
1322 cos_data->data[0].pri_join_mask = pri_mask_without_pri;
1323 cos_data->data[1].pri_join_mask = pri_tested;
1324 /* Both queues are strict priority,
1325 * and that with the highest priority
1326 * gets the highest strict priority in the arbiter.
1328 cos_data->data[0].strict =
1329 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(
1330 BNX2X_DCBX_STRICT_COS_HIGHEST);
1331 cos_data->data[1].strict =
1332 BNX2X_DCBX_STRICT_COS_HIGHEST;
1337 static void bnx2x_dcbx_2cos_limit_cee_two_pg_to_cos_params(
1339 struct pg_help_data *pg_help_data,
1340 struct dcbx_ets_feature *ets,
1341 struct cos_help_data *cos_data,
1342 u32 *pg_pri_orginal_spread,
1347 u8 pg[DCBX_COS_MAX_NUM_E2] = { 0 };
1349 /* If there are both pauseable and non-pauseable priorities,
1350 * the pauseable priorities go to the first queue and
1351 * the non-pauseable priorities go to the second queue.
1353 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask)) {
1354 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp,
1355 pg_help_data->data[0].pg_priority) ||
1356 IS_DCBX_PFC_PRI_MIX_PAUSE(bp,
1357 pg_help_data->data[1].pg_priority)) {
1358 /* If one PG contains both pauseable and
1359 * non-pauseable priorities then ETS is disabled.
1361 bnx2x_dcbx_separate_pauseable_from_non(bp, cos_data,
1362 pg_pri_orginal_spread, ets);
1363 bp->dcbx_port_params.ets.enabled = false;
1368 cos_data->data[0].pausable = true;
1369 /* Non pauseable. */
1370 cos_data->data[1].pausable = false;
1371 if (IS_DCBX_PFC_PRI_ONLY_PAUSE(bp,
1372 pg_help_data->data[0].pg_priority)) {
1373 /* 0 is pauseable */
1374 cos_data->data[0].pri_join_mask =
1375 pg_help_data->data[0].pg_priority;
1376 pg[0] = pg_help_data->data[0].pg;
1377 cos_data->data[1].pri_join_mask =
1378 pg_help_data->data[1].pg_priority;
1379 pg[1] = pg_help_data->data[1].pg;
1380 } else {/* 1 is pauseable */
1381 cos_data->data[0].pri_join_mask =
1382 pg_help_data->data[1].pg_priority;
1383 pg[0] = pg_help_data->data[1].pg;
1384 cos_data->data[1].pri_join_mask =
1385 pg_help_data->data[0].pg_priority;
1386 pg[1] = pg_help_data->data[0].pg;
1389 /* If there are only pauseable priorities or
1390 * only non-pauseable, each PG goes to a queue.
1392 cos_data->data[0].pausable = cos_data->data[1].pausable =
1393 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1394 cos_data->data[0].pri_join_mask =
1395 pg_help_data->data[0].pg_priority;
1396 pg[0] = pg_help_data->data[0].pg;
1397 cos_data->data[1].pri_join_mask =
1398 pg_help_data->data[1].pg_priority;
1399 pg[1] = pg_help_data->data[1].pg;
1402 /* There can be only one strict pg */
1403 for (i = 0 ; i < ARRAY_SIZE(pg); i++) {
1404 if (pg[i] < DCBX_MAX_NUM_PG_BW_ENTRIES)
1405 cos_data->data[i].cos_bw =
1406 DCBX_PG_BW_GET(ets->pg_bw_tbl, pg[i]);
1408 cos_data->data[i].strict =
1409 BNX2X_DCBX_STRICT_COS_HIGHEST;
1413 static int bnx2x_dcbx_join_pgs(
1415 struct dcbx_ets_feature *ets,
1416 struct pg_help_data *pg_help_data,
1417 u8 required_num_of_pg)
1419 u8 entry_joined = pg_help_data->num_of_pg - 1;
1420 u8 entry_removed = entry_joined + 1;
1423 if (required_num_of_pg == 0 || ARRAY_SIZE(pg_help_data->data)
1424 <= pg_help_data->num_of_pg) {
1426 BNX2X_ERR("required_num_of_pg can't be zero\n");
1430 while (required_num_of_pg < pg_help_data->num_of_pg) {
1431 entry_joined = pg_help_data->num_of_pg - 2;
1432 entry_removed = entry_joined + 1;
1434 entry_removed %= ARRAY_SIZE(pg_help_data->data);
1436 pg_help_data->data[entry_joined].pg_priority |=
1437 pg_help_data->data[entry_removed].pg_priority;
1439 pg_help_data->data[entry_joined].num_of_dif_pri +=
1440 pg_help_data->data[entry_removed].num_of_dif_pri;
1442 if (pg_help_data->data[entry_joined].pg == DCBX_STRICT_PRI_PG ||
1443 pg_help_data->data[entry_removed].pg == DCBX_STRICT_PRI_PG)
1444 /* Entries joined strict priority rules */
1445 pg_help_data->data[entry_joined].pg =
1448 /* Entries can be joined join BW */
1449 pg_joined = DCBX_PG_BW_GET(ets->pg_bw_tbl,
1450 pg_help_data->data[entry_joined].pg) +
1451 DCBX_PG_BW_GET(ets->pg_bw_tbl,
1452 pg_help_data->data[entry_removed].pg);
1454 DCBX_PG_BW_SET(ets->pg_bw_tbl,
1455 pg_help_data->data[entry_joined].pg, pg_joined);
1457 /* Joined the entries */
1458 pg_help_data->num_of_pg--;
1464 static void bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params(
1466 struct pg_help_data *pg_help_data,
1467 struct dcbx_ets_feature *ets,
1468 struct cos_help_data *cos_data,
1469 u32 *pg_pri_orginal_spread,
1477 bool b_found_strict = false;
1478 u8 num_of_pri = LLFC_DRIVER_TRAFFIC_TYPE_MAX;
1480 cos_data->data[0].pri_join_mask = cos_data->data[1].pri_join_mask = 0;
1481 /* If there are both pauseable and non-pauseable priorities,
1482 * the pauseable priorities go to the first queue and the
1483 * non-pauseable priorities go to the second queue.
1485 if (IS_DCBX_PFC_PRI_MIX_PAUSE(bp, pri_join_mask))
1486 bnx2x_dcbx_separate_pauseable_from_non(bp,
1487 cos_data, pg_pri_orginal_spread, ets);
1489 /* If two BW-limited PG-s were combined to one queue,
1490 * the BW is their sum.
1492 * If there are only pauseable priorities or only non-pauseable,
1493 * and there are both BW-limited and non-BW-limited PG-s,
1494 * the BW-limited PG/s go to one queue and the non-BW-limited
1495 * PG/s go to the second queue.
1497 * If there are only pauseable priorities or only non-pauseable
1498 * and all are BW limited, then two priorities go to the first
1499 * queue and one priority goes to the second queue.
1501 * We will join this two cases:
1502 * if one is BW limited it will go to the second queue
1503 * otherwise the last priority will get it
1506 cos_data->data[0].pausable = cos_data->data[1].pausable =
1507 IS_DCBX_PFC_PRI_ONLY_PAUSE(bp, pri_join_mask);
1509 for (i = 0 ; i < num_of_pri; i++) {
1510 pri_tested = 1 << bp->dcbx_port_params.
1511 app.traffic_type_priority[i];
1512 pg_entry = (u8)pg_pri_orginal_spread[bp->
1513 dcbx_port_params.app.traffic_type_priority[i]];
1515 if (pg_entry < DCBX_MAX_NUM_PG_BW_ENTRIES) {
1518 if (i == (num_of_pri-1) &&
1519 false == b_found_strict)
1520 /* last entry will be handled separately
1521 * If no priority is strict than last
1522 * entry goes to last queue.
1525 cos_data->data[entry].pri_join_mask |=
1527 bnx2x_dcbx_add_to_cos_bw(bp,
1528 &cos_data->data[entry],
1529 DCBX_PG_BW_GET(ets->pg_bw_tbl,
1532 b_found_strict = true;
1533 cos_data->data[1].pri_join_mask |= pri_tested;
1534 /* If we join a group and one is strict
1537 cos_data->data[1].strict =
1538 BNX2X_DCBX_STRICT_COS_HIGHEST;
1544 static void bnx2x_dcbx_2cos_limit_cee_fill_cos_params(struct bnx2x *bp,
1545 struct pg_help_data *help_data,
1546 struct dcbx_ets_feature *ets,
1547 struct cos_help_data *cos_data,
1548 u32 *pg_pri_orginal_spread,
1552 /* default E2 settings */
1553 cos_data->num_of_cos = DCBX_COS_MAX_NUM_E2;
1555 switch (help_data->num_of_pg) {
1557 bnx2x_dcbx_2cos_limit_cee_single_pg_to_cos_params(
1565 bnx2x_dcbx_2cos_limit_cee_two_pg_to_cos_params(
1570 pg_pri_orginal_spread,
1576 bnx2x_dcbx_2cos_limit_cee_three_pg_to_cos_params(
1581 pg_pri_orginal_spread,
1586 BNX2X_ERR("Wrong pg_help_data.num_of_pg\n");
1587 bnx2x_dcbx_ets_disabled_entry_data(bp,
1588 cos_data, pri_join_mask);
1592 static int bnx2x_dcbx_spread_strict_pri(struct bnx2x *bp,
1593 struct cos_help_data *cos_data,
1595 u8 num_spread_of_entries,
1598 u8 strict_pri = BNX2X_DCBX_STRICT_COS_HIGHEST;
1599 u8 num_of_app_pri = MAX_PFC_PRIORITIES;
1602 while (num_spread_of_entries && num_of_app_pri > 0) {
1603 app_pri_bit = 1 << (num_of_app_pri - 1);
1604 if (app_pri_bit & strict_app_pris) {
1605 struct cos_entry_help_data *data = &cos_data->
1607 num_spread_of_entries--;
1608 if (num_spread_of_entries == 0) {
1609 /* last entry needed put all the entries left */
1610 data->cos_bw = DCBX_INVALID_COS_BW;
1611 data->strict = strict_pri;
1612 data->pri_join_mask = strict_app_pris;
1613 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1614 data->pri_join_mask);
1616 strict_app_pris &= ~app_pri_bit;
1618 data->cos_bw = DCBX_INVALID_COS_BW;
1619 data->strict = strict_pri;
1620 data->pri_join_mask = app_pri_bit;
1621 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1622 data->pri_join_mask);
1626 BNX2X_DCBX_STRICT_COS_NEXT_LOWER_PRI(strict_pri);
1633 if (num_spread_of_entries) {
1634 BNX2X_ERR("Didn't succeed to spread strict priorities\n");
1641 static u8 bnx2x_dcbx_cee_fill_strict_pri(struct bnx2x *bp,
1642 struct cos_help_data *cos_data,
1644 u8 num_spread_of_entries,
1647 if (bnx2x_dcbx_spread_strict_pri(bp, cos_data, entry,
1648 num_spread_of_entries,
1650 struct cos_entry_help_data *data = &cos_data->
1653 data->cos_bw = DCBX_INVALID_COS_BW;
1654 data->strict = BNX2X_DCBX_STRICT_COS_HIGHEST;
1655 data->pri_join_mask = strict_app_pris;
1656 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1657 data->pri_join_mask);
1661 return num_spread_of_entries;
1664 static void bnx2x_dcbx_cee_fill_cos_params(struct bnx2x *bp,
1665 struct pg_help_data *help_data,
1666 struct dcbx_ets_feature *ets,
1667 struct cos_help_data *cos_data,
1671 u8 need_num_of_entries = 0;
1676 * if the number of requested PG-s in CEE is greater than 3
1677 * then the results are not determined since this is a violation
1680 if (help_data->num_of_pg > DCBX_COS_MAX_NUM_E3B0) {
1681 if (bnx2x_dcbx_join_pgs(bp, ets, help_data,
1682 DCBX_COS_MAX_NUM_E3B0)) {
1683 BNX2X_ERR("Unable to reduce the number of PGs - we will disables ETS\n");
1684 bnx2x_dcbx_ets_disabled_entry_data(bp, cos_data,
1690 for (i = 0 ; i < help_data->num_of_pg; i++) {
1691 struct pg_entry_help_data *pg = &help_data->data[i];
1692 if (pg->pg < DCBX_MAX_NUM_PG_BW_ENTRIES) {
1693 struct cos_entry_help_data *data = &cos_data->
1696 data->cos_bw = DCBX_PG_BW_GET(ets->pg_bw_tbl, pg->pg);
1697 data->strict = BNX2X_DCBX_STRICT_INVALID;
1698 data->pri_join_mask = pg->pg_priority;
1699 data->pausable = DCBX_IS_PFC_PRI_SOME_PAUSE(bp,
1700 data->pri_join_mask);
1704 need_num_of_entries = min_t(u8,
1705 (u8)pg->num_of_dif_pri,
1706 (u8)DCBX_COS_MAX_NUM_E3B0 -
1707 help_data->num_of_pg + 1);
1709 * If there are still VOQ-s which have no associated PG,
1710 * then associate these VOQ-s to PG15. These PG-s will
1711 * be used for SP between priorities on PG15.
1713 entry += bnx2x_dcbx_cee_fill_strict_pri(bp, cos_data,
1714 entry, need_num_of_entries, pg->pg_priority);
1718 /* the entry will represent the number of COSes used */
1719 cos_data->num_of_cos = entry;
1721 static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp,
1722 struct pg_help_data *help_data,
1723 struct dcbx_ets_feature *ets,
1724 u32 *pg_pri_orginal_spread)
1726 struct cos_help_data cos_data;
1728 u32 pri_join_mask = 0;
1729 u8 num_of_dif_pri = 0;
1731 memset(&cos_data, 0, sizeof(cos_data));
1733 /* Validate the pg value */
1734 for (i = 0; i < help_data->num_of_pg ; i++) {
1735 if (DCBX_STRICT_PRIORITY != help_data->data[i].pg &&
1736 DCBX_MAX_NUM_PG_BW_ENTRIES <= help_data->data[i].pg)
1737 BNX2X_ERR("Invalid pg[%d] data %x\n", i,
1738 help_data->data[i].pg);
1739 pri_join_mask |= help_data->data[i].pg_priority;
1740 num_of_dif_pri += help_data->data[i].num_of_dif_pri;
1744 cos_data.num_of_cos = 1;
1745 for (i = 0; i < ARRAY_SIZE(cos_data.data); i++) {
1746 cos_data.data[i].pri_join_mask = 0;
1747 cos_data.data[i].pausable = false;
1748 cos_data.data[i].strict = BNX2X_DCBX_STRICT_INVALID;
1749 cos_data.data[i].cos_bw = DCBX_INVALID_COS_BW;
1752 if (CHIP_IS_E3B0(bp))
1753 bnx2x_dcbx_cee_fill_cos_params(bp, help_data, ets,
1754 &cos_data, pri_join_mask);
1755 else /* E2 + E3A0 */
1756 bnx2x_dcbx_2cos_limit_cee_fill_cos_params(bp,
1759 pg_pri_orginal_spread,
1763 for (i = 0; i < cos_data.num_of_cos ; i++) {
1764 struct bnx2x_dcbx_cos_params *p =
1765 &bp->dcbx_port_params.ets.cos_params[i];
1767 p->strict = cos_data.data[i].strict;
1768 p->bw_tbl = cos_data.data[i].cos_bw;
1769 p->pri_bitmask = cos_data.data[i].pri_join_mask;
1770 p->pauseable = cos_data.data[i].pausable;
1773 if (p->bw_tbl != DCBX_INVALID_COS_BW ||
1774 p->strict != BNX2X_DCBX_STRICT_INVALID) {
1775 if (p->pri_bitmask == 0)
1776 BNX2X_ERR("Invalid pri_bitmask for %d\n", i);
1778 if (CHIP_IS_E2(bp) || CHIP_IS_E3A0(bp)) {
1781 DCBX_PFC_PRI_GET_NON_PAUSE(bp,
1782 p->pri_bitmask) != 0)
1783 BNX2X_ERR("Inconsistent config for pausable COS %d\n",
1786 if (!p->pauseable &&
1787 DCBX_PFC_PRI_GET_PAUSE(bp,
1788 p->pri_bitmask) != 0)
1789 BNX2X_ERR("Inconsistent config for nonpausable COS %d\n",
1795 DP(BNX2X_MSG_DCB, "COS %d PAUSABLE prijoinmask 0x%x\n",
1796 i, cos_data.data[i].pri_join_mask);
1799 "COS %d NONPAUSABLE prijoinmask 0x%x\n",
1800 i, cos_data.data[i].pri_join_mask);
1803 bp->dcbx_port_params.ets.num_of_cos = cos_data.num_of_cos ;
1806 static void bnx2x_dcbx_get_ets_pri_pg_tbl(struct bnx2x *bp,
1807 u32 *set_configuration_ets_pg,
1812 for (i = 0; i < DCBX_MAX_NUM_PRI_PG_ENTRIES; i++) {
1813 set_configuration_ets_pg[i] = DCBX_PRI_PG_GET(pri_pg_tbl, i);
1815 DP(BNX2X_MSG_DCB, "set_configuration_ets_pg[%d] = 0x%x\n",
1816 i, set_configuration_ets_pg[i]);
1820 static void bnx2x_dcbx_fw_struct(struct bnx2x *bp,
1821 struct bnx2x_func_tx_start_params *pfc_fw_cfg)
1824 u8 cos = 0, pri = 0;
1825 struct priority_cos *tt2cos;
1826 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
1827 int mfw_configured = SHMEM2_HAS(bp, drv_flags) &&
1828 GET_FLAGS(SHMEM2_RD(bp, drv_flags),
1829 1 << DRV_FLAGS_DCB_MFW_CONFIGURED);
1831 memset(pfc_fw_cfg, 0, sizeof(*pfc_fw_cfg));
1833 /* to disable DCB - the structure must be zeroed */
1834 if ((bp->dcbx_error & DCBX_REMOTE_MIB_ERROR) && !mfw_configured)
1838 tt2cos = pfc_fw_cfg->traffic_type_to_priority_cos;
1840 /* Fw version should be incremented each update */
1841 pfc_fw_cfg->dcb_version = ++bp->dcb_version;
1842 pfc_fw_cfg->dcb_enabled = 1;
1844 /* Fill priority parameters */
1845 for (pri = 0; pri < LLFC_DRIVER_TRAFFIC_TYPE_MAX; pri++) {
1846 tt2cos[pri].priority = ttp[pri];
1847 pri_bit = 1 << tt2cos[pri].priority;
1849 /* Fill COS parameters based on COS calculated to
1850 * make it more general for future use */
1851 for (cos = 0; cos < bp->dcbx_port_params.ets.num_of_cos; cos++)
1852 if (bp->dcbx_port_params.ets.cos_params[cos].
1853 pri_bitmask & pri_bit)
1854 tt2cos[pri].cos = cos;
1856 pfc_fw_cfg->dcb_outer_pri[pri] = ttp[pri];
1859 /* we never want the FW to add a 0 vlan tag */
1860 pfc_fw_cfg->dont_add_pri_0_en = 1;
1862 bnx2x_dcbx_print_cos_params(bp, pfc_fw_cfg);
1865 void bnx2x_dcbx_pmf_update(struct bnx2x *bp)
1867 /* if we need to synchronize DCBX result from prev PMF
1868 * read it from shmem and update bp and netdev accordingly
1870 if (SHMEM2_HAS(bp, drv_flags) &&
1871 GET_FLAGS(SHMEM2_RD(bp, drv_flags), 1 << DRV_FLAGS_DCB_CONFIGURED)) {
1872 /* Read neg results if dcbx is in the FW */
1873 if (bnx2x_dcbx_read_shmem_neg_results(bp))
1876 bnx2x_dump_dcbx_drv_param(bp, &bp->dcbx_local_feat,
1878 bnx2x_get_dcbx_drv_param(bp, &bp->dcbx_local_feat,
1882 * Add new app tlvs to dcbnl
1884 bnx2x_dcbnl_update_applist(bp, false);
1886 * Send a notification for the new negotiated parameters
1888 dcbnl_cee_notify(bp->dev, RTM_GETDCB, DCB_CMD_CEE_GET, 0, 0);
1891 * reconfigure the netdevice with the results of the new
1894 bnx2x_dcbx_update_tc_mapping(bp);
1901 #define BNX2X_DCBX_CAPS (DCB_CAP_DCBX_LLD_MANAGED | \
1902 DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_STATIC)
1904 static inline bool bnx2x_dcbnl_set_valid(struct bnx2x *bp)
1906 /* validate dcbnl call that may change HW state:
1907 * DCB is on and DCBX mode was SUCCESSFULLY set by the user.
1909 return bp->dcb_state && bp->dcbx_mode_uset;
1912 static u8 bnx2x_dcbnl_get_state(struct net_device *netdev)
1914 struct bnx2x *bp = netdev_priv(netdev);
1915 DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcb_state);
1916 return bp->dcb_state;
1919 static u8 bnx2x_dcbnl_set_state(struct net_device *netdev, u8 state)
1921 struct bnx2x *bp = netdev_priv(netdev);
1922 DP(BNX2X_MSG_DCB, "state = %s\n", state ? "on" : "off");
1924 /* Fail to set state to "enabled" if dcbx is disabled in nvram */
1925 if (state && ((bp->dcbx_enabled == BNX2X_DCBX_ENABLED_OFF) ||
1926 (bp->dcbx_enabled == BNX2X_DCBX_ENABLED_INVALID))) {
1927 DP(BNX2X_MSG_DCB, "Can not set dcbx to enabled while it is disabled in nvm\n");
1931 bnx2x_dcbx_set_state(bp, (state ? true : false), bp->dcbx_enabled);
1935 static void bnx2x_dcbnl_get_perm_hw_addr(struct net_device *netdev,
1938 struct bnx2x *bp = netdev_priv(netdev);
1939 DP(BNX2X_MSG_DCB, "GET-PERM-ADDR\n");
1941 /* first the HW mac address */
1942 memcpy(perm_addr, netdev->dev_addr, netdev->addr_len);
1944 if (CNIC_LOADED(bp))
1945 /* second SAN address */
1946 memcpy(perm_addr+netdev->addr_len, bp->fip_mac,
1950 static void bnx2x_dcbnl_set_pg_tccfg_tx(struct net_device *netdev, int prio,
1951 u8 prio_type, u8 pgid, u8 bw_pct,
1954 struct bnx2x *bp = netdev_priv(netdev);
1956 DP(BNX2X_MSG_DCB, "prio[%d] = %d\n", prio, pgid);
1957 if (!bnx2x_dcbnl_set_valid(bp) || prio >= DCBX_MAX_NUM_PRI_PG_ENTRIES)
1961 * bw_pct ignored - band-width percentage devision between user
1962 * priorities within the same group is not
1963 * standard and hence not supported
1965 * prio_type ignored - priority levels within the same group are not
1966 * standard and hence are not supported. According
1967 * to the standard pgid 15 is dedicated to strict
1968 * priority traffic (on the port level).
1973 bp->dcbx_config_params.admin_configuration_ets_pg[prio] = pgid;
1974 bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1;
1977 static void bnx2x_dcbnl_set_pg_bwgcfg_tx(struct net_device *netdev,
1978 int pgid, u8 bw_pct)
1980 struct bnx2x *bp = netdev_priv(netdev);
1981 DP(BNX2X_MSG_DCB, "pgid[%d] = %d\n", pgid, bw_pct);
1983 if (!bnx2x_dcbnl_set_valid(bp) || pgid >= DCBX_MAX_NUM_PG_BW_ENTRIES)
1986 bp->dcbx_config_params.admin_configuration_bw_precentage[pgid] = bw_pct;
1987 bp->dcbx_config_params.admin_ets_configuration_tx_enable = 1;
1990 static void bnx2x_dcbnl_set_pg_tccfg_rx(struct net_device *netdev, int prio,
1991 u8 prio_type, u8 pgid, u8 bw_pct,
1994 struct bnx2x *bp = netdev_priv(netdev);
1995 DP(BNX2X_MSG_DCB, "Nothing to set; No RX support\n");
1998 static void bnx2x_dcbnl_set_pg_bwgcfg_rx(struct net_device *netdev,
1999 int pgid, u8 bw_pct)
2001 struct bnx2x *bp = netdev_priv(netdev);
2002 DP(BNX2X_MSG_DCB, "Nothing to set; No RX support\n");
2005 static void bnx2x_dcbnl_get_pg_tccfg_tx(struct net_device *netdev, int prio,
2006 u8 *prio_type, u8 *pgid, u8 *bw_pct,
2009 struct bnx2x *bp = netdev_priv(netdev);
2010 DP(BNX2X_MSG_DCB, "prio = %d\n", prio);
2013 * bw_pct ignored - band-width percentage devision between user
2014 * priorities within the same group is not
2015 * standard and hence not supported
2017 * prio_type ignored - priority levels within the same group are not
2018 * standard and hence are not supported. According
2019 * to the standard pgid 15 is dedicated to strict
2020 * priority traffic (on the port level).
2024 *up_map = *bw_pct = *prio_type = *pgid = 0;
2026 if (!bp->dcb_state || prio >= DCBX_MAX_NUM_PRI_PG_ENTRIES)
2029 *pgid = DCBX_PRI_PG_GET(bp->dcbx_local_feat.ets.pri_pg_tbl, prio);
2032 static void bnx2x_dcbnl_get_pg_bwgcfg_tx(struct net_device *netdev,
2033 int pgid, u8 *bw_pct)
2035 struct bnx2x *bp = netdev_priv(netdev);
2036 DP(BNX2X_MSG_DCB, "pgid = %d\n", pgid);
2040 if (!bp->dcb_state || pgid >= DCBX_MAX_NUM_PG_BW_ENTRIES)
2043 *bw_pct = DCBX_PG_BW_GET(bp->dcbx_local_feat.ets.pg_bw_tbl, pgid);
2046 static void bnx2x_dcbnl_get_pg_tccfg_rx(struct net_device *netdev, int prio,
2047 u8 *prio_type, u8 *pgid, u8 *bw_pct,
2050 struct bnx2x *bp = netdev_priv(netdev);
2051 DP(BNX2X_MSG_DCB, "Nothing to get; No RX support\n");
2053 *prio_type = *pgid = *bw_pct = *up_map = 0;
2056 static void bnx2x_dcbnl_get_pg_bwgcfg_rx(struct net_device *netdev,
2057 int pgid, u8 *bw_pct)
2059 struct bnx2x *bp = netdev_priv(netdev);
2060 DP(BNX2X_MSG_DCB, "Nothing to get; No RX support\n");
2065 static void bnx2x_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio,
2068 struct bnx2x *bp = netdev_priv(netdev);
2069 DP(BNX2X_MSG_DCB, "prio[%d] = %d\n", prio, setting);
2071 if (!bnx2x_dcbnl_set_valid(bp) || prio >= MAX_PFC_PRIORITIES)
2075 bp->dcbx_config_params.admin_pfc_bitmap |= (1 << prio);
2076 bp->dcbx_config_params.admin_pfc_tx_enable = 1;
2078 bp->dcbx_config_params.admin_pfc_bitmap &= ~(1 << prio);
2082 static void bnx2x_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio,
2085 struct bnx2x *bp = netdev_priv(netdev);
2086 DP(BNX2X_MSG_DCB, "prio = %d\n", prio);
2090 if (!bp->dcb_state || prio >= MAX_PFC_PRIORITIES)
2093 *setting = (bp->dcbx_local_feat.pfc.pri_en_bitmap >> prio) & 0x1;
2096 static u8 bnx2x_dcbnl_set_all(struct net_device *netdev)
2098 struct bnx2x *bp = netdev_priv(netdev);
2100 DP(BNX2X_MSG_DCB, "SET-ALL\n");
2102 if (!bnx2x_dcbnl_set_valid(bp))
2105 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
2107 "Handling parity error recovery. Try again later\n");
2110 if (netif_running(bp->dev)) {
2111 bnx2x_update_drv_flags(bp,
2112 1 << DRV_FLAGS_DCB_MFW_CONFIGURED,
2114 bnx2x_dcbx_init(bp, true);
2116 DP(BNX2X_MSG_DCB, "set_dcbx_params done\n");
2121 static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap)
2123 struct bnx2x *bp = netdev_priv(netdev);
2126 if (bp->dcb_state) {
2128 case DCB_CAP_ATTR_PG:
2131 case DCB_CAP_ATTR_PFC:
2134 case DCB_CAP_ATTR_UP2TC:
2137 case DCB_CAP_ATTR_PG_TCS:
2138 *cap = 0x80; /* 8 priorities for PGs */
2140 case DCB_CAP_ATTR_PFC_TCS:
2141 *cap = 0x80; /* 8 priorities for PFC */
2143 case DCB_CAP_ATTR_GSP:
2146 case DCB_CAP_ATTR_BCN:
2149 case DCB_CAP_ATTR_DCBX:
2150 *cap = BNX2X_DCBX_CAPS;
2153 BNX2X_ERR("Non valid capability ID\n");
2158 DP(BNX2X_MSG_DCB, "DCB disabled\n");
2162 DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap);
2166 static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
2168 struct bnx2x *bp = netdev_priv(netdev);
2171 DP(BNX2X_MSG_DCB, "tcid %d\n", tcid);
2173 if (bp->dcb_state) {
2175 case DCB_NUMTCS_ATTR_PG:
2176 *num = CHIP_IS_E3B0(bp) ? DCBX_COS_MAX_NUM_E3B0 :
2177 DCBX_COS_MAX_NUM_E2;
2179 case DCB_NUMTCS_ATTR_PFC:
2180 *num = CHIP_IS_E3B0(bp) ? DCBX_COS_MAX_NUM_E3B0 :
2181 DCBX_COS_MAX_NUM_E2;
2184 BNX2X_ERR("Non valid TC-ID\n");
2189 DP(BNX2X_MSG_DCB, "DCB disabled\n");
2196 static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num)
2198 struct bnx2x *bp = netdev_priv(netdev);
2199 DP(BNX2X_MSG_DCB, "num tcs = %d; Not supported\n", num);
2203 static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev)
2205 struct bnx2x *bp = netdev_priv(netdev);
2206 DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled);
2211 return bp->dcbx_local_feat.pfc.enabled;
2214 static void bnx2x_dcbnl_set_pfc_state(struct net_device *netdev, u8 state)
2216 struct bnx2x *bp = netdev_priv(netdev);
2217 DP(BNX2X_MSG_DCB, "state = %s\n", state ? "on" : "off");
2219 if (!bnx2x_dcbnl_set_valid(bp))
2222 bp->dcbx_config_params.admin_pfc_tx_enable =
2223 bp->dcbx_config_params.admin_pfc_enable = (state ? 1 : 0);
2226 static void bnx2x_admin_app_set_ent(
2227 struct bnx2x_admin_priority_app_table *app_ent,
2228 u8 idtype, u16 idval, u8 up)
2233 case DCB_APP_IDTYPE_ETHTYPE:
2234 app_ent->traffic_type = TRAFFIC_TYPE_ETH;
2236 case DCB_APP_IDTYPE_PORTNUM:
2237 app_ent->traffic_type = TRAFFIC_TYPE_PORT;
2240 break; /* never gets here */
2242 app_ent->app_id = idval;
2243 app_ent->priority = up;
2246 static bool bnx2x_admin_app_is_equal(
2247 struct bnx2x_admin_priority_app_table *app_ent,
2248 u8 idtype, u16 idval)
2250 if (!app_ent->valid)
2254 case DCB_APP_IDTYPE_ETHTYPE:
2255 if (app_ent->traffic_type != TRAFFIC_TYPE_ETH)
2258 case DCB_APP_IDTYPE_PORTNUM:
2259 if (app_ent->traffic_type != TRAFFIC_TYPE_PORT)
2265 if (app_ent->app_id != idval)
2271 static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
2275 /* iterate over the app entries looking for idtype and idval */
2276 for (i = 0, ff = -1; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
2277 struct bnx2x_admin_priority_app_table *app_ent =
2278 &bp->dcbx_config_params.admin_priority_app_table[i];
2279 if (bnx2x_admin_app_is_equal(app_ent, idtype, idval))
2282 if (ff < 0 && !app_ent->valid)
2285 if (i < DCBX_CONFIG_MAX_APP_PROTOCOL)
2286 /* if found overwrite up */
2287 bp->dcbx_config_params.
2288 admin_priority_app_table[i].priority = up;
2290 /* not found use first-free */
2291 bnx2x_admin_app_set_ent(
2292 &bp->dcbx_config_params.admin_priority_app_table[ff],
2295 /* app table is full */
2296 BNX2X_ERR("Application table is too large\n");
2300 /* up configured, if not 0 make sure feature is enabled */
2302 bp->dcbx_config_params.admin_application_priority_tx_enable = 1;
2307 static int bnx2x_dcbnl_set_app_up(struct net_device *netdev, u8 idtype,
2310 struct bnx2x *bp = netdev_priv(netdev);
2312 DP(BNX2X_MSG_DCB, "app_type %d, app_id %x, prio bitmap %d\n",
2315 if (!bnx2x_dcbnl_set_valid(bp)) {
2316 DP(BNX2X_MSG_DCB, "dcbnl call not valid\n");
2322 case DCB_APP_IDTYPE_ETHTYPE:
2323 case DCB_APP_IDTYPE_PORTNUM:
2326 DP(BNX2X_MSG_DCB, "Wrong ID type\n");
2329 return bnx2x_set_admin_app_up(bp, idtype, idval, up);
2332 static u8 bnx2x_dcbnl_get_dcbx(struct net_device *netdev)
2334 struct bnx2x *bp = netdev_priv(netdev);
2337 state = DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_CEE;
2339 if (bp->dcbx_enabled == BNX2X_DCBX_ENABLED_ON_NEG_OFF)
2340 state |= DCB_CAP_DCBX_STATIC;
2345 static u8 bnx2x_dcbnl_set_dcbx(struct net_device *netdev, u8 state)
2347 struct bnx2x *bp = netdev_priv(netdev);
2348 DP(BNX2X_MSG_DCB, "state = %02x\n", state);
2352 if ((state & BNX2X_DCBX_CAPS) != state) {
2353 BNX2X_ERR("Requested DCBX mode %x is beyond advertised capabilities\n",
2358 if (bp->dcb_state != BNX2X_DCB_STATE_ON) {
2359 BNX2X_ERR("DCB turned off, DCBX configuration is invalid\n");
2363 if (state & DCB_CAP_DCBX_STATIC)
2364 bp->dcbx_enabled = BNX2X_DCBX_ENABLED_ON_NEG_OFF;
2366 bp->dcbx_enabled = BNX2X_DCBX_ENABLED_ON_NEG_ON;
2368 bp->dcbx_mode_uset = true;
2372 static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid,
2375 struct bnx2x *bp = netdev_priv(netdev);
2378 DP(BNX2X_MSG_DCB, "featid %d\n", featid);
2380 if (bp->dcb_state) {
2383 case DCB_FEATCFG_ATTR_PG:
2384 if (bp->dcbx_local_feat.ets.enabled)
2385 *flags |= DCB_FEATCFG_ENABLE;
2386 if (bp->dcbx_error & (DCBX_LOCAL_ETS_ERROR |
2387 DCBX_REMOTE_MIB_ERROR))
2388 *flags |= DCB_FEATCFG_ERROR;
2390 case DCB_FEATCFG_ATTR_PFC:
2391 if (bp->dcbx_local_feat.pfc.enabled)
2392 *flags |= DCB_FEATCFG_ENABLE;
2393 if (bp->dcbx_error & (DCBX_LOCAL_PFC_ERROR |
2394 DCBX_LOCAL_PFC_MISMATCH |
2395 DCBX_REMOTE_MIB_ERROR))
2396 *flags |= DCB_FEATCFG_ERROR;
2398 case DCB_FEATCFG_ATTR_APP:
2399 if (bp->dcbx_local_feat.app.enabled)
2400 *flags |= DCB_FEATCFG_ENABLE;
2401 if (bp->dcbx_error & (DCBX_LOCAL_APP_ERROR |
2402 DCBX_LOCAL_APP_MISMATCH |
2403 DCBX_REMOTE_MIB_ERROR))
2404 *flags |= DCB_FEATCFG_ERROR;
2407 BNX2X_ERR("Non valid feature-ID\n");
2412 DP(BNX2X_MSG_DCB, "DCB disabled\n");
2419 static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid,
2422 struct bnx2x *bp = netdev_priv(netdev);
2425 DP(BNX2X_MSG_DCB, "featid = %d flags = %02x\n", featid, flags);
2427 /* ignore the 'advertise' flag */
2428 if (bnx2x_dcbnl_set_valid(bp)) {
2430 case DCB_FEATCFG_ATTR_PG:
2431 bp->dcbx_config_params.admin_ets_enable =
2432 flags & DCB_FEATCFG_ENABLE ? 1 : 0;
2433 bp->dcbx_config_params.admin_ets_willing =
2434 flags & DCB_FEATCFG_WILLING ? 1 : 0;
2436 case DCB_FEATCFG_ATTR_PFC:
2437 bp->dcbx_config_params.admin_pfc_enable =
2438 flags & DCB_FEATCFG_ENABLE ? 1 : 0;
2439 bp->dcbx_config_params.admin_pfc_willing =
2440 flags & DCB_FEATCFG_WILLING ? 1 : 0;
2442 case DCB_FEATCFG_ATTR_APP:
2443 /* ignore enable, always enabled */
2444 bp->dcbx_config_params.admin_app_priority_willing =
2445 flags & DCB_FEATCFG_WILLING ? 1 : 0;
2448 BNX2X_ERR("Non valid feature-ID\n");
2453 DP(BNX2X_MSG_DCB, "dcbnl call not valid\n");
2460 static int bnx2x_peer_appinfo(struct net_device *netdev,
2461 struct dcb_peer_app_info *info, u16* app_count)
2464 struct bnx2x *bp = netdev_priv(netdev);
2466 DP(BNX2X_MSG_DCB, "APP-INFO\n");
2468 info->willing = (bp->dcbx_remote_flags & DCBX_APP_REM_WILLING) ?: 0;
2469 info->error = (bp->dcbx_remote_flags & DCBX_APP_RX_ERROR) ?: 0;
2472 for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++)
2473 if (bp->dcbx_remote_feat.app.app_pri_tbl[i].appBitfield &
2474 DCBX_APP_ENTRY_VALID)
2479 static int bnx2x_peer_apptable(struct net_device *netdev,
2480 struct dcb_app *table)
2483 struct bnx2x *bp = netdev_priv(netdev);
2485 DP(BNX2X_MSG_DCB, "APP-TABLE\n");
2487 for (i = 0, j = 0; i < DCBX_MAX_APP_PROTOCOL; i++) {
2488 struct dcbx_app_priority_entry *ent =
2489 &bp->dcbx_remote_feat.app.app_pri_tbl[i];
2491 if (ent->appBitfield & DCBX_APP_ENTRY_VALID) {
2492 table[j].selector = bnx2x_dcbx_dcbnl_app_idtype(ent);
2493 table[j].priority = bnx2x_dcbx_dcbnl_app_up(ent);
2494 table[j++].protocol = ent->app_id;
2500 static int bnx2x_cee_peer_getpg(struct net_device *netdev, struct cee_pg *pg)
2503 struct bnx2x *bp = netdev_priv(netdev);
2505 pg->willing = (bp->dcbx_remote_flags & DCBX_ETS_REM_WILLING) ?: 0;
2507 for (i = 0; i < CEE_DCBX_MAX_PGS; i++) {
2509 DCBX_PG_BW_GET(bp->dcbx_remote_feat.ets.pg_bw_tbl, i);
2511 DCBX_PRI_PG_GET(bp->dcbx_remote_feat.ets.pri_pg_tbl, i);
2516 static int bnx2x_cee_peer_getpfc(struct net_device *netdev,
2517 struct cee_pfc *pfc)
2519 struct bnx2x *bp = netdev_priv(netdev);
2520 pfc->tcs_supported = bp->dcbx_remote_feat.pfc.pfc_caps;
2521 pfc->pfc_en = bp->dcbx_remote_feat.pfc.pri_en_bitmap;
2525 const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = {
2526 .getstate = bnx2x_dcbnl_get_state,
2527 .setstate = bnx2x_dcbnl_set_state,
2528 .getpermhwaddr = bnx2x_dcbnl_get_perm_hw_addr,
2529 .setpgtccfgtx = bnx2x_dcbnl_set_pg_tccfg_tx,
2530 .setpgbwgcfgtx = bnx2x_dcbnl_set_pg_bwgcfg_tx,
2531 .setpgtccfgrx = bnx2x_dcbnl_set_pg_tccfg_rx,
2532 .setpgbwgcfgrx = bnx2x_dcbnl_set_pg_bwgcfg_rx,
2533 .getpgtccfgtx = bnx2x_dcbnl_get_pg_tccfg_tx,
2534 .getpgbwgcfgtx = bnx2x_dcbnl_get_pg_bwgcfg_tx,
2535 .getpgtccfgrx = bnx2x_dcbnl_get_pg_tccfg_rx,
2536 .getpgbwgcfgrx = bnx2x_dcbnl_get_pg_bwgcfg_rx,
2537 .setpfccfg = bnx2x_dcbnl_set_pfc_cfg,
2538 .getpfccfg = bnx2x_dcbnl_get_pfc_cfg,
2539 .setall = bnx2x_dcbnl_set_all,
2540 .getcap = bnx2x_dcbnl_get_cap,
2541 .getnumtcs = bnx2x_dcbnl_get_numtcs,
2542 .setnumtcs = bnx2x_dcbnl_set_numtcs,
2543 .getpfcstate = bnx2x_dcbnl_get_pfc_state,
2544 .setpfcstate = bnx2x_dcbnl_set_pfc_state,
2545 .setapp = bnx2x_dcbnl_set_app_up,
2546 .getdcbx = bnx2x_dcbnl_get_dcbx,
2547 .setdcbx = bnx2x_dcbnl_set_dcbx,
2548 .getfeatcfg = bnx2x_dcbnl_get_featcfg,
2549 .setfeatcfg = bnx2x_dcbnl_set_featcfg,
2550 .peer_getappinfo = bnx2x_peer_appinfo,
2551 .peer_getapptable = bnx2x_peer_apptable,
2552 .cee_peer_getpg = bnx2x_cee_peer_getpg,
2553 .cee_peer_getpfc = bnx2x_cee_peer_getpfc,
2556 #endif /* BCM_DCBNL */