hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
....@@ -524,19 +524,28 @@
524524 netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n");
525525 }
526526
527
+static unsigned int xgbe_get_fc_queue_count(struct xgbe_prv_data *pdata)
528
+{
529
+ unsigned int max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
530
+
531
+ /* From MAC ver 30H the TFCR is per priority, instead of per queue */
532
+ if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) >= 0x30)
533
+ return max_q_count;
534
+ else
535
+ return min_t(unsigned int, pdata->tx_q_count, max_q_count);
536
+}
537
+
527538 static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)
528539 {
529
- unsigned int max_q_count, q_count;
530540 unsigned int reg, reg_val;
531
- unsigned int i;
541
+ unsigned int i, q_count;
532542
533543 /* Clear MTL flow control */
534544 for (i = 0; i < pdata->rx_q_count; i++)
535545 XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0);
536546
537547 /* Clear MAC flow control */
538
- max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
539
- q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
548
+ q_count = xgbe_get_fc_queue_count(pdata);
540549 reg = MAC_Q0TFCR;
541550 for (i = 0; i < q_count; i++) {
542551 reg_val = XGMAC_IOREAD(pdata, reg);
....@@ -553,9 +562,8 @@
553562 {
554563 struct ieee_pfc *pfc = pdata->pfc;
555564 struct ieee_ets *ets = pdata->ets;
556
- unsigned int max_q_count, q_count;
557565 unsigned int reg, reg_val;
558
- unsigned int i;
566
+ unsigned int i, q_count;
559567
560568 /* Set MTL flow control */
561569 for (i = 0; i < pdata->rx_q_count; i++) {
....@@ -579,8 +587,7 @@
579587 }
580588
581589 /* Set MAC flow control */
582
- max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
583
- q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
590
+ q_count = xgbe_get_fc_queue_count(pdata);
584591 reg = MAC_Q0TFCR;
585592 for (i = 0; i < q_count; i++) {
586593 reg_val = XGMAC_IOREAD(pdata, reg);