]> git.proxmox.com Git - ovs.git/commitdiff
netdev-linux: indicate if netdev is a LAG master
authorJohn Hurley <john.hurley@netronome.com>
Thu, 28 Jun 2018 16:03:05 +0000 (17:03 +0100)
committerSimon Horman <simon.horman@netronome.com>
Fri, 29 Jun 2018 12:57:40 +0000 (14:57 +0200)
If a linux netdev is added to OvS that is a LAG master (for example, a
bond or team netdev) then record this in bool form in the dev struct. Use
the link info extracted from rtnetlink calls to determine this.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
lib/netdev-linux.c

index 8feab9882b5a01304010c2044f491eb9ad12654a..6ed2f05640597a9775130eafebc19ad36e96672e 100644 (file)
@@ -509,6 +509,9 @@ struct netdev_linux {
     int tap_fd;
     bool present;               /* If the device is present in the namespace */
     uint64_t tx_dropped;        /* tap device can drop if the iface is down */
+
+    /* LAG information. */
+    bool is_lag_master;         /* True if the netdev is a LAG master. */
 };
 
 struct netdev_rxq_linux {
@@ -678,6 +681,16 @@ netdev_linux_miimon_enabled(void)
     return atomic_count_get(&miimon_cnt) > 0;
 }
 
+static bool
+netdev_linux_kind_is_lag(const char *kind)
+{
+    if (!strcmp(kind, "bond") || !strcmp(kind, "team")) {
+        return true;
+    }
+
+    return false;
+}
+
 static void
 netdev_linux_run(const struct netdev_class *netdev_class OVS_UNUSED)
 {
@@ -812,6 +825,10 @@ netdev_linux_update__(struct netdev_linux *dev,
                 rtnetlink_report_link();
             }
 
+            if (change->master && netdev_linux_kind_is_lag(change->master)) {
+                dev->is_lag_master = true;
+            }
+
             dev->ifindex = change->if_index;
             dev->cache_valid |= VALID_IFINDEX;
             dev->get_ifindex_error = 0;
@@ -5764,6 +5781,9 @@ netdev_linux_update_via_netlink(struct netdev_linux *netdev)
             netdev->get_ifindex_error = 0;
             changed = true;
         }
+        if (change->master && netdev_linux_kind_is_lag(change->master)) {
+            netdev->is_lag_master = true;
+        }
         if (changed) {
             netdev_change_seq_changed(&netdev->up);
         }