mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-26 04:25:27 +08:00
ethernet/sun: use core min/max MTU checking
cassini: min_mtu 60, max_mtu 9000 niu: min_mtu 68, max_mtu 9216 sungem: min_mtu 68, max_mtu 1500 (comments say jumbo mode is broken) sunvnet: min_mtu 68, max_mtu 65535 - removed sunvnet_change_mut_common as it does nothing now CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c7315a95c2
commit
540bfe30dc
@ -3863,9 +3863,6 @@ static int cas_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct cas *cp = netdev_priv(dev);
|
||||
|
||||
if (new_mtu < CAS_MIN_MTU || new_mtu > CAS_MAX_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
if (!netif_running(dev) || !netif_device_present(dev))
|
||||
return 0;
|
||||
@ -5115,6 +5112,10 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if (pci_using_dac)
|
||||
dev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
/* MTU range: 60 - varies or 9000 */
|
||||
dev->min_mtu = CAS_MIN_MTU;
|
||||
dev->max_mtu = CAS_MAX_MTU;
|
||||
|
||||
if (register_netdev(dev)) {
|
||||
dev_err(&pdev->dev, "Cannot register net device, aborting\n");
|
||||
goto err_out_free_consistent;
|
||||
|
@ -139,7 +139,6 @@ static const struct net_device_ops vsw_ops = {
|
||||
.ndo_set_mac_address = sunvnet_set_mac_addr_common,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_tx_timeout = sunvnet_tx_timeout_common,
|
||||
.ndo_change_mtu = sunvnet_change_mtu_common,
|
||||
.ndo_start_xmit = vsw_start_xmit,
|
||||
.ndo_select_queue = vsw_select_queue,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
@ -239,6 +238,10 @@ static struct net_device *vsw_alloc_netdev(u8 hwaddr[],
|
||||
NETIF_F_HW_CSUM | NETIF_F_SG;
|
||||
dev->features = dev->hw_features;
|
||||
|
||||
/* MTU range: 68 - 65535 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = VNET_MAX_MTU;
|
||||
|
||||
SET_NETDEV_DEV(dev, &vdev->dev);
|
||||
|
||||
return dev;
|
||||
|
@ -6754,9 +6754,6 @@ static int niu_change_mtu(struct net_device *dev, int new_mtu)
|
||||
struct niu *np = netdev_priv(dev);
|
||||
int err, orig_jumbo, new_jumbo;
|
||||
|
||||
if (new_mtu < 68 || new_mtu > NIU_MAX_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
orig_jumbo = (dev->mtu > ETH_DATA_LEN);
|
||||
new_jumbo = (new_mtu > ETH_DATA_LEN);
|
||||
|
||||
@ -9823,6 +9820,10 @@ static int niu_pci_init_one(struct pci_dev *pdev,
|
||||
|
||||
dev->irq = pdev->irq;
|
||||
|
||||
/* MTU range: 68 - 9216 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = NIU_MAX_MTU;
|
||||
|
||||
niu_assign_netdev_ops(dev);
|
||||
|
||||
err = niu_get_invariants(np);
|
||||
|
@ -2476,9 +2476,9 @@ static void gem_set_multicast(struct net_device *dev)
|
||||
}
|
||||
|
||||
/* Jumbo-grams don't seem to work :-( */
|
||||
#define GEM_MIN_MTU 68
|
||||
#define GEM_MIN_MTU ETH_MIN_MTU
|
||||
#if 1
|
||||
#define GEM_MAX_MTU 1500
|
||||
#define GEM_MAX_MTU ETH_DATA_LEN
|
||||
#else
|
||||
#define GEM_MAX_MTU 9000
|
||||
#endif
|
||||
@ -2487,9 +2487,6 @@ static int gem_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct gem *gp = netdev_priv(dev);
|
||||
|
||||
if (new_mtu < GEM_MIN_MTU || new_mtu > GEM_MAX_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
|
||||
/* We'll just catch it later when the device is up'd or resumed */
|
||||
@ -2977,6 +2974,10 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if (pci_using_dac)
|
||||
dev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
/* MTU range: 68 - 1500 (Jumbo mode is broken) */
|
||||
dev->min_mtu = GEM_MIN_MTU;
|
||||
dev->max_mtu = GEM_MAX_MTU;
|
||||
|
||||
/* Register with kernel */
|
||||
if (register_netdev(dev)) {
|
||||
pr_err("Cannot register net device, aborting\n");
|
||||
|
@ -159,7 +159,6 @@ static const struct net_device_ops vnet_ops = {
|
||||
.ndo_set_mac_address = sunvnet_set_mac_addr_common,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_tx_timeout = sunvnet_tx_timeout_common,
|
||||
.ndo_change_mtu = sunvnet_change_mtu_common,
|
||||
.ndo_start_xmit = vnet_start_xmit,
|
||||
.ndo_select_queue = vnet_select_queue,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
@ -202,6 +201,10 @@ static struct vnet *vnet_new(const u64 *local_mac,
|
||||
NETIF_F_HW_CSUM | NETIF_F_SG;
|
||||
dev->features = dev->hw_features;
|
||||
|
||||
/* MTU range: 68 - 65535 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = VNET_MAX_MTU;
|
||||
|
||||
SET_NETDEV_DEV(dev, &vdev->dev);
|
||||
|
||||
err = register_netdev(dev);
|
||||
|
@ -1583,16 +1583,6 @@ void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sunvnet_set_rx_mode_common);
|
||||
|
||||
int sunvnet_change_mtu_common(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu < 68 || new_mtu > 65535)
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sunvnet_change_mtu_common);
|
||||
|
||||
int sunvnet_set_mac_addr_common(struct net_device *dev, void *p)
|
||||
{
|
||||
return -EINVAL;
|
||||
|
@ -15,6 +15,8 @@
|
||||
#define VNET_MINTSO 2048 /* VIO protocol's minimum TSO len */
|
||||
#define VNET_MAXTSO 65535 /* VIO protocol's maximum TSO len */
|
||||
|
||||
#define VNET_MAX_MTU 65535
|
||||
|
||||
/* VNET packets are sent in buffers with the first 6 bytes skipped
|
||||
* so that after the ethernet header the IPv4/IPv6 headers are aligned
|
||||
* properly.
|
||||
@ -125,7 +127,6 @@ int sunvnet_close_common(struct net_device *dev);
|
||||
void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp);
|
||||
int sunvnet_set_mac_addr_common(struct net_device *dev, void *p);
|
||||
void sunvnet_tx_timeout_common(struct net_device *dev);
|
||||
int sunvnet_change_mtu_common(struct net_device *dev, int new_mtu);
|
||||
int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
|
||||
struct vnet_port *(*vnet_tx_port)
|
||||
(struct sk_buff *, struct net_device *));
|
||||
|
Loading…
Reference in New Issue
Block a user