Skip to content

Commit 0364a0d

Browse files
Jesus Sanchez-Palenciadavem330
authored andcommitted
igb: Only change Tx arbitration when CBS is on
Currently the data transmission arbitration algorithm - DataTranARB field on TQAVCTRL reg - is always set to CBS when the Tx mode is changed from legacy to 'Qav' mode. Make that configuration a bit more granular in preparation for the upcoming Launchtime enabling patches, since CBS and Launchtime can be enabled separately. That is achieved by moving the DataTranARB setup to igb_config_tx_modes() instead. Similarly, when disabling CBS we must check if it has been disabled for all queues, and clear the DataTranARB accordingly. Signed-off-by: Jesus Sanchez-Palencia <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 91db364 commit 0364a0d

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,18 @@ static void set_queue_mode(struct e1000_hw *hw, int queue, enum queue_mode mode)
16541654
wr32(E1000_I210_TQAVCC(queue), val);
16551655
}
16561656

1657+
static bool is_any_cbs_enabled(struct igb_adapter *adapter)
1658+
{
1659+
int i;
1660+
1661+
for (i = 0; i < adapter->num_tx_queues; i++) {
1662+
if (adapter->tx_ring[i]->cbs_enable)
1663+
return true;
1664+
}
1665+
1666+
return false;
1667+
}
1668+
16571669
/**
16581670
* igb_config_tx_modes - Configure "Qav Tx mode" features on igb
16591671
* @adapter: pointer to adapter struct
@@ -1668,7 +1680,7 @@ static void igb_config_tx_modes(struct igb_adapter *adapter, int queue)
16681680
struct igb_ring *ring = adapter->tx_ring[queue];
16691681
struct net_device *netdev = adapter->netdev;
16701682
struct e1000_hw *hw = &adapter->hw;
1671-
u32 tqavcc;
1683+
u32 tqavcc, tqavctrl;
16721684
u16 value;
16731685

16741686
WARN_ON(hw->mac.type != e1000_i210);
@@ -1693,6 +1705,14 @@ static void igb_config_tx_modes(struct igb_adapter *adapter, int queue)
16931705
set_tx_desc_fetch_prio(hw, queue, TX_QUEUE_PRIO_HIGH);
16941706
set_queue_mode(hw, queue, QUEUE_MODE_STREAM_RESERVATION);
16951707

1708+
/* Always set data transfer arbitration to credit-based
1709+
* shaper algorithm on TQAVCTRL if CBS is enabled for any of
1710+
* the queues.
1711+
*/
1712+
tqavctrl = rd32(E1000_I210_TQAVCTRL);
1713+
tqavctrl |= E1000_TQAVCTRL_DATATRANARB;
1714+
wr32(E1000_I210_TQAVCTRL, tqavctrl);
1715+
16961716
/* According to i210 datasheet section 7.2.7.7, we should set
16971717
* the 'idleSlope' field from TQAVCC register following the
16981718
* equation:
@@ -1770,6 +1790,16 @@ static void igb_config_tx_modes(struct igb_adapter *adapter, int queue)
17701790

17711791
/* Set hiCredit to zero. */
17721792
wr32(E1000_I210_TQAVHC(queue), 0);
1793+
1794+
/* If CBS is not enabled for any queues anymore, then return to
1795+
* the default state of Data Transmission Arbitration on
1796+
* TQAVCTRL.
1797+
*/
1798+
if (!is_any_cbs_enabled(adapter)) {
1799+
tqavctrl = rd32(E1000_I210_TQAVCTRL);
1800+
tqavctrl &= ~E1000_TQAVCTRL_DATATRANARB;
1801+
wr32(E1000_I210_TQAVCTRL, tqavctrl);
1802+
}
17731803
}
17741804

17751805
/* XXX: In i210 controller the sendSlope and loCredit parameters from
@@ -1803,18 +1833,6 @@ static int igb_save_cbs_params(struct igb_adapter *adapter, int queue,
18031833
return 0;
18041834
}
18051835

1806-
static bool is_any_cbs_enabled(struct igb_adapter *adapter)
1807-
{
1808-
int i;
1809-
1810-
for (i = 0; i < adapter->num_tx_queues; i++) {
1811-
if (adapter->tx_ring[i]->cbs_enable)
1812-
return true;
1813-
}
1814-
1815-
return false;
1816-
}
1817-
18181836
/**
18191837
* igb_setup_tx_mode - Switch to/from Qav Tx mode when applicable
18201838
* @adapter: pointer to adapter struct
@@ -1838,11 +1856,10 @@ static void igb_setup_tx_mode(struct igb_adapter *adapter)
18381856
int i, max_queue;
18391857

18401858
/* Configure TQAVCTRL register: set transmit mode to 'Qav',
1841-
* set data fetch arbitration to 'round robin' and set data
1842-
* transfer arbitration to 'credit shaper algorithm.
1859+
* set data fetch arbitration to 'round robin'.
18431860
*/
18441861
val = rd32(E1000_I210_TQAVCTRL);
1845-
val |= E1000_TQAVCTRL_XMIT_MODE | E1000_TQAVCTRL_DATATRANARB;
1862+
val |= E1000_TQAVCTRL_XMIT_MODE;
18461863
val &= ~E1000_TQAVCTRL_DATAFETCHARB;
18471864
wr32(E1000_I210_TQAVCTRL, val);
18481865

0 commit comments

Comments
 (0)