diff -Nurb linux/include/linux/if_ether.h linux.p/include/linux/if_ether.h --- linux/include/linux/if_ether.h Mon Jun 4 17:51:51 2001 +++ linux.p/include/linux/if_ether.h Mon Jun 4 16:10:17 2001 @@ -33,8 +33,7 @@ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ -#ifdef CONFIG_VLAN_802_1Q - +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) #define VLAN_ETH_ALEN 6 /* Octets in one ethernet addr */ #define VLAN_ETH_HLEN 18 /* Total octets in header. */ @@ -58,9 +57,7 @@ unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */ }; - -#endif - +#endif /* CONFIG_VLAN_802_1Q ... */ /* * These are the defined Ethernet Protocol ID's. diff -Nurb linux/include/linux/netdevice.h linux.p/include/linux/netdevice.h --- linux/include/linux/netdevice.h Mon Jun 4 17:51:51 2001 +++ linux.p/include/linux/netdevice.h Mon Jun 4 16:10:48 2001 @@ -37,14 +37,11 @@ #ifdef CONFIG_NET_PROFILE #include #endif - -#if (defined(CONFIG_VLAN_802_1Q)) -struct vlan_dev_info; -#endif - #endif - +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) +struct vlan_dev_info; +#endif /* CONFIG_VLAN_802_1Q ... */ struct divert_blk; @@ -60,11 +57,11 @@ */ #if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR) -#if defined(CONFIG_VLAN_802_1Q) +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) #define LL_MAX_HEADER 36 #else #define LL_MAX_HEADER 32 -#endif +#endif /* CONFIG_VLAN_802_1Q ... */ #else #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #define LL_MAX_HEADER 96 @@ -168,17 +165,16 @@ atomic_t hh_refcnt; /* number of users */ unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP * NOTE: For VLANs, this will be the - * encapuslated type. --BLG + * encapsulated type. --BLG */ int (*hh_output)(struct sk_buff *skb); rwlock_t hh_lock; - /* cached hardware header; allow for machine alignment needs. */ -#ifdef CONFIG_VLAN_802_1Q /* we need 4 extra bytes for VLAN headers */ +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) /* we need 4 extra bytes for VLAN headers */ unsigned long hh_data[20/sizeof(unsigned long)]; #else unsigned long hh_data[16/sizeof(unsigned long)]; -#endif +#endif /* CONFIG_VLAN_802_1Q ... */ }; @@ -336,14 +332,13 @@ int tx_semaphore; #define NETDEV_FASTROUTE_HMASK 0xF /* Semi-private data. Keep it at the end of device struct. */ - struct dst_entry *fastpath[NETDEV_FASTROUTE_HMASK+1]; #endif -#ifdef CONFIG_VLAN_802_1Q +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) /* Holds information that makes sense if this device is a VLAN device. */ struct vlan_dev_info* vlan_dev; -#endif +#endif /* CONFIG_VLAN_802_1Q ... */ #ifdef CONFIG_NET_DIVERT /* this will get initialized at each interface type init routine */ diff -Nurb linux/net/802_1Q/Makefile linux.p/net/802_1Q/Makefile --- linux/net/802_1Q/Makefile Mon Jun 4 17:51:51 2001 +++ linux.p/net/802_1Q/Makefile Mon Jun 4 16:08:04 2001 @@ -1,5 +1,5 @@ # -# Makefile for the Linux Ethernet layer. +# Makefile for the Linux 802.1q protocol layer # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here @@ -8,19 +8,14 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := 802_1Q.o +O_OBJS := vlan.o vlanproc.o vlan_dev.o -OBJS := vlan.o vlanproc.o vlan_dev.o - -ifeq ($(CONFIG_SYSCTL),y) -OBJS += sysctl_net_vlan.o +ifeq ($(CONFIG_VLAN_802_1Q),m) +M_OBJS := $(O_TARGET) endif - -ifdef CONFIG_NET -O_OBJS := $(OBJS) $(OBJ2) +ifeq ($(CONFIG_SYSCTL),y) +O_OBJS += sysctl_net_vlan.o endif include $(TOPDIR)/Rules.make - -tar: - tar -cvf /dev/f1 . diff -Nurb linux/net/802_1Q/sysctl_net_vlan.c linux.p/net/802_1Q/sysctl_net_vlan.c --- linux/net/802_1Q/sysctl_net_vlan.c Mon Jun 4 17:51:51 2001 +++ linux.p/net/802_1Q/sysctl_net_vlan.c Mon Jun 4 16:08:04 2001 @@ -6,7 +6,7 @@ * TODO: What, if anything, should this do?? */ -#ifdef CONFIG_VLAN_802_1Q +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) #include #include @@ -15,4 +15,4 @@ {0} }; -#endif +#endif /* CONFIG_VLAN_802_1Q ... */ diff -Nurb linux/net/802_1Q/vlan.c linux.p/net/802_1Q/vlan.c --- linux/net/802_1Q/vlan.c Mon Jun 4 17:51:51 2001 +++ linux.p/net/802_1Q/vlan.c Mon Jun 4 17:46:31 2001 @@ -81,8 +81,6 @@ * Context: process */ int init_module (void) { - printk(VLAN_INF __FUNCTION__); - vlan_proto_init(NULL); return 0; } @@ -92,7 +90,8 @@ * o delete /proc/net/router directory and static entries. */ void cleanup_module (void) { - vlan_proto_cleanup(); // TODO: Define this so modules work. + dev_remove_pack(&vlan_packet_type); + vlan_proc_cleanup(); } #else @@ -100,11 +99,8 @@ /** Non-module init entry point. */ __initfunc(void vlan_system_init(void)) { - printk(VLAN_INF __FUNCTION__); - /* protocol initialization */ vlan_proto_init(NULL); - } #endif @@ -205,6 +201,7 @@ * NOTE: This deletes dev, don't access it again!! */ unregister_netdevice(dev); + MOD_DEC_USE_COUNT; }/* if */ }/* if */ @@ -438,6 +435,7 @@ /* printk(KERN_ALERT "Registering new device."); */ register_netdevice(new_dev); vlan_proc_add_dev(new_dev); /* create it's proc entry */ + MOD_INC_USE_COUNT; /* Add was a success!! */ return new_dev; } }//if diff -Nurb linux/net/802_1Q/vlan_dev.c linux.p/net/802_1Q/vlan_dev.c --- linux/net/802_1Q/vlan_dev.c Mon Jun 4 17:51:51 2001 +++ linux.p/net/802_1Q/vlan_dev.c Mon Jun 4 16:08:04 2001 @@ -18,7 +18,6 @@ */ #include /* for copy_from_user */ -#include #include #include #include diff -Nurb linux/net/802_1Q/vlanproc.c linux.p/net/802_1Q/vlanproc.c --- linux/net/802_1Q/vlanproc.c Mon Jun 4 17:51:51 2001 +++ linux.p/net/802_1Q/vlanproc.c Mon Jun 4 16:08:04 2001 @@ -1,19 +1,19 @@ /* * -*- linux-c -*- */ /***************************************************************************** * vlanproc.c VLAN Module. /proc filesystem interface. -* -* Author: Ben Greear, coppied from wanproc.c -* by: Gene Kozin -* -* Copyright: (c) 1998-2000 Ben Greear -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version -* 2 of the License, or (at your option) any later version. -* ============================================================================ -* Jan 20, 1998 Ben Greear Initial Version -*****************************************************************************/ + * + * Author: Ben Greear, coppied from wanproc.c + * by: Gene Kozin + * + * Copyright: (c) 1998-2000 Ben Greear + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * ============================================================================ + * Jan 20, 1998 Ben Greear Initial Version + *****************************************************************************/ #include #include /* offsetof(), etc. */ diff -Nurb linux/net/Config.in linux.p/net/Config.in --- linux/net/Config.in Mon Jun 4 17:51:51 2001 +++ linux.p/net/Config.in Mon Jun 4 16:08:04 2001 @@ -48,12 +48,12 @@ fi bool 'Frame Diverter (EXPERIMENTAL)' CONFIG_NET_DIVERT bool '802.2 LLC (EXPERIMENTAL)' CONFIG_LLC - - bool '802.1Q VLAN Support (EXPERIMENTAL)' CONFIG_VLAN_802_1Q - # if [ "$CONFIG_LLC" = "y" ]; then # bool 'Netbeui (EXPERIMENTAL)' CONFIG_NETBEUI # fi + + tristate '802.1Q VLAN Support (EXPERIMENTAL)' CONFIG_VLAN_802_1Q + tristate 'Acorn Econet/AUN protocols (EXPERIMENTAL)' CONFIG_ECONET if [ "$CONFIG_ECONET" != "n" ]; then bool ' AUN over UDP' CONFIG_ECONET_AUNUDP diff -Nurb linux/net/Makefile linux.p/net/Makefile --- linux/net/Makefile Mon Jun 4 17:51:51 2001 +++ linux.p/net/Makefile Mon Jun 4 16:08:04 2001 @@ -63,6 +63,10 @@ ifeq ($(CONFIG_VLAN_802_1Q),y) SUB_DIRS += 802_1Q +else + ifeq ($(CONFIG_VLAN_802_1Q),m) + MOD_SUB_DIRS += 802_1Q + endif endif ifeq ($(CONFIG_IPX),y) diff -Nurb linux/net/core/dev.c linux.p/net/core/dev.c --- linux/net/core/dev.c Mon Jun 4 17:51:51 2001 +++ linux.p/net/core/dev.c Mon Jun 4 16:08:04 2001 @@ -1,4 +1,4 @@ -/* -*- linux-c -*- +/* * NET3 Protocol independent device support routines. * * This program is free software; you can redistribute it and/or @@ -94,11 +94,9 @@ #ifdef CONFIG_NET_RADIO #include #endif /* CONFIG_NET_RADIO */ - -#ifdef CONFIG_VLAN_802_1Q +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) #include "../802_1Q/vlan.h" -#endif - +#endif /* CONFIG_VLAN_802_1Q ... */ #ifdef CONFIG_PLIP extern int plip_init(void); #endif @@ -138,7 +136,6 @@ * --BLG * * 0800 IP - * 8100 802.1Q VLAN * 0001 802.3 * 0002 AX.25 * 0004 802.2 @@ -146,6 +143,7 @@ * 0005 SNAP * 0805 X.25 * 0806 ARP + * 8100 802.1Q VLAN * 8137 IPX * 0009 Localtalk * 86DD IPv6 @@ -186,10 +184,11 @@ /* Taking this out, because lo has problems for some people. Feel * free to turn it back on and give me (greearb@candelatech.com) bug * reports if you can re-produce the problem. --Ben + * + * #define BENS_FAST_DEV_LOOKUP + * + */ - #define BENS_FAST_DEV_LOOKUP - -*/ #ifdef BENS_FAST_DEV_LOOKUP /* Fast Device Lookup code. Should give much better than * linear speed when looking for devices by idx or name. @@ -548,7 +547,8 @@ /* printk(KERN_ERR "__dev_get_by_name, didn't find it for name: %s\n", name); */ return NULL; } -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ + for (dev = dev_base; dev != NULL; dev = dev->next) { if (strcmp(dev->name, name) == 0) @@ -560,6 +560,7 @@ struct device * dev_get_by_index(int ifindex) { struct device *dev; + #ifdef BENS_FAST_DEV_LOOKUP int idx = fdl_calc_index_idx(ifindex); struct dev_hash_node* dhn; @@ -572,7 +573,8 @@ } return NULL; } -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ + for (dev = dev_base; dev != NULL; dev = dev->next) { if (dev->ifindex == ifindex) @@ -1127,7 +1129,7 @@ if(skb==NULL) return; - offset = skb->data - skb->mac.raw; + offset=skb->data-skb->mac.raw; skb_push(skb,offset); /* Put header back on for bridge */ if(br_receive_frame(skb)) @@ -1253,7 +1255,7 @@ } /* - * Fetch the packet protocol ID. (In Network Byte Order --BLG) + * Fetch the packet protocol ID. */ type = skb->protocol; @@ -1903,12 +1905,12 @@ #ifdef BENS_FAST_DEV_LOOKUP /* Doesn't seem to need any additional locking in kernel 2.2 series... --Ben */ __fdl_unregister_netdevice(dev); /* take it out of the name hash table */ -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ); dev->name[IFNAMSIZ-1] = 0; #ifdef BENS_FAST_DEV_LOOKUP __fdl_register_netdevice(dev); /* put it back in the name hash table, with the new name */ -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); return 0; @@ -2113,12 +2115,15 @@ return -EEXIST; } dev->next = NULL; + #ifdef BENS_FAST_DEV_LOOKUP - /* Must do this before dp is set to dev, or it could be added twice, once - * on initialization based on dev_base, and once again after that... + /* Must do this before dp is set to dev, or it could be added twice, + * once on initialization based on dev_base, and once again after + * that... */ __fdl_register_netdevice(dev); -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ + *dp = dev; #ifdef CONFIG_NET_DIVERT ret=alloc_divert_blk(dev); @@ -2150,7 +2155,7 @@ * on initialization based on dev_base, and once again after that... */ __fdl_register_netdevice(dev); -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ *dp = dev; /* Notify protocols, that a new device appeared. */ @@ -2204,7 +2209,7 @@ *dp = d->next; #ifdef BENS_FAST_DEV_LOOKUP __fdl_unregister_netdevice(dev); -#endif +#endif /* BENS_FAST_DEV_LOOKUP */ synchronize_bh(); d->next = NULL; diff -Nurb linux/net/ethernet/eth.c linux.p/net/ethernet/eth.c --- linux/net/ethernet/eth.c Mon Jun 4 17:51:51 2001 +++ linux.p/net/ethernet/eth.c Mon Jun 4 16:08:04 2001 @@ -186,7 +186,7 @@ skb->mac.raw=skb->data; -#ifdef CONFIG_VLAN_802_1Q +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) /* Moving this below to be more selective. Reason is that for VLAN * devices, we do not want to pull the header, we'll let the VLAN * device do that instead. This makes default vlans (based on incoming @@ -196,7 +196,7 @@ /* skb_pull(skb,dev->hard_header_len); */ #else skb_pull(skb,dev->hard_header_len); -#endif +#endif /* CONFIG_VLAN_802_1Q ... */ eth= skb->mac.ethernet; @@ -222,7 +222,7 @@ skb->pkt_type=PACKET_OTHERHOST; } -#ifdef CONFIG_VLAN_802_1Q +#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) if (ntohs(eth->h_proto) == ETH_P_802_1Q) { /* then we have to convert this into a VLAN looking packet. * We'll wait to do that in the VLAN protocol handler. @@ -234,7 +234,7 @@ else { skb_pull(skb, dev->hard_header_len); } -#endif +#endif /* CONFIG_VLAN_802_1Q ... */ if (ntohs(eth->h_proto) >= 1536) return eth->h_proto; diff -Nurb linux/net/netsyms.c linux.p/net/netsyms.c --- linux/net/netsyms.c Mon Jun 4 17:48:17 2001 +++ linux.p/net/netsyms.c Mon Jun 4 17:39:36 2001 @@ -403,6 +403,12 @@ EXPORT_SYMBOL(rtnl_lock); EXPORT_SYMBOL(rtnl_unlock); +#if defined(CONFIG_VLAN_802_1Q_MODULE) +extern struct Qdisc noqueue_qdisc; +EXPORT_SYMBOL(noqueue_qdisc); +EXPORT_SYMBOL(dev_change_flags); +EXPORT_SYMBOL(eth_header_parse); +#endif /* Used by at least ipip.c. */ EXPORT_SYMBOL(ipv4_config); @@ -533,7 +539,6 @@ #include EXPORT_SYMBOL(ltalk_setup); #endif - /* Packet scheduler modules want these. */ EXPORT_SYMBOL(qdisc_destroy);