Skip to contentSkip to conversation

virtio_net: add more ethtool information

PATCH In review Stephen Hemminger 2 participants 3 messages Dec 3, 2009 – Dec 4, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 virtio_net: add more ethtool information

It is useful for some tools (as well as bonding, and bridging) for virtio network interface provide more ethtool information.

drivers/net/virtio_net.c +29 -0
@@ -763,7 +763,36 @@ static void virtnet_vlan_rx_kill_vid(str
 		dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
 }
 
+static void virtnet_get_drvinfo(struct net_device *dev,
+				struct ethtool_drvinfo *info)
+{
+	struct virtnet_info *vi = netdev_priv(dev);
+
+	strcpy(info->driver, "virtnet");
+	strcpy(info->version, "0.1");
+	strcpy(info->fw_version, "N/A");
+	strcpy(info->bus_info, dev_driver_string(&vi->vdev->dev));
+}
+
+static int virtnet_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	cmd->supported = SUPPORTED_1000baseT_Full |
+		SUPPORTED_Autoneg | SUPPORTED_FIBRE;
+	cmd->advertising = ADVERTISED_1000baseT_Full |
+		ADVERTISED_Autoneg | ADVERTISED_FIBRE;
+	cmd->speed = SPEED_1000;
+	cmd->duplex = DUPLEX_FULL;
+	cmd->port = PORT_FIBRE;
+	cmd->phy_address = 0;
+	cmd->transceiver = XCVR_INTERNAL;
+	cmd->autoneg = AUTONEG_ENABLE;
+
+	return 0;
+}
+
 static const struct ethtool_ops virtnet_ethtool_ops = {
+	.get_settings = virtnet_get_settings,
+	.get_drvinfo = virtnet_get_drvinfo,
 	.set_tx_csum = virtnet_set_tx_csum,
 	.set_sg = ethtool_op_set_sg,
 	.set_tso = ethtool_op_set_tso,
#2 lore raw
Quoted 2 lines · Stephen Hemminger

It is useful for some tools (as well as bonding, and bridging) for virtio network interface provide more ethtool information.

Hi Stephen,

Can't see any harm. Some minor questions below:

Quoted 8 lines
drivers/net/virtio_net.c +0 -0
@@ -763,7 +763,36 @@ static void virtnet_vlan_rx_kill_vid(str
 		dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
 }

drivers/net/virtio_net.c static void virtnet_vlan_rx_kill_vid(str · line 774

Quoted 10 lines
drivers/net/virtio_net.c +9 -0
 
+static void virtnet_get_drvinfo(struct net_device *dev,
+				struct ethtool_drvinfo *info)
+{
+	struct virtnet_info *vi = netdev_priv(dev);
+
+	strcpy(info->driver, "virtnet");
+	strcpy(info->version, "0.1");
+	strcpy(info->fw_version, "N/A");
+	strcpy(info->bus_info, dev_driver_string(&vi->vdev->dev));

0.1 as a version is weird. If we need a number, "0" seems best.

drivers/net/virtio_net.c static void virtnet_vlan_rx_kill_vid(str · line 783

Quoted 1 line
drivers/net/virtio_net.c +1 -0
+	cmd->speed = SPEED_1000;

Why 1000? Because it's commong? How about a SPEED_UNLIMITED?

Thanks,
Rusty.

#3 lore raw
Quoted 29 lines · On Fri, 4 Dec 2009 10:32:23 +1030 Rusty Russell <[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger

It is useful for some tools (as well as bonding, and bridging) for virtio network interface provide more ethtool information.

Hi Stephen,

Can't see any harm. Some minor questions below:

Quoted 8 lines
drivers/net/virtio_net.c +0 -0
@@ -763,7 +763,36 @@ static void virtnet_vlan_rx_kill_vid(str
 		dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
 }

drivers/net/virtio_net.c static void virtnet_vlan_rx_kill_vid(str · line 774

Quoted 10 lines
drivers/net/virtio_net.c +9 -0
 
+static void virtnet_get_drvinfo(struct net_device *dev,
+				struct ethtool_drvinfo *info)
+{
+	struct virtnet_info *vi = netdev_priv(dev);
+
+	strcpy(info->driver, "virtnet");
+	strcpy(info->version, "0.1");
+	strcpy(info->fw_version, "N/A");
+	strcpy(info->bus_info, dev_driver_string(&vi->vdev->dev));

0.1 as a version is weird. If we need a number, "0" seems best.

Quoted 4 lines

drivers/net/virtio_net.c static void virtnet_vlan_rx_kill_vid(str · line 783

Quoted 1 line
drivers/net/virtio_net.c +1 -0
+	cmd->speed = SPEED_1000;

Why 1000? Because it's commong? How about a SPEED_UNLIMITED?

Well until the performance is improved, that is about what I see!