Skip to content

Commit 8b6b413

Browse files
jarodwilsondavem330
authored andcommitted
net: use core MTU range checking in WAN drivers
- set min/max_mtu in all hdlc drivers, remove hdlc_change_mtu - sent max_mtu in lec driver, remove lec_change_mtu - set min/max_mtu in x25_asy driver CC: [email protected] CC: Krzysztof Halasa <[email protected]> CC: Krzysztof Halasa <[email protected]> CC: Jan "Yenya" Kasprzak <[email protected]> CC: Francois Romieu <[email protected]> CC: Kevin Curtis <[email protected]> CC: Zhao Qiang <[email protected]> Signed-off-by: Jarod Wilson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9c22b4a commit 8b6b413

File tree

22 files changed

+7
-42
lines changed

22 files changed

+7
-42
lines changed

drivers/char/pcmcia/synclink_cs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4248,7 +4248,6 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
42484248
static const struct net_device_ops hdlcdev_ops = {
42494249
.ndo_open = hdlcdev_open,
42504250
.ndo_stop = hdlcdev_close,
4251-
.ndo_change_mtu = hdlc_change_mtu,
42524251
.ndo_start_xmit = hdlc_start_xmit,
42534252
.ndo_do_ioctl = hdlcdev_ioctl,
42544253
.ndo_tx_timeout = hdlcdev_tx_timeout,

drivers/net/wan/c101.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ static void c101_destroy_card(card_t *card)
302302
static const struct net_device_ops c101_ops = {
303303
.ndo_open = c101_open,
304304
.ndo_stop = c101_close,
305-
.ndo_change_mtu = hdlc_change_mtu,
306305
.ndo_start_xmit = hdlc_start_xmit,
307306
.ndo_do_ioctl = c101_ioctl,
308307
};

drivers/net/wan/cosa.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ module_exit(cosa_exit);
432432
static const struct net_device_ops cosa_ops = {
433433
.ndo_open = cosa_net_open,
434434
.ndo_stop = cosa_net_close,
435-
.ndo_change_mtu = hdlc_change_mtu,
436435
.ndo_start_xmit = hdlc_start_xmit,
437436
.ndo_do_ioctl = cosa_net_ioctl,
438437
.ndo_tx_timeout = cosa_net_timeout,

drivers/net/wan/dscc4.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ static inline int dscc4_set_quartz(struct dscc4_dev_priv *dpriv, int hz)
887887
static const struct net_device_ops dscc4_ops = {
888888
.ndo_open = dscc4_open,
889889
.ndo_stop = dscc4_close,
890-
.ndo_change_mtu = hdlc_change_mtu,
891890
.ndo_start_xmit = hdlc_start_xmit,
892891
.ndo_do_ioctl = dscc4_ioctl,
893892
.ndo_tx_timeout = dscc4_tx_timeout,

drivers/net/wan/farsync.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,6 @@ fst_init_card(struct fst_card_info *card)
23942394
static const struct net_device_ops fst_ops = {
23952395
.ndo_open = fst_open,
23962396
.ndo_stop = fst_close,
2397-
.ndo_change_mtu = hdlc_change_mtu,
23982397
.ndo_start_xmit = hdlc_start_xmit,
23992398
.ndo_do_ioctl = fst_ioctl,
24002399
.ndo_tx_timeout = fst_tx_timeout,

drivers/net/wan/fsl_ucc_hdlc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,6 @@ static const struct dev_pm_ops uhdlc_pm_ops = {
992992
static const struct net_device_ops uhdlc_ops = {
993993
.ndo_open = uhdlc_open,
994994
.ndo_stop = uhdlc_close,
995-
.ndo_change_mtu = hdlc_change_mtu,
996995
.ndo_start_xmit = hdlc_start_xmit,
997996
.ndo_do_ioctl = uhdlc_ioctl,
998997
};

drivers/net/wan/hdlc.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ static const char* version = "HDLC support module revision 1.22";
4646

4747
static struct hdlc_proto *first_proto;
4848

49-
int hdlc_change_mtu(struct net_device *dev, int new_mtu)
50-
{
51-
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
52-
return -EINVAL;
53-
dev->mtu = new_mtu;
54-
return 0;
55-
}
56-
5749
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
5850
struct packet_type *p, struct net_device *orig_dev)
5951
{
@@ -237,6 +229,8 @@ static void hdlc_setup_dev(struct net_device *dev)
237229
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
238230
dev->priv_flags = IFF_WAN_HDLC;
239231
dev->mtu = HDLC_MAX_MTU;
232+
dev->min_mtu = 68;
233+
dev->max_mtu = HDLC_MAX_MTU;
240234
dev->type = ARPHRD_RAWHDLC;
241235
dev->hard_header_len = 16;
242236
dev->addr_len = 0;
@@ -353,7 +347,6 @@ MODULE_AUTHOR("Krzysztof Halasa <[email protected]>");
353347
MODULE_DESCRIPTION("HDLC support module");
354348
MODULE_LICENSE("GPL v2");
355349

356-
EXPORT_SYMBOL(hdlc_change_mtu);
357350
EXPORT_SYMBOL(hdlc_start_xmit);
358351
EXPORT_SYMBOL(hdlc_open);
359352
EXPORT_SYMBOL(hdlc_close);

drivers/net/wan/hdlc_fr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,6 @@ static void pvc_setup(struct net_device *dev)
10531053
static const struct net_device_ops pvc_ops = {
10541054
.ndo_open = pvc_open,
10551055
.ndo_stop = pvc_close,
1056-
.ndo_change_mtu = hdlc_change_mtu,
10571056
.ndo_start_xmit = pvc_xmit,
10581057
.ndo_do_ioctl = pvc_ioctl,
10591058
};
@@ -1096,6 +1095,8 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
10961095
}
10971096
dev->netdev_ops = &pvc_ops;
10981097
dev->mtu = HDLC_MAX_MTU;
1098+
dev->min_mtu = 68;
1099+
dev->max_mtu = HDLC_MAX_MTU;
10991100
dev->priv_flags |= IFF_NO_QUEUE;
11001101
dev->ml_priv = pvc;
11011102

drivers/net/wan/hostess_sv11.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding,
180180
static const struct net_device_ops hostess_ops = {
181181
.ndo_open = hostess_open,
182182
.ndo_stop = hostess_close,
183-
.ndo_change_mtu = hdlc_change_mtu,
184183
.ndo_start_xmit = hdlc_start_xmit,
185184
.ndo_do_ioctl = hostess_ioctl,
186185
};

drivers/net/wan/ixp4xx_hss.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,6 @@ static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
13211321
static const struct net_device_ops hss_hdlc_ops = {
13221322
.ndo_open = hss_hdlc_open,
13231323
.ndo_stop = hss_hdlc_close,
1324-
.ndo_change_mtu = hdlc_change_mtu,
13251324
.ndo_start_xmit = hdlc_start_xmit,
13261325
.ndo_do_ioctl = hss_hdlc_ioctl,
13271326
};

0 commit comments

Comments
 (0)