mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-10 11:30:49 +00:00
Merge branch 'MTU-core-range-checking-more'
Jarod Wilson says:
====================
net: use core MTU range checking everywhere
This stack of patches should get absolutely everything in the kernel
converted from doing their own MTU range checking to the core MTU range
checking. This second spin includes alterations to hopefully fix all
concerns raised with the first, as well as including some additional
changes to drivers and infrastructure where I completely missed necessary
updates.
These have all been built through the 0-day build infrastructure via the
(rebasing) master branch at https://github.com/jarodwilson/linux-muck, which
at the time of the most recent compile across 147 configs, was based on
net-next at commit 7b1536ef0a
.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
9e58c5dc4b
@ -256,13 +256,6 @@ static void uml_net_tx_timeout(struct net_device *dev)
|
||||
netif_wake_queue(dev);
|
||||
}
|
||||
|
||||
static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
dev->mtu = new_mtu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
static void uml_net_poll_controller(struct net_device *dev)
|
||||
{
|
||||
@ -374,7 +367,6 @@ static const struct net_device_ops uml_netdev_ops = {
|
||||
.ndo_set_rx_mode = uml_net_set_multicast_list,
|
||||
.ndo_tx_timeout = uml_net_tx_timeout,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_change_mtu = uml_net_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = uml_net_poll_controller,
|
||||
|
@ -4248,7 +4248,6 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
|
||||
static const struct net_device_ops hdlcdev_ops = {
|
||||
.ndo_open = hdlcdev_open,
|
||||
.ndo_stop = hdlcdev_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = hdlcdev_ioctl,
|
||||
.ndo_tx_timeout = hdlcdev_tx_timeout,
|
||||
|
@ -1349,15 +1349,6 @@ static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
static int fwnet_change_mtu(struct net_device *net, int new_mtu)
|
||||
{
|
||||
if (new_mtu < 68)
|
||||
return -EINVAL;
|
||||
|
||||
net->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ethtool_ops fwnet_ethtool_ops = {
|
||||
.get_link = ethtool_op_get_link,
|
||||
};
|
||||
@ -1366,7 +1357,6 @@ static const struct net_device_ops fwnet_netdev_ops = {
|
||||
.ndo_open = fwnet_open,
|
||||
.ndo_stop = fwnet_stop,
|
||||
.ndo_start_xmit = fwnet_tx,
|
||||
.ndo_change_mtu = fwnet_change_mtu,
|
||||
};
|
||||
|
||||
static void fwnet_init_dev(struct net_device *net)
|
||||
@ -1435,7 +1425,6 @@ static int fwnet_probe(struct fw_unit *unit,
|
||||
struct net_device *net;
|
||||
bool allocated_netdev = false;
|
||||
struct fwnet_device *dev;
|
||||
unsigned max_mtu;
|
||||
int ret;
|
||||
union fwnet_hwaddr *ha;
|
||||
|
||||
@ -1478,9 +1467,10 @@ static int fwnet_probe(struct fw_unit *unit,
|
||||
* Use the RFC 2734 default 1500 octets or the maximum payload
|
||||
* as initial MTU
|
||||
*/
|
||||
max_mtu = (1 << (card->max_receive + 1))
|
||||
- sizeof(struct rfc2734_header) - IEEE1394_GASP_HDR_SIZE;
|
||||
net->mtu = min(1500U, max_mtu);
|
||||
net->max_mtu = (1 << (card->max_receive + 1))
|
||||
- sizeof(struct rfc2734_header) - IEEE1394_GASP_HDR_SIZE;
|
||||
net->mtu = min(1500U, net->max_mtu);
|
||||
net->min_mtu = ETH_MIN_MTU;
|
||||
|
||||
/* Set our hardware address while we're at it */
|
||||
ha = (union fwnet_hwaddr *)net->dev_addr;
|
||||
|
@ -960,15 +960,6 @@ static int ssip_pn_stop(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ssip_pn_set_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu > SSIP_MAX_MTU || new_mtu < PHONET_MIN_MTU)
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ssip_xmit_work(struct work_struct *work)
|
||||
{
|
||||
struct ssi_protocol *ssi =
|
||||
@ -1060,7 +1051,6 @@ static const struct net_device_ops ssip_pn_ops = {
|
||||
.ndo_open = ssip_pn_open,
|
||||
.ndo_stop = ssip_pn_stop,
|
||||
.ndo_start_xmit = ssip_pn_xmit,
|
||||
.ndo_change_mtu = ssip_pn_set_mtu,
|
||||
};
|
||||
|
||||
static void ssip_pn_setup(struct net_device *dev)
|
||||
@ -1136,6 +1126,10 @@ static int ssi_protocol_probe(struct device *dev)
|
||||
goto out1;
|
||||
}
|
||||
|
||||
/* MTU range: 6 - 65535 */
|
||||
ssi->netdev->min_mtu = PHONET_MIN_MTU;
|
||||
ssi->netdev->max_mtu = SSIP_MAX_MTU;
|
||||
|
||||
SET_NETDEV_DEV(ssi->netdev, dev);
|
||||
netif_carrier_off(ssi->netdev);
|
||||
err = register_netdev(ssi->netdev);
|
||||
|
@ -65,7 +65,6 @@ MODULE_DESCRIPTION("NetEffect RNIC Low-level iWARP Driver");
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
MODULE_VERSION(DRV_VERSION);
|
||||
|
||||
int max_mtu = 9000;
|
||||
int interrupt_mod_interval = 0;
|
||||
|
||||
/* Interoperability */
|
||||
|
@ -83,6 +83,8 @@
|
||||
#define NES_FIRST_QPN 64
|
||||
#define NES_SW_CONTEXT_ALIGN 1024
|
||||
|
||||
#define NES_MAX_MTU 9000
|
||||
|
||||
#define NES_NIC_MAX_NICS 16
|
||||
#define NES_MAX_ARP_TABLE_SIZE 4096
|
||||
|
||||
@ -169,8 +171,6 @@ do { \
|
||||
#include "nes_cm.h"
|
||||
#include "nes_mgt.h"
|
||||
|
||||
extern int max_mtu;
|
||||
#define max_frame_len (max_mtu+ETH_HLEN)
|
||||
extern int interrupt_mod_interval;
|
||||
extern int nes_if_count;
|
||||
extern int mpa_version;
|
||||
|
@ -981,20 +981,16 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
struct nes_vnic *nesvnic = netdev_priv(netdev);
|
||||
struct nes_device *nesdev = nesvnic->nesdev;
|
||||
int ret = 0;
|
||||
u8 jumbomode = 0;
|
||||
u32 nic_active;
|
||||
u32 nic_active_bit;
|
||||
u32 uc_all_active;
|
||||
u32 mc_all_active;
|
||||
|
||||
if ((new_mtu < ETH_ZLEN) || (new_mtu > max_mtu))
|
||||
return -EINVAL;
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN;
|
||||
|
||||
if (netdev->mtu > 1500) {
|
||||
if (netdev->mtu > ETH_DATA_LEN) {
|
||||
jumbomode=1;
|
||||
}
|
||||
nes_nic_init_timer_defaults(nesdev, jumbomode);
|
||||
@ -1020,7 +1016,7 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
nes_write_indexed(nesdev, NES_IDX_NIC_UNICAST_ALL, nic_active);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1658,7 +1654,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
|
||||
|
||||
netdev->watchdog_timeo = NES_TX_TIMEOUT;
|
||||
netdev->irq = nesdev->pcidev->irq;
|
||||
netdev->mtu = ETH_DATA_LEN;
|
||||
netdev->max_mtu = NES_MAX_MTU;
|
||||
netdev->hard_header_len = ETH_HLEN;
|
||||
netdev->addr_len = ETH_ALEN;
|
||||
netdev->type = ARPHRD_ETHER;
|
||||
|
@ -2017,6 +2017,7 @@ static struct net_device *ipoib_add_port(const char *format,
|
||||
/* MTU will be reset when mcast join happens */
|
||||
priv->dev->mtu = IPOIB_UD_MTU(priv->max_ib_mtu);
|
||||
priv->mcast_mtu = priv->admin_mtu = priv->dev->mtu;
|
||||
priv->dev->max_mtu = IPOIB_CM_MTU;
|
||||
|
||||
priv->dev->neigh_priv_len = sizeof(struct ipoib_neigh);
|
||||
|
||||
|
@ -548,16 +548,6 @@ mpt_lan_close(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
||||
static int
|
||||
mpt_lan_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < MPT_LAN_MIN_MTU) || (new_mtu > MPT_LAN_MAX_MTU))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
||||
/* Tx timeout handler. */
|
||||
static void
|
||||
@ -1304,7 +1294,6 @@ static const struct net_device_ops mpt_netdev_ops = {
|
||||
.ndo_open = mpt_lan_open,
|
||||
.ndo_stop = mpt_lan_close,
|
||||
.ndo_start_xmit = mpt_lan_sdu_send,
|
||||
.ndo_change_mtu = mpt_lan_change_mtu,
|
||||
.ndo_tx_timeout = mpt_lan_tx_timeout,
|
||||
};
|
||||
|
||||
@ -1375,6 +1364,10 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
|
||||
dev->netdev_ops = &mpt_netdev_ops;
|
||||
dev->watchdog_timeo = MPT_LAN_TX_TIMEOUT;
|
||||
|
||||
/* MTU range: 96 - 65280 */
|
||||
dev->min_mtu = MPT_LAN_MIN_MTU;
|
||||
dev->max_mtu = MPT_LAN_MAX_MTU;
|
||||
|
||||
dlprintk((KERN_INFO MYNAM ": Finished registering dev "
|
||||
"and setting initial values\n"));
|
||||
|
||||
|
@ -118,6 +118,8 @@ static DEFINE_SPINLOCK(xpnet_broadcast_lock);
|
||||
* now, the default is 64KB.
|
||||
*/
|
||||
#define XPNET_MAX_MTU (0x800000UL - L1_CACHE_BYTES)
|
||||
/* 68 comes from min TCP+IP+MAC header */
|
||||
#define XPNET_MIN_MTU 68
|
||||
/* 32KB has been determined to be the ideal */
|
||||
#define XPNET_DEF_MTU (0x8000UL)
|
||||
|
||||
@ -330,22 +332,6 @@ xpnet_dev_stop(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
xpnet_dev_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
/* 68 comes from min TCP+IP+MAC header */
|
||||
if ((new_mtu < 68) || (new_mtu > XPNET_MAX_MTU)) {
|
||||
dev_err(xpnet, "ifconfig %s mtu %d failed; value must be "
|
||||
"between 68 and %ld\n", dev->name, new_mtu,
|
||||
XPNET_MAX_MTU);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
dev_dbg(xpnet, "ifconfig %s mtu set to %d\n", dev->name, new_mtu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Notification that the other end has received the message and
|
||||
* DMA'd the skb information. At this point, they are done with
|
||||
@ -519,7 +505,6 @@ static const struct net_device_ops xpnet_netdev_ops = {
|
||||
.ndo_open = xpnet_dev_open,
|
||||
.ndo_stop = xpnet_dev_stop,
|
||||
.ndo_start_xmit = xpnet_dev_hard_start_xmit,
|
||||
.ndo_change_mtu = xpnet_dev_change_mtu,
|
||||
.ndo_tx_timeout = xpnet_dev_tx_timeout,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
@ -555,6 +540,8 @@ xpnet_init(void)
|
||||
|
||||
xpnet_device->netdev_ops = &xpnet_netdev_ops;
|
||||
xpnet_device->mtu = XPNET_DEF_MTU;
|
||||
xpnet_device->min_mtu = XPNET_MIN_MTU;
|
||||
xpnet_device->max_mtu = XPNET_MAX_MTU;
|
||||
|
||||
/*
|
||||
* Multicast assumes the LSB of the first octet is set for multicast
|
||||
|
@ -474,6 +474,8 @@ static int acenic_probe_one(struct pci_dev *pdev,
|
||||
dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
|
||||
|
||||
dev->watchdog_timeo = 5*HZ;
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ACE_JUMBO_MTU;
|
||||
|
||||
dev->netdev_ops = &ace_netdev_ops;
|
||||
dev->ethtool_ops = &ace_ethtool_ops;
|
||||
@ -2548,9 +2550,6 @@ static int ace_change_mtu(struct net_device *dev, int new_mtu)
|
||||
struct ace_private *ap = netdev_priv(dev);
|
||||
struct ace_regs __iomem *regs = ap->regs;
|
||||
|
||||
if (new_mtu > ACE_JUMBO_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
writel(new_mtu + ETH_HLEN + 4, ®s->IfMtu);
|
||||
dev->mtu = new_mtu;
|
||||
|
||||
|
@ -103,13 +103,6 @@ static int ena_change_mtu(struct net_device *dev, int new_mtu)
|
||||
struct ena_adapter *adapter = netdev_priv(dev);
|
||||
int ret;
|
||||
|
||||
if ((new_mtu > adapter->max_mtu) || (new_mtu < ENA_MIN_MTU)) {
|
||||
netif_err(adapter, drv, dev,
|
||||
"Invalid MTU setting. new_mtu: %d\n", new_mtu);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = ena_com_set_dev_mtu(adapter->ena_dev, new_mtu);
|
||||
if (!ret) {
|
||||
netif_dbg(adapter, drv, dev, "set MTU to %d\n", new_mtu);
|
||||
@ -2755,6 +2748,8 @@ static void ena_set_conf_feat_params(struct ena_adapter *adapter,
|
||||
ena_set_dev_offloads(feat, netdev);
|
||||
|
||||
adapter->max_mtu = feat->dev_attr.max_mtu;
|
||||
netdev->max_mtu = adapter->max_mtu;
|
||||
netdev->min_mtu = ENA_MIN_MTU;
|
||||
}
|
||||
|
||||
static int ena_rss_init_default(struct ena_adapter *adapter)
|
||||
|
@ -257,11 +257,6 @@ static int xgbe_calc_rx_buf_size(struct net_device *netdev, unsigned int mtu)
|
||||
{
|
||||
unsigned int rx_buf_size;
|
||||
|
||||
if (mtu > XGMAC_JUMBO_PACKET_MTU) {
|
||||
netdev_alert(netdev, "MTU exceeds maximum supported value\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rx_buf_size = mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
|
||||
rx_buf_size = clamp_val(rx_buf_size, XGBE_RX_MIN_BUF_SIZE, PAGE_SIZE);
|
||||
|
||||
|
@ -738,6 +738,8 @@ static int xgbe_probe(struct platform_device *pdev)
|
||||
pdata->netdev_features = netdev->features;
|
||||
|
||||
netdev->priv_flags |= IFF_UNICAST_FLT;
|
||||
netdev->min_mtu = 0;
|
||||
netdev->max_mtu = XGMAC_JUMBO_PACKET_MTU;
|
||||
|
||||
/* Use default watchdog timeout */
|
||||
netdev->watchdog_timeo = 0;
|
||||
|
@ -2147,15 +2147,6 @@ static void sbmac_setmulti(struct sbmac_softc *sc)
|
||||
}
|
||||
}
|
||||
|
||||
static int sb1250_change_mtu(struct net_device *_dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu > ENET_PACKET_SIZE)
|
||||
return -EINVAL;
|
||||
_dev->mtu = new_mtu;
|
||||
pr_info("changing the mtu to %d\n", new_mtu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops sbmac_netdev_ops = {
|
||||
.ndo_open = sbmac_open,
|
||||
.ndo_stop = sbmac_close,
|
||||
@ -2163,7 +2154,6 @@ static const struct net_device_ops sbmac_netdev_ops = {
|
||||
.ndo_set_rx_mode = sbmac_set_rx_mode,
|
||||
.ndo_tx_timeout = sbmac_tx_timeout,
|
||||
.ndo_do_ioctl = sbmac_mii_ioctl,
|
||||
.ndo_change_mtu = sb1250_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
@ -2229,6 +2219,8 @@ static int sbmac_init(struct platform_device *pldev, long long base)
|
||||
|
||||
dev->netdev_ops = &sbmac_netdev_ops;
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
dev->max_mtu = 0;
|
||||
dev->max_mtu = ENET_PACKET_SIZE;
|
||||
|
||||
netif_napi_add(dev, &sc->napi, sbmac_poll, 16);
|
||||
|
||||
|
@ -2531,8 +2531,6 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
|
||||
struct adapter *adapter = pi->adapter;
|
||||
int ret;
|
||||
|
||||
if (new_mtu < 81) /* accommodate SACK */
|
||||
return -EINVAL;
|
||||
if ((ret = t3_mac_set_mtu(&pi->mac, new_mtu)))
|
||||
return ret;
|
||||
dev->mtu = new_mtu;
|
||||
@ -3295,6 +3293,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
netdev->netdev_ops = &cxgb_netdev_ops;
|
||||
netdev->ethtool_ops = &cxgb_ethtool_ops;
|
||||
netdev->min_mtu = 81;
|
||||
netdev->max_mtu = ETH_MAX_MTU;
|
||||
}
|
||||
|
||||
pci_set_drvdata(pdev, adapter);
|
||||
|
@ -2502,8 +2502,6 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
|
||||
int ret;
|
||||
struct port_info *pi = netdev_priv(dev);
|
||||
|
||||
if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */
|
||||
return -EINVAL;
|
||||
ret = t4_set_rxmode(pi->adapter, pi->adapter->pf, pi->viid, new_mtu, -1,
|
||||
-1, -1, -1, true);
|
||||
if (!ret)
|
||||
@ -4803,6 +4801,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
netdev->priv_flags |= IFF_UNICAST_FLT;
|
||||
|
||||
/* MTU range: 81 - 9600 */
|
||||
netdev->min_mtu = 81;
|
||||
netdev->max_mtu = MAX_MTU;
|
||||
|
||||
netdev->netdev_ops = &cxgb4_netdev_ops;
|
||||
#ifdef CONFIG_CHELSIO_T4_DCB
|
||||
netdev->dcbnl_ops = &cxgb4_dcb_ops;
|
||||
|
@ -1108,10 +1108,6 @@ static int cxgb4vf_change_mtu(struct net_device *dev, int new_mtu)
|
||||
int ret;
|
||||
struct port_info *pi = netdev_priv(dev);
|
||||
|
||||
/* accommodate SACK */
|
||||
if (new_mtu < 81)
|
||||
return -EINVAL;
|
||||
|
||||
ret = t4vf_set_rxmode(pi->adapter, pi->viid, new_mtu,
|
||||
-1, -1, -1, -1, true);
|
||||
if (!ret)
|
||||
@ -2966,6 +2962,8 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
|
||||
netdev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
netdev->priv_flags |= IFF_UNICAST_FLT;
|
||||
netdev->min_mtu = 81;
|
||||
netdev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
netdev->netdev_ops = &cxgb4vf_netdev_ops;
|
||||
netdev->ethtool_ops = &cxgb4vf_ethtool_ops;
|
||||
|
@ -1406,23 +1406,6 @@ drop:
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
static int be_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
struct be_adapter *adapter = netdev_priv(netdev);
|
||||
struct device *dev = &adapter->pdev->dev;
|
||||
|
||||
if (new_mtu < BE_MIN_MTU || new_mtu > BE_MAX_MTU) {
|
||||
dev_info(dev, "MTU must be between %d and %d bytes\n",
|
||||
BE_MIN_MTU, BE_MAX_MTU);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_info(dev, "MTU changed from %d to %d bytes\n",
|
||||
netdev->mtu, new_mtu);
|
||||
netdev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool be_in_all_promisc(struct be_adapter *adapter)
|
||||
{
|
||||
return (adapter->if_flags & BE_IF_FLAGS_ALL_PROMISCUOUS) ==
|
||||
@ -5216,7 +5199,6 @@ static const struct net_device_ops be_netdev_ops = {
|
||||
.ndo_start_xmit = be_xmit,
|
||||
.ndo_set_rx_mode = be_set_rx_mode,
|
||||
.ndo_set_mac_address = be_mac_addr_set,
|
||||
.ndo_change_mtu = be_change_mtu,
|
||||
.ndo_get_stats64 = be_get_stats64,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_vlan_rx_add_vid = be_vlan_add_vid,
|
||||
@ -5266,6 +5248,10 @@ static void be_netdev_init(struct net_device *netdev)
|
||||
netdev->netdev_ops = &be_netdev_ops;
|
||||
|
||||
netdev->ethtool_ops = &be_ethtool_ops;
|
||||
|
||||
/* MTU range: 256 - 9000 */
|
||||
netdev->min_mtu = BE_MIN_MTU;
|
||||
netdev->max_mtu = BE_MAX_MTU;
|
||||
}
|
||||
|
||||
static void be_cleanup(struct be_adapter *adapter)
|
||||
|
@ -1349,9 +1349,6 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
int i, rc;
|
||||
int need_restart = 0;
|
||||
|
||||
if (new_mtu < IBMVETH_MIN_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
|
||||
if (new_mtu_oh <= adapter->rx_buff_pool[i].buff_size)
|
||||
break;
|
||||
@ -1551,6 +1548,9 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
|
||||
netdev->hw_features |= NETIF_F_TSO;
|
||||
}
|
||||
|
||||
netdev->min_mtu = IBMVETH_MIN_MTU;
|
||||
netdev->min_mtu = ETH_MAX_MTU;
|
||||
|
||||
memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
|
||||
|
||||
if (firmware_has_feature(FW_FEATURE_CMO))
|
||||
|
@ -902,17 +902,6 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if (new_mtu > adapter->req_mtu || new_mtu < adapter->min_mtu)
|
||||
return -EINVAL;
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ibmvnic_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
struct ibmvnic_adapter *adapter = netdev_priv(dev);
|
||||
@ -1029,7 +1018,6 @@ static const struct net_device_ops ibmvnic_netdev_ops = {
|
||||
.ndo_set_rx_mode = ibmvnic_set_multi,
|
||||
.ndo_set_mac_address = ibmvnic_set_mac,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_change_mtu = ibmvnic_change_mtu,
|
||||
.ndo_tx_timeout = ibmvnic_tx_timeout,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = ibmvnic_netpoll_controller,
|
||||
@ -2638,10 +2626,12 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq,
|
||||
break;
|
||||
case MIN_MTU:
|
||||
adapter->min_mtu = be64_to_cpu(crq->query_capability.number);
|
||||
netdev->min_mtu = adapter->min_mtu;
|
||||
netdev_dbg(netdev, "min_mtu = %lld\n", adapter->min_mtu);
|
||||
break;
|
||||
case MAX_MTU:
|
||||
adapter->max_mtu = be64_to_cpu(crq->query_capability.number);
|
||||
netdev->max_mtu = adapter->max_mtu;
|
||||
netdev_dbg(netdev, "max_mtu = %lld\n", adapter->max_mtu);
|
||||
break;
|
||||
case MAX_MULTICAST_FILTERS:
|
||||
@ -3654,6 +3644,8 @@ static void handle_crq_init_rsp(struct work_struct *work)
|
||||
goto task_failed;
|
||||
|
||||
netdev->real_num_tx_queues = adapter->req_tx_queues;
|
||||
netdev->min_mtu = adapter->min_mtu;
|
||||
netdev->max_mtu = adapter->max_mtu;
|
||||
|
||||
if (adapter->failover) {
|
||||
adapter->failover = false;
|
||||
|
@ -2357,14 +2357,6 @@ jme_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
struct jme_adapter *jme = netdev_priv(netdev);
|
||||
|
||||
if (new_mtu == jme->old_mtu)
|
||||
return 0;
|
||||
|
||||
if (((new_mtu + ETH_HLEN) > MAX_ETHERNET_JUMBO_PACKET_SIZE) ||
|
||||
((new_mtu) < IPV6_MIN_MTU))
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
netdev_update_features(netdev);
|
||||
|
||||
@ -3063,6 +3055,10 @@ jme_init_one(struct pci_dev *pdev,
|
||||
if (using_dac)
|
||||
netdev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
/* MTU range: 1280 - 9202*/
|
||||
netdev->min_mtu = IPV6_MIN_MTU;
|
||||
netdev->max_mtu = MAX_ETHERNET_JUMBO_PACKET_SIZE - ETH_HLEN;
|
||||
|
||||
SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||
pci_set_drvdata(pdev, netdev);
|
||||
|
||||
|
@ -2585,9 +2585,6 @@ static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
||||
if (new_mtu < 64 || new_mtu > 9500)
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
mv643xx_eth_recalc_skb_size(mp);
|
||||
tx_set_rate(mp, 1000000000, 16777216);
|
||||
@ -3206,6 +3203,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
|
||||
dev->priv_flags |= IFF_UNICAST_FLT;
|
||||
dev->gso_max_segs = MV643XX_MAX_TSO_SEGS;
|
||||
|
||||
/* MTU range: 64 - 9500 */
|
||||
dev->min_mtu = 64;
|
||||
dev->max_mtu = 9500;
|
||||
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
if (mp->shared->win_protect)
|
||||
|
@ -2284,6 +2284,9 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
|
||||
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
|
||||
dev->hw_features |= NETIF_F_HW_TC;
|
||||
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
/* Each packet needs to have a Tx header (metadata) on top all other
|
||||
* headers.
|
||||
*/
|
||||
|
@ -994,6 +994,9 @@ static int mlxsw_sx_port_create(struct mlxsw_sx *mlxsw_sx, u8 local_port)
|
||||
dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG |
|
||||
NETIF_F_VLAN_CHALLENGED;
|
||||
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
/* Each packet needs to have a Tx header (metadata) on top all other
|
||||
* headers.
|
||||
*/
|
||||
|
@ -1679,14 +1679,6 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac)
|
||||
}
|
||||
}
|
||||
|
||||
static int ns83820_change_mtu(struct net_device *ndev, int new_mtu)
|
||||
{
|
||||
if (new_mtu > RX_BUF_SIZE)
|
||||
return -EINVAL;
|
||||
ndev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ns83820_set_multicast(struct net_device *ndev)
|
||||
{
|
||||
struct ns83820 *dev = PRIV(ndev);
|
||||
@ -1933,7 +1925,6 @@ static const struct net_device_ops netdev_ops = {
|
||||
.ndo_stop = ns83820_stop,
|
||||
.ndo_start_xmit = ns83820_hard_start_xmit,
|
||||
.ndo_get_stats = ns83820_get_stats,
|
||||
.ndo_change_mtu = ns83820_change_mtu,
|
||||
.ndo_set_rx_mode = ns83820_set_multicast,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
@ -2190,6 +2181,8 @@ static int ns83820_init_one(struct pci_dev *pci_dev,
|
||||
ndev->features |= NETIF_F_SG;
|
||||
ndev->features |= NETIF_F_IP_CSUM;
|
||||
|
||||
ndev->min_mtu = 0;
|
||||
|
||||
#ifdef NS83820_VLAN_ACCEL_SUPPORT
|
||||
/* We also support hardware vlan acceleration */
|
||||
ndev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
|
||||
|
@ -987,20 +987,8 @@ int netxen_send_lro_cleanup(struct netxen_adapter *adapter)
|
||||
int netxen_nic_change_mtu(struct net_device *netdev, int mtu)
|
||||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(netdev);
|
||||
int max_mtu;
|
||||
int rc = 0;
|
||||
|
||||
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
|
||||
max_mtu = P3_MAX_MTU;
|
||||
else
|
||||
max_mtu = P2_MAX_MTU;
|
||||
|
||||
if (mtu > max_mtu) {
|
||||
printk(KERN_ERR "%s: mtu > %d bytes unsupported\n",
|
||||
netdev->name, max_mtu);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (adapter->set_mtu)
|
||||
rc = adapter->set_mtu(adapter, mtu);
|
||||
|
||||
|
@ -1572,6 +1572,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
adapter->physical_port = i;
|
||||
}
|
||||
|
||||
/* MTU range: 0 - 8000 (P2) or 9600 (P3) */
|
||||
netdev->min_mtu = 0;
|
||||
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
|
||||
netdev->max_mtu = P3_MAX_MTU;
|
||||
else
|
||||
netdev->max_mtu = P2_MAX_MTU;
|
||||
|
||||
netxen_nic_clear_stats(adapter);
|
||||
|
||||
err = netxen_setup_intr(adapter);
|
||||
|
@ -4788,6 +4788,13 @@ static int qlge_probe(struct pci_dev *pdev,
|
||||
ndev->ethtool_ops = &qlge_ethtool_ops;
|
||||
ndev->watchdog_timeo = 10 * HZ;
|
||||
|
||||
/* MTU range: this driver only supports 1500 or 9000, so this only
|
||||
* filters out values above or below, and we'll rely on
|
||||
* qlge_change_mtu to make sure only 1500 or 9000 are allowed
|
||||
*/
|
||||
ndev->min_mtu = ETH_DATA_LEN;
|
||||
ndev->max_mtu = 9000;
|
||||
|
||||
err = register_netdev(ndev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "net device registration failed.\n");
|
||||
|
@ -239,15 +239,8 @@ static void emac_rx_mode_set(struct net_device *netdev)
|
||||
/* Change the Maximum Transfer Unit (MTU) */
|
||||
static int emac_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
{
|
||||
unsigned int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
|
||||
struct emac_adapter *adpt = netdev_priv(netdev);
|
||||
|
||||
if ((max_frame < EMAC_MIN_ETH_FRAME_SIZE) ||
|
||||
(max_frame > EMAC_MAX_ETH_FRAME_SIZE)) {
|
||||
netdev_err(adpt->netdev, "error: invalid MTU setting\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
netif_info(adpt, hw, adpt->netdev,
|
||||
"changing MTU from %d to %d\n", netdev->mtu,
|
||||
new_mtu);
|
||||
@ -679,6 +672,12 @@ static int emac_probe(struct platform_device *pdev)
|
||||
netdev->vlan_features |= NETIF_F_SG | NETIF_F_HW_CSUM |
|
||||
NETIF_F_TSO | NETIF_F_TSO6;
|
||||
|
||||
/* MTU range: 46 - 9194 */
|
||||
netdev->min_mtu = EMAC_MIN_ETH_FRAME_SIZE -
|
||||
(ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
|
||||
netdev->max_mtu = EMAC_MAX_ETH_FRAME_SIZE -
|
||||
(ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
|
||||
|
||||
INIT_WORK(&adpt->work_thread, emac_work_thread);
|
||||
|
||||
/* Initialize queues */
|
||||
|
@ -1034,9 +1034,6 @@ static int axienet_change_mtu(struct net_device *ndev, int new_mtu)
|
||||
XAE_TRL_SIZE) > lp->rxmem)
|
||||
return -EINVAL;
|
||||
|
||||
if ((new_mtu > XAE_JUMBO_MTU) || (new_mtu < 64))
|
||||
return -EINVAL;
|
||||
|
||||
ndev->mtu = new_mtu;
|
||||
|
||||
return 0;
|
||||
@ -1475,6 +1472,10 @@ static int axienet_probe(struct platform_device *pdev)
|
||||
ndev->netdev_ops = &axienet_netdev_ops;
|
||||
ndev->ethtool_ops = &axienet_ethtool_ops;
|
||||
|
||||
/* MTU range: 64 - 9000 */
|
||||
ndev->min_mtu = 64;
|
||||
ndev->max_mtu = XAE_JUMBO_MTU;
|
||||
|
||||
lp = netdev_priv(ndev);
|
||||
lp->ndev = ndev;
|
||||
lp->dev = &pdev->dev;
|
||||
|
@ -166,7 +166,6 @@ static const struct net_device_ops skfp_netdev_ops = {
|
||||
.ndo_stop = skfp_close,
|
||||
.ndo_start_xmit = skfp_send_pkt,
|
||||
.ndo_get_stats = skfp_ctl_get_stats,
|
||||
.ndo_change_mtu = fddi_change_mtu,
|
||||
.ndo_set_rx_mode = skfp_ctl_set_multicast_list,
|
||||
.ndo_set_mac_address = skfp_ctl_set_mac_address,
|
||||
.ndo_do_ioctl = skfp_ioctl,
|
||||
|
@ -1316,6 +1316,8 @@ static void fjes_netdev_setup(struct net_device *netdev)
|
||||
netdev->netdev_ops = &fjes_netdev_ops;
|
||||
fjes_set_ethtool_ops(netdev);
|
||||
netdev->mtu = fjes_support_mtu[3];
|
||||
netdev->min_mtu = fjes_support_mtu[0];
|
||||
netdev->max_mtu = fjes_support_mtu[3];
|
||||
netdev->flags |= IFF_BROADCAST;
|
||||
netdev->features |= NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
}
|
||||
|
@ -1034,39 +1034,18 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
return geneve_xmit_skb(skb, dev, info);
|
||||
}
|
||||
|
||||
static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool strict)
|
||||
static int geneve_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct geneve_dev *geneve = netdev_priv(dev);
|
||||
/* The max_mtu calculation does not take account of GENEVE
|
||||
* options, to avoid excluding potentially valid
|
||||
* configurations.
|
||||
/* Only possible if called internally, ndo_change_mtu path's new_mtu
|
||||
* is guaranteed to be between dev->min_mtu and dev->max_mtu.
|
||||
*/
|
||||
int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len;
|
||||
|
||||
if (geneve->remote.sa.sa_family == AF_INET6)
|
||||
max_mtu -= sizeof(struct ipv6hdr);
|
||||
else
|
||||
max_mtu -= sizeof(struct iphdr);
|
||||
|
||||
if (new_mtu < 68)
|
||||
return -EINVAL;
|
||||
|
||||
if (new_mtu > max_mtu) {
|
||||
if (strict)
|
||||
return -EINVAL;
|
||||
|
||||
new_mtu = max_mtu;
|
||||
}
|
||||
if (new_mtu > dev->max_mtu)
|
||||
new_mtu = dev->max_mtu;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int geneve_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
return __geneve_change_mtu(dev, new_mtu, true);
|
||||
}
|
||||
|
||||
static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
|
||||
{
|
||||
struct ip_tunnel_info *info = skb_tunnel_info(skb);
|
||||
@ -1170,6 +1149,14 @@ static void geneve_setup(struct net_device *dev)
|
||||
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
|
||||
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
|
||||
|
||||
/* MTU range: 68 - (something less than 65535) */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
/* The max_mtu calculation does not take account of GENEVE
|
||||
* options, to avoid excluding potentially valid
|
||||
* configurations. This will be further reduced by IPvX hdr size.
|
||||
*/
|
||||
dev->max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len;
|
||||
|
||||
netif_keep_dst(dev);
|
||||
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
|
||||
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
|
||||
@ -1285,10 +1272,13 @@ static int geneve_configure(struct net *net, struct net_device *dev,
|
||||
|
||||
/* make enough headroom for basic scenario */
|
||||
encap_len = GENEVE_BASE_HLEN + ETH_HLEN;
|
||||
if (remote->sa.sa_family == AF_INET)
|
||||
if (remote->sa.sa_family == AF_INET) {
|
||||
encap_len += sizeof(struct iphdr);
|
||||
else
|
||||
dev->max_mtu -= sizeof(struct iphdr);
|
||||
} else {
|
||||
encap_len += sizeof(struct ipv6hdr);
|
||||
dev->max_mtu -= sizeof(struct ipv6hdr);
|
||||
}
|
||||
dev->needed_headroom = encap_len + ETH_HLEN;
|
||||
|
||||
if (metadata) {
|
||||
@ -1488,7 +1478,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
|
||||
/* openvswitch users expect packet sizes to be unrestricted,
|
||||
* so set the largest MTU we can.
|
||||
*/
|
||||
err = __geneve_change_mtu(dev, IP_MAX_MTU, false);
|
||||
err = geneve_change_mtu(dev, IP_MAX_MTU);
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
|
@ -68,7 +68,6 @@ static const struct net_device_ops rr_netdev_ops = {
|
||||
.ndo_stop = rr_close,
|
||||
.ndo_do_ioctl = rr_ioctl,
|
||||
.ndo_start_xmit = rr_start_xmit,
|
||||
.ndo_change_mtu = hippi_change_mtu,
|
||||
.ndo_set_mac_address = hippi_mac_addr,
|
||||
};
|
||||
|
||||
|
@ -606,8 +606,8 @@ struct nvsp_message {
|
||||
} __packed;
|
||||
|
||||
|
||||
#define NETVSC_MTU 65536
|
||||
#define NETVSC_MTU_MIN 68
|
||||
#define NETVSC_MTU 65535
|
||||
#define NETVSC_MTU_MIN ETH_MIN_MTU
|
||||
|
||||
#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */
|
||||
#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */
|
||||
|
@ -872,19 +872,12 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
|
||||
struct netvsc_device *nvdev = ndevctx->nvdev;
|
||||
struct hv_device *hdev = ndevctx->device_ctx;
|
||||
struct netvsc_device_info device_info;
|
||||
int limit = ETH_DATA_LEN;
|
||||
u32 num_chn;
|
||||
int ret = 0;
|
||||
|
||||
if (ndevctx->start_remove || !nvdev || nvdev->destroy)
|
||||
return -ENODEV;
|
||||
|
||||
if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
|
||||
limit = NETVSC_MTU - ETH_HLEN;
|
||||
|
||||
if (mtu < NETVSC_MTU_MIN || mtu > limit)
|
||||
return -EINVAL;
|
||||
|
||||
ret = netvsc_close(ndev);
|
||||
if (ret)
|
||||
goto out;
|
||||
@ -1402,6 +1395,13 @@ static int netvsc_probe(struct hv_device *dev,
|
||||
netif_set_real_num_tx_queues(net, nvdev->num_chn);
|
||||
netif_set_real_num_rx_queues(net, nvdev->num_chn);
|
||||
|
||||
/* MTU range: 68 - 1500 or 65521 */
|
||||
net->min_mtu = NETVSC_MTU_MIN;
|
||||
if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
|
||||
net->max_mtu = NETVSC_MTU - ETH_HLEN;
|
||||
else
|
||||
net->max_mtu = ETH_DATA_LEN;
|
||||
|
||||
ret = register_netdev(net);
|
||||
if (ret != 0) {
|
||||
pr_err("Unable to register netdev.\n");
|
||||
|
@ -2970,6 +2970,8 @@ static void macsec_free_netdev(struct net_device *dev)
|
||||
static void macsec_setup(struct net_device *dev)
|
||||
{
|
||||
ether_setup(dev);
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
dev->priv_flags |= IFF_NO_QUEUE;
|
||||
dev->netdev_ops = &macsec_netdev_ops;
|
||||
dev->destructor = macsec_free_netdev;
|
||||
|
@ -777,7 +777,7 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct macvlan_dev *vlan = netdev_priv(dev);
|
||||
|
||||
if (new_mtu < 68 || vlan->lowerdev->mtu < new_mtu)
|
||||
if (vlan->lowerdev->mtu < new_mtu)
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
@ -1085,6 +1085,8 @@ void macvlan_common_setup(struct net_device *dev)
|
||||
{
|
||||
ether_setup(dev);
|
||||
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
|
||||
netif_keep_dst(dev);
|
||||
dev->priv_flags |= IFF_UNICAST_FLT;
|
||||
@ -1297,6 +1299,10 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
|
||||
else if (dev->mtu > lowerdev->mtu)
|
||||
return -EINVAL;
|
||||
|
||||
/* MTU range: 68 - lowerdev->max_mtu */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = lowerdev->max_mtu;
|
||||
|
||||
if (!tb[IFLA_ADDRESS])
|
||||
eth_hw_addr_random(dev);
|
||||
|
||||
|
@ -433,6 +433,9 @@ static int ntb_netdev_probe(struct device *client_dev)
|
||||
ndev->netdev_ops = &ntb_netdev_ops;
|
||||
ndev->ethtool_ops = &ntb_ethtool_ops;
|
||||
|
||||
ndev->min_mtu = 0;
|
||||
ndev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
dev->qp = ntb_transport_create_queue(ndev, client_dev,
|
||||
&ntb_netdev_handlers);
|
||||
if (!dev->qp) {
|
||||
|
@ -466,17 +466,6 @@ static void rionet_set_msglevel(struct net_device *ndev, u32 value)
|
||||
rnet->msg_enable = value;
|
||||
}
|
||||
|
||||
static int rionet_change_mtu(struct net_device *ndev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < 68) || (new_mtu > RIONET_MAX_MTU)) {
|
||||
printk(KERN_ERR "%s: Invalid MTU size %d\n",
|
||||
ndev->name, new_mtu);
|
||||
return -EINVAL;
|
||||
}
|
||||
ndev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ethtool_ops rionet_ethtool_ops = {
|
||||
.get_drvinfo = rionet_get_drvinfo,
|
||||
.get_msglevel = rionet_get_msglevel,
|
||||
@ -488,7 +477,6 @@ static const struct net_device_ops rionet_netdev_ops = {
|
||||
.ndo_open = rionet_open,
|
||||
.ndo_stop = rionet_close,
|
||||
.ndo_start_xmit = rionet_start_xmit,
|
||||
.ndo_change_mtu = rionet_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
};
|
||||
@ -525,6 +513,9 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev)
|
||||
|
||||
ndev->netdev_ops = &rionet_netdev_ops;
|
||||
ndev->mtu = RIONET_MAX_MTU;
|
||||
/* MTU range: 68 - 4082 */
|
||||
ndev->min_mtu = ETH_MIN_MTU;
|
||||
ndev->max_mtu = RIONET_MAX_MTU;
|
||||
ndev->features = NETIF_F_LLTX;
|
||||
SET_NETDEV_DEV(ndev, &mport->dev);
|
||||
ndev->ethtool_ops = &rionet_ethtool_ops;
|
||||
|
@ -561,12 +561,7 @@ static int sl_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct slip *sl = netdev_priv(dev);
|
||||
|
||||
if (new_mtu < 68 || new_mtu > 65534)
|
||||
return -EINVAL;
|
||||
|
||||
if (new_mtu != dev->mtu)
|
||||
return sl_realloc_bufs(sl, new_mtu);
|
||||
return 0;
|
||||
return sl_realloc_bufs(sl, new_mtu);
|
||||
}
|
||||
|
||||
/* Netdevice get statistics request */
|
||||
@ -663,6 +658,10 @@ static void sl_setup(struct net_device *dev)
|
||||
dev->addr_len = 0;
|
||||
dev->tx_queue_len = 10;
|
||||
|
||||
/* MTU range: 68 - 65534 */
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = 65534;
|
||||
|
||||
/* New-style flags. */
|
||||
dev->flags = IFF_NOARP|IFF_POINTOPOINT|IFF_MULTICAST;
|
||||
}
|
||||
|
@ -925,18 +925,6 @@ static void tun_net_mclist(struct net_device *dev)
|
||||
*/
|
||||
}
|
||||
|
||||
#define MIN_MTU 68
|
||||
#define MAX_MTU 65535
|
||||
|
||||
static int
|
||||
tun_net_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu < MIN_MTU || new_mtu + dev->hard_header_len > MAX_MTU)
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static netdev_features_t tun_net_fix_features(struct net_device *dev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
@ -1014,7 +1002,6 @@ static const struct net_device_ops tun_netdev_ops = {
|
||||
.ndo_open = tun_net_open,
|
||||
.ndo_stop = tun_net_close,
|
||||
.ndo_start_xmit = tun_net_xmit,
|
||||
.ndo_change_mtu = tun_net_change_mtu,
|
||||
.ndo_fix_features = tun_net_fix_features,
|
||||
.ndo_select_queue = tun_select_queue,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
@ -1029,7 +1016,6 @@ static const struct net_device_ops tap_netdev_ops = {
|
||||
.ndo_open = tun_net_open,
|
||||
.ndo_stop = tun_net_close,
|
||||
.ndo_start_xmit = tun_net_xmit,
|
||||
.ndo_change_mtu = tun_net_change_mtu,
|
||||
.ndo_fix_features = tun_net_fix_features,
|
||||
.ndo_set_rx_mode = tun_net_mclist,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
@ -1062,6 +1048,9 @@ static void tun_flow_uninit(struct tun_struct *tun)
|
||||
tun_flow_flush(tun);
|
||||
}
|
||||
|
||||
#define MIN_MTU 68
|
||||
#define MAX_MTU 65535
|
||||
|
||||
/* Initialize net device. */
|
||||
static void tun_net_init(struct net_device *dev)
|
||||
{
|
||||
@ -1092,6 +1081,9 @@ static void tun_net_init(struct net_device *dev)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
dev->min_mtu = MIN_MTU;
|
||||
dev->max_mtu = MAX_MTU - dev->hard_header_len;
|
||||
}
|
||||
|
||||
/* Character device part */
|
||||
|
@ -1026,9 +1026,6 @@ static int ax88178_change_mtu(struct net_device *net, int new_mtu)
|
||||
|
||||
netdev_dbg(dev->net, "ax88178_change_mtu() new_mtu=%d\n", new_mtu);
|
||||
|
||||
if (new_mtu <= 0 || ll_mtu > 16384)
|
||||
return -EINVAL;
|
||||
|
||||
if ((ll_mtu % dev->maxpacket) == 0)
|
||||
return -EDOM;
|
||||
|
||||
@ -1081,6 +1078,7 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
|
||||
|
||||
dev->net->netdev_ops = &ax88178_netdev_ops;
|
||||
dev->net->ethtool_ops = &ax88178_ethtool_ops;
|
||||
dev->net->max_mtu = 16384 - (dev->net->hard_header_len + 4);
|
||||
|
||||
/* Blink LEDS so users know driver saw dongle */
|
||||
asix_sw_reset(dev, 0, 0);
|
||||
|
@ -907,9 +907,6 @@ static int ax88179_change_mtu(struct net_device *net, int new_mtu)
|
||||
struct usbnet *dev = netdev_priv(net);
|
||||
u16 tmp16;
|
||||
|
||||
if (new_mtu <= 0 || new_mtu > 4088)
|
||||
return -EINVAL;
|
||||
|
||||
net->mtu = new_mtu;
|
||||
dev->hard_mtu = net->mtu + net->hard_header_len;
|
||||
|
||||
@ -1266,6 +1263,7 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
|
||||
dev->net->netdev_ops = &ax88179_netdev_ops;
|
||||
dev->net->ethtool_ops = &ax88179_ethtool_ops;
|
||||
dev->net->needed_headroom = 8;
|
||||
dev->net->max_mtu = 4088;
|
||||
|
||||
/* Initialize MII structure */
|
||||
dev->mii.dev = dev->net;
|
||||
|
@ -276,21 +276,11 @@ static int usbpn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
static int usbpn_set_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < PHONET_MIN_MTU) || (new_mtu > PHONET_MAX_MTU))
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops usbpn_ops = {
|
||||
.ndo_open = usbpn_open,
|
||||
.ndo_stop = usbpn_close,
|
||||
.ndo_start_xmit = usbpn_xmit,
|
||||
.ndo_do_ioctl = usbpn_ioctl,
|
||||
.ndo_change_mtu = usbpn_set_mtu,
|
||||
};
|
||||
|
||||
static void usbpn_setup(struct net_device *dev)
|
||||
@ -301,6 +291,8 @@ static void usbpn_setup(struct net_device *dev)
|
||||
dev->type = ARPHRD_PHONET;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->mtu = PHONET_MAX_MTU;
|
||||
dev->min_mtu = PHONET_MIN_MTU;
|
||||
dev->max_mtu = PHONET_MAX_MTU;
|
||||
dev->hard_header_len = 1;
|
||||
dev->dev_addr[0] = PN_MEDIA_USB;
|
||||
dev->addr_len = 1;
|
||||
|
@ -740,10 +740,6 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx)
|
||||
int cdc_ncm_change_mtu(struct net_device *net, int new_mtu)
|
||||
{
|
||||
struct usbnet *dev = netdev_priv(net);
|
||||
int maxmtu = cdc_ncm_max_dgram_size(dev) - cdc_ncm_eth_hlen(dev);
|
||||
|
||||
if (new_mtu <= 0 || new_mtu > maxmtu)
|
||||
return -EINVAL;
|
||||
|
||||
net->mtu = new_mtu;
|
||||
cdc_ncm_set_dgram_size(dev, new_mtu + cdc_ncm_eth_hlen(dev));
|
||||
@ -909,6 +905,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
|
||||
|
||||
/* must handle MTU changes */
|
||||
dev->net->netdev_ops = &cdc_ncm_netdev_ops;
|
||||
dev->net->max_mtu = cdc_ncm_max_dgram_size(dev) - cdc_ncm_eth_hlen(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -1980,11 +1980,6 @@ static int lan78xx_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
int old_rx_urb_size = dev->rx_urb_size;
|
||||
int ret;
|
||||
|
||||
if (new_mtu > MAX_SINGLE_PACKET_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
if (new_mtu <= 0)
|
||||
return -EINVAL;
|
||||
/* no second zero-length packet read wanted after mtu-sized packets */
|
||||
if ((ll_mtu % dev->maxpacket) == 0)
|
||||
return -EDOM;
|
||||
@ -3388,6 +3383,9 @@ static int lan78xx_probe(struct usb_interface *intf,
|
||||
if (netdev->mtu > (dev->hard_mtu - netdev->hard_header_len))
|
||||
netdev->mtu = dev->hard_mtu - netdev->hard_header_len;
|
||||
|
||||
/* MTU range: 68 - 9000 */
|
||||
netdev->max_mtu = MAX_SINGLE_PACKET_SIZE;
|
||||
|
||||
dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0;
|
||||
dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1;
|
||||
dev->ep_intr = (intf->cur_altsetting)->endpoint + 2;
|
||||
|
@ -4119,9 +4119,6 @@ static int rtl8152_change_mtu(struct net_device *dev, int new_mtu)
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_mtu < 68 || new_mtu > RTL8153_MAX_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
ret = usb_autopm_get_interface(tp->intf);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -4311,6 +4308,18 @@ static int rtl8152_probe(struct usb_interface *intf,
|
||||
netdev->ethtool_ops = &ops;
|
||||
netif_set_gso_max_size(netdev, RTL_LIMITED_TSO_SIZE);
|
||||
|
||||
/* MTU range: 68 - 1500 or 9194 */
|
||||
netdev->min_mtu = ETH_MIN_MTU;
|
||||
switch (tp->version) {
|
||||
case RTL_VER_01:
|
||||
case RTL_VER_02:
|
||||
netdev->max_mtu = ETH_DATA_LEN;
|
||||
break;
|
||||
default:
|
||||
netdev->max_mtu = RTL8153_MAX_MTU;
|
||||
break;
|
||||
}
|
||||
|
||||
tp->mii.dev = netdev;
|
||||
tp->mii.mdio_read = read_mii_word;
|
||||
tp->mii.mdio_write = write_mii_word;
|
||||
|
@ -165,7 +165,6 @@ struct lsi_umts {
|
||||
|
||||
/* Forward definitions */
|
||||
static void sierra_sync_timer(unsigned long syncdata);
|
||||
static int sierra_net_change_mtu(struct net_device *net, int new_mtu);
|
||||
|
||||
/* Our own net device operations structure */
|
||||
static const struct net_device_ops sierra_net_device_ops = {
|
||||
@ -173,7 +172,7 @@ static const struct net_device_ops sierra_net_device_ops = {
|
||||
.ndo_stop = usbnet_stop,
|
||||
.ndo_start_xmit = usbnet_start_xmit,
|
||||
.ndo_tx_timeout = usbnet_tx_timeout,
|
||||
.ndo_change_mtu = sierra_net_change_mtu,
|
||||
.ndo_change_mtu = usbnet_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
@ -622,15 +621,6 @@ static const struct ethtool_ops sierra_net_ethtool_ops = {
|
||||
.nway_reset = usbnet_nway_reset,
|
||||
};
|
||||
|
||||
/* MTU can not be more than 1500 bytes, enforce it. */
|
||||
static int sierra_net_change_mtu(struct net_device *net, int new_mtu)
|
||||
{
|
||||
if (new_mtu > SIERRA_NET_MAX_SUPPORTED_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
return usbnet_change_mtu(net, new_mtu);
|
||||
}
|
||||
|
||||
static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap)
|
||||
{
|
||||
int result = 0;
|
||||
@ -720,6 +710,7 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
|
||||
|
||||
dev->net->hard_header_len += SIERRA_NET_HIP_EXT_HDR_LEN;
|
||||
dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
|
||||
dev->net->max_mtu = SIERRA_NET_MAX_SUPPORTED_MTU;
|
||||
|
||||
/* Set up the netdev */
|
||||
dev->net->flags |= IFF_NOARP;
|
||||
|
@ -925,9 +925,6 @@ static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
struct usbnet *dev = netdev_priv(netdev);
|
||||
int ret;
|
||||
|
||||
if (new_mtu > MAX_SINGLE_PACKET_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN);
|
||||
if (ret < 0) {
|
||||
netdev_warn(dev->net, "Failed to set mac rx frame length\n");
|
||||
@ -1448,6 +1445,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
|
||||
dev->net->flags |= IFF_MULTICAST;
|
||||
dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD;
|
||||
dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
|
||||
dev->net->max_mtu = MAX_SINGLE_PACKET_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -384,8 +384,6 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu)
|
||||
int old_hard_mtu = dev->hard_mtu;
|
||||
int old_rx_urb_size = dev->rx_urb_size;
|
||||
|
||||
if (new_mtu <= 0)
|
||||
return -EINVAL;
|
||||
// no second zero-length packet read wanted after mtu-sized packets
|
||||
if ((ll_mtu % dev->maxpacket) == 0)
|
||||
return -EDOM;
|
||||
@ -1669,6 +1667,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
|
||||
* bind() should set rx_urb_size in that case.
|
||||
*/
|
||||
dev->hard_mtu = net->mtu + net->hard_header_len;
|
||||
net->min_mtu = 0;
|
||||
net->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
net->netdev_ops = &usbnet_netdev_ops;
|
||||
net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
|
||||
|
@ -23,9 +23,6 @@
|
||||
#define DRV_NAME "veth"
|
||||
#define DRV_VERSION "1.0"
|
||||
|
||||
#define MIN_MTU 68 /* Min L3 MTU */
|
||||
#define MAX_MTU 65535 /* Max L3 MTU (arbitrary) */
|
||||
|
||||
struct pcpu_vstats {
|
||||
u64 packets;
|
||||
u64 bytes;
|
||||
@ -216,17 +213,9 @@ static int veth_close(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_valid_veth_mtu(int new_mtu)
|
||||
static int is_valid_veth_mtu(int mtu)
|
||||
{
|
||||
return new_mtu >= MIN_MTU && new_mtu <= MAX_MTU;
|
||||
}
|
||||
|
||||
static int veth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (!is_valid_veth_mtu(new_mtu))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
return mtu >= ETH_MIN_MTU && mtu <= ETH_MAX_MTU;
|
||||
}
|
||||
|
||||
static int veth_dev_init(struct net_device *dev)
|
||||
@ -300,7 +289,6 @@ static const struct net_device_ops veth_netdev_ops = {
|
||||
.ndo_open = veth_open,
|
||||
.ndo_stop = veth_close,
|
||||
.ndo_start_xmit = veth_xmit,
|
||||
.ndo_change_mtu = veth_change_mtu,
|
||||
.ndo_get_stats64 = veth_get_stats64,
|
||||
.ndo_set_rx_mode = veth_set_multicast_list,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
@ -337,6 +325,7 @@ static void veth_setup(struct net_device *dev)
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_RX);
|
||||
dev->destructor = veth_dev_free;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
dev->hw_features = VETH_FEATURES;
|
||||
dev->hw_enc_features = VETH_FEATURES;
|
||||
|
@ -1419,17 +1419,6 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
|
||||
.set_settings = virtnet_set_settings,
|
||||
};
|
||||
|
||||
#define MIN_MTU 68
|
||||
#define MAX_MTU 65535
|
||||
|
||||
static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops virtnet_netdev = {
|
||||
.ndo_open = virtnet_open,
|
||||
.ndo_stop = virtnet_close,
|
||||
@ -1437,7 +1426,6 @@ static const struct net_device_ops virtnet_netdev = {
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = virtnet_set_mac_address,
|
||||
.ndo_set_rx_mode = virtnet_set_rx_mode,
|
||||
.ndo_change_mtu = virtnet_change_mtu,
|
||||
.ndo_get_stats64 = virtnet_stats,
|
||||
.ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
|
||||
.ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
|
||||
@ -1748,6 +1736,9 @@ static bool virtnet_validate_features(struct virtio_device *vdev)
|
||||
return true;
|
||||
}
|
||||
|
||||
#define MIN_MTU ETH_MIN_MTU
|
||||
#define MAX_MTU ETH_MAX_MTU
|
||||
|
||||
static int virtnet_probe(struct virtio_device *vdev)
|
||||
{
|
||||
int i, err;
|
||||
@ -1821,6 +1812,10 @@ static int virtnet_probe(struct virtio_device *vdev)
|
||||
|
||||
dev->vlan_features = dev->features;
|
||||
|
||||
/* MTU range: 68 - 65535 */
|
||||
dev->min_mtu = MIN_MTU;
|
||||
dev->max_mtu = MAX_MTU;
|
||||
|
||||
/* Configuration may specify what MAC to use. Otherwise random. */
|
||||
if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC))
|
||||
virtio_cread_bytes(vdev,
|
||||
@ -1875,8 +1870,10 @@ static int virtnet_probe(struct virtio_device *vdev)
|
||||
mtu = virtio_cread16(vdev,
|
||||
offsetof(struct virtio_net_config,
|
||||
mtu));
|
||||
if (virtnet_change_mtu(dev, mtu))
|
||||
if (mtu < dev->min_mtu || mtu > dev->max_mtu)
|
||||
__virtio_clear_bit(vdev, VIRTIO_NET_F_MTU);
|
||||
else
|
||||
dev->mtu = mtu;
|
||||
}
|
||||
|
||||
if (vi->any_header_sg)
|
||||
|
@ -2969,9 +2969,6 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
|
||||
int err = 0;
|
||||
|
||||
if (new_mtu < VMXNET3_MIN_MTU || new_mtu > VMXNET3_MAX_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
|
||||
/*
|
||||
@ -3428,6 +3425,10 @@ vmxnet3_probe_device(struct pci_dev *pdev,
|
||||
vmxnet3_set_ethtool_ops(netdev);
|
||||
netdev->watchdog_timeo = 5 * HZ;
|
||||
|
||||
/* MTU range: 60 - 9000 */
|
||||
netdev->min_mtu = VMXNET3_MIN_MTU;
|
||||
netdev->max_mtu = VMXNET3_MAX_MTU;
|
||||
|
||||
INIT_WORK(&adapter->work, vmxnet3_reset_work);
|
||||
set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
|
||||
|
||||
|
@ -2367,41 +2367,29 @@ static void vxlan_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static int __vxlan_change_mtu(struct net_device *dev,
|
||||
struct net_device *lowerdev,
|
||||
struct vxlan_rdst *dst, int new_mtu, bool strict)
|
||||
{
|
||||
int max_mtu = IP_MAX_MTU;
|
||||
|
||||
if (lowerdev)
|
||||
max_mtu = lowerdev->mtu;
|
||||
|
||||
if (dst->remote_ip.sa.sa_family == AF_INET6)
|
||||
max_mtu -= VXLAN6_HEADROOM;
|
||||
else
|
||||
max_mtu -= VXLAN_HEADROOM;
|
||||
|
||||
if (new_mtu < 68)
|
||||
return -EINVAL;
|
||||
|
||||
if (new_mtu > max_mtu) {
|
||||
if (strict)
|
||||
return -EINVAL;
|
||||
|
||||
new_mtu = max_mtu;
|
||||
}
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vxlan_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct vxlan_dev *vxlan = netdev_priv(dev);
|
||||
struct vxlan_rdst *dst = &vxlan->default_dst;
|
||||
struct net_device *lowerdev = __dev_get_by_index(vxlan->net,
|
||||
dst->remote_ifindex);
|
||||
return __vxlan_change_mtu(dev, lowerdev, dst, new_mtu, true);
|
||||
bool use_ipv6 = false;
|
||||
|
||||
if (dst->remote_ip.sa.sa_family == AF_INET6)
|
||||
use_ipv6 = true;
|
||||
|
||||
/* This check is different than dev->max_mtu, because it looks at
|
||||
* the lowerdev->mtu, rather than the static dev->max_mtu
|
||||
*/
|
||||
if (lowerdev) {
|
||||
int max_mtu = lowerdev->mtu -
|
||||
(use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
|
||||
if (new_mtu > max_mtu)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
|
||||
@ -2795,6 +2783,10 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
|
||||
vxlan_ether_setup(dev);
|
||||
}
|
||||
|
||||
/* MTU range: 68 - 65535 */
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = ETH_MAX_MTU;
|
||||
|
||||
vxlan->net = src_net;
|
||||
|
||||
dst->remote_vni = conf->vni;
|
||||
@ -2838,7 +2830,8 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
|
||||
#endif
|
||||
|
||||
if (!conf->mtu)
|
||||
dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
|
||||
dev->mtu = lowerdev->mtu -
|
||||
(use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
|
||||
|
||||
needed_headroom = lowerdev->hard_header_len;
|
||||
} else if (vxlan_addr_multicast(&dst->remote_ip)) {
|
||||
@ -2847,9 +2840,20 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
|
||||
}
|
||||
|
||||
if (conf->mtu) {
|
||||
err = __vxlan_change_mtu(dev, lowerdev, dst, conf->mtu, false);
|
||||
if (err)
|
||||
return err;
|
||||
int max_mtu = ETH_MAX_MTU;
|
||||
|
||||
if (lowerdev)
|
||||
max_mtu = lowerdev->mtu;
|
||||
|
||||
max_mtu -= (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
|
||||
|
||||
if (conf->mtu < dev->min_mtu || conf->mtu > dev->max_mtu)
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = conf->mtu;
|
||||
|
||||
if (conf->mtu > max_mtu)
|
||||
dev->mtu = max_mtu;
|
||||
}
|
||||
|
||||
if (use_ipv6 || conf->flags & VXLAN_F_COLLECT_METADATA)
|
||||
|
@ -302,7 +302,6 @@ static void c101_destroy_card(card_t *card)
|
||||
static const struct net_device_ops c101_ops = {
|
||||
.ndo_open = c101_open,
|
||||
.ndo_stop = c101_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = c101_ioctl,
|
||||
};
|
||||
|
@ -432,7 +432,6 @@ module_exit(cosa_exit);
|
||||
static const struct net_device_ops cosa_ops = {
|
||||
.ndo_open = cosa_net_open,
|
||||
.ndo_stop = cosa_net_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = cosa_net_ioctl,
|
||||
.ndo_tx_timeout = cosa_net_timeout,
|
||||
|
@ -887,7 +887,6 @@ static inline int dscc4_set_quartz(struct dscc4_dev_priv *dpriv, int hz)
|
||||
static const struct net_device_ops dscc4_ops = {
|
||||
.ndo_open = dscc4_open,
|
||||
.ndo_stop = dscc4_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = dscc4_ioctl,
|
||||
.ndo_tx_timeout = dscc4_tx_timeout,
|
||||
|
@ -2394,7 +2394,6 @@ fst_init_card(struct fst_card_info *card)
|
||||
static const struct net_device_ops fst_ops = {
|
||||
.ndo_open = fst_open,
|
||||
.ndo_stop = fst_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = fst_ioctl,
|
||||
.ndo_tx_timeout = fst_tx_timeout,
|
||||
|
@ -992,7 +992,6 @@ static const struct dev_pm_ops uhdlc_pm_ops = {
|
||||
static const struct net_device_ops uhdlc_ops = {
|
||||
.ndo_open = uhdlc_open,
|
||||
.ndo_stop = uhdlc_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = uhdlc_ioctl,
|
||||
};
|
||||
|
@ -46,14 +46,6 @@ static const char* version = "HDLC support module revision 1.22";
|
||||
|
||||
static struct hdlc_proto *first_proto;
|
||||
|
||||
int hdlc_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct packet_type *p, struct net_device *orig_dev)
|
||||
{
|
||||
@ -237,6 +229,8 @@ static void hdlc_setup_dev(struct net_device *dev)
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->priv_flags = IFF_WAN_HDLC;
|
||||
dev->mtu = HDLC_MAX_MTU;
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = HDLC_MAX_MTU;
|
||||
dev->type = ARPHRD_RAWHDLC;
|
||||
dev->hard_header_len = 16;
|
||||
dev->addr_len = 0;
|
||||
@ -353,7 +347,6 @@ MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
|
||||
MODULE_DESCRIPTION("HDLC support module");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
EXPORT_SYMBOL(hdlc_change_mtu);
|
||||
EXPORT_SYMBOL(hdlc_start_xmit);
|
||||
EXPORT_SYMBOL(hdlc_open);
|
||||
EXPORT_SYMBOL(hdlc_close);
|
||||
|
@ -1053,7 +1053,6 @@ static void pvc_setup(struct net_device *dev)
|
||||
static const struct net_device_ops pvc_ops = {
|
||||
.ndo_open = pvc_open,
|
||||
.ndo_stop = pvc_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = pvc_xmit,
|
||||
.ndo_do_ioctl = pvc_ioctl,
|
||||
};
|
||||
@ -1096,6 +1095,8 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
|
||||
}
|
||||
dev->netdev_ops = &pvc_ops;
|
||||
dev->mtu = HDLC_MAX_MTU;
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = HDLC_MAX_MTU;
|
||||
dev->priv_flags |= IFF_NO_QUEUE;
|
||||
dev->ml_priv = pvc;
|
||||
|
||||
|
@ -180,7 +180,6 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding,
|
||||
static const struct net_device_ops hostess_ops = {
|
||||
.ndo_open = hostess_open,
|
||||
.ndo_stop = hostess_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = hostess_ioctl,
|
||||
};
|
||||
|
@ -1321,7 +1321,6 @@ static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
static const struct net_device_ops hss_hdlc_ops = {
|
||||
.ndo_open = hss_hdlc_open,
|
||||
.ndo_stop = hss_hdlc_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = hss_hdlc_ioctl,
|
||||
};
|
||||
|
@ -808,7 +808,6 @@ static int lmc_attach(struct net_device *dev, unsigned short encoding,
|
||||
static const struct net_device_ops lmc_ops = {
|
||||
.ndo_open = lmc_open,
|
||||
.ndo_stop = lmc_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = lmc_ioctl,
|
||||
.ndo_tx_timeout = lmc_driver_timeout,
|
||||
|
@ -330,7 +330,6 @@ static void n2_destroy_card(card_t *card)
|
||||
static const struct net_device_ops n2_ops = {
|
||||
.ndo_open = n2_open,
|
||||
.ndo_stop = n2_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = n2_ioctl,
|
||||
};
|
||||
|
@ -291,7 +291,6 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
|
||||
static const struct net_device_ops pc300_ops = {
|
||||
.ndo_open = pc300_open,
|
||||
.ndo_stop = pc300_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = pc300_ioctl,
|
||||
};
|
||||
|
@ -270,7 +270,6 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
|
||||
static const struct net_device_ops pci200_ops = {
|
||||
.ndo_open = pci200_open,
|
||||
.ndo_stop = pci200_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = pci200_ioctl,
|
||||
};
|
||||
|
@ -174,7 +174,6 @@ static int sealevel_attach(struct net_device *dev, unsigned short encoding,
|
||||
static const struct net_device_ops sealevel_ops = {
|
||||
.ndo_open = sealevel_open,
|
||||
.ndo_stop = sealevel_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = sealevel_ioctl,
|
||||
};
|
||||
|
@ -551,7 +551,6 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev)
|
||||
static const struct net_device_ops wanxl_ops = {
|
||||
.ndo_open = wanxl_open,
|
||||
.ndo_stop = wanxl_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = wanxl_ioctl,
|
||||
.ndo_get_stats = wanxl_get_stats,
|
||||
|
@ -124,9 +124,6 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
|
||||
unsigned char *xbuff, *rbuff;
|
||||
int len;
|
||||
|
||||
if (newmtu > 65534)
|
||||
return -EINVAL;
|
||||
|
||||
len = 2 * newmtu;
|
||||
xbuff = kmalloc(len + 4, GFP_ATOMIC);
|
||||
rbuff = kmalloc(len + 4, GFP_ATOMIC);
|
||||
@ -751,6 +748,8 @@ static void x25_asy_setup(struct net_device *dev)
|
||||
*/
|
||||
|
||||
dev->mtu = SL_MTU;
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = 65534;
|
||||
dev->netdev_ops = &x25_asy_netdev_ops;
|
||||
dev->watchdog_timeo = HZ*20;
|
||||
dev->hard_header_len = 0;
|
||||
|
@ -394,25 +394,6 @@ drop:
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int i2400m_change_mtu(struct net_device *net_dev, int new_mtu)
|
||||
{
|
||||
int result;
|
||||
struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
|
||||
struct device *dev = i2400m_dev(i2400m);
|
||||
|
||||
if (new_mtu >= I2400M_MAX_MTU) {
|
||||
dev_err(dev, "Cannot change MTU to %d (max is %d)\n",
|
||||
new_mtu, I2400M_MAX_MTU);
|
||||
result = -EINVAL;
|
||||
} else {
|
||||
net_dev->mtu = new_mtu;
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void i2400m_tx_timeout(struct net_device *net_dev)
|
||||
{
|
||||
@ -590,7 +571,6 @@ static const struct net_device_ops i2400m_netdev_ops = {
|
||||
.ndo_stop = i2400m_stop,
|
||||
.ndo_start_xmit = i2400m_hard_start_xmit,
|
||||
.ndo_tx_timeout = i2400m_tx_timeout,
|
||||
.ndo_change_mtu = i2400m_change_mtu,
|
||||
};
|
||||
|
||||
static void i2400m_get_drvinfo(struct net_device *net_dev,
|
||||
@ -621,6 +601,8 @@ void i2400m_netdev_setup(struct net_device *net_dev)
|
||||
d_fnstart(3, NULL, "(net_dev %p)\n", net_dev);
|
||||
ether_setup(net_dev);
|
||||
net_dev->mtu = I2400M_MAX_MTU;
|
||||
net_dev->min_mtu = 0;
|
||||
net_dev->max_mtu = I2400M_MAX_MTU;
|
||||
net_dev->tx_queue_len = I2400M_TX_QLEN;
|
||||
net_dev->features =
|
||||
NETIF_F_VLAN_CHALLENGED
|
||||
|
@ -41,21 +41,6 @@ static int wil_stop(struct net_device *ndev)
|
||||
return wil_down(wil);
|
||||
}
|
||||
|
||||
static int wil_change_mtu(struct net_device *ndev, int new_mtu)
|
||||
{
|
||||
struct wil6210_priv *wil = ndev_to_wil(ndev);
|
||||
|
||||
if (new_mtu < 68 || new_mtu > mtu_max) {
|
||||
wil_err(wil, "invalid MTU %d\n", new_mtu);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
wil_dbg_misc(wil, "change MTU %d -> %d\n", ndev->mtu, new_mtu);
|
||||
ndev->mtu = new_mtu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wil_do_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
|
||||
{
|
||||
struct wil6210_priv *wil = ndev_to_wil(ndev);
|
||||
@ -69,7 +54,6 @@ static const struct net_device_ops wil_netdev_ops = {
|
||||
.ndo_start_xmit = wil_start_xmit,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_change_mtu = wil_change_mtu,
|
||||
.ndo_do_ioctl = wil_do_ioctl,
|
||||
};
|
||||
|
||||
@ -126,6 +110,7 @@ static int wil6210_netdev_poll_tx(struct napi_struct *napi, int budget)
|
||||
static void wil_dev_setup(struct net_device *dev)
|
||||
{
|
||||
ether_setup(dev);
|
||||
dev->max_mtu = mtu_max;
|
||||
dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -1295,14 +1295,6 @@ static struct iw_statistics *atmel_get_wireless_stats(struct net_device *dev)
|
||||
return &priv->wstats;
|
||||
}
|
||||
|
||||
static int atmel_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < 68) || (new_mtu > 2312))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int atmel_set_mac_address(struct net_device *dev, void *p)
|
||||
{
|
||||
struct sockaddr *addr = p;
|
||||
@ -1506,7 +1498,6 @@ static const struct file_operations atmel_proc_fops = {
|
||||
static const struct net_device_ops atmel_netdev_ops = {
|
||||
.ndo_open = atmel_open,
|
||||
.ndo_stop = atmel_close,
|
||||
.ndo_change_mtu = atmel_change_mtu,
|
||||
.ndo_set_mac_address = atmel_set_mac_address,
|
||||
.ndo_start_xmit = start_tx,
|
||||
.ndo_do_ioctl = atmel_ioctl,
|
||||
@ -1600,6 +1591,10 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
|
||||
dev->irq = irq;
|
||||
dev->base_addr = port;
|
||||
|
||||
/* MTU range: 68 - 2312 */
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = MAX_WIRELESS_BODY - ETH_FCS_LEN;
|
||||
|
||||
SET_NETDEV_DEV(dev, sys_dev);
|
||||
|
||||
if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) {
|
||||
|
@ -2329,14 +2329,6 @@ static int airo_set_mac_address(struct net_device *dev, void *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int airo_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < 68) || (new_mtu > 2400))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LIST_HEAD(airo_devices);
|
||||
|
||||
static void add_airo_dev(struct airo_info *ai)
|
||||
@ -2656,7 +2648,6 @@ static const struct net_device_ops airo11_netdev_ops = {
|
||||
.ndo_get_stats = airo_get_stats,
|
||||
.ndo_set_mac_address = airo_set_mac_address,
|
||||
.ndo_do_ioctl = airo_ioctl,
|
||||
.ndo_change_mtu = airo_change_mtu,
|
||||
};
|
||||
|
||||
static void wifi_setup(struct net_device *dev)
|
||||
@ -2668,6 +2659,8 @@ static void wifi_setup(struct net_device *dev)
|
||||
dev->type = ARPHRD_IEEE80211;
|
||||
dev->hard_header_len = ETH_HLEN;
|
||||
dev->mtu = AIRO_DEF_MTU;
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = MIC_MSGLEN_MAX;
|
||||
dev->addr_len = ETH_ALEN;
|
||||
dev->tx_queue_len = 100;
|
||||
|
||||
@ -2754,7 +2747,6 @@ static const struct net_device_ops airo_netdev_ops = {
|
||||
.ndo_set_rx_mode = airo_set_multicast_list,
|
||||
.ndo_set_mac_address = airo_set_mac_address,
|
||||
.ndo_do_ioctl = airo_ioctl,
|
||||
.ndo_change_mtu = airo_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
@ -2766,7 +2758,6 @@ static const struct net_device_ops mpi_netdev_ops = {
|
||||
.ndo_set_rx_mode = airo_set_multicast_list,
|
||||
.ndo_set_mac_address = airo_set_mac_address,
|
||||
.ndo_do_ioctl = airo_ioctl,
|
||||
.ndo_change_mtu = airo_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
@ -2822,6 +2813,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
|
||||
dev->irq = irq;
|
||||
dev->base_addr = port;
|
||||
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
|
||||
dev->max_mtu = MIC_MSGLEN_MAX;
|
||||
|
||||
SET_NETDEV_DEV(dev, dmdev);
|
||||
|
||||
|
@ -6035,7 +6035,6 @@ static const struct net_device_ops ipw2100_netdev_ops = {
|
||||
.ndo_open = ipw2100_open,
|
||||
.ndo_stop = ipw2100_close,
|
||||
.ndo_start_xmit = libipw_xmit,
|
||||
.ndo_change_mtu = libipw_change_mtu,
|
||||
.ndo_tx_timeout = ipw2100_tx_timeout,
|
||||
.ndo_set_mac_address = ipw2100_set_address,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
@ -6071,6 +6070,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
|
||||
dev->wireless_data = &priv->wireless_data;
|
||||
dev->watchdog_timeo = 3 * HZ;
|
||||
dev->irq = 0;
|
||||
dev->min_mtu = 68;
|
||||
dev->max_mtu = LIBIPW_DATA_LEN;
|
||||
|
||||
/* NOTE: We don't use the wireless_handlers hook
|
||||
* in dev as the system will start throwing WX requests
|
||||
|
@ -11561,7 +11561,6 @@ static const struct net_device_ops ipw_prom_netdev_ops = {
|
||||
.ndo_open = ipw_prom_open,
|
||||
.ndo_stop = ipw_prom_stop,
|
||||
.ndo_start_xmit = ipw_prom_hard_start_xmit,
|
||||
.ndo_change_mtu = libipw_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
@ -11587,6 +11586,9 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
|
||||
priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
|
||||
priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
|
||||
|
||||
priv->prom_net_dev->min_mtu = 68;
|
||||
priv->prom_net_dev->max_mtu = LIBIPW_DATA_LEN;
|
||||
|
||||
priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
|
||||
SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
|
||||
|
||||
@ -11619,7 +11621,6 @@ static const struct net_device_ops ipw_netdev_ops = {
|
||||
.ndo_set_rx_mode = ipw_net_set_multicast_list,
|
||||
.ndo_set_mac_address = ipw_net_set_mac_address,
|
||||
.ndo_start_xmit = libipw_xmit,
|
||||
.ndo_change_mtu = libipw_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
@ -11729,6 +11730,9 @@ static int ipw_pci_probe(struct pci_dev *pdev,
|
||||
net_dev->wireless_handlers = &ipw_wx_handler_def;
|
||||
net_dev->ethtool_ops = &ipw_ethtool_ops;
|
||||
|
||||
net_dev->min_mtu = 68;
|
||||
net_dev->max_mtu = LIBIPW_DATA_LEN;
|
||||
|
||||
err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group);
|
||||
if (err) {
|
||||
IPW_ERROR("failed to create sysfs device attributes\n");
|
||||
|
@ -948,7 +948,6 @@ static inline int libipw_is_cck_rate(u8 rate)
|
||||
/* libipw.c */
|
||||
void free_libipw(struct net_device *dev, int monitor);
|
||||
struct net_device *alloc_libipw(int sizeof_priv, int monitor);
|
||||
int libipw_change_mtu(struct net_device *dev, int new_mtu);
|
||||
|
||||
void libipw_networks_age(struct libipw_device *ieee, unsigned long age_secs);
|
||||
|
||||
|
@ -118,15 +118,6 @@ static void libipw_networks_initialize(struct libipw_device *ieee)
|
||||
&ieee->network_free_list);
|
||||
}
|
||||
|
||||
int libipw_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < 68) || (new_mtu > LIBIPW_DATA_LEN))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(libipw_change_mtu);
|
||||
|
||||
struct net_device *alloc_libipw(int sizeof_priv, int monitor)
|
||||
{
|
||||
struct libipw_device *ieee;
|
||||
|
@ -765,16 +765,6 @@ static void hostap_set_multicast_list(struct net_device *dev)
|
||||
}
|
||||
|
||||
|
||||
static int prism2_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if (new_mtu < PRISM2_MIN_MTU || new_mtu > PRISM2_MAX_MTU)
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void prism2_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
struct hostap_interface *iface;
|
||||
@ -813,7 +803,6 @@ static const struct net_device_ops hostap_netdev_ops = {
|
||||
.ndo_do_ioctl = hostap_ioctl,
|
||||
.ndo_set_mac_address = prism2_set_mac_address,
|
||||
.ndo_set_rx_mode = hostap_set_multicast_list,
|
||||
.ndo_change_mtu = prism2_change_mtu,
|
||||
.ndo_tx_timeout = prism2_tx_timeout,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
@ -826,7 +815,6 @@ static const struct net_device_ops hostap_mgmt_netdev_ops = {
|
||||
.ndo_do_ioctl = hostap_ioctl,
|
||||
.ndo_set_mac_address = prism2_set_mac_address,
|
||||
.ndo_set_rx_mode = hostap_set_multicast_list,
|
||||
.ndo_change_mtu = prism2_change_mtu,
|
||||
.ndo_tx_timeout = prism2_tx_timeout,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
@ -839,7 +827,6 @@ static const struct net_device_ops hostap_master_ops = {
|
||||
.ndo_do_ioctl = hostap_ioctl,
|
||||
.ndo_set_mac_address = prism2_set_mac_address,
|
||||
.ndo_set_rx_mode = hostap_set_multicast_list,
|
||||
.ndo_change_mtu = prism2_change_mtu,
|
||||
.ndo_tx_timeout = prism2_tx_timeout,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
@ -851,6 +838,8 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
|
||||
|
||||
iface = netdev_priv(dev);
|
||||
ether_setup(dev);
|
||||
dev->min_mtu = PRISM2_MIN_MTU;
|
||||
dev->max_mtu = PRISM2_MAX_MTU;
|
||||
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
|
||||
|
||||
/* kernel callbacks */
|
||||
|
@ -322,9 +322,6 @@ int orinoco_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
struct orinoco_private *priv = ndev_priv(dev);
|
||||
|
||||
if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU))
|
||||
return -EINVAL;
|
||||
|
||||
/* MTU + encapsulation + header length */
|
||||
if ((new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
|
||||
(priv->nicbuf_size - ETH_HLEN))
|
||||
@ -2288,6 +2285,9 @@ int orinoco_if_add(struct orinoco_private *priv,
|
||||
dev->base_addr = base_addr;
|
||||
dev->irq = irq;
|
||||
|
||||
dev->min_mtu = ORINOCO_MIN_MTU;
|
||||
dev->max_mtu = ORINOCO_MAX_MTU;
|
||||
|
||||
SET_NETDEV_DEV(dev, priv->dev);
|
||||
ret = register_netdev(dev);
|
||||
if (ret)
|
||||
|
@ -302,7 +302,7 @@ static int xenvif_close(struct net_device *dev)
|
||||
static int xenvif_change_mtu(struct net_device *dev, int mtu)
|
||||
{
|
||||
struct xenvif *vif = netdev_priv(dev);
|
||||
int max = vif->can_sg ? 65535 - VLAN_ETH_HLEN : ETH_DATA_LEN;
|
||||
int max = vif->can_sg ? ETH_MAX_MTU - VLAN_ETH_HLEN : ETH_DATA_LEN;
|
||||
|
||||
if (mtu > max)
|
||||
return -EINVAL;
|
||||
@ -471,6 +471,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
|
||||
|
||||
dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
|
||||
|
||||
dev->min_mtu = 0;
|
||||
dev->max_mtu = ETH_MAX_MTU - VLAN_ETH_HLEN;
|
||||
|
||||
/*
|
||||
* Initialise a dummy MAC address. We choose the numerically
|
||||
* largest non-broadcast address to prevent the address getting
|
||||
|
@ -1329,6 +1329,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
|
||||
netdev->features |= netdev->hw_features;
|
||||
|
||||
netdev->ethtool_ops = &xennet_ethtool_ops;
|
||||
netdev->min_mtu = 0;
|
||||
netdev->max_mtu = XEN_NETIF_MAX_TX_SIZE;
|
||||
SET_NETDEV_DEV(netdev, &dev->dev);
|
||||
|
||||
np->netdev = netdev;
|
||||
|
@ -1032,9 +1032,6 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
|
||||
struct ctcm_priv *priv;
|
||||
int max_bufsize;
|
||||
|
||||
if (new_mtu < 576 || new_mtu > 65527)
|
||||
return -EINVAL;
|
||||
|
||||
priv = dev->ml_priv;
|
||||
max_bufsize = priv->channel[CTCM_READ]->max_bufsize;
|
||||
|
||||
@ -1123,6 +1120,8 @@ void static ctcm_dev_setup(struct net_device *dev)
|
||||
dev->type = ARPHRD_SLIP;
|
||||
dev->tx_queue_len = 100;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->min_mtu = 576;
|
||||
dev->max_mtu = 65527;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1428,27 +1428,6 @@ static struct net_device_stats *netiucv_stats (struct net_device * dev)
|
||||
return &priv->stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* netiucv_change_mtu
|
||||
* @dev: Pointer to interface struct.
|
||||
* @new_mtu: The new MTU to use for this interface.
|
||||
*
|
||||
* Sets MTU of an interface.
|
||||
*
|
||||
* Returns 0 on success, -EINVAL if MTU is out of valid range.
|
||||
* (valid range is 576 .. NETIUCV_MTU_MAX).
|
||||
*/
|
||||
static int netiucv_change_mtu(struct net_device * dev, int new_mtu)
|
||||
{
|
||||
IUCV_DBF_TEXT(trace, 3, __func__);
|
||||
if (new_mtu < 576 || new_mtu > NETIUCV_MTU_MAX) {
|
||||
IUCV_DBF_TEXT(setup, 2, "given MTU out of valid range\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* attributes in sysfs
|
||||
*/
|
||||
@ -1986,12 +1965,13 @@ static const struct net_device_ops netiucv_netdev_ops = {
|
||||
.ndo_stop = netiucv_close,
|
||||
.ndo_get_stats = netiucv_stats,
|
||||
.ndo_start_xmit = netiucv_tx,
|
||||
.ndo_change_mtu = netiucv_change_mtu,
|
||||
};
|
||||
|
||||
static void netiucv_setup_netdevice(struct net_device *dev)
|
||||
{
|
||||
dev->mtu = NETIUCV_MTU_DEFAULT;
|
||||
dev->min_mtu = 576;
|
||||
dev->max_mtu = NETIUCV_MTU_MAX;
|
||||
dev->destructor = netiucv_free_netdevice;
|
||||
dev->hard_header_len = NETIUCV_HDRLEN;
|
||||
dev->addr_len = 0;
|
||||
|
@ -4202,10 +4202,6 @@ int qeth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
sprintf(dbf_text, "%8x", new_mtu);
|
||||
QETH_CARD_TEXT(card, 4, dbf_text);
|
||||
|
||||
if (new_mtu < 64)
|
||||
return -EINVAL;
|
||||
if (new_mtu > 65535)
|
||||
return -EINVAL;
|
||||
if ((!qeth_is_supported(card, IPA_IP_FRAGMENTATION)) &&
|
||||
(!qeth_mtu_is_valid(card, new_mtu)))
|
||||
return -EINVAL;
|
||||
|
@ -1107,6 +1107,8 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
|
||||
card->dev->ml_priv = card;
|
||||
card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
|
||||
card->dev->mtu = card->info.initial_mtu;
|
||||
card->dev->min_mtu = 64;
|
||||
card->dev->max_mtu = ETH_MAX_MTU;
|
||||
card->dev->netdev_ops = &qeth_l2_netdev_ops;
|
||||
card->dev->ethtool_ops =
|
||||
(card->info.type != QETH_CARD_TYPE_OSN) ?
|
||||
|
@ -3140,6 +3140,8 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
|
||||
card->dev->ml_priv = card;
|
||||
card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
|
||||
card->dev->mtu = card->info.initial_mtu;
|
||||
card->dev->min_mtu = 64;
|
||||
card->dev->max_mtu = ETH_MAX_MTU;
|
||||
card->dev->ethtool_ops = &qeth_l3_ethtool_ops;
|
||||
card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
|
@ -113,12 +113,10 @@ enum net_types {
|
||||
|
||||
};
|
||||
|
||||
#define ETH_HEADER_SIZE 14 /* size of ethernet header */
|
||||
|
||||
#define ETH_MIN_DATA_SIZE 46 /* minimum eth data size */
|
||||
#define ETH_MIN_PACKET_SIZE (ETH_HEADER_SIZE + ETH_MIN_DATA_SIZE)
|
||||
#define ETH_MIN_PACKET_SIZE (ETH_HLEN + ETH_MIN_DATA_SIZE)
|
||||
|
||||
#define ETH_MAX_MTU 16384 /* maximum data size */
|
||||
#define VISOR_ETH_MAX_MTU 16384 /* maximum data size */
|
||||
|
||||
#ifndef MAX_MACADDR_LEN
|
||||
#define MAX_MACADDR_LEN 6 /* number of bytes in MAC address */
|
||||
@ -288,7 +286,7 @@ struct net_pkt_xmt {
|
||||
int len; /* full length of data in the packet */
|
||||
int num_frags; /* number of fragments in frags containing data */
|
||||
struct phys_info frags[MAX_PHYS_INFO]; /* physical page information */
|
||||
char ethhdr[ETH_HEADER_SIZE]; /* the ethernet header */
|
||||
char ethhdr[ETH_HLEN]; /* the ethernet header */
|
||||
struct {
|
||||
/* these are needed for csum at uisnic end */
|
||||
u8 valid; /* 1 = struct is valid - else ignore */
|
||||
@ -323,7 +321,7 @@ struct net_pkt_xmtdone {
|
||||
*/
|
||||
#define RCVPOST_BUF_SIZE 4032
|
||||
#define MAX_NET_RCV_CHAIN \
|
||||
((ETH_MAX_MTU + ETH_HEADER_SIZE + RCVPOST_BUF_SIZE - 1) \
|
||||
((VISOR_ETH_MAX_MTU + ETH_HLEN + RCVPOST_BUF_SIZE - 1) \
|
||||
/ RCVPOST_BUF_SIZE)
|
||||
|
||||
struct net_pkt_rcvpost {
|
||||
|
@ -791,7 +791,7 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||
* pointing to
|
||||
*/
|
||||
firstfraglen = skb->len - skb->data_len;
|
||||
if (firstfraglen < ETH_HEADER_SIZE) {
|
||||
if (firstfraglen < ETH_HLEN) {
|
||||
spin_unlock_irqrestore(&devdata->priv_lock, flags);
|
||||
devdata->busy_cnt++;
|
||||
dev_err(&netdev->dev,
|
||||
@ -864,7 +864,7 @@ visornic_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||
/* copy ethernet header from first frag into ocmdrsp
|
||||
* - everything else will be pass in frags & DMA'ed
|
||||
*/
|
||||
memcpy(cmdrsp->net.xmt.ethhdr, skb->data, ETH_HEADER_SIZE);
|
||||
memcpy(cmdrsp->net.xmt.ethhdr, skb->data, ETH_HLEN);
|
||||
/* copy frags info - from skb->data we need to only provide access
|
||||
* beyond eth header
|
||||
*/
|
||||
|
@ -669,18 +669,6 @@ static int p80211knetdev_set_mac_address(struct net_device *dev, void *addr)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int wlan_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
/* 2312 is max 802.11 payload, 20 is overhead, (ether + llc +snap)
|
||||
and another 8 for wep. */
|
||||
if ((new_mtu < 68) || (new_mtu > (2312 - 20 - 8)))
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = new_mtu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops p80211_netdev_ops = {
|
||||
.ndo_init = p80211knetdev_init,
|
||||
.ndo_open = p80211knetdev_open,
|
||||
@ -690,7 +678,6 @@ static const struct net_device_ops p80211_netdev_ops = {
|
||||
.ndo_do_ioctl = p80211knetdev_do_ioctl,
|
||||
.ndo_set_mac_address = p80211knetdev_set_mac_address,
|
||||
.ndo_tx_timeout = p80211knetdev_tx_timeout,
|
||||
.ndo_change_mtu = wlan_change_mtu,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
|
||||
@ -756,6 +743,11 @@ int wlan_setup(struct wlandevice *wlandev, struct device *physdev)
|
||||
wdev->wiphy = wiphy;
|
||||
wdev->iftype = NL80211_IFTYPE_STATION;
|
||||
netdev->ieee80211_ptr = wdev;
|
||||
netdev->min_mtu = 68;
|
||||
/* 2312 is max 802.11 payload, 20 is overhead,
|
||||
* (ether + llc + snap) and another 8 for wep.
|
||||
*/
|
||||
netdev->max_mtu = (2312 - 20 - 8);
|
||||
|
||||
netif_stop_queue(netdev);
|
||||
netif_carrier_off(netdev);
|
||||
|
@ -2711,15 +2711,6 @@ static void gsm_mux_rx_netchar(struct gsm_dlci *dlci,
|
||||
return;
|
||||
}
|
||||
|
||||
static int gsm_change_mtu(struct net_device *net, int new_mtu)
|
||||
{
|
||||
struct gsm_mux_net *mux_net = netdev_priv(net);
|
||||
if ((new_mtu < 8) || (new_mtu > mux_net->dlci->gsm->mtu))
|
||||
return -EINVAL;
|
||||
net->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gsm_mux_net_init(struct net_device *net)
|
||||
{
|
||||
static const struct net_device_ops gsm_netdev_ops = {
|
||||
@ -2728,7 +2719,6 @@ static void gsm_mux_net_init(struct net_device *net)
|
||||
.ndo_start_xmit = gsm_mux_net_start_xmit,
|
||||
.ndo_tx_timeout = gsm_mux_net_tx_timeout,
|
||||
.ndo_get_stats = gsm_mux_net_get_stats,
|
||||
.ndo_change_mtu = gsm_change_mtu,
|
||||
};
|
||||
|
||||
net->netdev_ops = &gsm_netdev_ops;
|
||||
@ -2787,6 +2777,8 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc)
|
||||
return -ENOMEM;
|
||||
}
|
||||
net->mtu = dlci->gsm->mtu;
|
||||
net->min_mtu = 8;
|
||||
net->max_mtu = dlci->gsm->mtu;
|
||||
mux_net = netdev_priv(net);
|
||||
mux_net->dlci = dlci;
|
||||
kref_init(&mux_net->ref);
|
||||
|
@ -7973,7 +7973,6 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size)
|
||||
static const struct net_device_ops hdlcdev_ops = {
|
||||
.ndo_open = hdlcdev_open,
|
||||
.ndo_stop = hdlcdev_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = hdlcdev_ioctl,
|
||||
.ndo_tx_timeout = hdlcdev_tx_timeout,
|
||||
|
@ -1768,7 +1768,6 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size)
|
||||
static const struct net_device_ops hdlcdev_ops = {
|
||||
.ndo_open = hdlcdev_open,
|
||||
.ndo_stop = hdlcdev_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = hdlcdev_ioctl,
|
||||
.ndo_tx_timeout = hdlcdev_tx_timeout,
|
||||
|
@ -1887,7 +1887,6 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size)
|
||||
static const struct net_device_ops hdlcdev_ops = {
|
||||
.ndo_open = hdlcdev_open,
|
||||
.ndo_stop = hdlcdev_close,
|
||||
.ndo_change_mtu = hdlc_change_mtu,
|
||||
.ndo_start_xmit = hdlc_start_xmit,
|
||||
.ndo_do_ioctl = hdlcdev_ioctl,
|
||||
.ndo_tx_timeout = hdlcdev_tx_timeout,
|
||||
|
@ -261,19 +261,10 @@ out:
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
static int pn_net_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < PHONET_MIN_MTU) || (new_mtu > PHONET_MAX_MTU))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops pn_netdev_ops = {
|
||||
.ndo_open = pn_net_open,
|
||||
.ndo_stop = pn_net_close,
|
||||
.ndo_start_xmit = pn_net_xmit,
|
||||
.ndo_change_mtu = pn_net_mtu,
|
||||
};
|
||||
|
||||
static void pn_net_setup(struct net_device *dev)
|
||||
@ -282,6 +273,8 @@ static void pn_net_setup(struct net_device *dev)
|
||||
dev->type = ARPHRD_PHONET;
|
||||
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
|
||||
dev->mtu = PHONET_DEV_MTU;
|
||||
dev->min_mtu = PHONET_MIN_MTU;
|
||||
dev->max_mtu = PHONET_MAX_MTU;
|
||||
dev->hard_header_len = 1;
|
||||
dev->dev_addr[0] = PN_MEDIA_USB;
|
||||
dev->addr_len = 1;
|
||||
|
@ -142,15 +142,6 @@ static inline int qlen(struct usb_gadget *gadget, unsigned qmult)
|
||||
|
||||
/* NETWORK DRIVER HOOKUP (to the layer above this driver) */
|
||||
|
||||
static int ueth_change_mtu(struct net_device *net, int new_mtu)
|
||||
{
|
||||
if (new_mtu <= ETH_HLEN || new_mtu > GETHER_MAX_ETH_FRAME_LEN)
|
||||
return -ERANGE;
|
||||
net->mtu = new_mtu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
|
||||
{
|
||||
struct eth_dev *dev = netdev_priv(net);
|
||||
@ -736,7 +727,6 @@ static const struct net_device_ops eth_netdev_ops = {
|
||||
.ndo_open = eth_open,
|
||||
.ndo_stop = eth_stop,
|
||||
.ndo_start_xmit = eth_start_xmit,
|
||||
.ndo_change_mtu = ueth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
};
|
||||
@ -799,6 +789,10 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g,
|
||||
|
||||
net->ethtool_ops = &ops;
|
||||
|
||||
/* MTU range: 14 - 15412 */
|
||||
net->min_mtu = ETH_HLEN;
|
||||
net->max_mtu = GETHER_MAX_ETH_FRAME_LEN;
|
||||
|
||||
dev->gadget = g;
|
||||
SET_NETDEV_DEV(net, &g->dev);
|
||||
SET_NETDEV_DEVTYPE(net, &gadget_type);
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#ifdef __KERNEL__
|
||||
__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev);
|
||||
int fddi_change_mtu(struct net_device *dev, int new_mtu);
|
||||
struct net_device *alloc_fddidev(int sizeof_priv);
|
||||
#endif
|
||||
|
||||
|
@ -93,8 +93,6 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
|
||||
int hdlc_open(struct net_device *dev);
|
||||
/* Must be called by hardware driver when HDLC device is being closed */
|
||||
void hdlc_close(struct net_device *dev);
|
||||
/* May be used by hardware driver */
|
||||
int hdlc_change_mtu(struct net_device *dev, int new_mtu);
|
||||
/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
|
||||
netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user