Esempio n. 1
0
/*
 * driver-info
 */
static int
get_ethtool_driver_info(const ni_netdev_ref_t *ref, ni_ethtool_t *ethtool, struct ethtool_args *args)
{
	const ni_ethtool_driver_info_t *info;
	unsigned int n;

	(void)args;
	if (ni_ethtool_get_driver_info(ref, ethtool) < 0 || !(info = ethtool->driver_info))
		return -1;

	printf("driver-info:\n");
	if (!ni_string_empty(info->driver))
		printf("\tdriver: %s\n", info->driver);
	if (!ni_string_empty(info->version))
		printf("\tversion: %s\n", info->version);
	if (!ni_string_empty(info->bus_info))
		printf("\tbus-info: %s\n", info->bus_info);
	if (!ni_string_empty(info->fw_version))
		printf("\tfirmware-version: %s\n", info->fw_version);
	if (!ni_string_empty(info->erom_version))
		printf("\texpansion-rom-version: %s\n", info->erom_version);
	printf("\tsupports:\n");
	for (n = 0; n <= NI_ETHTOOL_DRIVER_SUPP_REGDUMP; ++n) {
		printf("\t\t%s: %s\n",
				ni_ethtool_driver_supports_map_bit(n),
				info->supports.bitmap & NI_BIT(n) ? "yes" : "no");
	}

	return 0;
}
Esempio n. 2
0
/*
 * main system refresh and setup functions
 */
static ni_bool_t
ni_ethtool_refresh(ni_netdev_t *dev)
{
	ni_ethtool_t *ethtool;

	if (!dev || !(ethtool = ni_netdev_get_ethtool(dev)))
		return FALSE;

	if (!ethtool->driver_info)
		ni_ethtool_get_driver_info(dev->name, ethtool);
	ni_ethtool_get_priv_flags(dev->name, ethtool);

	return TRUE;
}