* [net-next] nlmon: use core MTU range checking in nlmon driver
@ 2016-12-07 9:26 Zhang Shengju
2016-12-07 18:30 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shengju @ 2016-12-07 9:26 UTC (permalink / raw)
To: jarod, netdev
Since commit 61e84623ace3 ("net: centralize net_device min/max MTU checking"),
mtu range is checked at dev_set_mtu().
This patch adds min_mtu for nlmon device and remove unnecessary
ndo_change_mtu() function.
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
drivers/net/nlmon.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c
index 7b7c70e..2de7fae 100644
--- a/drivers/net/nlmon.c
+++ b/drivers/net/nlmon.c
@@ -27,24 +27,6 @@ static netdev_tx_t nlmon_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
-static int nlmon_is_valid_mtu(int new_mtu)
-{
- /* Note that in netlink we do not really have an upper limit. On
- * default, we use NLMSG_GOODSIZE. Here at least we should make
- * sure that it's at least the header size.
- */
- return new_mtu >= (int) sizeof(struct nlmsghdr);
-}
-
-static int nlmon_change_mtu(struct net_device *dev, int new_mtu)
-{
- if (!nlmon_is_valid_mtu(new_mtu))
- return -EINVAL;
-
- dev->mtu = new_mtu;
- return 0;
-}
-
static int nlmon_dev_init(struct net_device *dev)
{
dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats);
@@ -124,7 +106,6 @@ static u32 always_on(struct net_device *dev)
.ndo_stop = nlmon_close,
.ndo_start_xmit = nlmon_xmit,
.ndo_get_stats64 = nlmon_get_stats64,
- .ndo_change_mtu = nlmon_change_mtu,
};
static void nlmon_setup(struct net_device *dev)
@@ -145,6 +126,7 @@ static void nlmon_setup(struct net_device *dev)
* expected in most cases.
*/
dev->mtu = NLMSG_GOODSIZE;
+ dev->min_mtu = sizeof(struct nlmsghdr);
}
static int nlmon_validate(struct nlattr *tb[], struct nlattr *data[])
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net-next] nlmon: use core MTU range checking in nlmon driver
2016-12-07 9:26 [net-next] nlmon: use core MTU range checking in nlmon driver Zhang Shengju
@ 2016-12-07 18:30 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-07 18:30 UTC (permalink / raw)
To: zhangshengju; +Cc: jarod, netdev
From: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Date: Wed, 7 Dec 2016 17:26:05 +0800
> Since commit 61e84623ace3 ("net: centralize net_device min/max MTU checking"),
> mtu range is checked at dev_set_mtu().
>
> This patch adds min_mtu for nlmon device and remove unnecessary
> ndo_change_mtu() function.
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-07 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 9:26 [net-next] nlmon: use core MTU range checking in nlmon driver Zhang Shengju
2016-12-07 18:30 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).