* [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers
@ 2021-03-16 14:47 Ioana Ciornei
2021-03-16 14:47 ` [PATCH net-next 1/3] dpaa2-eth: use indirect calls wrapper for FD enqueue Ioana Ciornei
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ioana Ciornei @ 2021-03-16 14:47 UTC (permalink / raw)
To: davem, kuba, netdev; +Cc: ruxandra.radulescu, Ioana Ciornei
From: Ioana Ciornei <ioana.ciornei@nxp.com>
The dpaa2-eth driver uses two indirect calls in fast-path, one invoked
on each FD to consume the packet and one for each Tx packet to be
enqueued.
Use the indirect call wrappers infrastructure in both dpaa2-eth and
dpaa2-switch drivers so that we avoid any RETPOLINE overhead.
Ioana Ciornei (3):
dpaa2-eth: use indirect calls wrapper for FD enqueue
dpaa2-eth: use indirect calls wrapper for FD consume
dpaa2-switch: use an indirect call wrapper instead of open-coding
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 15 +++++++++++----
.../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 12 ++++++------
.../net/ethernet/freescale/dpaa2/dpaa2-switch.h | 1 +
3 files changed, 18 insertions(+), 10 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/3] dpaa2-eth: use indirect calls wrapper for FD enqueue
2021-03-16 14:47 [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
@ 2021-03-16 14:47 ` Ioana Ciornei
2021-03-16 14:47 ` [PATCH net-next 2/3] dpaa2-eth: use indirect calls wrapper for FD consume Ioana Ciornei
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2021-03-16 14:47 UTC (permalink / raw)
To: davem, kuba, netdev; +Cc: ruxandra.radulescu, Ioana Ciornei
From: Ioana Ciornei <ioana.ciornei@nxp.com>
We can avoid an indirect call per Tx packet by wrapping the enqueue of
the frame descriptor with the appropriate helper.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 492943bb9c48..7702b921ab0b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -266,8 +266,11 @@ static int dpaa2_eth_xdp_flush(struct dpaa2_eth_priv *priv,
num_fds = xdp_fds->num;
max_retries = num_fds * DPAA2_ETH_ENQUEUE_RETRIES;
while (total_enqueued < num_fds && retries < max_retries) {
- err = priv->enqueue(priv, fq, &fds[total_enqueued],
- 0, num_fds - total_enqueued, &enqueued);
+ err = INDIRECT_CALL_2(priv->enqueue,
+ dpaa2_eth_enqueue_fq_multiple,
+ dpaa2_eth_enqueue_qd,
+ priv, fq, &fds[total_enqueued],
+ 0, num_fds - total_enqueued, &enqueued);
if (err == -EBUSY) {
percpu_extras->tx_portal_busy += ++retries;
continue;
@@ -1153,7 +1156,10 @@ static netdev_tx_t __dpaa2_eth_tx(struct sk_buff *skb,
* the Tx confirmation callback for this frame
*/
for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
- err = priv->enqueue(priv, fq, &fd, prio, 1, NULL);
+ err = INDIRECT_CALL_2(priv->enqueue,
+ dpaa2_eth_enqueue_fq_multiple,
+ dpaa2_eth_enqueue_qd,
+ priv, fq, &fd, prio, 1, NULL);
if (err != -EBUSY)
break;
}
--
2.30.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/3] dpaa2-eth: use indirect calls wrapper for FD consume
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 ` Ioana Ciornei
2021-03-16 14:47 ` [PATCH net-next 3/3] dpaa2-switch: use an indirect call wrapper instead of open-coding Ioana Ciornei
2021-03-16 16:44 ` [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2021-03-16 14:47 UTC (permalink / raw)
To: davem, kuba, netdev; +Cc: ruxandra.radulescu, Ioana Ciornei
From: Ioana Ciornei <ioana.ciornei@nxp.com>
We can avoid an indirect call per Rx packet by wrapping the consume
function on a frame descriptor with the appropriate helper.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 7702b921ab0b..4ea0bbd9e4c2 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -605,7 +605,8 @@ static int dpaa2_eth_consume_frames(struct dpaa2_eth_channel *ch,
fd = dpaa2_dq_fd(dq);
fq = (struct dpaa2_eth_fq *)(uintptr_t)dpaa2_dq_fqd_ctx(dq);
- fq->consume(priv, ch, fd, fq);
+ INDIRECT_CALL_3(fq->consume, dpaa2_eth_rx, dpaa2_eth_tx_conf, dpaa2_eth_rx_err,
+ priv, ch, fd, fq);
cleaned++;
retries = 0;
} while (!is_last);
--
2.30.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 3/3] dpaa2-switch: use an indirect call wrapper instead of open-coding
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
2021-03-16 16:44 ` [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2021-03-16 14:47 UTC (permalink / raw)
To: davem, kuba, netdev; +Cc: ruxandra.radulescu, Ioana Ciornei
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers
2021-03-16 14:47 [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
` (2 preceding siblings ...)
2021-03-16 14:47 ` [PATCH net-next 3/3] dpaa2-switch: use an indirect call wrapper instead of open-coding Ioana Ciornei
@ 2021-03-16 16:44 ` Ioana Ciornei
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2021-03-16 16:44 UTC (permalink / raw)
To: davem, kuba, netdev; +Cc: ruxandra.radulescu, Ioana Ciornei
On Tue, Mar 16, 2021 at 04:47:27PM +0200, Ioana Ciornei wrote:
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
>
> The dpaa2-eth driver uses two indirect calls in fast-path, one invoked
> on each FD to consume the packet and one for each Tx packet to be
> enqueued.
>
> Use the indirect call wrappers infrastructure in both dpaa2-eth and
> dpaa2-switch drivers so that we avoid any RETPOLINE overhead.
Please disregard these patches, somehow I failed to include all the
changes and it fails to build. Sorry.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-16 16:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH net-next 3/3] dpaa2-switch: use an indirect call wrapper instead of open-coding Ioana Ciornei
2021-03-16 16:44 ` [PATCH net-next 0/3] dpaa2-eth: use indirect call wrappers Ioana Ciornei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox