1 From 965b47cbf16a6d1bc8235e1bff038abc9b4cf142 Mon Sep 17 00:00:00 2001
2 From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
3 Date: Wed, 4 Sep 2019 19:45:01 +0300
4 Subject: [PATCH] dpaa2-eth: Minor cleanup in dpaa2_eth_set_rx_taildrop()
6 Make clear the setting refers to FQ-based taildrop and the threshold
7 value is given in bytes (the default option).
9 Reverse the logic of the second argument (pass tx_pause transparently).
10 This will be helpful further on.
12 Also don't set the device's Rx taildrop flag unless configuration
15 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
17 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 19 +++++++++++--------
18 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 4 ++--
19 2 files changed, 13 insertions(+), 10 deletions(-)
21 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
22 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
23 @@ -1228,17 +1228,20 @@ static void disable_ch_napi(struct dpaa2
27 -static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv, bool enable)
28 +static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv,
31 struct dpni_taildrop td = {0};
32 struct dpaa2_eth_fq *fq;
35 - if (priv->rx_td_enabled == enable)
36 + td.enable = !tx_pause;
37 + if (priv->rx_td_enabled == td.enable)
41 - td.threshold = DPAA2_ETH_TAILDROP_THRESH;
42 + /* FQ taildrop: thrshold is in bytes, per frame queue */
43 + td.threshold = DPAA2_ETH_FQ_TAILDROP_THRESH;
44 + td.units = DPNI_CONGESTION_UNIT_BYTES;
46 for (i = 0; i < priv->num_fqs; i++) {
48 @@ -1249,12 +1252,12 @@ static void dpaa2_eth_set_rx_taildrop(st
49 fq->tc, fq->flowid, &td);
51 netdev_err(priv->net_dev,
52 - "dpni_set_taildrop() failed\n");
54 + "dpni_set_taildrop(FQ) failed\n");
59 - priv->rx_td_enabled = enable;
60 + priv->rx_td_enabled = td.enable;
63 static void update_tx_fqids(struct dpaa2_eth_priv *priv);
64 @@ -1277,7 +1280,7 @@ static int link_state_update(struct dpaa
65 * only when pause frame generation is disabled.
67 tx_pause = dpaa2_eth_tx_pause_enabled(state.options);
68 - dpaa2_eth_set_rx_taildrop(priv, !tx_pause);
69 + dpaa2_eth_set_rx_taildrop(priv, tx_pause);
71 /* Chech link state; speed / duplex changes are not treated yet */
72 if (priv->link_state.up == state.up)
73 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
74 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
76 * frames in the Rx queues (length of the current frame is not
77 * taken into account when making the taildrop decision)
79 -#define DPAA2_ETH_TAILDROP_THRESH (64 * 1024)
80 +#define DPAA2_ETH_FQ_TAILDROP_THRESH (64 * 1024)
82 /* Maximum number of Tx confirmation frames to be processed
83 * in a single NAPI call
85 * how many 64B frames fit inside the taildrop threshold and add a margin
86 * to accommodate the buffer refill delay.
88 -#define DPAA2_ETH_MAX_FRAMES_PER_QUEUE (DPAA2_ETH_TAILDROP_THRESH / 64)
89 +#define DPAA2_ETH_MAX_FRAMES_PER_QUEUE (DPAA2_ETH_FQ_TAILDROP_THRESH / 64)
90 #define DPAA2_ETH_NUM_BUFS (DPAA2_ETH_MAX_FRAMES_PER_QUEUE + 256)
91 #define DPAA2_ETH_REFILL_THRESH \
92 (DPAA2_ETH_NUM_BUFS - DPAA2_ETH_BUFS_PER_CMD)