Skip to contentSkip to conversation

netfront: support ethtool's get_link()

PATCH In review Mark McLoughlin 1 participant 2 messages Jul 14, 2006 – Jul 17, 2006 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfront: support ethtool's get_link()

Hi,
Attached is a very simple patch to support ethtool's get_link()
operation. This allows things like NetworkManager's and anaconda's carrier detection code to work with netfront.

It seems sane to take the simple approach of reporting the link as
active as soon as we've connected to the backend device. It's irrelevant whether the physical device in dom0 has link, since there could well be someone else on the bridge responding.

I haven't looked at any of the other ethtool operations.

Cheers,
Mark.

drivers/xen/netfront/netfront.c renamed from drivers/xen/netfront/netfront.c.ethtool +6 -0
@@ -179,6 +179,10 @@
 	return dev->features & NETIF_F_SG;
 }
 
+static struct ethtool_ops netfront_ethtool_ops = {
+	.get_link = ethtool_op_get_link,
+};
+
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
  * structures and the ring buffers for communication with the backend, and
@@ -211,6 +215,8 @@
 	info = netdev_priv(netdev);
 	dev->data = info;
 
+	SET_ETHTOOL_OPS(netdev, &netfront_ethtool_ops);
+
 	err = talk_to_backend(dev, info);
 	if (err) {
 		xennet_sysfs_delif(info->netdev);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Hi,
I hadn't spotted that netfront already supports some ethtool ops. That
was just dumb; apologies.

More correct patch attached.

Thanks,
Mark.

Quoted 9 lines · Mark McLoughlin

Hi,
Attached is a very simple patch to support ethtool's get_link()
operation. This allows things like NetworkManager's and anaconda's carrier detection code to work with netfront.

It seems sane to take the simple approach of reporting the link as
active as soon as we've connected to the backend device. It's irrelevant whether the physical device in dom0 has link, since there could well be someone else on the bridge responding.

drivers/xen/netfront/netfront.c renamed from drivers/xen/netfront/netfront.c.ethtool +1 -0
@@ -1215,6 +1215,7 @@
 	.set_tx_csum = ethtool_op_set_tx_csum,
 	.get_sg = ethtool_op_get_sg,
 	.set_sg = xennet_set_sg,
+	.get_link = ethtool_op_get_link,
 };
 
 #ifdef CONFIG_SYSFS

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel