aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLendacky, Thomas <Thomas.Lendacky@amd.com>2016-02-17 12:48:48 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-17 15:22:19 -0500
commit8dba2a2a88397dec6bdcae8bf7ceeefd62fd39fc (patch)
treefa7ee6069d1dbe5a5d96d6de1475a25191d5090e
parent757e6aa34ca9529786877d3045684e7c9f686075 (diff)
amd-xgbe: Enable/disable PFC per traffic class
Currently the PFC flow control is enabled on all traffic classes if one or more traffic classes request it. The PFC enable setting of the traffic class should be used to determine whether to enable or disable flow control for the traffic class. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-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;