547
u8 bnx2x_dcbx_dcbnl_app_up(struct dcbx_app_priority_entry *ent)
551
/* Choose the highest priority */
552
for (pri = MAX_PFC_PRIORITIES - 1; pri > 0; pri--)
553
if (ent->pri_bitmap & (1 << pri))
559
u8 bnx2x_dcbx_dcbnl_app_idtype(struct dcbx_app_priority_entry *ent)
561
return ((ent->appBitfield & DCBX_APP_ENTRY_SF_MASK) ==
562
DCBX_APP_SF_PORT) ? DCB_APP_IDTYPE_PORTNUM :
563
DCB_APP_IDTYPE_ETHTYPE;
567
void bnx2x_dcbx_invalidate_local_apps(struct bnx2x *bp)
570
for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++)
571
bp->dcbx_local_feat.app.app_pri_tbl[i].appBitfield &=
572
~DCBX_APP_ENTRY_VALID;
575
int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall)
579
for (i = 0; i < DCBX_MAX_APP_PROTOCOL && err == 0; i++) {
580
struct dcbx_app_priority_entry *ent =
581
&bp->dcbx_local_feat.app.app_pri_tbl[i];
583
if (ent->appBitfield & DCBX_APP_ENTRY_VALID) {
584
u8 up = bnx2x_dcbx_dcbnl_app_up(ent);
586
/* avoid invalid user-priority */
589
app.selector = bnx2x_dcbx_dcbnl_app_idtype(ent);
590
app.protocol = ent->app_id;
591
app.priority = delall ? 0 : up;
592
err = dcb_setapp(bp->dev, &app);
511
600
void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
514
603
case BNX2X_DCBX_STATE_NEG_RECEIVED:
605
if (bp->state != BNX2X_STATE_OPENING_WAIT4_LOAD) {
606
struct cnic_ops *c_ops;
607
struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
608
bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;
609
cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;
610
cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI;
613
c_ops = rcu_dereference(bp->cnic_ops);
615
bnx2x_cnic_notify(bp, CNIC_CTL_STOP_ISCSI_CMD);
622
/* fall through if no CNIC initialized */
623
case BNX2X_DCBX_STATE_ISCSI_STOPPED:
516
627
DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_NEG_RECEIVED\n");
630
* Delete app tlvs from dcbnl before reading new
631
* negotiation results
633
bnx2x_dcbnl_update_applist(bp, true);
635
/* Read rmeote mib if dcbx is in the FW */
636
if (bnx2x_dcbx_read_shmem_remote_mib(bp))
518
639
/* Read neg results if dcbx is in the FW */
519
640
if (bnx2x_dcbx_read_shmem_neg_results(bp))
2147
static int bnx2x_peer_appinfo(struct net_device *netdev,
2148
struct dcb_peer_app_info *info, u16* app_count)
2151
struct bnx2x *bp = netdev_priv(netdev);
2153
DP(NETIF_MSG_LINK, "APP-INFO\n");
2155
info->willing = (bp->dcbx_remote_flags & DCBX_APP_REM_WILLING) ?: 0;
2156
info->error = (bp->dcbx_remote_flags & DCBX_APP_RX_ERROR) ?: 0;
2159
for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++)
2160
if (bp->dcbx_remote_feat.app.app_pri_tbl[i].appBitfield &
2161
DCBX_APP_ENTRY_VALID)
2166
static int bnx2x_peer_apptable(struct net_device *netdev,
2167
struct dcb_app *table)
2170
struct bnx2x *bp = netdev_priv(netdev);
2172
DP(NETIF_MSG_LINK, "APP-TABLE\n");
2174
for (i = 0, j = 0; i < DCBX_MAX_APP_PROTOCOL; i++) {
2175
struct dcbx_app_priority_entry *ent =
2176
&bp->dcbx_remote_feat.app.app_pri_tbl[i];
2178
if (ent->appBitfield & DCBX_APP_ENTRY_VALID) {
2179
table[j].selector = bnx2x_dcbx_dcbnl_app_idtype(ent);
2180
table[j].priority = bnx2x_dcbx_dcbnl_app_up(ent);
2181
table[j++].protocol = ent->app_id;
2187
static int bnx2x_cee_peer_getpg(struct net_device *netdev, struct cee_pg *pg)
2190
struct bnx2x *bp = netdev_priv(netdev);
2192
pg->willing = (bp->dcbx_remote_flags & DCBX_ETS_REM_WILLING) ?: 0;
2194
for (i = 0; i < CEE_DCBX_MAX_PGS; i++) {
2196
DCBX_PG_BW_GET(bp->dcbx_remote_feat.ets.pg_bw_tbl, i);
2198
DCBX_PRI_PG_GET(bp->dcbx_remote_feat.ets.pri_pg_tbl, i);
2203
static int bnx2x_cee_peer_getpfc(struct net_device *netdev,
2204
struct cee_pfc *pfc)
2206
struct bnx2x *bp = netdev_priv(netdev);
2207
pfc->tcs_supported = bp->dcbx_remote_feat.pfc.pfc_caps;
2208
pfc->pfc_en = bp->dcbx_remote_feat.pfc.pri_en_bitmap;
2090
2212
const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = {
2091
.getstate = bnx2x_dcbnl_get_state,
2092
.setstate = bnx2x_dcbnl_set_state,
2093
.getpermhwaddr = bnx2x_dcbnl_get_perm_hw_addr,
2094
.setpgtccfgtx = bnx2x_dcbnl_set_pg_tccfg_tx,
2095
.setpgbwgcfgtx = bnx2x_dcbnl_set_pg_bwgcfg_tx,
2096
.setpgtccfgrx = bnx2x_dcbnl_set_pg_tccfg_rx,
2097
.setpgbwgcfgrx = bnx2x_dcbnl_set_pg_bwgcfg_rx,
2098
.getpgtccfgtx = bnx2x_dcbnl_get_pg_tccfg_tx,
2099
.getpgbwgcfgtx = bnx2x_dcbnl_get_pg_bwgcfg_tx,
2100
.getpgtccfgrx = bnx2x_dcbnl_get_pg_tccfg_rx,
2101
.getpgbwgcfgrx = bnx2x_dcbnl_get_pg_bwgcfg_rx,
2102
.setpfccfg = bnx2x_dcbnl_set_pfc_cfg,
2103
.getpfccfg = bnx2x_dcbnl_get_pfc_cfg,
2104
.setall = bnx2x_dcbnl_set_all,
2105
.getcap = bnx2x_dcbnl_get_cap,
2106
.getnumtcs = bnx2x_dcbnl_get_numtcs,
2107
.setnumtcs = bnx2x_dcbnl_set_numtcs,
2108
.getpfcstate = bnx2x_dcbnl_get_pfc_state,
2109
.setpfcstate = bnx2x_dcbnl_set_pfc_state,
2110
.getapp = bnx2x_dcbnl_get_app_up,
2111
.setapp = bnx2x_dcbnl_set_app_up,
2112
.getdcbx = bnx2x_dcbnl_get_dcbx,
2113
.setdcbx = bnx2x_dcbnl_set_dcbx,
2114
.getfeatcfg = bnx2x_dcbnl_get_featcfg,
2115
.setfeatcfg = bnx2x_dcbnl_set_featcfg,
2213
.getstate = bnx2x_dcbnl_get_state,
2214
.setstate = bnx2x_dcbnl_set_state,
2215
.getpermhwaddr = bnx2x_dcbnl_get_perm_hw_addr,
2216
.setpgtccfgtx = bnx2x_dcbnl_set_pg_tccfg_tx,
2217
.setpgbwgcfgtx = bnx2x_dcbnl_set_pg_bwgcfg_tx,
2218
.setpgtccfgrx = bnx2x_dcbnl_set_pg_tccfg_rx,
2219
.setpgbwgcfgrx = bnx2x_dcbnl_set_pg_bwgcfg_rx,
2220
.getpgtccfgtx = bnx2x_dcbnl_get_pg_tccfg_tx,
2221
.getpgbwgcfgtx = bnx2x_dcbnl_get_pg_bwgcfg_tx,
2222
.getpgtccfgrx = bnx2x_dcbnl_get_pg_tccfg_rx,
2223
.getpgbwgcfgrx = bnx2x_dcbnl_get_pg_bwgcfg_rx,
2224
.setpfccfg = bnx2x_dcbnl_set_pfc_cfg,
2225
.getpfccfg = bnx2x_dcbnl_get_pfc_cfg,
2226
.setall = bnx2x_dcbnl_set_all,
2227
.getcap = bnx2x_dcbnl_get_cap,
2228
.getnumtcs = bnx2x_dcbnl_get_numtcs,
2229
.setnumtcs = bnx2x_dcbnl_set_numtcs,
2230
.getpfcstate = bnx2x_dcbnl_get_pfc_state,
2231
.setpfcstate = bnx2x_dcbnl_set_pfc_state,
2232
.setapp = bnx2x_dcbnl_set_app_up,
2233
.getdcbx = bnx2x_dcbnl_get_dcbx,
2234
.setdcbx = bnx2x_dcbnl_set_dcbx,
2235
.getfeatcfg = bnx2x_dcbnl_get_featcfg,
2236
.setfeatcfg = bnx2x_dcbnl_set_featcfg,
2237
.peer_getappinfo = bnx2x_peer_appinfo,
2238
.peer_getapptable = bnx2x_peer_apptable,
2239
.cee_peer_getpg = bnx2x_cee_peer_getpg,
2240
.cee_peer_getpfc = bnx2x_cee_peer_getpfc,
2118
#endif /* BCM_DCB */
2243
#endif /* BCM_DCBNL */