patch-2.1.93 linux/include/net/br.h

Next file: linux/include/net/ip.h
Previous file: linux/include/linux/skbuff.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.92/linux/include/net/br.h linux/include/net/br.h
@@ -27,7 +27,7 @@
 /*
  * We time out our entries in the FDB after this many seconds.
  */
-#define FDB_TIMEOUT	300
+#define FDB_TIMEOUT	20 /* JRP: 20s as NSC bridge code, was 300 for Linux */
 
 /*
  * the following defines are the initial values used when the 
@@ -40,6 +40,10 @@
 #define BRIDGE_FORWARD_DELAY	15
 #define HOLD_TIME		1
 
+/* broacast/multicast storm limitation. This per source. */
+#define MAX_MCAST_PER_PERIOD    4
+#define MCAST_HOLD_TIME		10	/* in jiffies unit (10ms increment) */
+
 #define Default_path_cost 10
 
 /*
@@ -71,13 +75,25 @@
 #define BRIDGE_ID_ULA	bi.p_u.ula
 #define BRIDGE_ID	bi.id
 
+/* JRP: on the network the flags field is between "type" and "root_id"
+ * this is unfortunated! To make the code portable to a RISC machine
+ * the pdus are now massaged a little bit for processing
+ */ 
+#define TOPOLOGY_CHANGE		0x01
+#define TOPOLOGY_CHANGE_ACK	0x80
+#define BRIDGE_BPDU_8021_CONFIG_SIZE            35	/* real size */
+#define BRIDGE_BPDU_8021_CONFIG_FLAG_OFFSET	 4
+#define BRIDGE_BPDU_8021_PROTOCOL_ID 0
+#define BRIDGE_BPDU_8021_PROTOCOL_VERSION_ID 0
+#define BRIDGE_LLC1_HS 3
+#define BRIDGE_LLC1_DSAP 0x42
+#define BRIDGE_LLC1_SSAP 0x42
+#define BRIDGE_LLC1_CTRL 0x03
+
 typedef struct {
 	unsigned short	protocol_id;	
 	unsigned char	protocol_version_id;
 	unsigned char   type;
-	unsigned char   flags;
-#define TOPOLOGY_CHANGE		0x01
-#define TOPOLOGY_CHANGE_ACK	0x80
 	bridge_id_t      root_id;		  /* (4.5.1.1)	 */
 	unsigned int     root_path_cost;	  /* (4.5.1.2)	 */
 	bridge_id_t      bridge_id;		  /* (4.5.1.3)	 */
@@ -86,8 +102,23 @@
 	unsigned short   max_age;		  /* (4.5.1.6)	 */
 	unsigned short   hello_time;		  /* (4.5.1.7)	 */
 	unsigned short   forward_delay;		  /* (4.5.1.8)	 */
+	unsigned char   top_change_ack;
+	unsigned char   top_change;
 } Config_bpdu;
 
+#ifdef __LITTLE_ENDIAN
+#define config_bpdu_hton(config_bpdu) \
+        (config_bpdu)->root_path_cost = htonl((config_bpdu)->root_path_cost); \
+        (config_bpdu)->port_id = htons((config_bpdu)->port_id); \
+        (config_bpdu)->message_age = htons((config_bpdu)->message_age); \
+        (config_bpdu)->max_age = htons((config_bpdu)->max_age); \
+        (config_bpdu)->hello_time = htons((config_bpdu)->hello_time); \
+        (config_bpdu)->forward_delay = htons((config_bpdu)->forward_delay);
+#else
+#define config_bpdu_hton(config_bpdu)
+#endif
+#define config_bpdu_ntoh config_bpdu_hton
+
 
 /** Topology Change Notification BPDU Parameters (4.5.2) **/
 
@@ -112,12 +143,10 @@
 	unsigned short   bridge_max_age;	  /* (4.5.3.8)	 */
 	unsigned short   bridge_hello_time;	  /* (4.5.3.9)	 */
 	unsigned short   bridge_forward_delay;	  /* (4.5.3.10)	 */
-	unsigned int     topology_change_detected; /* (4.5.3.11) */
-	unsigned int     topology_change;	  /* (4.5.3.12)	 */
+	unsigned int     top_change_detected;	  /* (4.5.3.11) */
+	unsigned int     top_change;		  /* (4.5.3.12)	 */
 	unsigned short   topology_change_time;	  /* (4.5.3.13)	 */
 	unsigned short   hold_time;		  /* (4.5.3.14)	 */
-	unsigned int     top_change;
-	unsigned int     top_change_detected;
 } Bridge_data;
 
 /** Port Parameters (4.5.5) **/
@@ -149,8 +178,11 @@
 	unsigned char pad[2];
 	unsigned short port;
 	unsigned int timer;
-	unsigned int flags;
+	unsigned short flags;
 #define FDB_ENT_VALID	0x01
+	unsigned short mcast_count;
+	unsigned int   mcast_timer;		/* oldest xxxxxcast */
+	
 /* AVL tree of all addresses, sorted by address */
 	short fdb_avl_height;
 	struct fdb *fdb_avl_left;
@@ -159,6 +191,19 @@
 	struct fdb *fdb_next;
 };
 
+/* data returned on BRCMD_DISPLAY_FDB */
+struct fdb_info {
+	unsigned char ula[6];
+	unsigned char port;
+        unsigned char flags;
+        unsigned int timer;
+};
+struct fdb_info_hdr {
+	int	copied;			/* nb of entries copied to user */
+	int	not_copied;		/* when user buffer is too small */
+	int	cmd_time;
+};	
+
 #define IS_BRIDGED	0x2e
 
 
@@ -169,6 +214,34 @@
 #define BR_ACCEPT 1
 #define BR_REJECT 0
 
+/* JRP: extra statistics for debug */
+typedef struct {
+	/* br_receive_frame counters */
+	int port_disable_up_stack;
+	int rcv_bpdu;
+	int notForwarding;
+	int forwarding_up_stack;
+	int unknown_state;
+
+	/* br_tx_frame counters */
+	int port_disable;
+	int port_not_disable;
+
+	/* br_forward counters */
+	int local_multicast;
+	int forwarded_multicast;	/* up stack as well */
+	int flood_unicast;
+	int aged_flood_unicast;
+	int forwarded_unicast;
+	int forwarded_unicast_up_stack;
+	int forwarded_ip_up_stack;
+	int forwarded_ip_up_stack_lie;	/* received on alternate device */
+	int arp_for_local_mac;
+	int drop_same_port;
+	int drop_same_port_aged;
+	int drop_multicast;
+} br_stats_counter;
+
 struct br_stat {
 	unsigned int flags;
 	Bridge_data bridge_data;
@@ -178,6 +251,7 @@
 	unsigned short protocols[BR_MAX_PROTOCOLS];
 	unsigned short prot_id[BR_MAX_PROT_STATS];	/* Protocol encountered */
 	unsigned int prot_counter[BR_MAX_PROT_STATS];	/* How many packets ? */
+	br_stats_counter packet_cnts;
 };
 
 /* defined flags for br_stat.flags */
@@ -215,9 +289,10 @@
 int br_tx_frame(struct sk_buff *skb);
 int br_ioctl(unsigned int cmd, void *arg);
 int br_protocol_ok(unsigned short protocol);
+void requeue_fdb(struct fdb *node, int new_port);
 
 struct fdb *br_avl_find_addr(unsigned char addr[6]);
-int br_avl_insert (struct fdb * new_node);
+struct fdb *br_avl_insert (struct fdb * new_node);
 
 /* externs */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov