Skip to content

Commit 2c8d1c8

Browse files
Ioana Radulescudavem330
authored andcommitted
dpaa2-eth: Add congestion group taildrop
The increase in number of ingress frame queues means we now risk depleting the buffer pool before the FQ taildrop kicks in. Congestion group taildrop allows us to control the number of frames that can accumulate on a group of Rx frame queues belonging to the same traffic class. This setting coexists with the frame queue based taildrop: whichever limit gets hit first triggers the frame drop. Signed-off-by: Ioana Radulescu <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ad054f2 commit 2c8d1c8

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,17 +1287,20 @@ static void disable_ch_napi(struct dpaa2_eth_priv *priv)
12871287
}
12881288
}
12891289

1290-
static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv, bool enable)
1290+
static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv,
1291+
bool tx_pause)
12911292
{
12921293
struct dpni_taildrop td = {0};
12931294
struct dpaa2_eth_fq *fq;
12941295
int i, err;
12951296

1296-
if (priv->rx_td_enabled == enable)
1297+
td.enable = !tx_pause;
1298+
if (priv->rx_td_enabled == td.enable)
12971299
return;
12981300

1299-
td.enable = enable;
1300-
td.threshold = DPAA2_ETH_TAILDROP_THRESH;
1301+
/* FQ taildrop: threshold is in bytes, per frame queue */
1302+
td.threshold = DPAA2_ETH_FQ_TAILDROP_THRESH;
1303+
td.units = DPNI_CONGESTION_UNIT_BYTES;
13011304

13021305
for (i = 0; i < priv->num_fqs; i++) {
13031306
fq = &priv->fq[i];
@@ -1308,12 +1311,28 @@ static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv, bool enable)
13081311
fq->tc, fq->flowid, &td);
13091312
if (err) {
13101313
netdev_err(priv->net_dev,
1311-
"dpni_set_taildrop() failed\n");
1312-
break;
1314+
"dpni_set_taildrop(FQ) failed\n");
1315+
return;
1316+
}
1317+
}
1318+
1319+
/* Congestion group taildrop: threshold is in frames, per group
1320+
* of FQs belonging to the same traffic class
1321+
*/
1322+
td.threshold = DPAA2_ETH_CG_TAILDROP_THRESH(priv);
1323+
td.units = DPNI_CONGESTION_UNIT_FRAMES;
1324+
for (i = 0; i < dpaa2_eth_tc_count(priv); i++) {
1325+
err = dpni_set_taildrop(priv->mc_io, 0, priv->mc_token,
1326+
DPNI_CP_GROUP, DPNI_QUEUE_RX,
1327+
i, 0, &td);
1328+
if (err) {
1329+
netdev_err(priv->net_dev,
1330+
"dpni_set_taildrop(CG) failed\n");
1331+
return;
13131332
}
13141333
}
13151334

1316-
priv->rx_td_enabled = enable;
1335+
priv->rx_td_enabled = td.enable;
13171336
}
13181337

13191338
static int link_state_update(struct dpaa2_eth_priv *priv)
@@ -1334,7 +1353,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv)
13341353
* only when pause frame generation is disabled.
13351354
*/
13361355
tx_pause = dpaa2_eth_tx_pause_enabled(state.options);
1337-
dpaa2_eth_set_rx_taildrop(priv, !tx_pause);
1356+
dpaa2_eth_set_rx_taildrop(priv, tx_pause);
13381357

13391358
/* When we manage the MAC/PHY using phylink there is no need
13401359
* to manually update the netif_carrier.

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* frames in the Rx queues (length of the current frame is not
4141
* taken into account when making the taildrop decision)
4242
*/
43-
#define DPAA2_ETH_TAILDROP_THRESH (64 * 1024)
43+
#define DPAA2_ETH_FQ_TAILDROP_THRESH (64 * 1024)
4444

4545
/* Maximum number of Tx confirmation frames to be processed
4646
* in a single NAPI call
@@ -52,11 +52,20 @@
5252
* how many 64B frames fit inside the taildrop threshold and add a margin
5353
* to accommodate the buffer refill delay.
5454
*/
55-
#define DPAA2_ETH_MAX_FRAMES_PER_QUEUE (DPAA2_ETH_TAILDROP_THRESH / 64)
55+
#define DPAA2_ETH_MAX_FRAMES_PER_QUEUE (DPAA2_ETH_FQ_TAILDROP_THRESH / 64)
5656
#define DPAA2_ETH_NUM_BUFS (DPAA2_ETH_MAX_FRAMES_PER_QUEUE + 256)
5757
#define DPAA2_ETH_REFILL_THRESH \
5858
(DPAA2_ETH_NUM_BUFS - DPAA2_ETH_BUFS_PER_CMD)
5959

60+
/* Congestion group taildrop threshold: number of frames allowed to accumulate
61+
* at any moment in a group of Rx queues belonging to the same traffic class.
62+
* Choose value such that we don't risk depleting the buffer pool before the
63+
* taildrop kicks in
64+
*/
65+
#define DPAA2_ETH_CG_TAILDROP_THRESH(priv) \
66+
(DPAA2_ETH_MAX_FRAMES_PER_QUEUE * dpaa2_eth_queue_count(priv) / \
67+
dpaa2_eth_tc_count(priv))
68+
6069
/* Maximum number of buffers that can be acquired/released through a single
6170
* QBMan command
6271
*/

0 commit comments

Comments
 (0)