From patchwork Tue Mar 23 03:51:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li RongQing X-Patchwork-Id: 1457021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F4Hf82MJ8z9sTD for ; Tue, 23 Mar 2021 14:58:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1654483D95; Tue, 23 Mar 2021 03:58:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dN75WYZqBEIK; Tue, 23 Mar 2021 03:58:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTP id 68CA783C8B; Tue, 23 Mar 2021 03:58:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 46C51C000B; Tue, 23 Mar 2021 03:58:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8B3B6C0001 for ; Tue, 23 Mar 2021 03:58:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7FF564045F for ; Tue, 23 Mar 2021 03:58:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AWlECA0esfrA for ; Tue, 23 Mar 2021 03:58:14 +0000 (UTC) X-Greylist: delayed 00:06:31 by SQLgrey-1.8.0 Received: from dbl-sys-mailin01.dbl01.baidu.com (mx435.baidu.com [119.249.100.99]) by smtp4.osuosl.org (Postfix) with ESMTP id 384A64045D for ; Tue, 23 Mar 2021 03:58:13 +0000 (UTC) Received: from bjhw-sys-rpm015653cc5.bjhw.baidu.com (bjhw-sys-rpm015653cc5.bjhw.baidu.com [10.227.53.39]) by dbl-sys-mailin01.dbl01.baidu.com (Postfix) with ESMTP id 8B78218180083 for ; Tue, 23 Mar 2021 11:51:33 +0800 (CST) From: Li RongQing To: dev@openvswitch.org Date: Tue, 23 Mar 2021 11:51:33 +0800 Message-Id: <1616471493-50477-1-git-send-email-lirongqing@baidu.com> Subject: [ovs-dev] [PATCH] netdev: Remove modulo operation in dpdk/vhost/afxdp tx path X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 --- lib/netdev-afxdp.c | 1 - lib/netdev-dpdk.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) 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); }