netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 06/12] ixgbe: cleanup logic in ixgbe_change_mtu
Date: Sat, 17 Mar 2012 01:50:54 -0700	[thread overview]
Message-ID: <1331974260-6383-7-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1331974260-6383-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Alexander Duyck <alexander.h.duyck@intel.com>

This change is meant to just cleanup the logic in ixgbe_change_mtu since we
are making it unnecessarily complex due to a workaround required for 82599
when SR-IOV is enabled.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index e97ef45..db1f17c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5544,20 +5544,24 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter)
 static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
 {
 	struct ixgbe_adapter *adapter = netdev_priv(netdev);
-	struct ixgbe_hw *hw = &adapter->hw;
 	int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
 
 	/* MTU < 68 is an error and causes problems on some kernels */
-	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED &&
-	    hw->mac.type != ixgbe_mac_X540) {
-		if ((new_mtu < 68) || (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE))
-			return -EINVAL;
-	} else {
-		if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
+	if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
+		return -EINVAL;
+
+	/*
+	 * For 82599EB we cannot allow PF to change MTU greater than 1500
+	 * in SR-IOV mode as it may cause buffer overruns in guest VFs that
+	 * don't allocate and chain buffers correctly.
+	 */
+	if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
+	    (adapter->hw.mac.type == ixgbe_mac_82599EB) &&
+	    (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE))
 			return -EINVAL;
-	}
 
 	e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
+
 	/* must set new MTU before calling down or up */
 	netdev->mtu = new_mtu;
 
-- 
1.7.7.6

  parent reply	other threads:[~2012-03-17  8:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-17  8:50 [net-next 00/12][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-03-17  8:50 ` [net-next 01/12] igb: Support sending custom Ethernet FCS Jeff Kirsher
2012-03-17  8:50 ` [net-next 02/12] igb: Support RX-ALL feature flag Jeff Kirsher
2012-03-17  8:50 ` [net-next 03/12] ixgbe: Support sending custom Ethernet FCS Jeff Kirsher
2012-03-17  8:50 ` [net-next 04/12] ixgbe: Support RX-ALL feature flag Jeff Kirsher
2012-03-17  8:50 ` [net-next 05/12] ixgbe: Replace standard receive path with a page based receive Jeff Kirsher
2012-03-17  8:50 ` Jeff Kirsher [this message]
2012-03-17  8:50 ` [net-next 07/12] ixgbe: Make certain that all frames fit minimum size requirements Jeff Kirsher
2012-03-17  8:50 ` [net-next 08/12] ixgbe: Modify setup of descriptor flags to avoid conditional jumps Jeff Kirsher
2012-03-17  8:50 ` [net-next 09/12] ixgbe: Use packets to track Tx completions instead of a seperate value Jeff Kirsher
2012-03-17  8:50 ` [net-next 10/12] ixgbe: Place skb on first buffer_info structure to avoid using stack space Jeff Kirsher
2012-03-17  8:50 ` [net-next 11/12] ixgbe: Write gso_segs and bytcount to the ring sooner Jeff Kirsher
2012-03-17  8:51 ` [net-next 12/12] ixgbe: always write DMA for single_mapped value with skb Jeff Kirsher
2012-03-17  9:06 ` [net-next 00/12][pull request] Intel Wired LAN Driver Updates 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=1331974260-6383-7-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.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).