04 Mar, 2015

1 commit


03 Mar, 2015

1 commit


03 Jan, 2015

1 commit


06 Sep, 2014

1 commit

  • This patch updates some of the flow_dissector api so that it can be used to
    parse the length of ethernet buffers stored in fragments. Most of the
    changes needed were to __skb_get_poff as it needed to be updated to support
    sending a linear buffer instead of a skb.

    I have split __skb_get_poff into two functions, the first is skb_get_poff
    and it retains the functionality of the original __skb_get_poff. The other
    function is __skb_get_poff which now works much like __skb_flow_dissect in
    relation to skb_flow_dissect in that it provides the same functionality but
    works with just a data buffer and hlen instead of needing an skb.

    Signed-off-by: Alexander Duyck
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexander Duyck
     

28 Aug, 2014

1 commit

  • DSA is currently registering one packet_type function per EtherType it
    needs to intercept in the receive path of a DSA-enabled Ethernet device.
    Right now we have three of them: trailer, DSA and eDSA, and there might
    be more in the future, this will not scale to the addition of new
    protocols.

    This patch proceeds with adding a new layer of abstraction and two new
    functions:

    dsa_switch_rcv() which will dispatch into the tag-protocol specific
    receive function implemented by net/dsa/tag_*.c

    dsa_slave_xmit() which will dispatch into the tag-protocol specific
    transmit function implemented by net/dsa/tag_*.c

    When we do create the per-port slave network devices, we iterate over
    the switch protocol to assign the DSA-specific receive and transmit
    operations.

    A new fake ethertype value is used: ETH_P_XDSA to illustrate the fact
    that this is no longer going to look like ETH_P_DSA or ETH_P_TRAILER
    like it used to be.

    This allows us to greatly simplify the check in eth_type_trans() and
    always override the skb->protocol with ETH_P_XDSA for Ethernet switches
    tagged protocol, while also reducing the number repetitive slave
    netdevice_ops assignments.

    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

16 Jul, 2014

1 commit

  • Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
    all users to pass NET_NAME_UNKNOWN.

    Coccinelle patch:

    @@
    expression sizeof_priv, name, setup, txqs, rxqs, count;
    @@

    (
    -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
    +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
    |
    -alloc_netdev_mq(sizeof_priv, name, setup, count)
    +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
    |
    -alloc_netdev(sizeof_priv, name, setup)
    +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
    )

    v9: move comments here from the wrong commit

    Signed-off-by: Tom Gundersen
    Reviewed-by: David Herrmann
    Signed-off-by: David S. Miller

    Tom Gundersen
     

17 Jan, 2014

1 commit

  • eth_type_trans() can read uninitialized memory as drivers
    do not necessarily pull more than 14 bytes in skb->head before
    calling it.

    As David suggested, we can use skb_header_pointer() to
    fix this without breaking some drivers that might not expect
    eth_type_trans() pulling 2 additional bytes.

    Signed-off-by: Eric Dumazet
    Cc: Ben Hutchings
    Signed-off-by: David S. Miller

    Eric Dumazet
     

01 Oct, 2013

2 commits


21 Sep, 2013

1 commit

  • removed these checkpatch.pl warnings:
    net/ethernet/eth.c:61: WARNING: Use #include instead of
    net/ethernet/eth.c:136: WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
    net/ethernet/eth.c:181: ERROR: space prohibited before that close parenthesis ')'

    Signed-off-by: Avinash Kumar
    Signed-off-by: David S. Miller

    Avinash Kumar
     

17 Jul, 2013

1 commit


28 Mar, 2013

1 commit

  • Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
    an 802.3 frame. Frames with a lower value in the ethernet type field
    are Ethernet II.

    Also update all the users of this value that David Miller and
    I could find to use the new constant.

    Also correct a bug in util.c. The comparison with ETH_P_802_3_MIN
    should be >= not >.

    As suggested by Jesse Gross.

    Compile tested only.

    Cc: David Miller
    Cc: Jesse Gross
    Cc: Karsten Keil
    Cc: John W. Linville
    Cc: Johannes Berg
    Cc: Bart De Schuymer
    Cc: Stephen Hemminger
    Cc: Patrick McHardy
    Cc: Marcel Holtmann
    Cc: Gustavo Padovan
    Cc: Johan Hedberg
    Cc: linux-bluetooth@vger.kernel.org
    Cc: netfilter-devel@vger.kernel.org
    Cc: bridge@lists.linux-foundation.org
    Cc: linux-wireless@vger.kernel.org
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: linux-media@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: dev@openvswitch.org
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Stefan Richter
    Signed-off-by: Simon Horman
    Signed-off-by: David S. Miller

    Simon Horman
     

22 Jan, 2013

1 commit

  • When we set mac address, software mac address in system and hardware mac
    address all need to be updated. Current eth_mac_addr() doesn't allow
    callers to implement error handling nicely.

    This patch split eth_mac_addr() to prepare part and real commit part,
    then we can prepare first, and try to change hardware address, then do
    the real commit if hardware address is set successfully.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Amos Kong
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     

04 Jan, 2013

1 commit


20 Jul, 2012

1 commit

  • The Ethernet II wrapper is only used by IPX protocol, may have once
    been used by Appletalk but not currently. Therefore it makes sense to
    move it to the IPX dust bin and drop the exports.

    Build tested only.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

11 Jul, 2012

1 commit


30 Jun, 2012

1 commit


11 May, 2012

1 commit

  • Use the new bool function ether_addr_equal_64bits to add
    some clarity and reduce the likelihood for misuse of
    compare_ether_addr_64bits for sorting.

    Done via cocci script:

    $ cat compare_ether_addr_64bits.cocci
    @@
    expression a,b;
    @@
    - !compare_ether_addr_64bits(a, b)
    + ether_addr_equal_64bits(a, b)

    @@
    expression a,b;
    @@
    - compare_ether_addr_64bits(a, b)
    + !ether_addr_equal_64bits(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal_64bits(a, b) == 0
    + ether_addr_equal_64bits(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal_64bits(a, b) != 0
    + !ether_addr_equal_64bits(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal_64bits(a, b) == 0
    + !ether_addr_equal_64bits(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal_64bits(a, b) != 0
    + ether_addr_equal_64bits(a, b)

    @@
    expression a,b;
    @@
    - !!ether_addr_equal_64bits(a, b)
    + ether_addr_equal_64bits(a, b)

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

16 Apr, 2012

1 commit


29 Mar, 2012

1 commit


13 Feb, 2012

1 commit

  • If eth_mac_addr() get called, usually if SIOCSIFHWADDR was
    used to change the MAC of a ethernet device, reset the
    addr_assign_type to NET_ADDR_PERM if the state was
    NET_ADDR_RANDOM before. Reset the state since the MAC is
    no longer random at least not from the kernel side.

    v2: changed to bitops, removed if()

    Signed-off-by: Danny Kukawka
    Signed-off-by: David S. Miller

    Danny Kukawka
     

16 Sep, 2011

1 commit

  • d88733150 introduced the IFF_SKB_TX_SHARING flag, which I unilaterally set in
    ether_setup. In doing this I didn't realize that other flags (such as
    IFF_XMIT_DST_RELEASE) might be set prior to calling the ether_setup routine.
    This patch changes ether_setup to or in SKB_TX_SHARING so as not to
    inadvertently clear other existing flags. Thanks to Pekka Riikonen for pointing
    out my error

    Signed-off-by: Neil Horman
    Reported-by: Pekka Riikonen
    CC: "David S. Miller"
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    nhorman
     

28 Jul, 2011

1 commit

  • Pktgen attempts to transmit shared skbs to net devices, which can't be used by
    some drivers as they keep state information in skbs. This patch adds a flag
    marking drivers as being able to handle shared skbs in their tx path. Drivers
    are defaulted to being unable to do so, but calling ether_setup enables this
    flag, as 90% of the drivers calling ether_setup touch real hardware and can
    handle shared skbs. A subsequent patch will audit drivers to ensure that the
    flag is set properly

    Signed-off-by: Neil Horman
    Reported-by: Jiri Pirko
    CC: Robert Olsson
    CC: Eric Dumazet
    CC: Alexey Dobriyan
    CC: David S. Miller
    Signed-off-by: David S. Miller

    Neil Horman
     

26 Jul, 2011

1 commit


13 Jul, 2011

1 commit


13 Jan, 2011

1 commit


11 Jan, 2011

1 commit

  • Added alloc_netdev_mqs function which allows the number of transmit and
    receive queues to be specified independenty. alloc_netdev_mq was
    changed to a macro to call the new function. Also added
    alloc_etherdev_mqs with same purpose.

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

    Tom Herbert
     

24 Sep, 2010

1 commit


27 Aug, 2010

1 commit

  • strlcpy() returns the total length of the string they tried to create, so
    we should not use its return value without any check. scnprintf() returns
    the number of characters written into @buf not including the trailing '\0',
    so use it instead here.

    Signed-off-by: Changli Gao
    Signed-off-by: David S. Miller

    Changli Gao
     

15 Jul, 2010

1 commit


11 Jun, 2010

1 commit


02 May, 2010

1 commit

  • In commit 6be8ac2f ("[NET]: uninline skb_pull, de-bloats a lot")
    we uninlined skb_pull.

    But in some critical paths it makes sense to inline this thing
    and it helps performance significantly.

    Create an skb_pull_inline() so that we can do this in a way that
    serves also as annotation.

    Based upon a patch by Eric Dumazet.

    Signed-off-by: David S. Miller

    David S. Miller
     

22 Apr, 2010

1 commit


21 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

27 Dec, 2009

1 commit

  • Using dev_hard_header allows us to use LLC with VLANs and potentially
    other Ethernet/TokernRing specific encapsulations. It also removes code
    duplication between LLC and Ethernet/TokenRing core code.

    Signed-off-by: Octavian Purdila
    Signed-off-by: David S. Miller

    Octavian Purdila
     

16 Nov, 2009

1 commit


25 May, 2009

1 commit


24 Nov, 2008

1 commit

  • Linus mentioned we could try to perform long word operations, even
    on potentially unaligned addresses, on x86 at least. David mentioned
    the HAVE_EFFICIENT_UNALIGNED_ACCESS test to handle this on all
    arches that have efficient unailgned accesses.

    I tried this idea and got nice assembly on 32 bits:

    158: 33 82 38 01 00 00 xor 0x138(%edx),%eax
    15e: 33 8a 34 01 00 00 xor 0x134(%edx),%ecx
    164: c1 e0 10 shl $0x10,%eax
    167: 09 c1 or %eax,%ecx
    169: 74 0b je 176

    And very nice assembly on 64 bits of course (one xor, one shl)

    Nice oprofile improvement in eth_type_trans(), 0.17 % instead of 0.41 %,
    expected since we remove 8 instructions on a fast path.

    This patch implements a compare_ether_addr_64bits() function, that
    uses the CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS ifdef to efficiently
    perform the 6 bytes comparison on all capable arches.

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

    Eric Dumazet
     

20 Nov, 2008

1 commit