aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bnx2x/bnx2x.h4
-rw-r--r--drivers/net/bnx2x/bnx2x_dcb.c152
2 files changed, 131 insertions, 25 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 16a76f074df5..668a578c49e9 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1242,6 +1242,10 @@ struct bnx2x {
1242 /* DCBX Negotiation results */ 1242 /* DCBX Negotiation results */
1243 struct dcbx_features dcbx_local_feat; 1243 struct dcbx_features dcbx_local_feat;
1244 u32 dcbx_error; 1244 u32 dcbx_error;
1245#ifdef BCM_DCBNL
1246 struct dcbx_features dcbx_remote_feat;
1247 u32 dcbx_remote_flags;
1248#endif
1245 u32 pending_max; 1249 u32 pending_max;
1246}; 1250};
1247 1251
diff --git a/drivers/net/bnx2x/bnx2x_dcb.c b/drivers/net/bnx2x/bnx2x_dcb.c
index 0f8309233ff2..410a49e571ac 100644
--- a/drivers/net/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/bnx2x/bnx2x_dcb.c
@@ -485,6 +485,36 @@ static void bnx2x_dcbx_update_ets_params(struct bnx2x *bp)
485 } 485 }
486} 486}
487 487
488#ifdef BCM_DCBNL
489static int bnx2x_dcbx_read_shmem_remote_mib(struct bnx2x *bp)
490{
491 struct lldp_remote_mib remote_mib = {0};
492 u32 dcbx_remote_mib_offset = SHMEM2_RD(bp, dcbx_remote_mib_offset);
493 int rc;
494
495 DP(NETIF_MSG_LINK, "dcbx_remote_mib_offset 0x%x\n",
496 dcbx_remote_mib_offset);
497
498 if (SHMEM_DCBX_REMOTE_MIB_NONE == dcbx_remote_mib_offset) {
499 BNX2X_ERR("FW doesn't support dcbx_remote_mib_offset\n");
500 return -EINVAL;
501 }
502
503 rc = bnx2x_dcbx_read_mib(bp, (u32 *)&remote_mib, dcbx_remote_mib_offset,
504 DCBX_READ_REMOTE_MIB);
505
506 if (rc) {
507 BNX2X_ERR("Faild to read remote mib from FW\n");
508 return rc;
509 }
510
511 /* save features and flags */
512 bp->dcbx_remote_feat = remote_mib.features;
513 bp->dcbx_remote_flags = remote_mib.flags;
514 return 0;
515}
516#endif
517
488static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp) 518static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp)
489{ 519{
490 struct lldp_local_mib local_mib = {0}; 520 struct lldp_local_mib local_mib = {0};
@@ -601,6 +631,10 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
601 * negotiation results 631 * negotiation results
602 */ 632 */
603 bnx2x_dcbnl_update_applist(bp, true); 633 bnx2x_dcbnl_update_applist(bp, true);
634
635 /* Read rmeote mib if dcbx is in the FW */
636 if (bnx2x_dcbx_read_shmem_remote_mib(bp))
637 return;
604#endif 638#endif
605 /* Read neg results if dcbx is in the FW */ 639 /* Read neg results if dcbx is in the FW */
606 if (bnx2x_dcbx_read_shmem_neg_results(bp)) 640 if (bnx2x_dcbx_read_shmem_neg_results(bp))
@@ -2031,7 +2065,6 @@ static u8 bnx2x_dcbnl_set_dcbx(struct net_device *netdev, u8 state)
2031 return 0; 2065 return 0;
2032} 2066}
2033 2067
2034
2035static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid, 2068static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid,
2036 u8 *flags) 2069 u8 *flags)
2037{ 2070{
@@ -2111,31 +2144,100 @@ static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid,
2111 return rval; 2144 return rval;
2112} 2145}
2113 2146
2147static int bnx2x_peer_appinfo(struct net_device *netdev,
2148 struct dcb_peer_app_info *info, u16* app_count)
2149{
2150 int i;
2151 struct bnx2x *bp = netdev_priv(netdev);
2152
2153 DP(NETIF_MSG_LINK, "APP-INFO\n");
2154
2155 info->willing = (bp->dcbx_remote_flags & DCBX_APP_REM_WILLING) ?: 0;
2156 info->error = (bp->dcbx_remote_flags & DCBX_APP_RX_ERROR) ?: 0;
2157 *app_count = 0;
2158
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)
2162 (*app_count)++;
2163 return 0;
2164}
2165
2166static int bnx2x_peer_apptable(struct net_device *netdev,
2167 struct dcb_app *table)
2168{
2169 int i, j;
2170 struct bnx2x *bp = netdev_priv(netdev);
2171
2172 DP(NETIF_MSG_LINK, "APP-TABLE\n");
2173
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];
2177
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;
2182 }
2183 }
2184 return 0;
2185}
2186
2187static int bnx2x_cee_peer_getpg(struct net_device *netdev, struct cee_pg *pg)
2188{
2189 int i;
2190 struct bnx2x *bp = netdev_priv(netdev);
2191
2192 pg->willing = (bp->dcbx_remote_flags & DCBX_ETS_REM_WILLING) ?: 0;
2193
2194 for (i = 0; i < CEE_DCBX_MAX_PGS; i++) {
2195 pg->pg_bw[i] =
2196 DCBX_PG_BW_GET(bp->dcbx_remote_feat.ets.pg_bw_tbl, i);
2197 pg->prio_pg[i] =
2198 DCBX_PRI_PG_GET(bp->dcbx_remote_feat.ets.pri_pg_tbl, i);
2199 }
2200 return 0;
2201}
2202
2203static int bnx2x_cee_peer_getpfc(struct net_device *netdev,
2204 struct cee_pfc *pfc)
2205{
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;
2209 return 0;
2210}
2211
2114const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = { 2212const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = {
2115 .getstate = bnx2x_dcbnl_get_state, 2213 .getstate = bnx2x_dcbnl_get_state,
2116 .setstate = bnx2x_dcbnl_set_state, 2214 .setstate = bnx2x_dcbnl_set_state,
2117 .getpermhwaddr = bnx2x_dcbnl_get_perm_hw_addr, 2215 .getpermhwaddr = bnx2x_dcbnl_get_perm_hw_addr,
2118 .setpgtccfgtx = bnx2x_dcbnl_set_pg_tccfg_tx, 2216 .setpgtccfgtx = bnx2x_dcbnl_set_pg_tccfg_tx,
2119 .setpgbwgcfgtx = bnx2x_dcbnl_set_pg_bwgcfg_tx, 2217 .setpgbwgcfgtx = bnx2x_dcbnl_set_pg_bwgcfg_tx,
2120 .setpgtccfgrx = bnx2x_dcbnl_set_pg_tccfg_rx, 2218 .setpgtccfgrx = bnx2x_dcbnl_set_pg_tccfg_rx,
2121 .setpgbwgcfgrx = bnx2x_dcbnl_set_pg_bwgcfg_rx, 2219 .setpgbwgcfgrx = bnx2x_dcbnl_set_pg_bwgcfg_rx,
2122 .getpgtccfgtx = bnx2x_dcbnl_get_pg_tccfg_tx, 2220 .getpgtccfgtx = bnx2x_dcbnl_get_pg_tccfg_tx,
2123 .getpgbwgcfgtx = bnx2x_dcbnl_get_pg_bwgcfg_tx, 2221 .getpgbwgcfgtx = bnx2x_dcbnl_get_pg_bwgcfg_tx,
2124 .getpgtccfgrx = bnx2x_dcbnl_get_pg_tccfg_rx, 2222 .getpgtccfgrx = bnx2x_dcbnl_get_pg_tccfg_rx,
2125 .getpgbwgcfgrx = bnx2x_dcbnl_get_pg_bwgcfg_rx, 2223 .getpgbwgcfgrx = bnx2x_dcbnl_get_pg_bwgcfg_rx,
2126 .setpfccfg = bnx2x_dcbnl_set_pfc_cfg, 2224 .setpfccfg = bnx2x_dcbnl_set_pfc_cfg,
2127 .getpfccfg = bnx2x_dcbnl_get_pfc_cfg, 2225 .getpfccfg = bnx2x_dcbnl_get_pfc_cfg,
2128 .setall = bnx2x_dcbnl_set_all, 2226 .setall = bnx2x_dcbnl_set_all,
2129 .getcap = bnx2x_dcbnl_get_cap, 2227 .getcap = bnx2x_dcbnl_get_cap,
2130 .getnumtcs = bnx2x_dcbnl_get_numtcs, 2228 .getnumtcs = bnx2x_dcbnl_get_numtcs,
2131 .setnumtcs = bnx2x_dcbnl_set_numtcs, 2229 .setnumtcs = bnx2x_dcbnl_set_numtcs,
2132 .getpfcstate = bnx2x_dcbnl_get_pfc_state, 2230 .getpfcstate = bnx2x_dcbnl_get_pfc_state,
2133 .setpfcstate = bnx2x_dcbnl_set_pfc_state, 2231 .setpfcstate = bnx2x_dcbnl_set_pfc_state,
2134 .setapp = bnx2x_dcbnl_set_app_up, 2232 .setapp = bnx2x_dcbnl_set_app_up,
2135 .getdcbx = bnx2x_dcbnl_get_dcbx, 2233 .getdcbx = bnx2x_dcbnl_get_dcbx,
2136 .setdcbx = bnx2x_dcbnl_set_dcbx, 2234 .setdcbx = bnx2x_dcbnl_set_dcbx,
2137 .getfeatcfg = bnx2x_dcbnl_get_featcfg, 2235 .getfeatcfg = bnx2x_dcbnl_get_featcfg,
2138 .setfeatcfg = bnx2x_dcbnl_set_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,
2139}; 2241};
2140 2242
2141#endif /* BCM_DCBNL */ 2243#endif /* BCM_DCBNL */