From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: oss-drivers@netronome.com, netdev@vger.kernel.org,
Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH net-next 01/11] nfp: copy only the relevant part of the TX descriptor for frags
Date: Tue, 27 Nov 2018 22:24:48 -0800 [thread overview]
Message-ID: <20181128062458.12087-2-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20181128062458.12087-1-jakub.kicinski@netronome.com>
Chained descriptors for fragments need to duplicate all the descriptor
fields of the skb head, so we copy the descriptor and then modify the
relevant fields. This is wasteful, because the top half of the descriptor
will get overwritten entirely while the bottom half is not modified at all.
Copy only the bottom half. This saves us 0.3% of CPU in a GSO test.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
---
drivers/net/ethernet/netronome/nfp/nfp_net.h | 1 +
drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 12 +++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net.h b/drivers/net/ethernet/netronome/nfp/nfp_net.h
index bb3dbd74583b..5a9a6178cf26 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net.h
@@ -158,6 +158,7 @@ struct nfp_net_tx_desc {
__le16 data_len; /* Length of frame + meta data */
} __packed;
__le32 vals[4];
+ __le64 vals8[2];
};
};
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 9aa6265bf4de..b54c6e481229 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -786,11 +786,11 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
{
struct nfp_net *nn = netdev_priv(netdev);
const struct skb_frag_struct *frag;
- struct nfp_net_tx_desc *txd, txdg;
int f, nr_frags, wr_idx, md_bytes;
struct nfp_net_tx_ring *tx_ring;
struct nfp_net_r_vector *r_vec;
struct nfp_net_tx_buf *txbuf;
+ struct nfp_net_tx_desc *txd;
struct netdev_queue *nd_q;
struct nfp_net_dp *dp;
dma_addr_t dma_addr;
@@ -860,8 +860,10 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
/* Gather DMA */
if (nr_frags > 0) {
+ __le64 second_half;
+
/* all descs must match except for in addr, length and eop */
- txdg = *txd;
+ second_half = txd->vals8[1];
for (f = 0; f < nr_frags; f++) {
frag = &skb_shinfo(skb)->frags[f];
@@ -878,11 +880,11 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
tx_ring->txbufs[wr_idx].fidx = f;
txd = &tx_ring->txds[wr_idx];
- *txd = txdg;
txd->dma_len = cpu_to_le16(fsize);
nfp_desc_set_dma_addr(txd, dma_addr);
- txd->offset_eop |=
- (f == nr_frags - 1) ? PCIE_DESC_TX_EOP : 0;
+ txd->offset_eop = md_bytes |
+ ((f == nr_frags - 1) ? PCIE_DESC_TX_EOP : 0);
+ txd->vals8[1] = second_half;
}
u64_stats_update_begin(&r_vec->tx_sync);
--
2.17.1
next prev parent reply other threads:[~2018-11-28 17:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 6:24 [PATCH net-next 00/11] nfp: update TX path to enable repr offloads Jakub Kicinski
2018-11-28 6:24 ` Jakub Kicinski [this message]
2018-11-28 6:24 ` [PATCH net-next 02/11] nfp: move temporary variables in nfp_net_tx_complete() Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 03/11] nfp: move queue variable init Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 04/11] nfp: correct descriptor offsets in presence of metadata Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 05/11] nfp: avoid oversized TSO headers with metadata prepend Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 06/11] nfp: run representor TX locklessly Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 07/11] nfp: run don't require Qdiscs on representor netdevs Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 08/11] nfp: add locking around representor changes Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 09/11] nfp: add offloads on representors Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 10/11] nfp: add offset to all TLV parsing errors Jakub Kicinski
2018-11-28 6:24 ` [PATCH net-next 11/11] nfp: report more info when reconfiguration fails Jakub Kicinski
2018-11-30 21:31 ` [PATCH net-next 00/11] nfp: update TX path to enable repr offloads David Miller
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=20181128062458.12087-2-jakub.kicinski@netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.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).