summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamelia Groza <camelia.groza@nxp.com>2017-11-24 09:55:51 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-12-12 07:32:43 (GMT)
commitb8bf07567660ebd5b67c434e11d32717b7edce20 (patch)
treebcd54bef57087a7c813b4f9ac08cc5319546caa4
parent11a1b0633b31adb168fa49be548b732f38989fda (diff)
downloadlinux-b8bf07567660ebd5b67c434e11d32717b7edce20.tar.xz
sdk_dpaa: ceetm: coding style fixes and added comments
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
-rw-r--r--drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
index b7362bd..db61c3a 100644
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
@@ -69,15 +69,17 @@ static void get_dcp_and_sp(struct net_device *dev, enum qm_dc_portal *dcp_id,
static void ceetm_ern(struct qman_portal *portal, struct qman_fq *fq,
const struct qm_mr_entry *msg)
{
- struct net_device *net_dev;
- struct ceetm_class *cls;
+ struct dpa_percpu_priv_s *dpa_percpu_priv;
struct ceetm_class_stats *cstats = NULL;
const struct dpa_priv_s *dpa_priv;
- struct dpa_percpu_priv_s *dpa_percpu_priv;
- struct sk_buff *skb;
struct qm_fd fd = msg->ern.fd;
+ struct net_device *net_dev;
+ struct ceetm_fq *ceetm_fq;
+ struct ceetm_class *cls;
+ struct sk_buff *skb;
- net_dev = ((struct ceetm_fq *)fq)->net_dev;
+ ceetm_fq = container_of(fq, struct ceetm_fq, fq);
+ net_dev = ceetm_fq->net_dev;
dpa_priv = netdev_priv(net_dev);
dpa_percpu_priv = raw_cpu_ptr(dpa_priv->percpu_priv);
@@ -86,7 +88,7 @@ static void ceetm_ern(struct qman_portal *portal, struct qman_fq *fq,
dpa_percpu_priv->stats.tx_fifo_errors++;
/* Increment CEETM counters */
- cls = ((struct ceetm_fq *)fq)->ceetm_cls;
+ cls = ceetm_fq->ceetm_cls;
switch (cls->type) {
case CEETM_PRIO:
cstats = this_cpu_ptr(cls->prio.cstats);
@@ -99,11 +101,15 @@ static void ceetm_ern(struct qman_portal *portal, struct qman_fq *fq,
if (cstats)
cstats->ern_drop_count++;
+ /* Release the buffers that were supposed to be recycled. */
if (fd.bpid != 0xff) {
dpa_fd_release(net_dev, &fd);
return;
}
+ /* Release the frames that were supposed to return on the
+ * confirmation path.
+ */
skb = _dpa_cleanup_tx_fd(dpa_priv, &fd);
dev_kfree_skb_any(skb);
}
@@ -1909,18 +1915,22 @@ static struct ceetm_class *ceetm_classify(struct sk_buff *skb,
int __hot ceetm_tx(struct sk_buff *skb, struct net_device *net_dev)
{
- int ret;
- bool act_drop = false;
+ const int queue_mapping = dpa_get_queue_mapping(skb);
struct Qdisc *sch = net_dev->qdisc;
- struct ceetm_class *cl;
+ struct ceetm_class_stats *cstats;
+ struct ceetm_qdisc_stats *qstats;
struct dpa_priv_s *priv_dpa;
struct ceetm_fq *ceetm_fq;
+ struct ceetm_qdisc *priv;
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;
- const int queue_mapping = dpa_get_queue_mapping(skb);
- spinlock_t *root_lock = qdisc_lock(sch);
+ struct ceetm_class *cl;
+ spinlock_t *root_lock;
+ bool act_drop = false;
+ int ret;
+
+ root_lock = qdisc_lock(sch);
+ priv = qdisc_priv(sch);
+ qstats = this_cpu_ptr(priv->root.qstats);
spin_lock(root_lock);
cl = ceetm_classify(skb, sch, &ret, &act_drop);