27 Nov, 2009

1 commit

  • Currently the UP/DOWN state of VLANs is synchronized to the state of the
    underlying device, meaning all VLANs are set down once the underlying
    device is set down. This causes all routes to the VLAN devices to vanish.

    Add a flag to specify a "loose binding" mode, in which only the operstate
    is transfered, but the VLAN device state is independant.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

30 Oct, 2009

1 commit


28 Oct, 2009

1 commit


27 Oct, 2009

1 commit

  • We currently use a 16 bit field (vlan_tci) to store VLAN ID/PRIO on a skb.

    Null value is used as a special value, meaning vlan tagging not enabled.
    This forbids use of null vlan ID.

    As pointed by David, some drivers use the 3 high order bits (PRIO)

    As VLAN ID is 12 bits, we can use the remaining bit (CFI) as a flag, and
    allow null VLAN ID.

    In case future code really wants to use VLAN_CFI_MASK, we'll have to use
    a bit outside of vlan_tci.

    #define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */
    #define VLAN_PRIO_SHIFT 13
    #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */
    #define VLAN_TAG_PRESENT VLAN_CFI_MASK
    #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */

    Reported-by: Gertjan Hofman
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

16 Apr, 2009

1 commit

  • It turns out that copying a 16-byte area at ~800k times a second
    can be really expensive :) This patch redesigns the frags GRO
    interface to avoid copying that area twice.

    The two disciples of the frags interface have been converted.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

19 Feb, 2009

1 commit


07 Jan, 2009

1 commit

  • This patch adds GRO interfaces for hardware-assisted VLAN reception.
    With this in place we're now at parity with LRO as far as the
    interface is concerned. That is, you can now take any LRO driver
    and convert it over to GRO.

    As the CB memory clashes with GRO's use of CB, I've removed it
    entirely by storing dev in skb->dev. This is OK because VLAN
    gets called first thing in netif_receive_skb and skb->dev is
    not used in between us calling netif_rx and netif_receive_skb
    getting called.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

05 Nov, 2008

1 commit

  • The changes to deliver hardware accelerated VLAN packets to packet
    sockets (commit bc1d0411) caused a warning for non-NAPI drivers.
    The __vlan_hwaccel_rx() function is called directly from the drivers
    RX function, for non-NAPI drivers that means its still in RX IRQ
    context:

    [ 27.779463] ------------[ cut here ]------------
    [ 27.779509] WARNING: at kernel/softirq.c:136 local_bh_enable+0x37/0x81()
    ...
    [ 27.782520] [] netif_nit_deliver+0x5b/0x75
    [ 27.782590] [] __vlan_hwaccel_rx+0x79/0x162
    [ 27.782664] [] atl1_intr+0x9a9/0xa7c [atl1]
    [ 27.782738] [] handle_IRQ_event+0x23/0x51
    [ 27.782808] [] handle_edge_irq+0xc2/0x102
    [ 27.782878] [] do_IRQ+0x4d/0x64

    Split hardware accelerated VLAN reception into two parts to fix this:

    - __vlan_hwaccel_rx just stores the VLAN TCI and performs the VLAN
    device lookup, then calls netif_receive_skb()/netif_rx()

    - vlan_hwaccel_do_receive(), which is invoked by netif_receive_skb()
    in softirq context, performs the real reception and delivery to
    packet sockets.

    Reported-and-tested-by: Ramon Casellas
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

15 Jul, 2008

1 commit

  • Use a real skb member to store the skb to avoid clashes with qdiscs,
    which are allowed to use the cb area themselves. As currently only real
    devices that consume the skb set the NETIF_F_HW_VLAN_TX flag, no explicit
    invalidation is neccessary.

    The new member fills a hole on 64 bit, the skb layout changes from:

    __u32 mark; /* 172 4 */
    sk_buff_data_t transport_header; /* 176 4 */
    sk_buff_data_t network_header; /* 180 4 */
    sk_buff_data_t mac_header; /* 184 4 */
    sk_buff_data_t tail; /* 188 4 */
    /* --- cacheline 3 boundary (192 bytes) --- */
    sk_buff_data_t end; /* 192 4 */

    /* XXX 4 bytes hole, try to pack */

    to

    __u32 mark; /* 172 4 */
    __u16 vlan_tci; /* 176 2 */

    /* XXX 2 bytes hole, try to pack */

    sk_buff_data_t transport_header; /* 180 4 */
    sk_buff_data_t network_header; /* 184 4 */

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

09 Jul, 2008

1 commit

  • - vlan_dev_reorder_header() is only called on the receive path after
    calling skb_share_check(). This means we can use skb_cow() since
    all we need is a writable header.

    - vlan_dev_hard_header() includes a work-around for some apparently
    broken out of tree MPLS code. The hard_header functions can expect
    to always have a headroom of at least there own hard_header_len
    available, so the reallocation check is unnecessary.

    - __vlan_put_tag() can use skb_cow_head() to avoid the skb_unshare()
    copy when the header is writable.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

08 Jul, 2008

