aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-dev.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 931e3745c451..6b98a99fbfa4 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -518,13 +518,45 @@ static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)
518 518
519static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) 519static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata)
520{ 520{
521 struct ieee_pfc *pfc = pdata->pfc;
522 struct ieee_ets *ets = pdata->ets;
521 unsigned int max_q_count, q_count; 523 unsigned int max_q_count, q_count;
522 unsigned int reg, reg_val; 524 unsigned int reg, reg_val;
523 unsigned int i; 525 unsigned int i;
524 526
525 /* Set MTL flow control */ 527 /* Set MTL flow control */
526 for (i = 0; i < pdata->rx_q_count; i++) 528 for (i = 0; i < pdata->rx_q_count; i++) {
527 XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 1); 529 unsigned int ehfc = 0;
530
531 if (pfc && ets) {
532 unsigned int prio;
533
534 for (prio = 0; prio < IEEE_8021QAZ_MAX_TCS; prio++) {
535 unsigned int tc;
536
537 /* Does this queue handle the priority? */
538 if (pdata->prio2q_map[prio] != i)
539 continue;
540
541 /* Get the Traffic Class for this priority */
542 tc = ets->prio_tc[prio];
543
544 /* Check if flow control should be enabled */
545 if (pfc->pfc_en & (1 << tc)) {
546 ehfc = 1;
547 break;
548 }
549 }
550 } else {
551 ehfc = 1;
552 }
553
554 XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, ehfc);
555
556 netif_dbg(pdata, drv, pdata->netdev,
557 "flow control %s for RXq%u\n",
558 ehfc ? "enabled" : "disabled", i);
559 }
528 560
529 /* Set MAC flow control */ 561 /* Set MAC flow control */
530 max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; 562 max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;