Skip to contentSkip to conversation

fix bridge <-> ATM compile error

PATCH In review Adrian Bunk 3 participants 10 messages Mar 15, 2005 – Mar 28, 2005

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix bridge <-> ATM compile error

This patch fixes the following compile error with CONFIG_BRIDGE=y and CONFIG_ATM_LANE=m:

<-- snip -->

...
LD .tmp_vmlinux1
net/built-in.o(.init.text+0x3ad1): In function `br_init':
: undefined reference to br_fdb_get_hook' net/built-in.o(.init.text+0x3adb): In function br_init':
: undefined reference to br_fdb_put_hook' net/built-in.o(.exit.text+0xa2): In function br_deinit':
: undefined reference to br_fdb_get_hook' net/built-in.o(.exit.text+0xac): In function br_deinit':
: undefined reference to `br_fdb_put_hook'
make: *** [.tmp_vmlinux1] Error 1

<-- snip -->

---

 net/bridge/br.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
net/bridge/br.c renamed from net/bridge/br.c.old +3 -3
@@ -22,7 +22,7 @@
 
 #include "br_private.h"
 
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
+#if defined(CONFIG_ATM_LANE) || (defined(CONFIG_ATM_LANE_MODULE) && defined(MODULE))
 #include "../atm/lec.h"
 #endif
 
@@ -39,7 +39,7 @@
 	brioctl_set(br_ioctl_deviceless_stub);
 	br_handle_frame_hook = br_handle_frame;
 
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
+#if defined(CONFIG_ATM_LANE) || (defined(CONFIG_ATM_LANE_MODULE) && defined(MODULE))
 	br_fdb_get_hook = br_fdb_get;
 	br_fdb_put_hook = br_fdb_put;
 #endif
@@ -60,7 +60,7 @@
 
 	synchronize_net();
 
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
+#if defined(CONFIG_ATM_LANE) || (defined(CONFIG_ATM_LANE_MODULE) && defined(MODULE))
 	br_fdb_get_hook = NULL;
 	br_fdb_put_hook = NULL;
 #endif
#1 lore raw

Given the #ifdef mess, perhaps bridge should have the hooks available independent of the configuration.

#2 lore raw
Quoted 2 lines · Stephen Hemminger

Given the #ifdef mess, perhaps bridge should have the hooks available independent of the configuration.

The problem is the other way round:
The bridge code accesses hooks in the ATM code.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
In reply to Stephen Hemminger
Quoted 2 lines · Stephen Hemminger

Given the #ifdef mess, perhaps bridge should have the hooks available independent of the configuration.

The problem is the other way round:
The bridge code accesses hooks in the ATM code.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#4 lore raw
In reply to Adrian Bunk
Quoted 2 lines · In message <[email protected]>,Adrian Bunk writes:

This patch fixes the following compile error with CONFIG_BRIDGE=y and CONFIG_ATM_LANE=m:

isnt the problem more that CONFIG_ATM=m not CONFIG_ATM_LANE=m? perhaps CONFIG_BRIDGE should be dependent on CONFIG_ATM. if atm is a module then bridge cannot be a module (unless the hooks are moved from atm to bridge)?

#5 lore raw
Quoted 8 lines · chas williams - CONTRACTOR
Quoted 2 lines · In message <[email protected]>,Adrian Bunk writes:

This patch fixes the following compile error with CONFIG_BRIDGE=y and CONFIG_ATM_LANE=m:

isnt the problem more that CONFIG_ATM=m not CONFIG_ATM_LANE=m? perhaps CONFIG_BRIDGE should be dependent on CONFIG_ATM. if atm is a module then bridge cannot be a module (unless the hooks are moved from atm to bridge)?

The problem is currently CONFIG_ATM_LANE due to the #ifdef's in net/atm/common.c .

Letting CONFIG_BRIDGE depend on CONFIG_ATM doesn't sound like a good idea, since I doubt all people using the Bridge code require ATM support.

Moving the hooks to the bridge code will give you exactly the same problems the other way round.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#6 lore raw
Quoted 3 lines · In message <[email protected]>,Adrian Bunk writes:

Letting CONFIG_BRIDGE depend on CONFIG_ATM doesn't sound like a good idea, since I doubt all people using the Bridge code require ATM support.

i agree.

Quoted 2 lines

Moving the hooks to the bridge code will give you exactly the same problems the other way round.

how about moving them to a third location like net/core/dev.c?

#7 lore raw
In reply to Adrian Bunk
Quoted 3 lines · In message <[email protected]>,Adrian Bunk writes:

Letting CONFIG_BRIDGE depend on CONFIG_ATM doesn't sound like a good idea, since I doubt all people using the Bridge code require ATM support.

how about the following?

