1. 13 6月, 2012 1 次提交
  2. 14 5月, 2012 1 次提交
  3. 11 5月, 2012 3 次提交
    • J
      net, drivers/net: Convert compare_ether_addr_64bits to ether_addr_equal_64bits · a6700db1
      Joe Perches 提交于
      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: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a6700db1
    • J
      drivers/net: Convert compare_ether_addr to ether_addr_equal · 2e42e474
      Joe Perches 提交于
      Use the new bool function ether_addr_equal to add
      some clarity and reduce the likelihood for misuse
      of compare_ether_addr for sorting.
      
      Done via cocci script:
      
      $ cat compare_ether_addr.cocci
      @@
      expression a,b;
      @@
      -	!compare_ether_addr(a, b)
      +	ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	compare_ether_addr(a, b)
      +	!ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	!ether_addr_equal(a, b) == 0
      +	ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	!ether_addr_equal(a, b) != 0
      +	!ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	ether_addr_equal(a, b) == 0
      +	!ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	ether_addr_equal(a, b) != 0
      +	ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	!!ether_addr_equal(a, b)
      +	ether_addr_equal(a, b)
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2e42e474
    • J
      bonding: don't increase rx_dropped after processing LACPDUs · 13a8e0c8
      Jiri Bohac 提交于
      Since commit 3aba891d, bonding processes LACP frames (802.3ad
      mode) with bond_handle_frame(). Currently a copy of the skb is
      made and the original is left to be processed by other
      rx_handlers and the rest of the network stack by returning
      RX_HANDLER_ANOTHER.  As there is no protocol handler for
      PKT_TYPE_LACPDU, the frame is dropped and dev->rx_dropped
      increased.
      
      Fix this by making bond_handle_frame() return RX_HANDLER_CONSUMED
      if bonding has processed the LACP frame.
      Signed-off-by: NJiri Bohac <jbohac@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      13a8e0c8
  4. 27 4月, 2012 1 次提交
  5. 20 4月, 2012 1 次提交
  6. 14 4月, 2012 2 次提交
  7. 06 4月, 2012 1 次提交
  8. 05 4月, 2012 2 次提交
  9. 30 3月, 2012 1 次提交
    • W
      bonding: emit event when bonding changes MAC · 7d26bb10
      Weiping Pan 提交于
      When a bonding device is configured with fail_over_mac=active,
      we expect to see the MAC address of the new active slave as the source MAC
      address after failover. But we see that the source MAC address is the MAC
      address of previous active slave.
      
      Emit NETDEV_CHANGEADDR event when bonding changes its MAC address, in order
      to let arp_netdev_event flush neighbour cache and route cache.
      
      How to reproduce this bug ?
      
                             -----------hostB----------------
      hostA ----- switch ---|-- eth0--bond0(192.168.100.2/24)|
      (192.168.100.1/24  \--|-- eth1-/                       |
                             --------------------------------
      
      1 on hostB,
      modprobe bonding mode=1 miimon=500 fail_over_mac=active downdelay=1000
      num_grat_arp=1
      ifconfig bond0 192.168.100.2/24 up
      ifenslave bond0 eth0
      ifenslave bond0 eth1
      
      then eth0 is the active slave, and MAC of bond0 is MAC of eth0.
      
      2 on hostA, ping 192.168.100.2
      
      3 on hostB,
      tcpdump -i bond0 -p icmp -XXX
      you will see bond0 uses MAC of eth0 as source MAC in icmp reply.
      
      4 on hostB,
      ifconfig eth0 down
      tcpdump -i bond0 -p icmp -XXX (just keep it running in step 3)
      you will see first bond0 uses MAC of eth1 as source MAC in icmp
      reply, then it will use MAC of eth0 as source MAC.
      Signed-off-by: NWeiping Pan <wpan@redhat.com>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d26bb10
  10. 29 3月, 2012 1 次提交
  11. 23 3月, 2012 1 次提交
    • A
      bonding: remove entries for master_ip and vlan_ip and query devices instead · eaddcd76
      Andy Gospodarek 提交于
      The following patch aimed to resolve an issue where secondary, tertiary,
      etc. addresses added to bond interfaces could overwrite the
      bond->master_ip and vlan_ip values.
      
              commit 917fbdb3
              Author: Henrik Saavedra Persson <henrik.e.persson@ericsson.com>
              Date:   Wed Nov 23 23:37:15 2011 +0000
      
                  bonding: only use primary address for ARP
      
      That patch was good because it prevented bonds using ARP monitoring from
      sending frames with an invalid source IP address.  Unfortunately, it
      didn't always work as expected.
      
      When using an ioctl (like ifconfig does) to set the IP address and
      netmask, 2 separate ioctls are actually called to set the IP and netmask
      if the mask chosen doesn't match the standard mask for that class of
      address.  The first ioctl did not have a mask that matched the one in
      the primary address and would still cause the device address to be
      overwritten.  The second ioctl that was called to set the mask would
      then detect as secondary and ignored, but the damage was already done.
      
      This was not an issue when using an application that used netlink
      sockets as the setting of IP and netmask came down at once.  The
      inconsistent behavior between those two interfaces was something that
      needed to be resolved.
      
      While I was thinking about how I wanted to resolve this, Ralf Zeidler
      came with a patch that resolved this on a RHEL kernel by keeping a full
      shadow of the entries in dev->ifa_list for the bonding device and vlan
      devices in the bonding driver.  I didn't like the duplication of the
      list as I want to see the 'bonding' struct and code shrink rather than
      grow, but liked the general idea.
      
      As the Subject indicates this patch drops the master_ip and vlan_ip
      elements from the 'bonding' and 'vlan_entry' structs, respectively.
      This can be done because a device's address-list is now traversed to
      determine the optimal source IP address for ARP requests and for checks
      to see if the bonding device has a particular IP address.  This code
      could have all be contained inside the bonding driver, but it made more
      sense to me to EXPORT and call inet_confirm_addr since it did exactly
      what was needed.
      
      I tested this and a backported patch and everything works as expected.
      Ralf also helped with verification of the backported patch.
      
      Thanks to Ralf for all his help on this.
      
      v2: Whitespace and organizational changes based on suggestions from Jay
      Vosburgh and Dave Miller.
      
      v3: Fixup incorrect usage of rcu_read_unlock based on Dave Miller's
      suggestion.
      Signed-off-by: NAndy Gospodarek <andy@greyhouse.net>
      CC: Ralf Zeidler <ralf.zeidler@nsn.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eaddcd76
  12. 20 3月, 2012 1 次提交
    • P
      bonding: send igmp report for its master · 1c3ac428
      Peter Pan(潘卫平) 提交于
      Liang Zheng(lzheng@redhat.com) found that in the following topo,
      bonding does not send igmp report when we trigger a fail-over of bonding.
      
      eth0--
            |-- bond0 -- br0
      eth1--
      
      modprobe bonding mode=1 miimon=100 resend_igmp=10
      ifconfig bond0 up
      ifenslave bond0 eth0 eth1
      
      brctl addbr br0
      ifconfig br0 192.168.100.2/24 up
      brctl addif br0 bond0
      
      Add 192.168.100.2(br0) into a multicast group, like 224.10.10.10,
      then trigger a fali-over in bonding.
      You can see that parameter "resend_igmp" does not work.
      
      The reason is that when we add br0 into a multicast group,
      it does not propagate multicast knowledge down to its ports.
      
      If we choose to propagate multicast knowledge down to all ports for bridge,
      then we have to track every change that is done to bridge, and keep a backup
      for all ports. It is hard to track, I think.
      
      Instead I choose to modify bonding to send igmp report for its master.
      
      Changelog:
      V2: correct comments
      V3: move this check into bond_resend_igmp_join_requests()
      V4: only send igmp reports if bond is enslaved to a bridge
      Signed-off-by: NWeiping Pan <panweiping3@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1c3ac428
  13. 10 2月, 2012 1 次提交
  14. 06 2月, 2012 1 次提交
  15. 01 2月, 2012 1 次提交
  16. 19 1月, 2012 1 次提交
    • J
      bonding: fix enslaving in alb mode when link down · b924551b
      Jiri Bohac 提交于
      bond_alb_init_slave() is called from bond_enslave() and sets the slave's MAC
      address. This is done differently for TLB and ALB modes.
      bond->alb_info.rlb_enabled is used to discriminate between the two modes but
      this flag may be uninitialized if the slave is being enslaved prior to calling
      bond_open() -> bond_alb_initialize() on the master.
      
      It turns out all the callers of alb_set_slave_mac_addr() pass
      bond->alb_info.rlb_enabled as the hw parameter.
      
      This patch cleans up the unnecessary parameter of alb_set_slave_mac_addr() and
      makes the function decide based on the bonding mode instead, which fixes the
      above problem.
      Reported-by: NNarendra K <Narendra_K@Dell.com>
      Signed-off-by: NJiri Bohac <jbohac@suse.cz>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b924551b
  17. 12 1月, 2012 1 次提交
  18. 04 1月, 2012 1 次提交
  19. 22 12月, 2011 1 次提交
    • K
      driver-core: remove sysdev.h usage. · edbaa603
      Kay Sievers 提交于
      The sysdev.h file should not be needed by any in-kernel code, so remove
      the .h file from these random files that seem to still want to include
      it.
      
      The sysdev code will be going away soon, so this include needs to be
      removed no matter what.
      
      Cc: Jiandong Zheng <jdzheng@broadcom.com>
      Cc: Scott Branden <sbranden@broadcom.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Kukjin Kim <kgene.kim@samsung.com>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Daniel Walker <dwalker@fifo99.com>
      Cc: Bryan Huntsman <bryanh@codeaurora.org>
      Cc: Ben Dooks <ben-linux@fluff.org>
      Cc: Wan ZongShun <mcuos.com@gmail.com>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: "Venkatesh Pallipadi
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Matthew Garrett <mjg@redhat.com>
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      edbaa603
  20. 09 12月, 2011 2 次提交
  21. 01 12月, 2011 1 次提交
  22. 27 11月, 2011 1 次提交
  23. 23 11月, 2011 1 次提交
  24. 18 11月, 2011 1 次提交
  25. 17 11月, 2011 2 次提交
  26. 05 11月, 2011 1 次提交
  27. 02 11月, 2011 1 次提交
    • W
      bonding:update speed/duplex for NETDEV_CHANGE · 98f41f69
      Weiping Pan 提交于
      Zheng Liang(lzheng@redhat.com) found a bug that if we config bonding with
      arp monitor, sometimes bonding driver cannot get the speed and duplex from
      its slaves, it will assume them to be 100Mb/sec and Full, please see
      /proc/net/bonding/bond0.
      But there is no such problem when uses miimon.
      
      (Take igb for example)
      I find that the reason is that after dev_open() in bond_enslave(),
      bond_update_speed_duplex() will call igb_get_settings()
      , but in that function,
      it runs ethtool_cmd_speed_set(ecmd, -1); ecmd->duplex = -1;
      because igb get an error value of status.
      So even dev_open() is called, but the device is not really ready to get its
      settings.
      
      Maybe it is safe for us to call igb_get_settings() only after
      this message shows up, that is "igb: p4p1 NIC Link is Up 1000 Mbps Full Duplex,
      Flow Control: RX".
      
      So I prefer to update the speed and duplex for a slave when reseices
      NETDEV_CHANGE/NETDEV_UP event.
      
      Changelog
      V2:
      1 remove the "fake 100/Full" logic in bond_update_speed_duplex(),
        set speed and duplex to -1 when it gets error value of speed and duplex.
      2 delete the warning in bond_enslave() if bond_update_speed_duplex() returns
        error.
      3 make bond_info_show_slave() handle bad values of speed and duplex.
      Signed-off-by: NWeiping Pan <wpan@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      98f41f69
  28. 01 11月, 2011 1 次提交
  29. 30 10月, 2011 1 次提交
    • J
      bonding: eliminate bond_close race conditions · e6d265e8
      Jay Vosburgh 提交于
      This patch resolves two sets of race conditions.
      
      	Mitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com> reported the
      first, as follows:
      
      The bond_close() calls cancel_delayed_work() to cancel delayed works.
      It, however, cannot cancel works that were already queued in workqueue.
      The bond_open() initializes work->data, and proccess_one_work() refers
      get_work_cwq(work)->wq->flags. The get_work_cwq() returns NULL when
      work->data has been initialized. Thus, a panic occurs.
      
      	He included a patch that converted the cancel_delayed_work calls
      in bond_close to flush_delayed_work_sync, which eliminated the above
      problem.
      
      	His patch is incorporated, at least in principle, into this
      patch.  In this patch, we use cancel_delayed_work_sync in place of
      flush_delayed_work_sync, and also convert bond_uninit in addition to
      bond_close.
      
      	This conversion to _sync, however, opens new races between
      bond_close and three periodically executing workqueue functions:
      bond_mii_monitor, bond_alb_monitor and bond_activebackup_arp_mon.
      
      	The race occurs because bond_close and bond_uninit are always
      called with RTNL held, and these workqueue functions may acquire RTNL to
      perform failover-related activities.  If bond_close or bond_uninit is
      waiting in cancel_delayed_work_sync, deadlock occurs.
      
      	These deadlocks are resolved by having the workqueue functions
      acquire RTNL conditionally.  If the rtnl_trylock() fails, the functions
      reschedule and return immediately.  For the cases that are attempting to
      perform link failover, a delay of 1 is used; for the other cases, the
      normal interval is used (as those activities are not as time critical).
      
      	Additionally, the bond_mii_monitor function now stores the delay
      in a variable (mimicing the structure of activebackup_arp_mon).
      
      	Lastly, all of the above renders the kill_timers sentinel moot,
      and therefore it has been removed.
      Tested-by: NMitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e6d265e8
  30. 26 10月, 2011 1 次提交
  31. 22 10月, 2011 1 次提交
    • E
      bonding: Add a forgetten sysfs_attr_init on class_attr_bonding_masters · 01718e36
      Eric W. Biederman 提交于
      When I made class_attr_bonding_matters per network namespace and dynamically
      allocated I overlooked the need for calling sysfs_attr_init.  Oops.
      
      This fixes the following lockdep splat:
      
      [    5.749651] bonding: Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
      [    5.749655] bonding: MII link monitoring set to 100 ms
      [    5.749676] BUG: key f49a831c not in .data!
      [    5.749677] ------------[ cut here ]------------
      [    5.749752] WARNING: at kernel/lockdep.c:2897 lockdep_init_map+0x1c3/0x460()
      [    5.749809] Hardware name: ProLiant BL460c G1
      [    5.749862] Modules linked in: bonding(+)
      [    5.749978] Pid: 3177, comm: modprobe Not tainted 3.1.0-rc9-02177-gf2d1a4e-dirty #1157
      [    5.750066] Call Trace:
      [    5.750120]  [<c1352c2f>] ? printk+0x18/0x21
      [    5.750176]  [<c103112d>] warn_slowpath_common+0x6d/0xa0
      [    5.750231]  [<c1060133>] ? lockdep_init_map+0x1c3/0x460
      [    5.750287]  [<c1060133>] ? lockdep_init_map+0x1c3/0x460
      [    5.750342]  [<c103117d>] warn_slowpath_null+0x1d/0x20
      [    5.750398]  [<c1060133>] lockdep_init_map+0x1c3/0x460
      [    5.750453]  [<c1355ddd>] ? _raw_spin_unlock+0x1d/0x20
      [    5.750510]  [<c11255c8>] ? sysfs_new_dirent+0x68/0x110
      [    5.750565]  [<c1124d4b>] sysfs_add_file_mode+0x8b/0xe0
      [    5.750621]  [<c1124db3>] sysfs_add_file+0x13/0x20
      [    5.750675]  [<c1124e7c>] sysfs_create_file+0x1c/0x20
      [    5.750737]  [<c1208f09>] class_create_file+0x19/0x20
      [    5.750794]  [<c12c186f>] netdev_class_create_file+0xf/0x20
      [    5.750853]  [<f85deaf4>] bond_create_sysfs+0x44/0x90 [bonding]
      [    5.750911]  [<f8410947>] ? bond_create_proc_dir+0x1e/0x3e [bonding]
      [    5.750970]  [<f841007e>] bond_net_init+0x7e/0x87 [bonding]
      [    5.751026]  [<f8410000>] ? 0xf840ffff
      [    5.751080]  [<c12abc7a>] ops_init.clone.4+0xba/0x100
      [    5.751135]  [<c12abdb2>] ? register_pernet_subsys+0x12/0x30
      [    5.751191]  [<c12abd03>] register_pernet_operations.clone.3+0x43/0x80
      [    5.751249]  [<c12abdb9>] register_pernet_subsys+0x19/0x30
      [    5.751306]  [<f84108b9>] bonding_init+0x832/0x8a2 [bonding]
      [    5.751363]  [<c10011f0>] do_one_initcall+0x30/0x160
      [    5.751420]  [<f8410087>] ? bond_net_init+0x87/0x87 [bonding]
      [    5.751477]  [<c106d5cf>] sys_init_module+0xef/0x1890
      [    5.751533]  [<c1356490>] sysenter_do_call+0x12/0x36
      [    5.751588] ---[ end trace 89f492d83a7f5006 ]---
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Tested-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      01718e36
  32. 20 10月, 2011 2 次提交
  33. 19 10月, 2011 1 次提交