dpaa2-eth: Set congestion group before the Rx queues become operational
authorRadu Bulie <radu-andrei.bulie@nxp.com>
Fri, 30 Apr 2021 00:59:35 +0000 (03:59 +0300)
committerXiaobo Xie <xiaobo.xie@nxp.com>
Thu, 3 Jun 2021 04:10:20 +0000 (06:10 +0200)
Setting  the CGID for the first time or dynamically changing it
with a different one  on a FQ that has been in service (has frames in it)
is not supported, the byte/frame counts in both the old and new CGRs may be
corrupted if this is done.

This patch adds the configuration of the CGR(congestion group record)
for the network interface RX queues, in the probe function before the queues
become operational,  to prevent the corruption of the aforementioned counter.

Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

index b15c13e..816256e 100644 (file)
@@ -4364,6 +4364,30 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev)
        if (err)
                goto err_bind;
 
+       /* Setting (creating a CGID and assigning it on a frame queue that does
+        * not have a congestion group associated  or modifying
+        * an existing CGID on a frame queue to a different CGID) a CGID on a
+        * frame queue that is in service(has frames in it),
+        * will cause the byte/frame counter of that CGR to become corrupted.
+        *
+        * Below is the detailed solution and the impact if it is not applied
+        * precisely.
+        *
+        * Enable tail drop at probe time to prevent instantaneous counter
+        * of a congestion group to be 0 while traffic might be in flight on
+        * the ingress queues. The instantaneous counter will be
+        * decremented by the number of frames that are dequeued from the ingress
+        * queue, once the interface is up. Because its value is 0,
+        * this subtraction yields  an invalid overflow  value.(7FFFFFFFFF)
+        * The outcome will be greater than
+        * any configured value for the tail drop threshold, for any queue in the
+        * group;
+        * as a consequence, the group will always discard frames and this will
+        * trigger a situation in which all the frames received on a queue that
+        * belongs to the congestion group, are discarded continuously.
+        */
+       dpaa2_eth_set_rx_taildrop(priv, false, priv->pfc_enabled);
+
        /* Add a NAPI context for each channel */
        dpaa2_eth_add_ch_napi(priv);