===== net/atm/common.c 1.58 vs edited =====

net/atm/common.c +0 -15
@@ -755,21 +755,6 @@
 	return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len);
 }
 
-
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
-#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
-struct net_bridge;
-struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
-						unsigned char *addr) = NULL;
-void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent) = NULL;
-#if defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_BRIDGE_MODULE)
-EXPORT_SYMBOL(br_fdb_get_hook);
-EXPORT_SYMBOL(br_fdb_put_hook);
-#endif /* defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_BRIDGE_MODULE) */
-#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
-#endif /* defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) */
-
-
 static int __init atm_init(void)
 {
 	int error;

===== net/atm/lec.c 1.47 vs edited =====

net/atm/lec.c +1 -4
@@ -37,11 +37,8 @@
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
 #include <linux/if_bridge.h>
 #include "../bridge/br_private.h"
-static unsigned char bridge_ula_lec[] = {0x01, 0x80, 0xc2, 0x00, 0x00};
 
-extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
-       unsigned char *addr);
-extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
+static unsigned char bridge_ula_lec[] = {0x01, 0x80, 0xc2, 0x00, 0x00};
 #endif
 
 /* Modular too */

===== net/atm/lec.h 1.13 vs edited =====

net/atm/lec.h +0 -8
@@ -14,14 +14,6 @@
 #include <linux/netdevice.h>
 #include <linux/atmlec.h>
 
-#if defined (CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
-#include <linux/if_bridge.h>
-struct net_bridge;
-extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
-                                                unsigned char *addr);
-extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
-#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
-
 #define LEC_HEADER_LEN 16
 
 struct lecdatahdr_8023 {

===== net/bridge/br.c 1.20 vs edited =====

net/bridge/br.c +1 -8
@@ -22,10 +22,6 @@
 
 #include "br_private.h"
 
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
-#include "../atm/lec.h"
-#endif
-
 int (*br_should_route_hook) (struct sk_buff **pskb) = NULL;
 
 static int __init br_init(void)
@@ -39,10 +35,9 @@
 	brioctl_set(br_ioctl_deviceless_stub);
 	br_handle_frame_hook = br_handle_frame;
 
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
 	br_fdb_get_hook = br_fdb_get;
 	br_fdb_put_hook = br_fdb_put;
-#endif
+
 	register_netdevice_notifier(&br_device_notifier);
 
 	return 0;
@@ -60,10 +55,8 @@
 
 	synchronize_net();
 
-#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
 	br_fdb_get_hook = NULL;
 	br_fdb_put_hook = NULL;
-#endif
 
 	br_handle_frame_hook = NULL;
 	br_fdb_fini();

===== net/bridge/br_private.h 1.37 vs edited =====

net/bridge/br_private.h +6 -0
@@ -216,6 +216,12 @@
 extern void br_stp_port_timer_init(struct net_bridge_port *p);
 extern unsigned long br_timer_value(const struct timer_list *timer);
 
+/* br.c */
+extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
+						       unsigned char *addr);
+extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
+
+
 #ifdef CONFIG_SYSFS
 /* br_sysfs_if.c */
 extern int br_sysfs_addif(struct net_bridge_port *p);

===== net/core/dev.c 1.185 vs edited =====

net/core/dev.c +6 -0
@@ -1561,6 +1561,10 @@
 
 #if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
 int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb);
+struct net_bridge;
+struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
+						unsigned char *addr);
+void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
 
 static __inline__ int handle_bridge(struct sk_buff **pskb,
 				    struct packet_type **pt_prev, int *ret)
@@ -3346,6 +3350,8 @@
 
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
 EXPORT_SYMBOL(br_handle_frame_hook);
+EXPORT_SYMBOL(br_fdb_get_hook);
+EXPORT_SYMBOL(br_fdb_put_hook);
 #endif
 
 #ifdef CONFIG_KMOD
#8 lore raw
Quoted 7 lines · chas williams - CONTRACTOR
Quoted 3 lines · In message <[email protected]>,Adrian Bunk writes:

Letting CONFIG_BRIDGE depend on CONFIG_ATM doesn't sound like a good idea, since I doubt all people using the Bridge code require ATM support.

how about the following?
...

Looks good.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#9 lore raw
Quoted 10 lines · On Sun, 20 Mar 2005 00:04:58 +0100 Adrian Bunk <[email protected]> wrote:
Quoted 7 lines · chas williams - CONTRACTOR
Quoted 3 lines · In message <[email protected]>,Adrian Bunk writes:

Letting CONFIG_BRIDGE depend on CONFIG_ATM doesn't sound like a good idea, since I doubt all people using the Bridge code require ATM support.

how about the following?
...

Looks good

Ditto