From: Arend Van Spriel <arend.vanspriel@broadcom.com>
To: Johannes Berg <johannes@sipsolutions.net>,
"backports@vger.kernel.org" <backports@vger.kernel.org>
Subject: Re: min/max mtu field in struct net_device
Date: Mon, 14 Nov 2016 11:46:01 +0100 [thread overview]
Message-ID: <57925560-252e-a547-fe09-959362d9dce4@broadcom.com> (raw)
In-Reply-To: <1479115859.7899.3.camel@sipsolutions.net>
[-- Attachment #1: Type: text/plain, Size: 849 bytes --]
On 14-11-2016 10:30, Johannes Berg wrote:
> On Mon, 2016-11-14 at 09:49 +0100, Arend Van Spriel wrote:
>> Just wondering. Does anyone have any ideas on how to backport the two
>> patches below. The struct net_device now holds mtu range which
>> network subsystem checks. For a number of drivers and mac80211 it
>> means they no longer have .ndo_change_mtu callback. My guess is that
>> we need patches in backport of some sort to tackle this.
>
> Yeah, I kinda saw this coming. Since in almost all cases using the new
> min/max the ndo_change_mtu was actually removed, perhaps we can come up
> with a way to spatch it back in?
Me too. This is what I got so far, but the callback is generated twice
for net/mac80211/iface.c for obvious reasons (data and monitor ops).
These are my first baby steps with spatch so not sure how to solve it.
Gr. AvS
[-- Attachment #2: 0073-netdevice-mtu-range.cocci --]
[-- Type: text/plain, Size: 395 bytes --]
@r1@
expression ndev, e1, e2;
identifier func;
@@
func(...) {
<...
- ndev->min_mtu = e1;
- ndev->max_mtu = e2;
...>
}
@@
expression r1.e1, r1.e2;
identifier OPS;
@@
+ static int __change_mtu(struct net_device *ndev, int new_mtu)
+ {
+ if (new_mtu < e1 || new_mtu > e2)
+ return -EINVAL;
+ ndev->mtu = new_mtu;
+ }
+
struct net_device_ops OPS = {
+ .ndo_change_mtu = __change_mtu,
...
};
next prev parent reply other threads:[~2016-11-14 10:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-14 8:49 min/max mtu field in struct net_device Arend Van Spriel
2016-11-14 9:30 ` Johannes Berg
2016-11-14 10:46 ` Arend Van Spriel [this message]
2016-11-14 13:27 ` Johannes Berg
2016-11-15 8:36 ` Fwd: " Arend Van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57925560-252e-a547-fe09-959362d9dce4@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=backports@vger.kernel.org \
--cc=johannes@sipsolutions.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox