03 Jun, 2014

1 commit

  • This change provides a function to be used in order to break the
    ndo_set_rx_mode call into a set of address add and remove calls. The code
    is based on the implementation of dev_uc_sync/dev_mc_sync. Since they
    essentially do the same thing but with only one dev I simply named my
    functions __dev_uc_sync/__dev_mc_sync.

    I also implemented an unsync version of the functions as well to allow for
    cleanup on close.

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

    Alexander Duyck
     

24 Jan, 2014

1 commit

  • When we have multiple devices attempting to sync the same address
    to a single destination, each device should be permitted to sync
    it once. To accomplish this, pass the 'sync_cnt' of the source
    address when adding the addresss to the lower device. 'sync_cnt'
    tracks how many time a given address has been succefully synced.
    This way, we know that if the 'sync_cnt' passed in is 0, we should
    sync this address.

    Also, turn 'synced' member back into the counter as was originally
    done in
    commit 4543fbefe6e06a9e40d9f2b28d688393a299f079.
    net: count hw_addr syncs so that unsync works properly.
    It tracks how many time a given address has been added via a
    'sync' operation. For every successfull 'sync' the counter is
    incremented, and for ever 'unsync', the counter is decremented.
    This makes sure that the address will be properly removed from
    the the lower device when all the upper devices have removed it.

    Reported-by: Andrey Dmitrov
    CC: Andrey Dmitrov
    CC: Alexandra N. Kossovsky
    CC: Konstantin Ushakov
    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

18 Dec, 2013

1 commit

  • These function to manipulate multiple addresses are not used anywhere
    in current net-next tree. Some out of tree code maybe using these but
    too bad; they should submit their code upstream..

    Also, make __hw_addr_flush local since only used by dev_addr_lists.c

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

    stephen hemminger
     

29 Oct, 2013

1 commit


01 Jun, 2013

4 commits

  • The dev_mc_sync_multiple function is currently calling
    __hw_addr_sync, and not __hw_addr_sync_multiple. This will result in
    addresses only being synced to the first device from the set.

    Corrected by calling the _multiple variant.

    Signed-off-by: Jay Vosburgh
    Reviewed-by: Vlad Yasevich
    Tested-by: Shawn Bohrer
    Signed-off-by: David S. Miller

    Jay Vosburgh
     
  • Currently, __hw_addr_sync_one is called in a loop by
    __hw_addr_sync_multiple to sync each of a "from" device's hw addresses
    to a "to" device. __hw_addr_sync_one calls __hw_addr_add_ex to attempt
    to add each address. __hw_addr_add_ex is called with global=false, and
    sync=true.

    __hw_addr_add_ex checks to see if the new address matches an
    address already on the list. If so, it tests global and sync. In this
    case, sync=true, and it then checks if the address is already synced,
    and if so, returns 0.

    This 0 return causes __hw_addr_sync_one to increment the sync_cnt
    and refcount for the "from" list's address entry, even though the address
    is already synced and has a reference and sync_cnt. This will cause
    the sync_cnt and refcount to increment without bound every time an
    addresses is added to the "from" device and synced to the "to" device.

    The fix here has two parts:

    First, when __hw_addr_add_ex finds the address already exists
    and is synced, return -EEXIST instead of 0.

    Second, __hw_addr_sync_one checks the error return for -EEXIST,
    and if so, it (a) does not add a refcount/sync_cnt, and (b) returns 0
    itself so that __hw_addr_sync_multiple will not return an error.

    Signed-off-by: Jay Vosburgh
    Reviewed-by: Vlad Yasevich
    Tested-by: Shawn Bohrer
    Signed-off-by: David S. Miller

    Jay Vosburgh
     
  • When an address is added to a subordinate interface (the "to"
    list), the address entry in the "from" list is not marked "synced" as
    the entry added to the "to" list is.

    When performing the unsync operation (e.g., dev_mc_unsync),
    __hw_addr_unsync_one calls __hw_addr_del_entry with the "synced"
    parameter set to true for the case when the address reference is being
    released from the "from" list. This causes a test inside to fail,
    with the result being that the reference count on the "from" address
    is not properly decremeted and the address on the "from" list will
    never be freed.

    Correct this by having __hw_addr_unsync_one call the
    __hw_addr_del_entry function with the "sync" flag set to false for the
    "remove from the from list" case.

    Signed-off-by: Jay Vosburgh
    Reviewed-by: Vlad Yasevich
    Tested-by: Shawn Bohrer
    Signed-off-by: David S. Miller

    Jay Vosburgh
     
  • The sync_cnt field is not being initialized, which can result
    in arbitrary values in the field. Fixed by initializing it to zero.

    Signed-off-by: Jay Vosburgh
    Reviewed-by: Vlad Yasevich
    Tested-by: Shawn Bohrer
    Signed-off-by: David S. Miller

    Jay Vosburgh
     

16 Apr, 2013

1 commit

  • The current implementation of dev_uc_sync/unsync() assumes that there is
    a strict 1-to-1 relationship between the source and destination of the sync.
    In other words, once an address has been synced to a destination device, it
    will not be synced to any other device through the sync API.
    However, there are some virtual devices that aggreate a number of lower
    devices and need to sync addresses to all of them. The current
    API falls short there.

    This patch introduces a new dev_uc_sync_multiple() api that can be called
    in the above circumstances and allows sync to work for every invocation.

    CC: Jiri Pirko
    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

05 Apr, 2013

1 commit

  • A few drivers use dev_uc_sync/unsync to synchronize the
    address lists from master down to slave/lower devices. In
    some cases (bond/team) a single address list is synched down
    to multiple devices. At the time of unsync, we have a leak
    in these lower devices, because "synced" is treated as a
    boolean and the address will not be unsynced for anything after
    the first device/call.

    Treat "synced" as a count (same as refcount) and allow all
    unsync calls to work.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

19 Feb, 2013

3 commits

  • Similar to net/core/net-sysfs.c, group procfs code to
    a single unit.

    Cc: "David S. Miller"
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • proc_net_remove is only used to remove proc entries
    that under /proc/net,it's not a general function for
    removing proc entries of netns. if we want to remove
    some proc entries which under /proc/net/stat/, we still
    need to call remove_proc_entry.

    this patch use remove_proc_entry to replace proc_net_remove.
    we can remove proc_net_remove after this patch.

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

    Gao feng
     
  • Right now, some modules such as bonding use proc_create
    to create proc entries under /proc/net/, and other modules
    such as ipv4 use proc_net_fops_create.

    It looks a little chaos.this patch changes all of
    proc_net_fops_create to proc_create. we can remove
    proc_net_fops_create after this patch.

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

    Gao feng
     

16 Nov, 2012

1 commit


20 Sep, 2012

1 commit


16 Apr, 2012

1 commit

  • This adds a dev_uc_add_excl() and dev_mc_add_excl() calls
    similar to the original dev_{uc|mc}_add() except it sets
    the global bit and returns -EEXIST for duplicat entires.

    This is useful for drivers that support SR-IOV, macvlan
    devices and any other devices that need to manage the
    unicast and multicast lists.

    v2: fix typo UNICAST should be MULTICAST in dev_mc_add_excl()

    CC: Ben Hutchings
    Signed-off-by: John Fastabend
    Signed-off-by: David S. Miller

    John Fastabend
     

04 Apr, 2012

