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.hur...@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vanderme...@netronome.com> Reviewed-by: Simon Horman <simon.hor...@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> --- lib/netdev-linux.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 8feab98..6ed2f05 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -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); } -- 2.7.4 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev