From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH v3 5/9] igb: Limit maximum frame Rx based on MTU
Date: Mon, 23 Jan 2017 08:59:00 -0800 [thread overview]
Message-ID: <20170123165856.13402.70299.stgit@localhost.localdomain> (raw)
In-Reply-To: <20170123165647.13402.1254.stgit@localhost.localdomain>
From: Alexander Duyck <alexander.h.duyck@intel.com>
In order to support the use of build_skb going forward it will be necessary
to place a maximum limit on the amount of data we can receive when jumbo
frames is not enabled. In order to do this I am adding a new upper limit
for receive based on the size of a 2K buffer minus padding.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
drivers/net/ethernet/intel/igb/igb.h | 10 +++++++++-
drivers/net/ethernet/intel/igb/igb_main.c | 16 ++++++++++++----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index a638254f4e06..a74928cc0e58 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -143,8 +143,17 @@ struct vf_data_storage {
#define IGB_RXBUFFER_256 256
#define IGB_RXBUFFER_2048 2048
#define IGB_RX_HDR_LEN IGB_RXBUFFER_256
+#define IGB_TS_HDR_LEN 16
#define IGB_RX_BUFSZ IGB_RXBUFFER_2048
+#define IGB_SKB_PAD (NET_SKB_PAD + NET_IP_ALIGN)
+#if (PAGE_SIZE < 8192)
+#define IGB_MAX_FRAME_BUILD_SKB \
+ (SKB_WITH_OVERHEAD(IGB_RXBUFFER_2048) - IGB_SKB_PAD - IGB_TS_HDR_LEN)
+#else
+#define IGB_MAX_FRAME_BUILD_SKB (IGB_RXBUFFER_2048 - IGB_TS_HDR_LEN)
+#endif
+
/* How many Rx Buffers do we bundle into one write to the hardware ? */
#define IGB_RX_BUFFER_WRITE 16 /* Must be power of 2 */
@@ -561,7 +570,6 @@ struct igb_adapter {
#define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coal Flush */
#define IGB_82576_TSYNC_SHIFT 19
-#define IGB_TS_HDR_LEN 16
enum e1000_state_t {
__IGB_TESTING,
__IGB_RESETTING,
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 3f3ae098e39a..d881c51ef162 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4250,7 +4250,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
unsigned int vfn = adapter->vfs_allocated_count;
- u32 rctl = 0, vmolr = 0;
+ u32 rctl = 0, vmolr = 0, rlpml = MAX_JUMBO_FRAME_SIZE;
int count;
/* Check for Promiscuous and All Multicast modes */
@@ -4322,12 +4322,20 @@ static void igb_set_rx_mode(struct net_device *netdev)
vmolr |= rd32(E1000_VMOLR(vfn)) &
~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE);
- /* enable Rx jumbo frames, no need for restriction */
+ /* enable Rx jumbo frames, restrict as needed to support build_skb */
vmolr &= ~E1000_VMOLR_RLPML_MASK;
- vmolr |= MAX_JUMBO_FRAME_SIZE | E1000_VMOLR_LPE;
+#if (PAGE_SIZE < 8192)
+ if (adapter->max_frame_size <= IGB_MAX_FRAME_BUILD_SKB) {
+ if (!adapter->vfs_allocated_count)
+ rlpml = IGB_MAX_FRAME_BUILD_SKB;
+ vmolr |= IGB_MAX_FRAME_BUILD_SKB;
+ } else
+#endif
+ vmolr |= MAX_JUMBO_FRAME_SIZE;
+ vmolr |= E1000_VMOLR_LPE;
wr32(E1000_VMOLR(vfn), vmolr);
- wr32(E1000_RLPML, MAX_JUMBO_FRAME_SIZE);
+ wr32(E1000_RLPML, rlpml);
igb_restore_vf_multicasts(adapter);
}
next prev parent reply other threads:[~2017-01-23 16:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-23 16:57 [Intel-wired-lan] [next PATCH v3 0/9] igb: Add support for writable pages and build_skb Alexander Duyck
2017-01-23 16:58 ` [Intel-wired-lan] [next PATCH v3 1/9] igb: Add support for DMA_ATTR_WEAK_ORDERING Alexander Duyck
2017-01-23 16:58 ` [Intel-wired-lan] [next PATCH v3 2/9] igb: Use length to determine if descriptor is done Alexander Duyck
2017-01-23 16:58 ` [Intel-wired-lan] [next PATCH v3 3/9] igb: Clear Rx buffer_info in configure instead of clean Alexander Duyck
2017-01-23 16:58 ` [Intel-wired-lan] [next PATCH v3 4/9] igb: Don't bother clearing Tx buffer_info in igb_clean_tx_ring Alexander Duyck
2017-01-23 16:59 ` Alexander Duyck [this message]
2017-01-23 16:59 ` [Intel-wired-lan] [next PATCH v3 6/9] igb: Add support for padding packet Alexander Duyck
2017-02-03 4:01 ` Brown, Aaron F
2017-02-03 17:58 ` Alexander Duyck
2017-02-04 0:39 ` Brown, Aaron F
2017-02-06 4:44 ` Alexander Duyck
2017-02-06 23:20 ` Brown, Aaron F
2017-02-07 1:15 ` Brown, Aaron F
2017-02-07 1:51 ` Alexander Duyck
2017-02-07 2:11 ` Alexander Duyck
2017-01-23 16:59 ` [Intel-wired-lan] [next PATCH v3 7/9] igb: Add support for ethtool private flag to allow use of legacy Rx Alexander Duyck
2017-01-23 16:59 ` [Intel-wired-lan] [next PATCH v3 8/9] igb: Break out Rx buffer page management Alexander Duyck
2017-01-23 16:59 ` [Intel-wired-lan] [next PATCH v3 9/9] igb: Re-add support for build_skb in igb 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=20170123165856.13402.70299.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.