Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3800946pxj; Tue, 11 May 2021 12:08:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzx7qo5y4jelmVygjVZO3f1nZtuN5Ybt3XcHi4mVpxuLnGcS4E4nswz0pWOTo2eItyM+NpM X-Received: by 2002:a17:906:994f:: with SMTP id zm15mr33763342ejb.24.1620760105780; Tue, 11 May 2021 12:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620760105; cv=none; d=google.com; s=arc-20160816; b=VCFbJCrscw4YsDZiDyaUQcUf6K40DhOWC2z+m6aBeCCMrXzfQJcOxm2A10POHghFuL 9AQJ4ygBVVSSL12nYUrKTJBWhwca9uKYAm7Kki5Rv68ongva+jWIzFKqXPUaa+4v29If naLh+4X2rxP66kw9dhaNrnOi7F6wfwiTGaN+ZMR4ZKs5dj3uzZ8+OKZAov1ALCgtEk5N v+/rs5nhfpr6zagyXdPLdl8V9fb04H4KP/KmD34D/UVJHXjbVJNtgdXYyfzBxwXu2bW6 +IgjT+R6J+D0bLyyRFQEPdrV3oCgacglHfC4OHSXPE3s+u9UMsQ6M8/1bLflcL8lBAPC Owzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d66AkV3nR9rzbmrewDWsy6dcNlU8qWbQwCazkPc7izI=; b=D/xbE4munfIon4qFc7D8ST9pkFbdO7mX2jfUCeS3lkgH8l90tsVtOr9uk7DBN89IKm STMFHFZ78jwZvdp09DuZpqdzr/Z/hV3udKN1FtsuCO+Y2jvCypcFqBgWrFbS95UB83hl WIEhH1uG74N7ZoiuD6WX4nBh5M5IUT7ulzL8z7kWuFVmymyt7N7ws+Vwl4Xn8zZvgGxX QyeoK2ORoMKD2/akkiJ/jLC2kbZqjJVW80BG+cFGrlxFJLh5Kd7XDtUKtgpe6ysq7fWR 9xorU6py2NJ8XDWfTwh9zHRKxfK4iN1hv1uLnCGe1AmCj25uQjeAZ6wB0n5rB6uClL/p FAsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si18228707edy.134.2021.05.11.12.08.01; Tue, 11 May 2021 12:08:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232267AbhEKTHA (ORCPT + 99 others); Tue, 11 May 2021 15:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231998AbhEKTGr (ORCPT ); Tue, 11 May 2021 15:06:47 -0400 Received: from plekste.mt.lv (bute.mt.lv [IPv6:2a02:610:7501:2000::195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23416C061761; Tue, 11 May 2021 12:05:39 -0700 (PDT) Received: from [2a02:610:7501:feff:1ccf:41ff:fe50:18b9] (helo=localhost.localdomain) by plekste.mt.lv with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1lgXhA-0004HR-Vb; Tue, 11 May 2021 22:05:28 +0300 From: Gatis Peisenieks To: chris.snook@gmail.com, davem@davemloft.net, kuba@kernel.org, hkallweit1@gmail.com, jesse.brandeburg@intel.com, dchickles@marvell.com, tully@mikrotik.com, eric.dumazet@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Gatis Peisenieks Subject: [PATCH net-next 2/4] atl1c: improve performance by avoiding unnecessary pcie writes on xmit Date: Tue, 11 May 2021 22:05:16 +0300 Message-Id: <20210511190518.8901-3-gatis@mikrotik.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511190518.8901-1-gatis@mikrotik.com> References: <20210511190518.8901-1-gatis@mikrotik.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel has xmit_more facility that hints the networking driver xmit path about whether more packets are coming soon. This information can be used to avoid unnecessary expensive PCIe transaction per tx packet at a slight increase in latency. Max TX pps on Mikrotik 10/25G NIC in a Threadripper 3960X system improved from 1150Kpps to 1700Kpps. Signed-off-by: Gatis Peisenieks --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 28c30d5288e4..2a8ab51b0ed9 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -2211,8 +2211,8 @@ static int atl1c_tx_map(struct atl1c_adapter *adapter, return -1; } -static void atl1c_tx_queue(struct atl1c_adapter *adapter, struct sk_buff *skb, - struct atl1c_tpd_desc *tpd, enum atl1c_trans_queue type) +static void atl1c_tx_queue(struct atl1c_adapter *adapter, + enum atl1c_trans_queue type) { struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type]; u16 reg; @@ -2238,6 +2238,7 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, if (atl1c_tpd_avail(adapter, type) < tpd_req) { /* no enough descriptor, just stop queue */ + atl1c_tx_queue(adapter, type); netif_stop_queue(netdev); return NETDEV_TX_BUSY; } @@ -2246,6 +2247,7 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, /* do TSO and check sum */ if (atl1c_tso_csum(adapter, skb, &tpd, type) != 0) { + atl1c_tx_queue(adapter, type); dev_kfree_skb_any(skb); return NETDEV_TX_OK; } @@ -2270,8 +2272,11 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, atl1c_tx_rollback(adapter, tpd, type); dev_kfree_skb_any(skb); } else { - netdev_sent_queue(adapter->netdev, skb->len); - atl1c_tx_queue(adapter, skb, tpd, type); + bool more = netdev_xmit_more(); + + __netdev_sent_queue(adapter->netdev, skb->len, more); + if (!more) + atl1c_tx_queue(adapter, type); } return NETDEV_TX_OK; -- 2.31.1