19 Aug, 2011

1 commit

  • It's after all necessary to do reset headers here. The reason is we
    cannot depend that it gets reseted in __netif_receive_skb once skb is
    reinjected. For incoming vlanids without vlan_dev, vlan_do_receive()
    returns false with skb != NULL and __netif_reveive_skb continues, skb is
    not reinjected.

    This might be good material for 3.0-stable as well

    Reported-by: Mike Auty
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

22 Jul, 2011

3 commits


12 Jun, 2011

1 commit

  • Testing of VLAN_FLAG_REORDER_HDR does not belong in vlan_untag
    but rather in vlan_do_receive. Otherwise the vlan header
    will not be properly put on the packet in the case of
    vlan header accelleration.

    As we remove the check from vlan_check_reorder_header
    rename it vlan_reorder_header to keep the naming clean.

    Fix up the skb->pkt_type early so we don't look at the packet
    after adding the vlan tag, which guarantees we don't goof
    and look at the wrong field.

    Use a simple if statement instead of a complicated switch
    statement to decided that we need to increment rx_stats
    for a multicast packet.

    Hopefully at somepoint we will just declare the case where
    VLAN_FLAG_REORDER_HDR is cleared as unsupported and remove
    the code. Until then this keeps it working correctly.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Jiri Pirko
    Acked-by: Changli Gao
    Signed-off-by: David S. Miller

    Jiri Pirko
     

13 Apr, 2011

1 commit

  • Now there are 2 paths for rx vlan frames. When rx-vlan-hw-accel is
    enabled, skb is untagged by NIC, vlan_tci is set and the skb gets into
    vlan code in __netif_receive_skb - vlan_hwaccel_do_receive.

    For non-rx-vlan-hw-accel however, tagged skb goes thru whole
    __netif_receive_skb, it's untagged in ptype_base hander and reinjected

    This incosistency is fixed by this patch. Vlan untagging happens early in
    __netif_receive_skb so the rest of code (ptype_all handlers, rx_handlers)
    see the skb like it was untagged by hw.

    Signed-off-by: Jiri Pirko

    v1->v2:
    remove "inline" from vlan_core.c functions
    Signed-off-by: David S. Miller

    Jiri Pirko
     

17 Nov, 2010

1 commit

  • vlan is a stacked device, like tunnels. We should use the lockless
    mechanism we are using in tunnels and loopback.

    This patch completely removes locking in TX path.

    tx stat counters are added into existing percpu stat structure, renamed
    from vlan_rx_stats to vlan_pcpu_stats.

    Note : this partially reverts commit 2e59af3dcbdf (vlan: multiqueue vlan
    device)

    Signed-off-by: Eric Dumazet
    Cc: Patrick McHardy
    Signed-off-by: David S. Miller

    Eric Dumazet
     

21 Oct, 2010

1 commit

  • Currently each driver that is capable of vlan hardware acceleration
    must be aware of the vlan groups that are configured and then pass
    the stripped tag to a specialized receive function. This is

    different from other types of hardware offload in that it places a
    significant amount of knowledge in the driver itself rather keeping
    it in the networking core.

    This makes vlan offloading function more similarly to other forms
    of offloading (such as checksum offloading or TSO) by doing the
    following:
    * On receive, stripped vlans are passed directly to the network
    core, without attempting to check for vlan groups or reconstructing
    the header if no group
    * vlans are made less special by folding the logic into the main
    receive routines
    * On transmit, the device layer will add the vlan header in software
    if the hardware doesn't support it, instead of spreading that logic
    out in upper layers, such as bonding.

    There are a number of advantages to this:
    * Fixes all bugs with drivers incorrectly dropping vlan headers at once.
    * Avoids having to disable VLAN acceleration when in promiscuous mode
    (good for bridging since it always puts devices in promiscuous mode).
    * Keeps VLAN tag separate until given to ultimate consumer, which
    avoids needing to do header reconstruction as in tg3 unless absolutely
    necessary.
    * Consolidates common code in core networking.

    Signed-off-by: Jesse Gross
    Signed-off-by: David S. Miller

    Jesse Gross
     

