26 Apr, 2018

1 commit

  • [ Upstream commit e728789c52afccc1275cba1dd812f03abe16ea3c ]

    In commit c7f5d105495a ("net: Add eth_platform_get_mac_address() helper."),
    two declarations were added:

    int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr);
    unsigned char *arch_get_platform_get_mac_address(void);

    An extra '_get' was introduced in arch_get_platform_get_mac_address, remove
    it. Fix compile warning using W=1:

    CC net/ethernet/eth.o
    net/ethernet/eth.c:523:24: warning: no previous prototype for ‘arch_get_platform_mac_address’ [-Wmissing-prototypes]
    unsigned char * __weak arch_get_platform_mac_address(void)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    AR net/ethernet/built-in.o

    Signed-off-by: Mathieu Malaterre
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mathieu Malaterre
     

13 Mar, 2017

1 commit


30 Jan, 2017

1 commit

  • This patch adds devm_alloc_etherdev_mqs function and devm_alloc_etherdev
    macro. These can be used for simpler netdev allocation without having to
    care about calling free_netdev.

    Thanks to this change drivers, their error paths and removal paths may
    get simpler by a bit.

    Signed-off-by: Rafał Miłecki
    Signed-off-by: David S. Miller

    Rafał Miłecki
     

05 Jan, 2017

1 commit

  • Lookup in the ATU can be performed starting from a given MAC
    address. This is faster than starting with the first possible MAC
    address and iterating all entries.

    Entries are returned in numeric order. So if the MAC address returned
    is bigger than what we are searching for, we know it is not in the
    ATU.

    Using the benchmark provided by Volodymyr Bendiuga
    ,

    https://www.spinics.net/lists/netdev/msg411550.html

    on an Marvell Armada 370 RD, the test to add a number of static fdb
    entries went from 1.616531 seconds to 0.312052 seconds.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     

01 Jul, 2016

1 commit


07 Jan, 2016

1 commit

  • A repeating pattern in drivers has become to use OF node information
    and, if not found, platform specific host information to extract the
    ethernet address for a given device.

    Currently this is done with a call to of_get_mac_address() and then
    some ifdef'd stuff for SPARC.

    Consolidate this into a portable routine, and provide the
    arch_get_platform_mac_address() weak function hook for all
    architectures to implement if they want.

    Signed-off-by: David S. Miller

    David S. Miller
     

18 Aug, 2015

1 commit

  • Sparse builds have been warning for a really long time now
    that etherdevice.h has a conversion that is unsafe.

    include/linux/etherdevice.h:79:32: warning: restricted __be16 degrades to integer

    This code change fixes the issue and generates the exact
    same assembly before/after (checked on x86_64)

    Fixes: 2c722fe1c821 (etherdevice: Optimize a few is__ether_addr functions)
    Signed-off-by: Jesse Brandeburg
    CC: Joe Perches
    Signed-off-by: David S. Miller

    Jesse Brandeburg
     

06 May, 2015

1 commit

  • This change does two things. First it fixes a sparse error for the fact
    that the __be16 degrades to an integer. Since that is actually what I am
    kind of doing I am simply working around that by forcing both sides of the
    comparison to u16.

    Also I realized on some compilers I was generating another instruction for
    big endian systems such as PowerPC since it was masking the value before
    doing the comparison. So to resolve that I have simply pulled the mask out
    and wrapped it in an #ifndef __BIG_ENDIAN.

    Lastly I pulled this all out into its own function. I notices there are
    similar checks in a number of other places so this function can be reused
    there to help reduce overhead in these paths as well.

    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     

04 May, 2015

1 commit

  • This change makes it so that we process the address in
    is_multicast_ether_addr at the same size as the other calls. This allows
    us to avoid duplicate reads when used with other calls such as
    is_zero_ether_addr or eth_addr_copy. In addition I have added a 64 bit
    version of the function so in eth_type_trans we can process the destination
    address as a 64 bit value throughout.

    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     

03 Mar, 2015

1 commit


03 Jan, 2015

1 commit


09 Dec, 2014

1 commit

  • This patch adds two new helper functions skb_put_padto and eth_skb_pad.
    These functions deviate from the standard skb_pad or skb_padto in that they
    will also update the length and tail pointers so that they reflect the
    padding added to the frame.

    The eth_skb_pad helper is meant to be used with Ethernet devices to update
    either Rx or Tx frames so that they report the correct size. The
    skb_put_padto helper is meant to be used primarily in the transmit path for
    network devices that need frames to be padded up to some minimum size and
    don't wish to simply update the length somewhere external to the frame.

    The motivation behind this is that there are a number of implementations
    throughout the network device drivers that are all doing the same thing,
    but each a little bit differently and as a result several implementations
    contain bugs such as updating the length without updating the tail offset
    and other similar issues.

    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     

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
     

16 Jan, 2014

