1 From 3aa939c73c176690a9ebe646612cd097f281efe5 Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Fri, 24 Nov 2017 10:48:31 +0200
4 Subject: [PATCH] sdk_dpaa: ceetm: stop transmitting frames when the CQ is
7 When the egress CQ is congested, drop the frames instead of enqueueing
8 them. This is more efficient than enqueueing and receiving them back on
11 We also can't stop the netdev queues because that would affect all the CQs
12 and would hinder prioritization.
14 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
16 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 22 ++++++++++++++++------
17 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h | 1 +
18 2 files changed, 17 insertions(+), 6 deletions(-)
20 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
21 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
22 @@ -125,16 +125,16 @@ static void ceetm_cscn(struct qm_ceetm_c
26 + ceetm_fq->congested = congested;
29 dpa_priv->cgr_data.congestion_start_jiffies = jiffies;
30 - netif_tx_stop_all_queues(dpa_priv->net_dev);
31 dpa_priv->cgr_data.cgr_congested_count++;
33 cstats->congested_count++;
35 dpa_priv->cgr_data.congested_jiffies +=
36 (jiffies - dpa_priv->cgr_data.congestion_start_jiffies);
37 - netif_tx_wake_all_queues(dpa_priv->net_dev);
41 @@ -148,6 +148,7 @@ static int ceetm_alloc_fq(struct ceetm_f
44 (*fq)->ceetm_cls = cls;
45 + (*fq)->congested = 0;
49 @@ -1913,7 +1914,8 @@ int __hot ceetm_tx(struct sk_buff *skb,
50 struct Qdisc *sch = net_dev->qdisc;
51 struct ceetm_class *cl;
52 struct dpa_priv_s *priv_dpa;
53 - struct qman_fq *egress_fq, *conf_fq;
54 + struct ceetm_fq *ceetm_fq;
55 + struct qman_fq *conf_fq;
56 struct ceetm_qdisc *priv = qdisc_priv(sch);
57 struct ceetm_qdisc_stats *qstats = this_cpu_ptr(priv->root.qstats);
58 struct ceetm_class_stats *cstats;
59 @@ -1945,11 +1947,11 @@ int __hot ceetm_tx(struct sk_buff *skb,
63 - egress_fq = &cl->prio.fq->fq;
64 + ceetm_fq = cl->prio.fq;
65 cstats = this_cpu_ptr(cl->prio.cstats);
68 - egress_fq = &cl->wbfs.fq->fq;
69 + ceetm_fq = cl->wbfs.fq;
70 cstats = this_cpu_ptr(cl->wbfs.cstats);
73 @@ -1957,8 +1959,16 @@ int __hot ceetm_tx(struct sk_buff *skb,
77 + /* If the FQ is congested, avoid enqueuing the frame and dropping it
78 + * when it returns on the ERN path. Drop it here directly instead.
80 + if (unlikely(ceetm_fq->congested)) {
85 bstats_update(&cstats->bstats, skb);
86 - return dpa_tx_extended(skb, net_dev, egress_fq, conf_fq);
87 + return dpa_tx_extended(skb, net_dev, &ceetm_fq->fq, conf_fq);
90 dev_kfree_skb_any(skb);
91 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
92 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
93 @@ -105,6 +105,7 @@ struct ceetm_fq {
95 struct net_device *net_dev;
96 struct ceetm_class *ceetm_cls;
97 + int congested; /* Congestion status */