aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2011-08-26 03:43:32 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-09-20 02:57:04 -0400
commit153285f9ce88b2d37e29a351dfcf7601ff274c69 (patch)
treeb199948023a6157885f1f765eeb002c96218c506 /drivers
parenta74420e0f3bdb4bfd8b59a4e67442d642f22e5b9 (diff)
igb: Update max_frame_size to account for an optional VLAN tag if present
This patch modifies the max_frame_size in order account for an optional VLAN tag. In order to support this we must also increase the MAX_STD_JUMBO_FRAME_SIZE to account for the 4 extra bytes. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c19
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 577fd3e797e5..8e90b85e9f6e 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -117,8 +117,6 @@ struct vf_data_storage {
117#define IGB_RXBUFFER_2048 2048 117#define IGB_RXBUFFER_2048 2048
118#define IGB_RXBUFFER_16384 16384 118#define IGB_RXBUFFER_16384 16384
119 119
120#define MAX_STD_JUMBO_FRAME_SIZE 9234
121
122/* How many Tx Descriptors do we need to call netif_wake_queue ? */ 120/* How many Tx Descriptors do we need to call netif_wake_queue ? */
123#define IGB_TX_QUEUE_WAKE 16 121#define IGB_TX_QUEUE_WAKE 16
124/* How many Rx Buffers do we bundle into one write to the hardware ? */ 122/* How many Rx Buffers do we bundle into one write to the hardware ? */
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index aa78c10a2ec3..615627590259 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2396,7 +2396,8 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
2396 adapter->rx_itr_setting = IGB_DEFAULT_ITR; 2396 adapter->rx_itr_setting = IGB_DEFAULT_ITR;
2397 adapter->tx_itr_setting = IGB_DEFAULT_ITR; 2397 adapter->tx_itr_setting = IGB_DEFAULT_ITR;
2398 2398
2399 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 2399 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN +
2400 VLAN_HLEN;
2400 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 2401 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
2401 2402
2402 spin_lock_init(&adapter->stats64_lock); 2403 spin_lock_init(&adapter->stats64_lock);
@@ -2962,16 +2963,19 @@ static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size,
2962 **/ 2963 **/
2963static void igb_rlpml_set(struct igb_adapter *adapter) 2964static void igb_rlpml_set(struct igb_adapter *adapter)
2964{ 2965{
2965 u32 max_frame_size; 2966 u32 max_frame_size = adapter->max_frame_size;
2966 struct e1000_hw *hw = &adapter->hw; 2967 struct e1000_hw *hw = &adapter->hw;
2967 u16 pf_id = adapter->vfs_allocated_count; 2968 u16 pf_id = adapter->vfs_allocated_count;
2968 2969
2969 max_frame_size = adapter->max_frame_size + VLAN_TAG_SIZE;
2970
2971 /* if vfs are enabled we set RLPML to the largest possible request
2972 * size and set the VMOLR RLPML to the size we need */
2973 if (pf_id) { 2970 if (pf_id) {
2974 igb_set_vf_rlpml(adapter, max_frame_size, pf_id); 2971 igb_set_vf_rlpml(adapter, max_frame_size, pf_id);
2972 /*
2973 * If we're in VMDQ or SR-IOV mode, then set global RLPML
2974 * to our max jumbo frame size, in case we need to enable
2975 * jumbo frames on one of the rings later.
2976 * This will not pass over-length frames into the default
2977 * queue because it's gated by the VMOLR.RLPML.
2978 */
2975 max_frame_size = MAX_JUMBO_FRAME_SIZE; 2979 max_frame_size = MAX_JUMBO_FRAME_SIZE;
2976 } 2980 }
2977 2981
@@ -4461,7 +4465,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
4461{ 4465{
4462 struct igb_adapter *adapter = netdev_priv(netdev); 4466 struct igb_adapter *adapter = netdev_priv(netdev);
4463 struct pci_dev *pdev = adapter->pdev; 4467 struct pci_dev *pdev = adapter->pdev;
4464 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 4468 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
4465 u32 rx_buffer_len, i; 4469 u32 rx_buffer_len, i;
4466 4470
4467 if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) { 4471 if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) {
@@ -4469,6 +4473,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
4469 return -EINVAL; 4473 return -EINVAL;
4470 } 4474 }
4471 4475
4476#define MAX_STD_JUMBO_FRAME_SIZE 9238
4472 if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { 4477 if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
4473 dev_err(&pdev->dev, "MTU > 9216 not supported.\n"); 4478 dev_err(&pdev->dev, "MTU > 9216 not supported.\n");
4474 return -EINVAL; 4479 return -EINVAL;