hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
....@@ -39,8 +39,8 @@
3939 static int bnxt_hwrm_queue_pri2cos_cfg(struct bnxt *bp, struct ieee_ets *ets)
4040 {
4141 struct hwrm_queue_pri2cos_cfg_input req = {0};
42
- int rc = 0, i;
4342 u8 *pri2cos;
43
+ int i;
4444
4545 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_PRI2COS_CFG, -1, -1);
4646 req.flags = cpu_to_le32(QUEUE_PRI2COS_CFG_REQ_FLAGS_PATH_BIDIR |
....@@ -56,8 +56,7 @@
5656 qidx = bp->tc_to_qidx[ets->prio_tc[i]];
5757 pri2cos[i] = bp->q_info[qidx].queue_id;
5858 }
59
- rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
60
- return rc;
59
+ return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
6160 }
6261
6362 static int bnxt_hwrm_queue_pri2cos_qcfg(struct bnxt *bp, struct ieee_ets *ets)
....@@ -93,8 +92,8 @@
9392 {
9493 struct hwrm_queue_cos2bw_cfg_input req = {0};
9594 struct bnxt_cos2bw_cfg cos2bw;
96
- int rc = 0, i;
9795 void *data;
96
+ int i;
9897
9998 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_COS2BW_CFG, -1, -1);
10099 for (i = 0; i < max_tc; i++) {
....@@ -128,8 +127,7 @@
128127 req.unused_0 = 0;
129128 }
130129 }
131
- rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
132
- return rc;
130
+ return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
133131 }
134132
135133 static int bnxt_hwrm_queue_cos2bw_qcfg(struct bnxt *bp, struct ieee_ets *ets)
....@@ -236,7 +234,6 @@
236234 unsigned int tc_mask = 0, pri_mask = 0;
237235 u8 i, pri, lltc_count = 0;
238236 bool need_q_remap = false;
239
- int rc;
240237
241238 if (!my_ets)
242239 return -EINVAL;
....@@ -267,15 +264,11 @@
267264 }
268265
269266 if (need_q_remap)
270
- rc = bnxt_queue_remap(bp, tc_mask);
267
+ bnxt_queue_remap(bp, tc_mask);
271268
272269 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_PFCENABLE_CFG, -1, -1);
273270 req.flags = cpu_to_le32(pri_mask);
274
- rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
275
- if (rc)
276
- return rc;
277
-
278
- return rc;
271
+ return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
279272 }
280273
281274 static int bnxt_hwrm_queue_pfc_qcfg(struct bnxt *bp, struct ieee_pfc *pfc)
....@@ -316,8 +309,8 @@
316309
317310 n = IEEE_8021QAZ_MAX_TCS;
318311 data_len = sizeof(*data) + sizeof(*fw_app) * n;
319
- data = dma_zalloc_coherent(&bp->pdev->dev, data_len, &mapping,
320
- GFP_KERNEL);
312
+ data = dma_alloc_coherent(&bp->pdev->dev, data_len, &mapping,
313
+ GFP_KERNEL);
321314 if (!data)
322315 return -ENOMEM;
323316
....@@ -377,8 +370,6 @@
377370 set.data_len = cpu_to_le16(sizeof(*data) + sizeof(*fw_app) * n);
378371 set.hdr_cnt = 1;
379372 rc = hwrm_send_message(bp, &set, sizeof(set), HWRM_CMD_TIMEOUT);
380
- if (rc)
381
- rc = -EIO;
382373
383374 set_app_exit:
384375 dma_free_coherent(&bp->pdev->dev, data_len, data, mapping);
....@@ -391,6 +382,7 @@
391382 struct hwrm_queue_dscp_qcaps_input req = {0};
392383 int rc;
393384
385
+ bp->max_dscp_value = 0;
394386 if (bp->hwrm_spec_code < 0x10800 || BNXT_VF(bp))
395387 return 0;
396388
....@@ -433,8 +425,6 @@
433425 dscp2pri->pri = app->priority;
434426 req.entry_cnt = cpu_to_le16(1);
435427 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
436
- if (rc)
437
- rc = -EIO;
438428 dma_free_coherent(&bp->pdev->dev, sizeof(*dscp2pri), dscp2pri,
439429 mapping);
440430 return rc;
....@@ -471,7 +461,10 @@
471461 if (total_ets_bw > 100)
472462 return -EINVAL;
473463
474
- *tc = max_tc + 1;
464
+ if (max_tc >= bp->max_tc)
465
+ *tc = bp->max_tc;
466
+ else
467
+ *tc = max_tc + 1;
475468 return 0;
476469 }
477470
....@@ -551,7 +544,7 @@
551544 static int bnxt_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc)
552545 {
553546 struct bnxt *bp = netdev_priv(dev);
554
- __le64 *stats = (__le64 *)bp->hw_rx_port_stats;
547
+ __le64 *stats = bp->port_stats.hw_stats;
555548 struct ieee_pfc *my_pfc = bp->ieee_pfc;
556549 long rx_off, tx_off;
557550 int i, rc;
....@@ -724,6 +717,7 @@
724717
725718 void bnxt_dcb_init(struct bnxt *bp)
726719 {
720
+ bp->dcbx_cap = 0;
727721 if (bp->hwrm_spec_code < 0x10501)
728722 return;
729723