ethernet/atheros: use core min/max MTU checking
atl2: min_mtu 40, max_mtu 1504 - Remove a few redundant defines that already have equivalents in if_ether.h. atl1: min_mtu 42, max_mtu 10218 atl1e: min_mtu 42, max_mtu 8170 atl1c: min_mtu 42, max_mtu 6122/1500 - GbE hardware gets a max_mtu of 6122, slower hardware gets 1500. alx: min_mtu 34, max_mtu 9256 - Not so sure that minimum MTU number is really what was intended, but that's what the math actually makes it out to be, due to max_frame manipulations and comparison in alx_change_mtu, rather than just comparing new_mtu. (I think 68 was the intended min_mtu value). CC: netdev@vger.kernel.org CC: Jay Cliburn <jcliburn@gmail.com> CC: Chris Snook <chris.snook@gmail.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committato da
David S. Miller

parent
60d2d8dd9e
commit
67bef94280
@@ -439,16 +439,10 @@ static int atl1e_set_features(struct net_device *netdev,
|
||||
static int atl1e_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
struct atl1e_adapter *adapter = netdev_priv(netdev);
|
||||
int old_mtu = netdev->mtu;
|
||||
int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
|
||||
|
||||
if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
|
||||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
|
||||
netdev_warn(adapter->netdev, "invalid MTU setting\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* set MTU */
|
||||
if (old_mtu != new_mtu && netif_running(netdev)) {
|
||||
if (netif_running(netdev)) {
|
||||
while (test_and_set_bit(__AT_RESETTING, &adapter->flags))
|
||||
msleep(1);
|
||||
netdev->mtu = new_mtu;
|
||||
@@ -2272,6 +2266,10 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
|
||||
netdev->netdev_ops = &atl1e_netdev_ops;
|
||||
|
||||
netdev->watchdog_timeo = AT_TX_WATCHDOG;
|
||||
/* MTU range: 42 - 8170 */
|
||||
netdev->min_mtu = ETH_ZLEN - (ETH_HLEN + VLAN_HLEN);
|
||||
netdev->max_mtu = MAX_JUMBO_FRAME_SIZE -
|
||||
(ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
|
||||
atl1e_set_ethtool_ops(netdev);
|
||||
|
||||
netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
|
||||
|
Fai riferimento in un nuovo problema
Block a user