1 commit


10 Dec, 2013

2 commits

  • If CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set,
    several is__ether_addr functions can be slightly
    improved by using u32 dereferences.

    I believe all current uses of is_zero_ether_addr and
    is_broadcast_ether_addr are u16 aligned, so always use
    u16 references to improve those functions performance.

    Document the u16 alignment requirements.

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

    Joe Perches
     
  • Add a generic routine to test if possibly unaligned
    to u16 Ethernet addresses are equal.

    If CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set,
    this uses the slightly faster generic routine
    ether_addr_equal, otherwise this uses memcmp.

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

    Joe Perches
     

07 Dec, 2013

1 commit

  • Add a new check for CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to reduce
    the number of or's used in the ether_addr_equal comparison to very
    slightly improve function performance.

    Simplify the ether_addr_equal_64bits implementation.
    Integrate and remove the zap_last_2bytes helper as it's now
    used only once.

    Remove the now unused compare_ether_addr function.

    Update the unaligned-memory-access documentation to remove the
    compare_ether_addr description and show how unaligned accesses
    could occur with ether_addr_equal.

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

    Joe Perches
     

27 Sep, 2013

1 commit

  • There are a mix of function prototypes with and without extern
    in the kernel sources. Standardize on not using extern for
    function prototypes.

    Function prototypes don't need to be written with extern.
    extern is assumed by the compiler. Its use is as unnecessary as
    using auto to declare automatic/local variables in a block.

    Signed-off-by: Joe Perches

    Joe Perches
     

04 Sep, 2013

1 commit


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


03 Nov, 2012

2 commits


30 Oct, 2012

1 commit


11 Sep, 2012

1 commit

  • a lot of code has either the memset or an inefficient copy
    from a static array that contains the all-zeros Ethernet address.
    Introduce help function eth_zero_addr() to fill an address with
    all zeros, making the code clearer and allowing us to get rid of
    some constant arrays.

    Signed-off-by: Duan Jiong
    Signed-off-by: David S. Miller

    Duan Jiong
     

17 Jul, 2012

1 commit


11 Jul, 2012

1 commit

  • A lot of code has either the memset or an inefficient copy
    from a static array that contains the all-ones broadcast
    address. Introduce eth_broadcast_addr() to fill an address
    with all ones, making the code clearer and allowing us to
    get rid of some constant arrays.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

18 May, 2012

1 commit

  • Fix some minor problems in comments of etherdevice.h
    * Warning is out dated, file hasn't moved or disappeared in many years and
    is unlikely to do so soon.
    * Capitalize Ethernet consistently since it is a proper name
    * Fix descriptive comment of padding
    * Spelling and grammar fix for alignment comment

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

    stephen hemminger
     

13 May, 2012

1 commit


11 May, 2012

1 commit

  • Add an optimized boolean function to check if
    2 ethernet addresses are the same.

    This is to avoid any confusion about compare_ether_addr_64bits
    returning an unsigned, and not being able to use the
    compare_ether_addr_64bits function for sorting ala memcmp.

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

    Joe Perches
     

10 May, 2012

1 commit

  • Add a boolean function to check if 2 ethernet addresses
    are the same.

    This is to avoid any confusion about compare_ether_addr
    returning an unsigned, and not being able to use the
    compare_ether_addr function for sorting ala memcmp.

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

    Joe Perches
     

09 May, 2012

1 commit


08 May, 2012

1 commit

  • Neither compare_ether_addr() nor compare_ether_addr_64bits()
    (as it can fall back to the former) have comparison semantics
    like memcmp() where the sign of the return value indicates sort
    order. We had a bug in the wireless code due to a blind memcmp
    replacement because of this.

    A cursory look suggests that the wireless bug was the only one
    due to this semantic difference.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

13 Feb, 2012

1 commit

  • Renamed dev_hw_addr_random to eth_hw_addr_random() to reflect that
    this function only assign a random ethernet address (MAC). Removed
    the second parameter (u8 *hwaddr), it's redundant since the also
    given net_device already contains net_device->dev_addr.
    Set it directly.

    Adapt igbvf and ixgbevf to the changed function.

    Small fix for ixgbevf_probe(): if ixgbevf_sw_init() fails
    (which means the device got no dev_addr) handle the error and
    jump to err_sw_init as already done by igbvf in similar case.

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

    Danny Kukawka
     

13 Jul, 2011

1 commit


14 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

  • 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
     

10 Aug, 2010

1 commit

  • Fix etherdevice.h parameter name typo in kernel-doc:

    Warning(include/linux/etherdevice.h:138): No description found for parameter 'hwaddr'
    Warning(include/linux/etherdevice.h:138): Excess function parameter 'addr' description in 'dev_hw_addr_random'

    Signed-off-by: Randy Dunlap
    Signed-off-by: David S. Miller

    Randy Dunlap