5 commits

  • The VLAN code contains multiple spots that use tag, id and tci as
    identifiers for arguments and variables incorrectly and they actually
    contain or are expected to contain something different. Additionally
    types are used inconsistently (unsigned short vs u16) and identifiers
    are sometimes capitalized.

    - consistently use u16 for storing TCI, ID or QoS values
    - consistently use vlan_id and vlan_tci for storing the respective values
    - remove capitalization
    - add kdoc comment to netif_hwaccel_{rx,receive_skb}

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Hide struct vlan_dev_info from drivers to prevent them from growing
    more creative ways to use it. Provide accessors for the two drivers
    that currently use it.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • The function is huge and included at least once in every VLAN acceleration
    capable driver. Uninline it; to avoid having drivers depend on the VLAN
    module, the function is always built in statically when VLAN is enabled.

    With all VLAN acceleration capable drivers that build on x86_64 enabled,
    this results in:

    text data bss dec hex filename
    6515227 854044 343968 7713239 75b1d7 vmlinux.inlined
    6505637 854044 343968 7703649 758c61 vmlinux.uninlined
    ----------------------------------------------------------
    -9590

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Lennert Buytenhek points out that the VLAN code incorrectly adjusts
    skb->network_header to point in the middle of the VLAN header and
    additionally tries to adjust skb->mac_header without checking for
    validity.

    The network_header should not be touched at all since we're only
    adding headers in front of it, mac_header adjustments are not
    necessary at all.

    Based on patch by Lennert Buytenhek .

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

06 Jul, 2008

1 commit

  • Add GVRP support for dynamically registering VLANs with switches.

    By default GVRP is disabled because we only support the applicant-only
    participant model, which means it should not be enabled on vlans that
    are members of a bridge. Since there is currently no way to cleanly
    determine that, the user is responsible for enabling it.

    The code is pretty small and low impact, its wrapped in a config
    option though because it depends on the GARP implementation and
    the STP core.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

16 Apr, 2008

1 commit

  • Currently vlan group is searched using one key - the ifindex.
    We'll have to lookup the vlan_group by two keys - ifindex and
    net. Turning the vlan_group lookup key to struct net_device
    pointer will make this process easier.

    Besides, this will eliminate one more place in the networking,
    that assumes that indexes are unique in the kernel.

    Signed-off-by: Pavel Emelyanov
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     

27 Mar, 2008

1 commit

  • Currently each vlan_groupd contains 8 pointers on arrays with 512
    pointers on struct net_device each :) Such a construction "in many
    cases ... wastes memory".

    My proposal is to allow for some of these arrays pointers be NULL,
    meaning that there are no devices in it. When a new device is added
    to the vlan_group, the appropriate array is allocated.

    The check in vlan_group_get_device's is safe, since the pointer
    vg->vlan_devices_arrays[x] can only switch from NULL to not-NULL.
    The vlan_group_prealloc_vid() is guarded with rtnl lock and is
    also safe.

    I've checked (I hope that) all the places, that use these arrays
    and found, that the register_vlan_dev is the only place, that can
    put a vlan device on an empty vlan_group.

    Rough calculations shows, that after the patch a setup with a
    single vlan dev (or up to 512 vlans with sequential vids) will
    occupy approximately 8 times less memory.

    The question I have is - does this patch makes sense, or a totally
    new structures are required to store the vlan_devs?

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: Patrick McHardy

    Pavel Emelyanov
     

06 Feb, 2008

1 commit


29 Jan, 2008

8 commits


11 Oct, 2007

1 commit

  • This patch makes most of the generic device layer network
    namespace safe. This patch makes dev_base_head a
    network namespace variable, and then it picks up
    a few associated variables. The functions:
    dev_getbyhwaddr
    dev_getfirsthwbytype
    dev_get_by_flags
    dev_get_by_name
    __dev_get_by_name
    dev_get_by_index
    __dev_get_by_index
    dev_ioctl
    dev_ethtool
    dev_load
    wireless_process_ioctl

    were modified to take a network namespace argument, and
    deal with it.

    vlan_ioctl_set and brioctl_set were modified so their
    hooks will receive a network namespace argument.

    So basically anthing in the core of the network stack that was
    affected to by the change of dev_base was modified to handle
    multiple network namespaces. The rest of the network stack was
    simply modified to explicitly use &init_net the initial network
    namespace. This can be fixed when those components of the network
    stack are modified to handle multiple network namespaces.

    For now the ifindex generator is left global.

    Fundametally ifindex numbers are per namespace, or else
    we will have corner case problems with migration when
    we get that far.

    At the same time there are assumptions in the network stack
    that the ifindex of a network device won't change. Making
    the ifindex number global seems a good compromise until
    the network stack can cope with ifindex changes when
    you change namespaces, and the like.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

15 Jul, 2007

2 commits


12 Jul, 2007

1 commit

  • The VLAN MAC address handling is broken in multiple ways. When the address
    differs when setting it, the real device is put in promiscous mode twice,
    but never taken out again. Additionally it doesn't resync when the real
    device's address is changed and needlessly puts it in promiscous mode when
    the vlan device is still down.

    Fix by moving address handling to vlan_dev_open/vlan_dev_stop and properly
    deal with address changes in the device notifier. Also switch to
    dev_unicast_add (which needs the exact same handling).

    Since the set_mac_address handler is identical to the generic ethernet one
    with these changes, kill it and use ether_setup().

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

11 Jul, 2007

3 commits


26 Apr, 2007

2 commits


03 Mar, 2007

1 commit

  • This patch splits the vlan_group struct into a multi-allocated struct. On
    x86_64, the size of the original struct is a little more than 32KB, causing
    a 4-order allocation, which is prune to problems caused by buddy-system
    external fragmentation conditions.

    I couldn't just use vmalloc() because vfree() cannot be called in the
    softirq context of the RCU callback.

    Signed-off-by: Dan Aloni
    Acked-by: Jeff Garzik
    Signed-off-by: David S. Miller

    Dan Aloni
     

11 Oct, 2006

1 commit


18 Aug, 2006

1 commit


15 Jul, 2006

1 commit