06 Oct, 2010

1 commit

  • In various situations, a device provides a packet to our stack and we
    drop it before it enters protocol stack :
    - softnet backlog full (accounted in /proc/net/softnet_stat)
    - bad vlan tag (not accounted)
    - unknown/unregistered protocol (not accounted)

    We can handle a per-device counter of such dropped frames at core level,
    and automatically adds it to the device provided stats (rx_dropped), so
    that standard tools can be used (ifconfig, ip link, cat /proc/net/dev)

    This is a generalization of commit 8990f468a (net: rx_dropped
    accounting), thus reverting it.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

05 Oct, 2010

1 commit


01 Oct, 2010

1 commit

  • Roger Luethi noticed packets for unknown VLANs getting silently dropped
    even in promiscuous mode.

    Check for promiscuous mode in __vlan_hwaccel_rx() and vlan_gro_common()
    before drops.

    As suggested by Patrick, mark such packets to have skb->pkt_type set to
    PACKET_OTHERHOST to make sure they are dropped by IP stack.

    Reported-by: Roger Luethi
    Signed-off-by: Eric Dumazet
    CC: Patrick McHardy
    Signed-off-by: David S. Miller

    Eric Dumazet
     

24 Sep, 2010

1 commit


01 Sep, 2010

1 commit


27 Aug, 2010

1 commit

  • compare_ether_header() can have a special implementation on 64 bit
    arches if CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is defined.

    __napi_gro_receive() and vlan_gro_common() can avoid a conditional
    branch to perform device match.

    On x86_64, __napi_gro_receive() has now 38 instructions instead of 53

    As gcc-4.4.3 still choose to not inline it, add inline keyword to this
    performance critical function.

    Signed-off-by: Eric Dumazet
    CC: Herbert Xu
    Signed-off-by: David S. Miller

    Eric Dumazet
     

23 Aug, 2010

1 commit


19 Jul, 2010

1 commit

  • - Without the 8021q module loaded in the kernel, all 802.1p packets
    (VLAN 0 but QoS tagging) are silently discarded (as expected, as
    the protocol is not loaded).

    - Without this patch in 8021q module, these packets are forwarded to
    the module, but they are discarded also if VLAN 0 is not configured,
    which should not be the default behaviour, as VLAN 0 is not really
    a VLANed packet but a 802.1p packet. Defining VLAN 0 makes it almost
    impossible to communicate with mixed 802.1p and non 802.1p devices on
    the same network due to arp table issues.

    - Changed logic to skip vlan specific code in vlan_skb_recv if VLAN
    is 0 and we have not defined a VLAN with ID 0, but we accept the
    packet with the encapsulated proto and pass it later to netif_rx.

    - In the vlan device event handler, added some logic to add VLAN 0
    to HW filter in devices that support it (this prevented any traffic
    in VLAN 0 to reach the stack in e1000e with HW filter under 2.6.35,
    and probably also with other HW filtered cards, so we fix it here).

    - In the vlan unregister logic, prevent the elimination of VLAN 0
    in devices with HW filter.

    - The default behaviour is to ignore the VLAN 0 tagging and accept
    the packet as if it was not tagged, but we can still define a
    VLAN 0 if desired (so it is backwards compatible).

    Signed-off-by: Pedro Garcia
    Signed-off-by: David S. Miller

    Pedro Garcia
     

29 Jun, 2010

1 commit


11 Jun, 2010

1 commit

  • Currently, the accelerated receive path for VLAN's will
    drop packets if the real device is an inactive slave and
    is not one of the special pkts tested for in
    skb_bond_should_drop(). This behavior is different then
    the non-accelerated path and for pkts over a bonded vlan.

    For example,

    vlanx -> bond0 -> ethx

    will be dropped in the vlan path and not delivered to any
    packet handlers at all. However,

    bond0 -> vlanx -> ethx

    and

    bond0 -> ethx

    will be delivered to handlers that match the exact dev,
    because the VLAN path checks the real_dev which is not a
    slave and netif_recv_skb() doesn't drop frames but only
    delivers them to exact matches.

    This patch adds a sk_buff flag which is used for tagging
    skbs that would previously been dropped and allows the
    skb to continue to skb_netif_recv(). Here we add
    logic to check for the deliver_no_wcard flag and if it
    is set only deliver to handlers that match exactly. This
    makes both paths above consistent and gives pkt handlers
    a way to identify skbs that come from inactive slaves.
    Without this patch in some configurations skbs will be
    delivered to handlers with exact matches and in others
    be dropped out right in the vlan path.

    I have tested the following 4 configurations in failover modes
    and load balancing modes.

    # bond0 -> ethx

    # vlanx -> bond0 -> ethx

    # bond0 -> vlanx -> ethx

    # bond0 -> ethx
    |
    vlanx -> --

    Signed-off-by: John Fastabend
    Signed-off-by: David S. Miller

    John Fastabend
     

18 May, 2010

1 commit


19 Mar, 2010

1 commit

  • When doing "ifenslave -d bond0 eth0", there is chance to get NULL
    dereference in netif_receive_skb(), because dev->master suddenly becomes
    NULL after we tested it.

    We should use ACCESS_ONCE() to avoid this (or rcu_dereference())

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

04 Jan, 2010

1 commit

  • This allows a bond device to specify an arp_ip_target as a host that is
    not on the same vlan as the base bond device and still use arp
    validation. A configuration like this, now works:

    BONDING_OPTS="mode=active-backup arp_interval=1000 arp_ip_target=10.0.100.1 arp_validate=3"

    1: lo: mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: eth1: mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
    3: eth0: mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
    8: bond0: mtu 1500 qdisc noqueue
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::213:21ff:febe:33e9/64 scope link
    valid_lft forever preferred_lft forever
    9: bond0.100@bond0: mtu 1500 qdisc noqueue
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
    inet 10.0.100.2/24 brd 10.0.100.255 scope global bond0.100
    inet6 fe80::213:21ff:febe:33e9/64 scope link
    valid_lft forever preferred_lft forever

    Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

    Bonding Mode: fault-tolerance (active-backup)
    Primary Slave: None
    Currently Active Slave: eth1
    MII Status: up
    MII Polling Interval (ms): 0
    Up Delay (ms): 0
    Down Delay (ms): 0
    ARP Polling Interval (ms): 1000
    ARP IP target/s (n.n.n.n form): 10.0.100.1

    Slave Interface: eth1
    MII Status: up
    Link Failure Count: 1
    Permanent HW addr: 00:40:05:30:ff:30

    Slave Interface: eth0
    MII Status: up
    Link Failure Count: 0
    Permanent HW addr: 00:13:21:be:33:e9

    Signed-off-by: Andy Gospodarek
    Signed-off-by: Jay Vosburgh
    Signed-off-by: David S. Miller

    Andy Gospodarek
     

18 Nov, 2009

1 commit

  • With multi queue devices, its possible that several cpus call
    vlan RX routines simultaneously for the same vlan device.

    We update RX stats counter without any locking, so we can
    get slightly wrong counters.

    One possible fix is to use percpu counters, to get precise
    accounting and also get guarantee of no cache line ping pongs
    between cpus.

    Note: this adds 16 bytes (32 bytes on 64bit arches) of percpu
    data per vlan device.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

16 Nov, 2009

1 commit


30 Oct, 2009

2 commits



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
     

14 Apr, 2009

