2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

bridge: Store status of physical network interfaces in Interface table.

New columns in Interface table: admin_state, link_state, link_speed, duplex,
mtu.

New keys in status map in Interface table: driver_name, driver_version,
firmware_version.

Requested-by: Peter Balland <pballand@nicira.com>
Bug #4299.
This commit is contained in:
Andrew Evans
2011-01-17 15:37:13 -08:00
parent b42c5c2404
commit e210037edd
4 changed files with 149 additions and 6 deletions

View File

@@ -2025,6 +2025,26 @@ netdev_linux_get_next_hop(const struct in_addr *host, struct in_addr *next_hop,
return ENXIO;
}
static int
netdev_linux_get_status(const struct netdev *netdev, struct shash *sh)
{
struct ethtool_drvinfo drvinfo;
int error;
memset(&drvinfo, 0, sizeof drvinfo);
error = netdev_linux_do_ethtool(netdev_get_name(netdev),
(struct ethtool_cmd *)&drvinfo,
ETHTOOL_GDRVINFO,
"ETHTOOL_GDRVINFO");
if (!error) {
shash_add(sh, "driver_name", xstrdup(drvinfo.driver));
shash_add(sh, "driver_version", xstrdup(drvinfo.version));
shash_add(sh, "firmware_version", xstrdup(drvinfo.fw_version));
}
return error;
}
/* Looks up the ARP table entry for 'ip' on 'netdev'. If one exists and can be
* successfully retrieved, it stores the corresponding MAC address in 'mac' and
* returns 0. Otherwise, it returns a positive errno value; in particular,
@@ -2238,7 +2258,7 @@ netdev_linux_poll_remove(struct netdev_notifier *notifier_)
netdev_linux_get_in6, \
netdev_linux_add_router, \
netdev_linux_get_next_hop, \
NULL, /* get_status */ \
netdev_linux_get_status, \
netdev_linux_arp_lookup, \
\
netdev_linux_update_flags, \