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


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
     

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


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


09 Oct, 2008

2 commits

  • This adds support for the Trailer switch tagging format. This is
    another tagging that doesn't explicitly mark tagged packets with a
    distinct ethertype, so that we need to add a similar hack in the
    receive path as for the Original DSA tagging format.

    Signed-off-by: Lennert Buytenhek
    Tested-by: Byron Bradley
    Tested-by: Tim Ellis
    Signed-off-by: David S. Miller

    Lennert Buytenhek
     
  • Most of the DSA switches currently in the field do not support the
    Ethertype DSA tagging format that one of the previous patches added
    support for, but only the original DSA tagging format.

    The original DSA tagging format carries the same information as the
    Ethertype DSA tagging format, but with the difference that it does not
    have an ethertype field. In other words, when receiving a packet that
    is tagged with an original DSA tag, there is no way of telling in
    eth_type_trans() that this packet is in fact a DSA-tagged packet.

    This patch adds a hook into eth_type_trans() which is only compiled in
    if support for a switch chip that doesn't support Ethertype DSA is
    selected, and which checks whether there is a DSA switch driver
    instance attached to this network device which uses the old tag format.
    If so, it sets the protocol field to ETH_P_DSA without looking at the
    packet, so that the packet ends up in the right place.

    Signed-off-by: Lennert Buytenhek
    Tested-by: Nicolas Pitre
    Tested-by: Peter van Valderen
    Tested-by: Dirk Teurlings
    Signed-off-by: David S. Miller

    Lennert Buytenhek
     

21 Sep, 2008

1 commit


14 Apr, 2008

1 commit

  • Paul Bolle wrote:
    > http://bugzilla.kernel.org/show_bug.cgi?id=9923 would have been much easier to
    > track down if eth_validate_addr() would somehow complain aloud if an address
    > is invalid. Shouldn't it make at least some noise?

    I guess it should return -EADDRNOTAVAIL similar to eth_mac_addr()
    when validation fails.

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

    Patrick McHardy
     

29 Jan, 2008

1 commit

  • print_mac() used many most net drivers and format_addr() used by
    net-sysfs.c are very similar and they can be intergrated.

    format_addr() is also identically redefined in the qla4xxx iscsi
    driver.

    Export a new function sysfs_format_mac() to be used by net-sysfs,
    qla4xxx and others in the future. Both print_mac() and
    sysfs_format_mac() call _format_mac_addr() to do the formatting.

    Changed print_mac() to use unsigned char * to be consistent with
    net_device struct's dev_addr. Added buffer length overrun checking
    as suggested by Joe Perches.

    Signed-off-by: Michael Chan
    Signed-off-by: David S. Miller

    Michael Chan
     

24 Oct, 2007

1 commit


11 Oct, 2007

3 commits