1 commit

  • Hi:

    gro: Normalise skb before bypassing GRO on netpoll VLAN path

    When we detect netpoll RX on the GRO VLAN path we bail out and
    call the normal VLAN receive handler. However, the packet needs
    to be normalised by calling eth_type_trans since that's what the
    normal path expects (normally the GRO path does the fixup).

    This patch adds the necessary call to vlan_gro_frags.

    Signed-off-by: Herbert Xu

    Thanks,
    Signed-off-by: David S. Miller

    Herbert Xu
     

18 Mar, 2009

1 commit

  • Jarek Poplawski pointed out that my previous fix is broken for
    VLAN+netpoll as if netpoll is enabled we'd end up in the normal
    receive path instead of the VLAN receive path.

    This patch fixes it by calling the VLAN receive hook.

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

    Herbert Xu
     

17 Mar, 2009

1 commit

  • As my netpoll fix for net doesn't really work for net-next, we
    need this update to move the checks into the right place. As it
    stands we may pass freed skbs to netpoll_receive_skb.

    This patch also introduces a netpoll_rx_on function to avoid GRO
    completely if we're invoked through netpoll. This might seem
    paranoid but as netpoll may have an external receive hook it's
    better to be safe than sorry. I don't think we need this for
    2.6.29 though since there's nothing immediately broken by it.

    This patch also moves the GRO_* return values to netdevice.h since
    VLAN needs them too (I tried to avoid this originally but alas
    this seems to be the easiest way out). This fixes a bug in VLAN
    where it continued to use the old return value 2 instead of the
    correct GRO_DROP.

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

    Herbert Xu
     

02 Mar, 2009

1 commit


01 Mar, 2009

1 commit

  • The netpoll entry checks are required to ensure that we don't
    receive normal packets when invoked via netpoll. Unfortunately
    it only ever worked for the netif_receive_skb/netif_rx entry
    points. The VLAN (and subsequently GRO) entry point didn't
    have the check and therefore can trigger all sorts of weird
    problems.

    This patch adds the netpoll check to all entry points.

    I'm still uneasy with receiving at all under netpoll (which
    apparently is only used by the out-of-tree kdump code). The
    reason is it is perfectly legal to receive all data including
    headers into highmem if netpoll is off, but if you try to do
    that with netpoll on and someone gets a printk in an IRQ handler
    you're going to get a nice BUG_ON.

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

    Herbert Xu
     

09 Feb, 2009

1 commit

  • This patch optimises the Ethernet header comparison to use 2-byte
    and 4-byte xors instead of memcmp. In order to facilitate this,
    the actual comparison is now carried out by the callers of the
    shared dev_gro_receive function.

    This has a significant impact when receiving 1500B packets through
    10GbE.

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

    Herbert Xu
     

30 Jan, 2009

2 commits

  • Unfortunately simplicity isn't always the best. The fraginfo
    interface turned out to be suboptimal. The problem was quite
    obvious. For every packet, we have to copy the headers from
    the frags structure into skb->head, even though for 99% of the
    packets this part is immediately thrown away after the merge.

    LRO didn't have this problem because it directly read the headers
    from the frags structure.

    This patch attempts to address this by creating an interface
    that allows GRO to access the headers in the first frag without
    having to copy it. Because all drivers that use frags place the
    headers in the first frag this optimisation should be enough.

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

    Herbert Xu
     
  • Currently VLAN still has a bit of common code handling the aftermath
    of GRO that's shared with the common path. This patch moves them
    into shared helpers to reduce code duplication.

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

    Herbert Xu
     

27 Jan, 2009

1 commit

  • In previous kernels, any kernel module could get access to the
    'real-device' and the VLAN-ID for a particular VLAN. In more recent
    kernels, the code was restructured such that this is hard to do
    without accessing private .h files for any module that cannot use
    GPL-only symbols.

    Attached is a patch to once again allow non-GPL modules the ability to
    access the real-device and VLAN id for VLANs.

    Signed-off-by: Ben Greear
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Ben Greear
     

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
     

07 Nov, 2008

1 commit


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
     

04 Nov, 2008

1 commit