Diet struct net_device a bit
Subsystems (3)
cover Diet struct net_device a bit
There are some pointers, that are used in protocols/drivers/etc in this struct. E.g. br_port, macvlan_port, ec_ptr, etc. Some of them can be simply compile out with ifdefs, some require a bit closer look.
Here's the summary:
Compiled out in this set with appropriate ifdef:
* br_port
* macvlan_port
* dn_ptr
* ec_ptr
* ax25_ptr
Require a closer look:
* atalk_ptr is shared with irda with "should we get our own field?" comment;
* ip_ptr and
* ip6_ptr are used in headers and gcc complains when trying to compile net/socket.c that these fields are unreclared;
* ieee80211_ptr is used in many wireless drivers. Need time to check for the config dependencies.
PATCH 1/5 Cut off br_port fied from net_device
And add the forward declaration for br_handle_frame_hook in include/linux/if_bridge.h
---
include/linux/if_bridge.h +2 -0
@@ -104,6 +104,8 @@ struct __fdb_entry#include <linux/netdevice.h> +struct net_bridge_port ; +extern void brioctl_set (int (*ioctl_hook)(struct net *,unsigned int ,void __user *));extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,struct sk_buff *skb);
include/linux/netdevice.h +2 -0
@@ -699,8 +699,10 @@ struct net_device/* Network namespace this network device is inside */ struct net *nd_net; +#if defined(CONFIG_BRIDGE ) || defined(CONFIG_BRIDGE_MODULE )/* bridge stuff */ struct net_bridge_port *br_port; +#endif /* macvlan */ struct macvlan_port *macvlan_port;
Signature · 1 line
1.5.3.4
Re: [Devel] [PATCH 1/5] Cut off br_port fied from net_device
include/linux/netdevice.h struct net_device · line 705
Quoted 13 lines · Pavel Emelyanov
And add the forward declaration for
br_handle_frame_hookininclude/linux/if_bridge.hinclude/linux/netdevice.h +2
-0@@ -699,8 +699,10 @@ struct net_device/* Network namespace this network device is inside */ struct net *nd_net; +#if defined(CONFIG_BRIDGE ) || defined(CONFIG_BRIDGE_MODULE )/* bridge stuff */ struct net_bridge_port *br_port; +#endif
Such ifdefs are troublesome, because one can compile kernel with CONFIG_BRIDGE=n and later decide he needs BRIDGE=m and go boom.
IPv6 -- the biggest violator of this rule should not be taken as example. :^)
Re: [Devel] [PATCH 1/5] Cut off br_port fied from net_device
Quoted 10 lines · Alexey Dobriyan
Quoted 9 lines · Pavel Emelyanov
And add the forward declaration for
br_handle_frame_hookininclude/linux/if_bridge.hinclude/linux/netdevice.h +0
-0@@ -699,8 +699,10 @@ struct net_device/* Network namespace this network device is inside */ struct net *nd_net;
Quoted 7 lines
include/linux/netdevice.h struct net_device · line 705
Quoted 4 lines
include/linux/netdevice.h +2
-0+#if defined(CONFIG_BRIDGE ) || defined(CONFIG_BRIDGE_MODULE )/* bridge stuff */ struct net_bridge_port *br_port; +#endif Such ifdefs are troublesome, because one can compile kernel with
CONFIG_BRIDGE=nand later decide he needs BRIDGE=m and go boom.
You will have to recompile the whole kernel when this config is on. Look at netif_receive_skb() ;)
Quoted 4 lines
IPv6 -- the biggest violator of this rule should not be taken as example. :^)
PATCH 2/5 Cut off macvlan_port from net_device
In reply to Pavel Emelyanov---
include/linux/netdevice.h +2 -0
@@ -703,8 +703,10 @@ struct net_device/* bridge stuff */ struct net_bridge_port *br_port;#endif +#if defined(CONFIG_MACVLAN ) || defined(CONFIG_MACVLAN_MODULE )/* macvlan */ struct macvlan_port *macvlan_port; +#endif /* class/net/name entry */ struct device dev;
Signature · 1 line
1.5.3.4
PATCH 3/5 Cut off ax25_ptr from net_device
In reply to Pavel Emelyanov---
include/linux/netdevice.h +2 -0
@@ -580,7 +580,9 @@ struct net_devicevoid *dn_ptr;/* DECnet specific data */ void *ip6_ptr;/* IPv6 specific data */ void *ec_ptr;/* Econet specific data */ +#if defined(CONFIG_AX25 ) || defined(CONFIG_AX25_MODULE )void *ax25_ptr;/* AX.25 specific data */ +#endif struct wireless_dev *ieee80211_ptr;/* IEEE 802.11 specific data, assign before registering */
Signature · 1 line
1.5.3.4
PATCH 4/5 Cut off ec_ptr from net_device
In reply to Pavel Emelyanov---
include/linux/netdevice.h +2 -0
@@ -579,7 +579,9 @@ struct net_devicevoid *ip_ptr;/* IPv4 specific data */ void *dn_ptr;/* DECnet specific data */ void *ip6_ptr;/* IPv6 specific data */ +#if defined(CONFIG_ECONET ) || defined(CONFIG_ECONET_MODULE )void *ec_ptr;/* Econet specific data */ +#endif #if defined(CONFIG_AX25 ) || defined(CONFIG_AX25_MODULE )void *ax25_ptr;/* AX.25 specific data */ #endif
Signature · 1 line
1.5.3.4
PATCH 5/5 Cut off dn_ptr from net_device
In reply to Pavel EmelyanovAnd remove a BUG_TRAP from netdev_run_todo as well.
---
include/linux/netdevice.h +2 -0
@@ -577,7 +577,9 @@ struct net_devicevoid *atalk_ptr;/* AppleTalk link */ void *ip_ptr;/* IPv4 specific data */ +#if defined(CONFIG_DECNET ) || defined(CONFIG_DECNET_MODULE )void *dn_ptr;/* DECnet specific data */ +#endif void *ip6_ptr;/* IPv6 specific data */ #if defined(CONFIG_ECONET ) || defined(CONFIG_ECONET_MODULE )void *ec_ptr;/* Econet specific data */
net/core/dev.c +2 -0
@@ -3781,7 +3781,9 @@ void netdev_run_todo(void)BUG_ON (atomic_read (&dev->refcnt));BUG_TRAP (!dev->ip_ptr);BUG_TRAP (!dev->ip6_ptr); +#if defined(CONFIG_DECNET ) || defined(CONFIG_DECNET_MODULE )BUG_TRAP (!dev->dn_ptr); +#endif if (dev->destructor) dev->destructor (dev);
Signature · 1 line
1.5.3.4
Quoted 2 lines · Pavel Emelyanov
*
ieee80211_ptris used in many wireless drivers. Need time to check for the config dependencies.
Depending on CFG80211 should be fine, if not that's a bug elsewhere.
johannes