netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Diet struct net_device a bit
@ 2007-10-22 12:31 Pavel Emelyanov
  2007-10-22 12:33 ` [PATCH 1/5] Cut off br_port fied from net_device Pavel Emelyanov
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 12:31 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

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.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] Cut off br_port fied from net_device
  2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
@ 2007-10-22 12:33 ` Pavel Emelyanov
  2007-10-22 12:49   ` [Devel] " Alexey Dobriyan
  2007-10-22 12:34 ` [PATCH 2/5] Cut off macvlan_port " Pavel Emelyanov
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 12:33 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

And add the forward declaration for br_handle_frame_hook in
include/linux/if_bridge.h

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 58e43e5..a718586 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -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);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a3f54e..469e04f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -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;
 
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] Cut off macvlan_port from net_device
  2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
  2007-10-22 12:33 ` [PATCH 1/5] Cut off br_port fied from net_device Pavel Emelyanov
@ 2007-10-22 12:34 ` Pavel Emelyanov
  2007-10-22 12:35 ` [PATCH 3/5] Cut off ax25_ptr " Pavel Emelyanov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 12:34 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 469e04f..c41a5c4 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -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;
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] Cut off ax25_ptr from net_device
  2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
  2007-10-22 12:33 ` [PATCH 1/5] Cut off br_port fied from net_device Pavel Emelyanov
  2007-10-22 12:34 ` [PATCH 2/5] Cut off macvlan_port " Pavel Emelyanov
@ 2007-10-22 12:35 ` Pavel Emelyanov
  2007-10-22 12:36 ` [PATCH 4/5] Cut off ec_ptr " Pavel Emelyanov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 12:35 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c41a5c4..504f843 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -580,7 +580,9 @@ struct net_device
 	void                    *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 */
 
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] Cut off ec_ptr from net_device
  2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
                   ` (2 preceding siblings ...)
  2007-10-22 12:35 ` [PATCH 3/5] Cut off ax25_ptr " Pavel Emelyanov
@ 2007-10-22 12:36 ` Pavel Emelyanov
  2007-10-22 12:37 ` [PATCH 5/5] Cut off dn_ptr " Pavel Emelyanov
  2007-10-23 17:07 ` [PATCH 0/5] Diet struct net_device a bit Johannes Berg
  5 siblings, 0 replies; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 12:36 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 504f843..472d9cc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -579,7 +579,9 @@ struct net_device
 	void			*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
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] Cut off dn_ptr from net_device
  2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
                   ` (3 preceding siblings ...)
  2007-10-22 12:36 ` [PATCH 4/5] Cut off ec_ptr " Pavel Emelyanov
@ 2007-10-22 12:37 ` Pavel Emelyanov
  2007-10-23 17:07 ` [PATCH 0/5] Diet struct net_device a bit Johannes Berg
  5 siblings, 0 replies; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 12:37 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

And remove a BUG_TRAP from netdev_run_todo as well.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 472d9cc..e94c636 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -577,7 +577,9 @@ struct net_device
 	
 	void 			*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	*/
diff --git a/net/core/dev.c b/net/core/dev.c
index 8726589..3ac35fe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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);
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Devel] [PATCH 1/5] Cut off br_port fied from net_device
  2007-10-22 12:33 ` [PATCH 1/5] Cut off br_port fied from net_device Pavel Emelyanov
@ 2007-10-22 12:49   ` Alexey Dobriyan
  2007-10-22 13:02     ` Pavel Emelyanov
  0 siblings, 1 reply; 9+ messages in thread
From: Alexey Dobriyan @ 2007-10-22 12:49 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List, devel

On Mon, Oct 22, 2007 at 04:33:33PM +0400, Pavel Emelyanov wrote:
> And add the forward declaration for br_handle_frame_hook in
> include/linux/if_bridge.h

> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -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. :^)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Devel] [PATCH 1/5] Cut off br_port fied from net_device
  2007-10-22 12:49   ` [Devel] " Alexey Dobriyan
@ 2007-10-22 13:02     ` Pavel Emelyanov
  0 siblings, 0 replies; 9+ messages in thread
From: Pavel Emelyanov @ 2007-10-22 13:02 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: David Miller, Linux Netdev List, devel

Alexey Dobriyan wrote:
> On Mon, Oct 22, 2007 at 04:33:33PM +0400, Pavel Emelyanov wrote:
>> And add the forward declaration for br_handle_frame_hook in
>> include/linux/if_bridge.h
> 
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -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.

You will have to recompile the whole kernel when this config
is on. Look at netif_receive_skb() ;)

> IPv6 -- the biggest violator of this rule should not be taken as
> example. :^)
> 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] Diet struct net_device a bit
  2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
                   ` (4 preceding siblings ...)
  2007-10-22 12:37 ` [PATCH 5/5] Cut off dn_ptr " Pavel Emelyanov
@ 2007-10-23 17:07 ` Johannes Berg
  5 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2007-10-23 17:07 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List, devel

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

On Mon, 2007-10-22 at 16:31 +0400, Pavel Emelyanov wrote:

>  * ieee80211_ptr is 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-10-24  8:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 12:31 [PATCH 0/5] Diet struct net_device a bit Pavel Emelyanov
2007-10-22 12:33 ` [PATCH 1/5] Cut off br_port fied from net_device Pavel Emelyanov
2007-10-22 12:49   ` [Devel] " Alexey Dobriyan
2007-10-22 13:02     ` Pavel Emelyanov
2007-10-22 12:34 ` [PATCH 2/5] Cut off macvlan_port " Pavel Emelyanov
2007-10-22 12:35 ` [PATCH 3/5] Cut off ax25_ptr " Pavel Emelyanov
2007-10-22 12:36 ` [PATCH 4/5] Cut off ec_ptr " Pavel Emelyanov
2007-10-22 12:37 ` [PATCH 5/5] Cut off dn_ptr " Pavel Emelyanov
2007-10-23 17:07 ` [PATCH 0/5] Diet struct net_device a bit Johannes Berg

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).