From: Radu Bulie Date: Fri, 30 Apr 2021 00:59:35 +0000 (+0300) Subject: dpaa2-eth: Set congestion group before the Rx queues become operational X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~56 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=cf8c29c14df7f7cacfe04b71e682cfe409f7ec22;p=linux.git dpaa2-eth: Set congestion group before the Rx queues become operational 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 --- diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index b15c13ed9256..816256eaeac7 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -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);