From: Ioana Ciornei <ciorneiioana@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
Cc: ruxandra.radulescu@nxp.com, Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: [PATCH net-next 3/3] dpaa2-switch: use an indirect call wrapper instead of open-coding
Date: Tue, 16 Mar 2021 16:47:30 +0200 [thread overview]
Message-ID: <20210316144730.2150767-4-ciorneiioana@gmail.com> (raw)
In-Reply-To: <20210316144730.2150767-1-ciorneiioana@gmail.com>
From: Ioana Ciornei <ioana.ciornei@nxp.com>
Instead of open-coding the call to the consume function of each frame
queue, use the provided INDIRECT_CALL_2.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 12 ++++++------
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h | 1 +
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index 2fd05dd18d46..e6ec5de0e303 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -1917,11 +1917,13 @@ static int dpaa2_switch_setup_fqs(struct ethsw_core *ethsw)
ethsw->fq[i].fqid = ctrl_if_attr.rx_fqid;
ethsw->fq[i].ethsw = ethsw;
- ethsw->fq[i++].type = DPSW_QUEUE_RX;
+ ethsw->fq[i].type = DPSW_QUEUE_RX;
+ ethsw->fq[i++].consume = dpaa2_switch_rx;
ethsw->fq[i].fqid = ctrl_if_attr.tx_err_conf_fqid;
ethsw->fq[i].ethsw = ethsw;
- ethsw->fq[i++].type = DPSW_QUEUE_TX_ERR_CONF;
+ ethsw->fq[i].type = DPSW_QUEUE_TX_ERR_CONF;
+ ethsw->fq[i++].consume = dpaa2_switch_tx_conf;
return 0;
}
@@ -2208,10 +2210,8 @@ static int dpaa2_switch_store_consume(struct dpaa2_switch_fq *fq)
continue;
}
- if (fq->type == DPSW_QUEUE_RX)
- dpaa2_switch_rx(fq, dpaa2_dq_fd(dq));
- else
- dpaa2_switch_tx_conf(fq, dpaa2_dq_fd(dq));
+ INDIRECT_CALL_2(fq->consume, dpaa2_switch_rx, dpaa2_switch_tx_conf,
+ fq, dpaa2_dq_fd(dq));
cleaned++;
} while (!is_last);
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
index 933563064015..e4d8a99a6d32 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h
@@ -84,6 +84,7 @@ extern const struct ethtool_ops dpaa2_switch_port_ethtool_ops;
struct ethsw_core;
struct dpaa2_switch_fq {
+ void (*consume)(struct dpaa2_switch_fq *fq, const struct dpaa2_fd *fd);
struct ethsw_core *ethsw;
enum dpsw_queue_type type;
struct dpaa2_io_store *store;
--
2.30.0
next prev parent reply other threads:[~2021-03-16 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 14:47 [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
2021-03-16 14:47 ` [PATCH net-next 1/3] dpaa2-eth: use indirect calls wrapper for FD enqueue Ioana Ciornei
2021-03-16 14:47 ` [PATCH net-next 2/3] dpaa2-eth: use indirect calls wrapper for FD consume Ioana Ciornei
2021-03-16 14:47 ` Ioana Ciornei [this message]
2021-03-16 16:44 ` [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210316144730.2150767-4-ciorneiioana@gmail.com \
--to=ciorneiioana@gmail.com \
--cc=davem@davemloft.net \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ruxandra.radulescu@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox