Skip to content

Commit

Permalink
netdev-linux: indicate if netdev is a LAG master
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Dirk van der Merwe <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
jahurley authored and shorman-netronome committed Jun 29, 2018
1 parent 135ee7e commit 3d9c99a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/netdev-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 3d9c99a

Please sign in to comment.