03 Dec, 2014

3 commits

  • When the swdev device learns a new mac/vlan on a port, it sends some async
    notification to the driver and the driver installs an FDB in the device.
    To give a holistic system view, the learned mac/vlan should be reflected
    in the bridge's FBD table, so the user, using normal iproute2 cmds, can view
    what is currently learned by the device. This API on the bridge driver gives
    a way for the swdev driver to install an FBD entry in the bridge FBD table.
    (And remove one).

    This is equivalent to the device running these cmds:

    bridge fdb [add|del] dev vid master

    This patch needs some extra eyeballs for review, in paricular around the
    locking and contexts.

    Signed-off-by: Scott Feldman
    Signed-off-by: Jiri Pirko
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Scott Feldman
     
  • Do the work of parsing NDA_VLAN directly in rtnetlink code, pass simple
    u16 vid to drivers from there.

    Signed-off-by: Jiri Pirko
    Acked-by: Andy Gospodarek
    Acked-by: Jamal Hadi Salim
    Acked-by: John Fastabend
    Signed-off-by: David S. Miller

    Jiri Pirko
     
  • The current name might seem that this actually offloads the fdb entry to
    hw. So rename it to clearly present that this for hardware address
    addition/removal.

    Signed-off-by: Jiri Pirko
    Acked-by: Andy Gospodarek
    Acked-by: Jamal Hadi Salim
    Acked-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Jiri Pirko
     

06 Aug, 2014

1 commit

  • Conflicts:
    drivers/net/Makefile
    net/ipv6/sysctl_net_ipv6.c

    Two ipv6_table_template[] additions overlap, so the index
    of the ipv6_table[x] assignments needed to be adjusted.

    In the drivers/net/Makefile case, we've gotten rid of the
    garbage whereby we had to list every single USB networking
    driver in the top-level Makefile, there is just one
    "USB_NETWORKING" that guards everything.

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Aug, 2014

1 commit

  • An FDB entry with vlan_id 0 doesn't mean it is used in vlan 0, but used when
    vlan_filtering is disabled.

    There is inconsistency around NDA_VLAN whose payload is 0 - even if we add
    an entry by RTM_NEWNEIGH without any NDA_VLAN, and even though adding an
    entry with NDA_VLAN 0 is prohibited, we get an entry with NDA_VLAN 0 by
    RTM_GETNEIGH.

    Dumping an FDB entry with vlan_id 0 shouldn't include NDA_VLAN.

    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller

    Toshiaki Makita
     

11 Jul, 2014

2 commits

  • Actually better than brctl showmacs because we can filter by bridge
    port in the kernel.
    The current bridge netlink interface doesnt scale when you have many
    bridges each with large fdbs or even bridges with many bridge ports

    And now for the science non-fiction novel you have all been
    waiting for..

    //lets see what bridge ports we have
    root@moja-1:/configs/may30-iprt/bridge# ./bridge link show
    8: eth1 state DOWN : mtu 1500 master br0 state
    disabled priority 32 cost 19
    17: sw1-p1 state DOWN : mtu 1500 master br0 state
    disabled priority 32 cost 100

    // show all..
    root@moja-1:/configs/may30-iprt/bridge# ./bridge fdb show
    33:33:00:00:00:01 dev bond0 self permanent
    33:33:00:00:00:01 dev dummy0 self permanent
    33:33:00:00:00:01 dev ifb0 self permanent
    33:33:00:00:00:01 dev ifb1 self permanent
    33:33:00:00:00:01 dev eth0 self permanent
    01:00:5e:00:00:01 dev eth0 self permanent
    33:33:ff:22:01:01 dev eth0 self permanent
    02:00:00:12:01:02 dev eth1 vlan 0 master br0 permanent
    00:17:42:8a:b4:05 dev eth1 vlan 0 master br0 permanent
    00:17:42:8a:b4:07 dev eth1 self permanent
    33:33:00:00:00:01 dev eth1 self permanent
    33:33:00:00:00:01 dev gretap0 self permanent
    da:ac:46:27:d9:53 dev sw1-p1 vlan 0 master br0 permanent
    33:33:00:00:00:01 dev sw1-p1 self permanent

    //filter by bridge
    root@moja-1:/configs/may30-iprt/bridge# ./bridge fdb show br br0
    02:00:00:12:01:02 dev eth1 vlan 0 master br0 permanent
    00:17:42:8a:b4:05 dev eth1 vlan 0 master br0 permanent
    00:17:42:8a:b4:07 dev eth1 self permanent
    33:33:00:00:00:01 dev eth1 self permanent
    da:ac:46:27:d9:53 dev sw1-p1 vlan 0 master br0 permanent
    33:33:00:00:00:01 dev sw1-p1 self permanent

    // bridge sw1 has no ports attached..
    root@moja-1:/configs/may30-iprt/bridge# ./bridge fdb show br sw1

    //filter by port
    root@moja-1:/configs/may30-iprt/bridge# ./bridge fdb show brport eth1
    02:00:00:12:01:02 vlan 0 master br0 permanent
    00:17:42:8a:b4:05 vlan 0 master br0 permanent
    00:17:42:8a:b4:07 self permanent
    33:33:00:00:00:01 self permanent

    // filter by port + bridge
    root@moja-1:/configs/may30-iprt/bridge# ./bridge fdb show br br0 brport
    sw1-p1
    da:ac:46:27:d9:53 vlan 0 master br0 permanent
    33:33:00:00:00:01 self permanent

    // for shits and giggles (as they say in New Brunswick), lets
    // change the mac that br0 uses
    // Note: a magical fdb entry with no brport is added ...
    root@moja-1:/configs/may30-iprt/bridge# ip link set dev br0 address
    02:00:00:12:01:04

    // lets see if we can see the unicorn ..
    root@moja-1:/configs/may30-iprt/bridge# ./bridge fdb show
    33:33:00:00:00:01 dev bond0 self permanent
    33:33:00:00:00:01 dev dummy0 self permanent
    33:33:00:00:00:01 dev ifb0 self permanent
    33:33:00:00:00:01 dev ifb1 self permanent
    33:33:00:00:00:01 dev eth0 self permanent
    01:00:5e:00:00:01 dev eth0 self permanent
    33:33:ff:22:01:01 dev eth0 self permanent
    02:00:00:12:01:02 dev eth1 vlan 0 master br0 permanent
    00:17:42:8a:b4:05 dev eth1 vlan 0 master br0 permanent
    00:17:42:8a:b4:07 dev eth1 self permanent
    33:33:00:00:00:01 dev eth1 self permanent
    33:33:00:00:00:01 dev gretap0 self permanent
    02:00:00:12:01:04 dev br0 vlan 0 master br0 permanent
    Signed-off-by: David S. Miller

    Jamal Hadi Salim
     
  • Dumping a bridge fdb dumps every fdb entry
    held. With this change we are going to filter
    on selected bridge port.

    Signed-off-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Jamal Hadi Salim
     

22 Jun, 2014

1 commit


04 Jun, 2014

1 commit


03 Jun, 2014

1 commit

  • (This patch was previously posted as RFC at
    http://patchwork.ozlabs.org/patch/352677/)

    This patch adds NDA_MASTER attribute to neighbour attributes enum for
    bridge/master ifindex. And adds NDA_MASTER to bridge fdb notify msgs.

    Today bridge fdb notifications dont contain bridge information.
    Userspace can derive it from the port information in the fdb
    notification. However this is tricky in some scenarious.

    Example, bridge port delete notification comes before bridge fdb
    delete notifications. And we have seen problems in userspace
    when using libnl where, the bridge fdb delete notification handling code
    does not understand which bridge this fdb entry is part of because
    the bridge and port association has already been deleted.
    And these notifications (port membership and fdb) are generated on
    separate rtnl groups.

    Fixing the order of notifications could possibly solve the problem
    for some cases (I can submit a separate patch for that).

    This patch chooses to add NDA_MASTER to bridge fdb notify msgs
    because it not only solves the problem described above, but also helps
    userspace avoid another lookup into link msgs to derive the master index.

    Signed-off-by: Roopa Prabhu
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Roopa Prabhu
     

02 Jun, 2014

1 commit

  • There has been a number incidents recently where customers running KVM have
    reported that VM hosts on different Hypervisors are unreachable. Based on
    pcap traces we found that the bridge was broadcasting the ARP request out
    onto the network. However some NICs have an inbuilt switch which on occasions
    were broadcasting the VMs ARP request back through the physical NIC on the
    Hypervisor. This resulted in the bridge changing ports and incorrectly learning
    that the VMs mac address was external. As a result the ARP reply was directed
    back onto the external network and VM never updated it's ARP cache. This patch
    will notify the bridge command, after a fdb has been updated to identify such
    port toggling.

    Signed-off-by: Jon Maxwell
    Reviewed-by: Jiri Pirko
    Acked-by: Toshiaki Makita
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Jon Maxwell
     

17 May, 2014

2 commits

  • When a static fdb entry is created, add the mac address
    from this fdb entry to any ports that are currently running
    in non-promiscuous mode. These ports need this data so that
    they can receive traffic destined to these addresses.
    By default ports start in promiscuous mode, so this feature
    is disabled.

    Acked-by: Michael S. Tsirkin
    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • Add code that allows static fdb entires to be synced to the
    hw list for a specified port. This will be used later to
    program ports that can function in non-promiscuous mode.

    Acked-by: Michael S. Tsirkin
    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

11 Feb, 2014

7 commits

  • br_fdb_change_mac_address() calls fdb_insert()/fdb_delete() without
    br->hash_lock.

    These hash list updates are racy with br_fdb_update()/br_fdb_cleanup().

    Signed-off-by: Toshiaki Makita
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Toshiaki Makita
     
  • Vlan codes unconditionally delete local fdb entries.
    We should consider the possibility that other ports have the same
    address and vlan.

    Example of problematic case:
    ip link set eth0 address 12:34:56:78:90:ab
    ip link set eth1 address aa:bb:cc:dd:ee:ff
    brctl addif br0 eth0
    brctl addif br0 eth1 # br0 will have mac address 12:34:56:78:90:ab
    bridge vlan add dev eth0 vid 10
    bridge vlan add dev eth1 vid 10
    bridge vlan add dev br0 vid 10 self
    We will have fdb entry such that f->dst == eth0, f->vlan_id == 10 and
    f->addr == 12:34:56:78:90:ab at this time.
    Next, delete eth0 vlan 10.
    bridge vlan del dev eth0 vid 10
    In this case, we still need the entry for br0, but it will be deleted.

    Note that br0 needs the entry even though its mac address is not set
    manually. To delete the entry with proper condition checking,
    fdb_delete_local() is suitable to use.

    Signed-off-by: Toshiaki Makita
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Toshiaki Makita
     
  • br_fdb_delete_by_port() doesn't care about vlan and mac address of the
    bridge device.

    As the check is almost the same as mac address changing, slightly modify
    fdb_delete_local() and use it.

    Note that we can always set added_by_user to 0 in fdb_delete_local() because
    - br_fdb_delete_by_port() calls fdb_delete_local() for local entries
    regardless of its added_by_user. In this case, we have to check if another
    port has the same address and vlan, and if found, we have to create the
    entry (by changing dst). This is kernel-added entry, not user-added.
    - br_fdb_changeaddr() doesn't call fdb_delete_local() for user-added entry.

    Signed-off-by: Toshiaki Makita
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Toshiaki Makita
     
  • br_fdb_change_mac_address() doesn't check if the local entry has the
    same address as any of bridge ports.
    Although I'm not sure when it is beneficial, current implementation allow
    the bridge device to receive any mac address of its ports.
    To preserve this behavior, we have to check if the mac address of the
    entry being deleted is identical to that of any port.

    As this check is almost the same as that in br_fdb_changeaddr(), create
    a common function fdb_delete_local() and call it from
    br_fdb_changeadddr() and br_fdb_change_mac_address().

    Signed-off-by: Toshiaki Makita
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Toshiaki Makita
     
  • We should take into account the followings when deleting a local fdb
    entry.

    - nbp_vlan_find() can be used only when vid != 0 to check if an entry is
    deletable, because a fdb entry with vid 0 can exist at any time while
    nbp_vlan_find() always return false with vid 0.

    Example of problematic case:
    ip link set eth0 address 12:34:56:78:90:ab
    ip link set eth1 address 12:34:56:78:90:ab
    brctl addif br0 eth0
    brctl addif br0 eth1
    ip link set eth0 address aa:bb:cc:dd:ee:ff
    Then, the fdb entry 12:34:56:78:90:ab will be deleted even though the
    bridge port eth1 still has that address.

    - The port to which the bridge device is attached might needs a local entry
    if its mac address is set manually.

    Example of problematic case:
    ip link set eth0 address 12:34:56:78:90:ab
    brctl addif br0 eth0
    ip link set br0 address 12:34:56:78:90:ab
    ip link set eth0 address aa:bb:cc:dd:ee:ff
    Then, the fdb still must have the entry 12:34:56:78:90:ab, but it will be
    deleted.

    We can use br->dev->addr_assign_type to check if the address is manually
    set or not, but I propose another approach.

    Since we delete and insert local entries whenever changing mac address
    of the bridge device, we can change dst of the entry to NULL regardless of
    addr_assign_type when deleting an entry associated with a certain port,
    and if it is found to be unnecessary later, then delete it.
    That is, if changing mac address of a port, the entry might be changed
    to its dst being NULL first, but is eventually deleted when recalculating
    and changing bridge id.

    This approach is especially useful when we want to share the code with
    deleting vlan in which the bridge device might want such an entry regardless
    of addr_assign_type, and makes things easy because we don't have to consider
    if mac address of the bridge device will be changed or not at the time we
    delete a local entry of a port, which means fdb code will not be bothered
    even if the bridge id calculating logic is changed in the future.

    Also, this change reduces inconsistent state, where frames whose dst is the
    mac address of the bridge, can't reach the bridge because of premature fdb
    entry deletion. This change reduces the possibility that the bridge device
    replies unreachable mac address to arp requests, which could occur during
    the short window between calling del_nbp() and br_stp_recalculate_bridge_id()
    in br_del_if(). This will effective after br_fdb_delete_by_port() starts to
    use the same code by following patch.

    Signed-off-by: Toshiaki Makita
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Toshiaki Makita
     
  • Since commit bc9a25d21ef8 ("bridge: Add vlan support for local fdb entries"),
    br_fdb_changeaddr() has inserted a new local fdb entry only if it can
    find old one. But if we have two ports where they have the same address
    or user has deleted a local entry, there will be no entry for one of the
    ports.

    Example of problematic case:
    ip link set eth0 address aa:bb:cc:dd:ee:ff
    ip link set eth1 address aa:bb:cc:dd:ee:ff
    brctl addif br0 eth0
    brctl addif br0 eth1 # eth1 will not have a local entry due to dup.
    ip link set eth1 address 12:34:56:78:90:ab
    Then, the new entry for the address 12:34:56:78:90:ab will not be
    created, and the bridge device will not be able to communicate.

    Insert new entries regardless of whether we can find old entries or not.

    Signed-off-by: Toshiaki Makita
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Toshiaki Makita
     
  • br_fdb_changeaddr() assumes that there is at most one local entry per port
    per vlan. It used to be true, but since commit 36fd2b63e3b4 ("bridge: allow
    creating/deleting fdb entries via netlink"), it has not been so.
    Therefore, the function might fail to search a correct previous address
    to be deleted and delete an arbitrary local entry if user has added local
    entries manually.

    Example of problematic case:
    ip link set eth0 address ee:ff:12:34:56:78
    brctl addif br0 eth0
    bridge fdb add 12:34:56:78:90:ab dev eth0 master
    ip link set eth0 address aa:bb:cc:dd:ee:ff
    Then, the address 12:34:56:78:90:ab might be deleted instead of
    ee:ff:12:34:56:78, the original mac address of eth0.

    Address this issue by introducing a new flag, added_by_user, to struct
    net_bridge_fdb_entry.

    Note that br_fdb_delete_by_port() has to set added_by_user to 0 in cases
    like:
    ip link set eth0 address 12:34:56:78:90:ab
    ip link set eth1 address aa:bb:cc:dd:ee:ff
    brctl addif br0 eth0
    bridge fdb add aa:bb:cc:dd:ee:ff dev eth0 master
    brctl addif br0 eth1
    brctl delif br0 eth0
    In this case, kernel should delete the user-added entry aa:bb:cc:dd:ee:ff,
    but it also should have been added by "brctl addif br0 eth1" originally,
    so we don't delete it and treat it a new kernel-created entry.

    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller

    Toshiaki Makita
     

20 Dec, 2013

1 commit


19 Oct, 2013

1 commit

  • IEEE 802.1Q says that:
    - VID 0 shall not be configured as a PVID, or configured in any Filtering
    Database entry.
    - VID 4095 shall not be configured as a PVID, or transmitted in a tag
    header. This VID value may be used to indicate a wildcard match for the VID
    in management operations or Filtering Database entries.
    (See IEEE 802.1Q-2011 6.9.1 and Table 9-2)

    Don't accept adding these VIDs in the vlan_filtering implementation.

    Signed-off-by: Toshiaki Makita
    Reviewed-by: Vlad Yasevich
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Toshiaki Makita
     

21 Aug, 2013

1 commit

  • The VLAN code needs to know the length of the per-port VLAN bitmap to
    perform its most basic operations (retrieving VLAN informations, removing
    VLANs, forwarding database manipulation, etc). Unfortunately, in the
    current implementation we are using a macro that indicates the bitmap
    size in longs in places where the size in bits is expected, which in
    some cases can cause what appear to be random failures.
    Use the correct macro.

    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller

    Toshiaki Makita
     

26 Jun, 2013

1 commit


29 Apr, 2013

1 commit

  • Current bridge fdb update code does not seem to update the port
    during fdb update. This patch adds a check for fdb dst (port)
    change during fdb update. Also rearranges the call to
    fdb_notify to send only one notification for create and update.

    Changelog:
    v2 - Change notify flag to bool

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

    roopa
     

28 Mar, 2013

1 commit


25 Mar, 2013

1 commit

  • When I tried to set mac address of a bridge interface to a mac
    address which already learned on this bridge, I got system hang.

    The cause is straight forward: function br_fdb_change_mac_address
    calls fdb_insert with NULL source nbp. Then an fdb lookup is
    performed. If an fdb entry is found and it's local, it's OK. But
    if it's not local, source is dereferenced for printk without NULL
    check.

    Signed-off-by: Hong Zhiguo
    Signed-off-by: David S. Miller

    Hong zhi guo
     

12 Mar, 2013

2 commits


28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

14 Feb, 2013

3 commits

  • When VLAN is added to the port, a local fdb entry for that port
    (the entry with the mac address of the port) is added for that
    VLAN. This way we can correctly determine if the traffic
    is for the bridge itself. If the address of the port changes,
    we try to change all the local fdb entries we have for that port.

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

    Vlad Yasevich
     
  • When a user adds bridge neighbors, allow him to specify VLAN id.
    If the VLAN id is not specified, the neighbor will be added
    for VLANs currently in the ports filter list. If no VLANs are
    configured on the port, we use vlan 0 and only add 1 entry.

    Signed-off-by: Vlad Yasevich
    Acked-by: Jitendra Kalsaria
    Signed-off-by: David S. Miller

    Vlad Yasevich
     
  • This patch adds vlan to unicast fdb entries that are created for
    learned addresses (not the manually configured ones). It adds
    vlan id into the hash mix and uses vlan as an addditional parameter
    for an entry match.

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

    Vlad Yasevich
     

02 Oct, 2012

1 commit


20 Sep, 2012

1 commit


11 Sep, 2012

1 commit

  • It is a frequent mistake to confuse the netlink port identifier with a
    process identifier. Try to reduce this confusion by renaming fields
    that hold port identifiers portid instead of pid.

    I have carefully avoided changing the structures exported to
    userspace to avoid changing the userspace API.

    I have successfully built an allyesconfig kernel with this change.

    Signed-off-by: "Eric W. Biederman"
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

10 Aug, 2012

1 commit

  • Various /proc/net files sometimes report crazy timer values, expressed
    in clock_t units.

    This happens when an expired timer delta (expires - jiffies) is passed
    to jiffies_to_clock_t().

    This function has an overflow in :

    return div_u64((u64)x * TICK_NSEC, NSEC_PER_SEC / USER_HZ);

    commit cbbc719fccdb8cb (time: Change jiffies_to_clock_t() argument type
    to unsigned long) only got around the problem.

    As we cant output negative values in /proc/net/tcp without breaking
    various tools, I suggest adding a jiffies_delta_to_clock_t() wrapper
    that caps the negative delta to a 0 value.

    Signed-off-by: Eric Dumazet
    Reported-by: Maciej Żenczykowski
    Cc: Thomas Gleixner
    Cc: Paul Gortmaker
    Cc: Andrew Morton
    Cc: hank
    Signed-off-by: David S. Miller

    Eric Dumazet
     

10 May, 2012

1 commit

  • 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: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

16 Apr, 2012

1 commit

  • This adds two new flags NTF_MASTER and NTF_SELF that can
    now be used to specify where PF_BRIDGE netlink commands should
    be sent. NTF_MASTER sends the commands to the 'dev->master'
    device for parsing. Typically this will be the linux net/bridge,
    or open-vswitch devices. Also without any flags set the command
    will be handled by the master device as well so that current user
    space tools continue to work as expected.

    The NTF_SELF flag will push the PF_BRIDGE commands to the
    device. In the basic example below the commands are then parsed
    and programmed in the embedded bridge.

    Note if both NTF_SELF and NTF_MASTER bits are set then the
    command will be sent to both 'dev->master' and 'dev' this allows
    user space to easily keep the embedded bridge and software bridge
    in sync.

    There is a slight complication in the case with both flags set
    when an error occurs. To resolve this the rtnl handler clears
    the NTF_ flag in the netlink ack to indicate which sets completed
    successfully. The add/del handlers will abort as soon as any
    error occurs.

    To support this new net device ops were added to call into
    the device and the existing bridging code was refactored
    to use these. There should be no required changes in user space
    to support the current bridge behavior.

    A basic setup with a SR-IOV enabled NIC looks like this,

    veth0 veth2
    | |
    ------------
    | bridge0 |
    Signed-off-by: David S. Miller

    John Fastabend
     

02 Apr, 2012

1 commit