1 commit

  • Commit f04565ddf52 (dev: use name hash for dev_seq_ops) added a second
    regression, as some devices are missing from /proc/net/dev if many
    devices are defined.

    When seq_file buffer is filled, the last ->next/show() method is
    canceled (pos value is reverted to value prior ->next() call)

    Problem is after above commit, we dont restart the lookup at right
    position in ->start() method.

    Fix this by removing the internal 'pos' pointer added in commit, since
    we need to use the 'loff_t *pos' provided by seq_file layer.

    This also reverts commit 5cac98dd0 (net: Fix corruption
    in /proc/*/net/dev_mcast), since its not needed anymore.

    Reported-by: Ben Greear
    Signed-off-by: Eric Dumazet
    Cc: Mihai Maruseac
    Tested-by: Ben Greear
    Signed-off-by: David S. Miller

    Eric Dumazet
     

10 Jan, 2012

2 commits


29 Nov, 2011

1 commit

  • I just hit this during my testing. Isn't there another bug lurking?

    BUG kmalloc-8: Redzone overwritten

    INFO: 0xc0000000de9dec48-0xc0000000de9dec4b. First byte 0x0 instead of 0xcc
    INFO: Allocated in .__seq_open_private+0x30/0xa0 age=0 cpu=5 pid=3896
    .__kmalloc+0x1e0/0x2d0
    .__seq_open_private+0x30/0xa0
    .seq_open_net+0x60/0xe0
    .dev_mc_seq_open+0x4c/0x70
    .proc_reg_open+0xd8/0x260
    .__dentry_open.clone.11+0x2b8/0x400
    .do_last+0xf4/0x950
    .path_openat+0xf8/0x480
    .do_filp_open+0x48/0xc0
    .do_sys_open+0x140/0x250
    syscall_exit+0x0/0x40

    dev_mc_seq_ops uses dev_seq_start/next/stop but only allocates
    sizeof(struct seq_net_private) of private data, whereas it expects
    sizeof(struct dev_iter_state):

    struct dev_iter_state {
    struct seq_net_private p;
    unsigned int pos; /* bucket << BUCKET_SPACE + offset */
    };

    Create dev_seq_open_ops and use it so we don't have to expose
    struct dev_iter_state.

    [ Problem added by commit f04565ddf52e4 (dev: use name hash for
    dev_seq_ops) -Eric ]

    Signed-off-by: Anton Blanchard
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Anton Blanchard
     

01 Nov, 2011

1 commit


18 Aug, 2011

1 commit


08 May, 2011

1 commit


19 Mar, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (47 commits)
    doc: CONFIG_UNEVICTABLE_LRU doesn't exist anymore
    Update cpuset info & webiste for cgroups
    dcdbas: force SMI to happen when expected
    arch/arm/Kconfig: remove one to many l's in the word.
    asm-generic/user.h: Fix spelling in comment
    drm: fix printk typo 'sracth'
    Remove one to many n's in a word
    Documentation/filesystems/romfs.txt: fixing link to genromfs
    drivers:scsi Change printk typo initate -> initiate
    serial, pch uart: Remove duplicate inclusion of linux/pci.h header
    fs/eventpoll.c: fix spelling
    mm: Fix out-of-date comments which refers non-existent functions
    drm: Fix printk typo 'failled'
    coh901318.c: Change initate to initiate.
    mbox-db5500.c Change initate to initiate.
    edac: correct i82975x error-info reported
    edac: correct i82975x mci initialisation
    edac: correct commented info
    fs: update comments to point correct document
    target: remove duplicate include of target/target_core_device.h from drivers/target/target_core_hba.c
    ...

    Trivial conflict in fs/eventpoll.c (spelling vs addition)

    Linus Torvalds
     

26 Feb, 2011

1 commit

  • addr_type of 0 means that the type should be adopted from from_dev and
    not from __hw_addr_del_multiple(). Unfortunately it isn't so and
    addr_type will always be considered. Fix this by implementing the
    considered and documented behavior.

    Signed-off-by: Hagen Paul Pfeifer
    Signed-off-by: David S. Miller

    Hagen Paul Pfeifer
     

17 Feb, 2011

1 commit


08 Apr, 2010

1 commit


04 Apr, 2010

2 commits

  • Converts the list and the core manipulating with it to be the same as uc_list.

    +uses two functions for adding/removing mc address (normal and "global"
    variant) instead of a function parameter.
    +removes dev_mcast.c completely.
    +exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for
    manipulation with lists on a sandbox (used in bonding and 80211 drivers)

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     
  • +little renaming of unicast functions to be smooth with multicast ones

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko