* min/max mtu field in struct net_device
@ 2016-11-14 8:49 Arend Van Spriel
2016-11-14 9:30 ` Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Arend Van Spriel @ 2016-11-14 8:49 UTC (permalink / raw)
To: backports@vger.kernel.org
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.
Regards,
Arend
commit 61e84623ace35ce48975e8f90bbbac7557c43d61
Author: Jarod Wilson <jarod@redhat.com>
Date: Fri Oct 7 22:04:33 2016 -0400
net: centralize net_device min/max MTU checking
commit 9c22b4a34eddbaa5b5243c8cd27e31aa36e676e1
Author: Jarod Wilson <jarod@redhat.com>
Date: Thu Oct 20 13:55:18 2016 -0400
net: use core MTU range checking in wireless drivers
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: min/max mtu field in struct net_device
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
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2016-11-14 9:30 UTC (permalink / raw)
To: Arend Van Spriel, backports@vger.kernel.org
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?
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: min/max mtu field in struct net_device
2016-11-14 9:30 ` Johannes Berg
@ 2016-11-14 10:46 ` Arend Van Spriel
2016-11-14 13:27 ` Johannes Berg
2016-11-15 8:36 ` Fwd: " Arend Van Spriel
0 siblings, 2 replies; 5+ messages in thread
From: Arend Van Spriel @ 2016-11-14 10:46 UTC (permalink / raw)
To: Johannes Berg, backports@vger.kernel.org
[-- 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,
...
};
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: min/max mtu field in struct net_device
2016-11-14 10:46 ` Arend Van Spriel
@ 2016-11-14 13:27 ` Johannes Berg
2016-11-15 8:36 ` Fwd: " Arend Van Spriel
1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2016-11-14 13:27 UTC (permalink / raw)
To: Arend Van Spriel, backports@vger.kernel.org
> 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.
Oh, right, that's problematic - no easy way to link the two and know
which one is which ...
I guess we'll have to carry that as a manual patch. We should probably
also ifdef on the kernel version.
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply [flat|nested] 5+ messages in thread
* Fwd: Re: min/max mtu field in struct net_device
2016-11-14 10:46 ` Arend Van Spriel
2016-11-14 13:27 ` Johannes Berg
@ 2016-11-15 8:36 ` Arend Van Spriel
1 sibling, 0 replies; 5+ messages in thread
From: Arend Van Spriel @ 2016-11-15 8:36 UTC (permalink / raw)
To: Julia Lawall; +Cc: backports@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]
Hi Julia,
Would you have any ideas on how to solve the problem below. The problem
occurs with source files that have more than one struct net_device_ops
defined, which is the case for net/mac80211/iface.c for one. Obviously I
want the callback definition to be added only once.
Regards,
Arend
-------- Forwarded Message --------
Subject: Re: min/max mtu field in struct net_device
Date: Mon, 14 Nov 2016 11:46:01 +0100
From: Arend Van Spriel <arend.vanspriel@broadcom.com>
To: Johannes Berg <johannes@sipsolutions.net>, backports@vger.kernel.org
<backports@vger.kernel.org>
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,
...
};
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-15 8:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-11-14 13:27 ` Johannes Berg
2016-11-15 8:36 ` Fwd: " Arend Van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox