mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
netdev-linux: indicate if netdev is a LAG master
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>
This commit is contained in:
committed by
Simon Horman
parent
135ee7ef36
commit
3d9c99ab8a
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user