diff mbox series

[ovs-dev] netdev: Remove modulo operation in dpdk/vhost/afxdp tx path

Message ID 1616471493-50477-1-git-send-email-lirongqing@baidu.com
State Deferred
Headers show
Series [ovs-dev] netdev: Remove modulo operation in dpdk/vhost/afxdp tx path | expand

Commit Message

Li RongQing March 23, 2021, 3:51 a.m. UTC
After 324c8374852a ("dpif-netdev: XPS (Transmit Packet Steering)
implementation."), it is impossible that qid is greater than or
equal to n_txq of netdev. so remove this modulo operation which
is in hot path

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 lib/netdev-afxdp.c | 1 -
 lib/netdev-dpdk.c  | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Simon Horman Oct. 6, 2023, 10:51 a.m. UTC | #1
On Tue, Mar 23, 2021 at 11:51:33AM +0800, Li RongQing wrote:
> After 324c8374852a ("dpif-netdev: XPS (Transmit Packet Steering)
> implementation."), it is impossible that qid is greater than or
> equal to n_txq of netdev. so remove this modulo operation which
> is in hot path
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Hi Li RongQing,

This patch appears to have gone stale in patchwork, for one reason or
another. If it is still relevant then I think it needs to be revisited,
by being reposted after appropriate preparation.

As such I'm marking this patch as "Deferred" in patchwork.

No action is required unless there is a desire to revisit this patch.
Kumar, Rohit via dev Oct. 7, 2023, 6:06 a.m. UTC | #2
> -----Original Message-----
> From: Simon Horman <horms@ovn.org>
> Sent: Friday, October 6, 2023 6:52 PM
> To: Li,Rongqing <lirongqing@baidu.com>
> Cc: dev@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] netdev: Remove modulo operation in
> dpdk/vhost/afxdp tx path
> 
> On Tue, Mar 23, 2021 at 11:51:33AM +0800, Li RongQing wrote:
> > After 324c8374852a ("dpif-netdev: XPS (Transmit Packet Steering)
> > implementation."), it is impossible that qid is greater than or equal
> > to n_txq of netdev. so remove this modulo operation which is in hot
> > path
> >
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> 
> Hi Li RongQing,
> 
> This patch appears to have gone stale in patchwork, for one reason or another. If
> it is still relevant then I think it needs to be revisited, by being reposted after
> appropriate preparation.
> 
> As such I'm marking this patch as "Deferred" in patchwork.
> 
> No action is required unless there is a desire to revisit this patch.


I hope this patch can be reviewed
And modulo is an expensive operations in some CPUs, and it is in hot path

Thanks

-Li
Simon Horman Oct. 9, 2023, 9:52 a.m. UTC | #3
On Sat, Oct 07, 2023 at 06:06:56AM +0000, Li,Rongqing wrote:
> 
> 
> > -----Original Message-----
> > From: Simon Horman <horms@ovn.org>
> > Sent: Friday, October 6, 2023 6:52 PM
> > To: Li,Rongqing <lirongqing@baidu.com>
> > Cc: dev@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH] netdev: Remove modulo operation in
> > dpdk/vhost/afxdp tx path
> > 
> > On Tue, Mar 23, 2021 at 11:51:33AM +0800, Li RongQing wrote:
> > > After 324c8374852a ("dpif-netdev: XPS (Transmit Packet Steering)
> > > implementation."), it is impossible that qid is greater than or equal
> > > to n_txq of netdev. so remove this modulo operation which is in hot
> > > path
> > >
> > > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > 
> > Hi Li RongQing,
> > 
> > This patch appears to have gone stale in patchwork, for one reason or another. If
> > it is still relevant then I think it needs to be revisited, by being reposted after
> > appropriate preparation.
> > 
> > As such I'm marking this patch as "Deferred" in patchwork.
> > 
> > No action is required unless there is a desire to revisit this patch.
> 
> 
> I hope this patch can be reviewed
> And modulo is an expensive operations in some CPUs, and it is in hot path

Hi Li RongQing,

In that case, please consider rebasing and reposting the patch.

For one, it does not appear to apply cleanly anymore.
For another, this will allow it to run through the upstream CI,
AFIK, which was not in place when the patch was originally submitted.

Thanks!
diff mbox series

Patch

diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c
index 482400d8d..c16ba7b90 100644
--- a/lib/netdev-afxdp.c
+++ b/lib/netdev-afxdp.c
@@ -1117,7 +1117,6 @@  netdev_afxdp_batch_send(struct netdev *netdev, int qid,
 
     if (concurrent_txq) {
         dev = netdev_linux_cast(netdev);
-        qid = qid % netdev_n_txq(netdev);
 
         ovs_spin_lock(&dev->tx_locks[qid].lock);
         ret = __netdev_afxdp_batch_send(netdev, qid, batch);
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 9d8096668..0078957ff 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2598,7 +2598,7 @@  __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
     int max_retries = VHOST_ENQ_RETRY_MIN;
     int vid = netdev_dpdk_get_vid(dev);
 
-    qid = dev->tx_q[qid % netdev->n_txq].map;
+    qid = dev->tx_q[qid].map;
 
     if (OVS_UNLIKELY(vid < 0 || !dev->vhost_reconfigured || qid < 0
                      || !(dev->flags & NETDEV_UP))) {
@@ -2872,7 +2872,6 @@  netdev_dpdk_send__(struct netdev_dpdk *dev, int qid,
     }
 
     if (OVS_UNLIKELY(concurrent_txq)) {
-        qid = qid % dev->up.n_txq;
         rte_spinlock_lock(&dev->tx_q[qid].tx_lock);
     }