diff options
author | Bruce Allan <bruce.w.allan@intel.com> | 2009-06-02 07:28:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-03 05:46:33 -0400 |
commit | 2adc55c959940fc680074392eddbd5585a76f3d9 (patch) | |
tree | bf5050070f1f0ef3dd6d1f951d0a50c7ac8aa161 /drivers/net/e1000e/netdev.c | |
parent | 3ec2a2b80f3eb53851fe4cef9e65b5d33376ef89 (diff) |
e1000e: specify max supported frame size in adapter struct
By putting the maximum frame size supported by the hardware into the
adapter structure, the change_mtu entry point function can be cleaned
up of checks for all the different max frame sizes supported by
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index b7a46c513783..4072fbb6493d 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4212,27 +4212,17 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
4212 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4212 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4213 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 4213 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
4214 | 4214 | ||
4215 | if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) || | 4215 | /* Jumbo frame support */ |
4216 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { | 4216 | if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) && |
4217 | e_err("Invalid MTU setting\n"); | 4217 | !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
4218 | e_err("Jumbo Frames not supported.\n"); | ||
4218 | return -EINVAL; | 4219 | return -EINVAL; |
4219 | } | 4220 | } |
4220 | 4221 | ||
4221 | /* Jumbo frame size limits */ | 4222 | /* Supported frame sizes */ |
4222 | if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { | 4223 | if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) || |
4223 | if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { | 4224 | (max_frame > adapter->max_hw_frame_size)) { |
4224 | e_err("Jumbo Frames not supported.\n"); | 4225 | e_err("Unsupported MTU setting\n"); |
4225 | return -EINVAL; | ||
4226 | } | ||
4227 | if (adapter->hw.phy.type == e1000_phy_ife) { | ||
4228 | e_err("Jumbo Frames not supported.\n"); | ||
4229 | return -EINVAL; | ||
4230 | } | ||
4231 | } | ||
4232 | |||
4233 | #define MAX_STD_JUMBO_FRAME_SIZE 9234 | ||
4234 | if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { | ||
4235 | e_err("MTU > 9216 not supported.\n"); | ||
4236 | return -EINVAL; | 4226 | return -EINVAL; |
4237 | } | 4227 | } |
4238 | 4228 | ||
@@ -4848,6 +4838,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4848 | adapter->flags2 = ei->flags2; | 4838 | adapter->flags2 = ei->flags2; |
4849 | adapter->hw.adapter = adapter; | 4839 | adapter->hw.adapter = adapter; |
4850 | adapter->hw.mac.type = ei->mac; | 4840 | adapter->hw.mac.type = ei->mac; |
4841 | adapter->max_hw_frame_size = ei->max_hw_frame_size; | ||
4851 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 4842 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; |
4852 | 4843 | ||
4853 | mmio_start = pci_resource_start(pdev, 0); | 4844 | mmio_start = pci_resource_start(pdev, 0); |