示例#1
0
文件: ethernet.c 项目: nirmoy/wicked
/*
 * Get ethernet specific settings from the kernel
 */
void
__ni_system_ethernet_refresh(ni_netdev_t *dev)
{
	ni_ethernet_t *ethernet;
	ni_ethtool_t *ethtool;

	if (!ni_netdev_device_is_ready(dev) || !dev->link.ifindex)
		return;

	/* A permanent address is not strictly ethernet specific,
	 * we just don't query it along with ethtool options as
	 * most (virtual) devices provide all-zeroes hw-address.
	 *
	 * As infiniband does not permit to change hw-address,
	 * it never differs from the normal dev->link.hwaddr.
	 */
	ethernet = ni_ethernet_new();
	ethernet->permanent_address.type = dev->link.hwaddr.type;
	if ((ethtool = ni_netdev_get_ethtool(dev))) {
		ni_netdev_ref_t ref;

		ref.name = dev->name;
		ref.index = dev->link.ifindex;
		ni_ethtool_get_permanent_address(&ref, ethtool,
				&ethernet->permanent_address);
	}
	ni_netdev_set_ethernet(dev, ethernet);
}
示例#2
0
文件: ethtool.c 项目: openSUSE/wicked
/*
 * retrieve an ethtool handle from dbus netif object
 */
static ni_ethtool_t *
ni_objectmodel_ethtool_handle(const ni_dbus_object_t *object,
		ni_bool_t write_access, DBusError *error)
{
	ni_netdev_t *dev;

	if (!(dev = ni_objectmodel_unwrap_netif(object, error)))
		return NULL;

	if (!write_access)
		return dev->ethtool;

	return ni_netdev_get_ethtool(dev);
}
示例#3
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;
}