101 lines
3.1 KiB
Diff
101 lines
3.1 KiB
Diff
From 3aa939c73c176690a9ebe646612cd097f281efe5 Mon Sep 17 00:00:00 2001
|
|
From: Camelia Groza <camelia.groza@nxp.com>
|
|
Date: Fri, 24 Nov 2017 10:48:31 +0200
|
|
Subject: [PATCH] sdk_dpaa: ceetm: stop transmitting frames when the CQ is
|
|
congested
|
|
|
|
When the egress CQ is congested, drop the frames instead of enqueueing
|
|
them. This is more efficient than enqueueing and receiving them back on
|
|
the ERN queue.
|
|
|
|
We also can't stop the netdev queues because that would affect all the CQs
|
|
and would hinder prioritization.
|
|
|
|
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
|
|
---
|
|
.../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 22 ++++++++++++++++------
|
|
.../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h | 1 +
|
|
2 files changed, 17 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
|
|
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
|
|
@@ -125,16 +125,16 @@ static void ceetm_cscn(struct qm_ceetm_c
|
|
break;
|
|
}
|
|
|
|
+ ceetm_fq->congested = congested;
|
|
+
|
|
if (congested) {
|
|
dpa_priv->cgr_data.congestion_start_jiffies = jiffies;
|
|
- netif_tx_stop_all_queues(dpa_priv->net_dev);
|
|
dpa_priv->cgr_data.cgr_congested_count++;
|
|
if (cstats)
|
|
cstats->congested_count++;
|
|
} else {
|
|
dpa_priv->cgr_data.congested_jiffies +=
|
|
(jiffies - dpa_priv->cgr_data.congestion_start_jiffies);
|
|
- netif_tx_wake_all_queues(dpa_priv->net_dev);
|
|
}
|
|
}
|
|
|
|
@@ -148,6 +148,7 @@ static int ceetm_alloc_fq(struct ceetm_f
|
|
|
|
(*fq)->net_dev = dev;
|
|
(*fq)->ceetm_cls = cls;
|
|
+ (*fq)->congested = 0;
|
|
return 0;
|
|
}
|
|
|
|
@@ -1913,7 +1914,8 @@ int __hot ceetm_tx(struct sk_buff *skb,
|
|
struct Qdisc *sch = net_dev->qdisc;
|
|
struct ceetm_class *cl;
|
|
struct dpa_priv_s *priv_dpa;
|
|
- struct qman_fq *egress_fq, *conf_fq;
|
|
+ struct ceetm_fq *ceetm_fq;
|
|
+ struct qman_fq *conf_fq;
|
|
struct ceetm_qdisc *priv = qdisc_priv(sch);
|
|
struct ceetm_qdisc_stats *qstats = this_cpu_ptr(priv->root.qstats);
|
|
struct ceetm_class_stats *cstats;
|
|
@@ -1945,11 +1947,11 @@ int __hot ceetm_tx(struct sk_buff *skb,
|
|
*/
|
|
switch (cl->type) {
|
|
case CEETM_PRIO:
|
|
- egress_fq = &cl->prio.fq->fq;
|
|
+ ceetm_fq = cl->prio.fq;
|
|
cstats = this_cpu_ptr(cl->prio.cstats);
|
|
break;
|
|
case CEETM_WBFS:
|
|
- egress_fq = &cl->wbfs.fq->fq;
|
|
+ ceetm_fq = cl->wbfs.fq;
|
|
cstats = this_cpu_ptr(cl->wbfs.cstats);
|
|
break;
|
|
default:
|
|
@@ -1957,8 +1959,16 @@ int __hot ceetm_tx(struct sk_buff *skb,
|
|
goto drop;
|
|
}
|
|
|
|
+ /* If the FQ is congested, avoid enqueuing the frame and dropping it
|
|
+ * when it returns on the ERN path. Drop it here directly instead.
|
|
+ */
|
|
+ if (unlikely(ceetm_fq->congested)) {
|
|
+ qstats->drops++;
|
|
+ goto drop;
|
|
+ }
|
|
+
|
|
bstats_update(&cstats->bstats, skb);
|
|
- return dpa_tx_extended(skb, net_dev, egress_fq, conf_fq);
|
|
+ return dpa_tx_extended(skb, net_dev, &ceetm_fq->fq, conf_fq);
|
|
|
|
drop:
|
|
dev_kfree_skb_any(skb);
|
|
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
|
|
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
|
|
@@ -105,6 +105,7 @@ struct ceetm_fq {
|
|
struct qman_fq fq;
|
|
struct net_device *net_dev;
|
|
struct ceetm_class *ceetm_cls;
|
|
+ int congested; /* Congestion status */
|
|
};
|
|
|
|
struct root_q {
|