From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [RFC PATCH 10/20] igb: Revert "igb: Revert support for build_skb in igb"
Date: Mon, 19 Dec 2016 12:11:40 -0800 [thread overview]
Message-ID: <20161219201140.27116.98146.stgit@localhost.localdomain> (raw)
In-Reply-To: <20161219200456.27116.28900.stgit@localhost.localdomain>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This reverts commit f9d40f6a9921 ("igb: Revert support for build_skb in
igb") and adds a few changes to update it to work with the latest version
of igb. We are now able to revert the removal of this due to the fact
that with the recent changes to the page count and the use of
DMA_ATTR_SKIP_CPU_SYNC we can make the pages writable so we should not be
invalidating the additional data added when we call build_skb.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 47 +++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index cea252fc7582..ffafb50f458f 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6990,6 +6990,51 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring,
return skb;
}
+static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring,
+ struct igb_rx_buffer *rx_buffer,
+ union e1000_adv_rx_desc *rx_desc,
+ unsigned int size)
+{
+ void *va = page_address(rx_buffer->page) + rx_buffer->page_offset;
+#if (PAGE_SIZE < 8192)
+ unsigned int truesize = igb_rx_pg_size(rx_ring) / 2;
+#else
+ unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
+ SKB_DATA_ALIGN(IGB_SKB_PAD + size);
+#endif
+ struct sk_buff *skb;
+
+ /* prefetch first cache line of first page */
+ prefetch(va);
+#if L1_CACHE_BYTES < 128
+ prefetch(va + L1_CACHE_BYTES);
+#endif
+
+ /* build an skb to around the page buffer */
+ skb = build_skb(va - IGB_SKB_PAD, truesize);
+ if (unlikely(!skb))
+ return NULL;
+
+ /* update pointers within the skb to store the data */
+ skb_reserve(skb, IGB_SKB_PAD);
+ __skb_put(skb, size);
+
+ /* pull timestamp out of packet data */
+ if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
+ igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb);
+ __skb_pull(skb, IGB_TS_HDR_LEN);
+ }
+
+ /* update buffer offset */
+#if (PAGE_SIZE < 8192)
+ rx_buffer->page_offset ^= truesize;
+#else
+ rx_buffer->page_offset += truesize;
+#endif
+
+ return skb;
+}
+
static inline void igb_rx_checksum(struct igb_ring *ring,
union e1000_adv_rx_desc *rx_desc,
struct sk_buff *skb)
@@ -7219,6 +7264,8 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
/* retrieve a buffer from the ring */
if (skb)
igb_add_rx_frag(rx_ring, rx_buffer, skb, size);
+ else if (ring_uses_build_skb(rx_ring))
+ skb = igb_build_skb(rx_ring, rx_buffer, rx_desc, size);
else
skb = igb_construct_skb(rx_ring, rx_buffer,
rx_desc, size);
next prev parent reply other threads:[~2016-12-19 20:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 20:10 [Intel-wired-lan] [RFC PATCH 00/20] Enable the use of build_skb in igb/ixgbe Alexander Duyck
2016-12-19 20:10 ` [Intel-wired-lan] [RFC PATCH 01/20] mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free Alexander Duyck
2016-12-19 20:10 ` [Intel-wired-lan] [RFC PATCH 02/20] mm: Rename __page_frag functions to __page_frag_cache, drop order from drain Alexander Duyck
2016-12-19 20:10 ` [Intel-wired-lan] [RFC PATCH 03/20] mm: Add documentation for page fragment APIs Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 04/20] igb: Add support for DMA_ATTR_WEAK_ORDERING Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 05/20] igb: Use length to determine if descriptor is done Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 06/20] igb: Limit maximum frame Rx based on MTU Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 07/20] igb: Add support for padding packet Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 08/20] igb: Add support for ethtool private flag to allow use of legacy Rx Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 09/20] igb: Break out Rx buffer page management Alexander Duyck
2016-12-19 20:11 ` Alexander Duyck [this message]
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 11/20] ixgbe: Add function for checking to see if we can reuse page Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 12/20] ixgbe: Only DMA sync frame length Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 13/20] ixgbe: Update driver to make use of DMA attributes in Rx path Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 14/20] ixgbe: Update code to better handle incrementing page count Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 15/20] ixgbe: Make use of order 1 pages and 3K buffers independent of FCoE Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 16/20] ixgbe: Use length to determine if descriptor is done Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 17/20] ixgbe: Break out Rx buffer page management Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 18/20] ixgbe: Add support for padding packet Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 19/20] ixgbe: Add private flag to control buffer mode Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 20/20] ixgbe: Add support for build_skb Alexander Duyck
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=20161219201140.27116.98146.stgit@localhost.localdomain \
--to=alexander.duyck@gmail.com \
--cc=intel-wired-lan@osuosl.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.