linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gatis Peisenieks <gatis@mikrotik.com>
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 <gatis@mikrotik.com>
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	[thread overview]
Message-ID: <20210511190518.8901-3-gatis@mikrotik.com> (raw)
In-Reply-To: <20210511190518.8901-1-gatis@mikrotik.com>

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 <gatis@mikrotik.com>
---
 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


  parent reply	other threads:[~2021-05-11 19:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 19:05 [PATCH net-next 0/4] atl1c: support for Mikrotik 10/25G NIC features Gatis Peisenieks
2021-05-11 19:05 ` [PATCH net-next 1/4] atl1c: show correct link speed on Mikrotik 10/25G NIC Gatis Peisenieks
2021-05-11 19:05 ` Gatis Peisenieks [this message]
2021-05-11 21:39   ` [PATCH net-next 2/4] atl1c: improve performance by avoiding unnecessary pcie writes on xmit Eric Dumazet
2021-05-12  7:53     ` Gatis Peisenieks
2021-05-12  2:39   ` Chris Snook
2021-05-12  8:33     ` David Laight
2021-05-12 14:35     ` Gatis Peisenieks
2021-05-11 19:05 ` [PATCH net-next 3/4] atl1c: adjust max mtu according to Mikrotik 10/25G NIC ability Gatis Peisenieks
2021-05-11 19:05 ` [PATCH net-next 4/4] atl1c: enable rx csum offload on Mikrotik 10/25G NIC Gatis Peisenieks
  -- strict thread matches above, loose matches on Subject: below --
2021-04-19 14:34 [PATCH net-next 0/4] atl1c: support for Mikrotik 10/25G NIC features Gatis Peisenieks
2021-04-19 14:34 ` [PATCH net-next 2/4] atl1c: improve performance by avoiding unnecessary pcie writes on xmit Gatis Peisenieks

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=20210511190518.8901-3-gatis@mikrotik.com \
    --to=gatis@mikrotik.com \
    --cc=chris.snook@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dchickles@marvell.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tully@mikrotik.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;
as well as URLs for NNTP newsgroup(s).