[VLAN] Newbiew question: Need some clarifications in 802.1q and bridging code interaction in linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pranjal Kumar Dutta wrote:
> Hi,
>            I have some problems in understanding some parts of the
> (802.1q)vlan module in linux kernel and its interaction with linux
> bridging code.
> 
> I have the following problems in understanding the codes.
> 
> 1. In linux 802.1q code a vlan is characterised as a generic
> net_device. Every real net_device (Ethernet NICs e.g) has a vlan_group
> attached to it to identify the port's membership of vlans. A
> vlan_group contains an array of pointers to all vlan_devices (in the
> form of net_devices) to which the real device is member of. As per my
> understanding goes here whenever a vlan is attached to an interface
> the following is called.
> 
> static struct net_device *register_vlan_device(const char *eth_IF_name,
> 
> unsigned short VLAN_ID)
> Inside this function I could see that a new net_device is created for
> the corresponding vlan attched to it. So that means a VLAN domain in
> the box is NOT represented by a single net_device, rather it is
> interface specific. For the same vlan X every interface will be having
> its own net_device for X in its vlan_group. Then how the vlan layer
> glues all the vlan_devices
> (in the form of net_devices) for a particular vlan X into a domain?
> Because theoretically speaking while bridging ethernet flows MAC
> Learning and forwarding should be based on vlan domains.
> 

I'm not sure I understand your question fully, but I think this info may 
be helpful:

When 8021q.o is isnmodded it calls

	dev_add_pack(&vlan_packet_type);

which registers the function vlan_skb_recv() as a handler for the vlan
dix type, namely 0x8100.

The code in net/core/dev.c which dequeues frames - queued by device 
drivers using netif_rx() - uses a hash table to find the handler for 
each frame by dix type.  After 8021q.o is insmodded net/core/dev.c will 
send all frames with dix type 0x8100 to vlan_skb_recv().

vlan_skb_recv() checks to see if the originating device (e.g. eth0) has 
a vlan device with the correct vid on top of it (e.g. eth0.10).  If it 
has then it passes the frame up through this device (i.e. changes 
skb->dev, rearranges the header if neccessary, and calls netif_rx()). 
If not, it frees the skb and returns a failure code.

Alex



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux