Skip to contentSkip to conversation

macvlan: add support for ethtool get settings

PATCH Applied Stephen Hemminger 3 participants 8 messages Oct 29, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 macvlan: add support for ethtool get settings

If macvlan's are used, it is useful to propgate speed and other settings from underlying device up for application usage.

drivers/net/macvlan.c +24 -0
@@ -333,10 +333,34 @@ static u32 macvlan_ethtool_get_rx_csum(s
 	return lowerdev->ethtool_ops->get_rx_csum(lowerdev);
 }
 
+static int macvlan_ethtool_get_settings(struct net_device *dev,
+					struct ethtool_cmd *cmd)
+{
+	const struct macvlan_dev *vlan = netdev_priv(dev);
+	struct net_device *lowerdev = vlan->lowerdev;
+
+	if (!lowerdev->ethtool_ops->get_settings)
+		return -EOPNOTSUPP;
+
+	return lowerdev->ethtool_ops->get_settings(lowerdev, cmd);
+}
+
+static u32 macvlan_ethtool_get_flags(struct net_device *dev)
+{
+	const struct macvlan_dev *vlan = netdev_priv(dev);
+	struct net_device *lowerdev = vlan->lowerdev;
+
+	if (!lowerdev->ethtool_ops->get_flags)
+		return 0;
+	return lowerdev->ethtool_ops->get_flags(lowerdev);
+}
+
 static const struct ethtool_ops macvlan_ethtool_ops = {
 	.get_link		= ethtool_op_get_link,
+	.get_settings		= macvlan_ethtool_get_settings,
 	.get_rx_csum		= macvlan_ethtool_get_rx_csum,
 	.get_drvinfo		= macvlan_ethtool_get_drvinfo,
+	.get_flags		= macvlan_ethtool_get_flags,
 };
 
 static void macvlan_setup(struct net_device *dev)
#1 lore raw

PATCH 2/2 macvlan: propogate mtu changes

If MTU of underlying real device is changed, propogate up to macvlan pseudo devices.

drivers/net/macvlan.c +13 -0
@@ -537,6 +537,19 @@ static int macvlan_device_event(struct n
 		list_for_each_entry_safe(vlan, next, &port->vlans, list)
 			macvlan_dellink(vlan->dev);
 		break;
+	case NETDEV_CHANGEMTU:
+		list_for_each_entry(vlan, &port->vlans, list) {
+			int err, oldmtu = vlan->dev->mtu;
+
+			err = dev_set_mtu(vlan->dev, dev->mtu);
+			if (err) {
+				list_for_each_entry_continue_reverse(vlan,
+								     &port->vlans,
+								     list)
+					dev_set_mtu(vlan->dev, oldmtu);
+				return notifier_from_errno(err);
+			}
+		}
 	}
 	return NOTIFY_DONE;
 }
#2 lore raw

Re: [PATCH 2/2] macvlan: propogate mtu changes

Quoted 2 lines · Stephen Hemminger

If MTU of underlying real device is changed, propogate up to macvlan pseudo devices.

I'm going to do a similar patch for macvlan as I did for VLAN for the MTU settings (desired MTU/operational MTU).

#3 lore raw

Re: [PATCH 2/2] macvlan: propogate mtu changes

Quoted 8 lines · Patrick McHardy
Quoted 3 lines · Stephen Hemminger

If MTU of underlying real device is changed, propogate up to macvlan pseudo devices.

I'm going to do a similar patch for macvlan as I did for VLAN for the MTU settings (desired MTU/operational MTU).

... and add the rollback part from your patch to VLAN as well.

maintainer
#4 lore raw

Re: [PATCH 2/2] macvlan: propogate mtu changes

From: Patrick McHardy <[email protected]>
Date: Wed, 29 Oct 2008 22:05:02 +0100

Quoted 11 lines
Quoted 8 lines · Patrick McHardy
Quoted 3 lines · Stephen Hemminger

If MTU of underlying real device is changed, propogate up to macvlan pseudo devices.

I'm going to do a similar patch for macvlan as I did for VLAN for the MTU settings (desired MTU/operational MTU).

... and add the rollback part from your patch to VLAN as well.

So you want me to drop this second patch from Stephen from now?

#5 lore raw

Re: [PATCH 2/2] macvlan: propogate mtu changes

Quoted 13 lines · David Miller

From: Patrick McHardy <[email protected]>
Date: Wed, 29 Oct 2008 22:05:02 +0100

Quoted 9 lines
Quoted 7 lines · Patrick McHardy
Quoted 4 lines · Stephen Hemminger

If MTU of underlying real device is changed, propogate up to macvlan pseudo devices.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I'm going to do a similar patch for macvlan as I did for VLAN for the MTU settings (desired MTU/operational MTU).

... and add the rollback part from your patch to VLAN as well.

So you want me to drop this second patch from Stephen from now?

Yes please, I'll send patches for both VLAN and macvlan MTU settings later.

maintainer Applied
#7 lore raw

From: Patrick McHardy <[email protected]>
Date: Wed, 29 Oct 2008 22:01:28 +0100

Quoted 6 lines
Quoted 3 lines · Stephen Hemminger

If macvlan's are used, it is useful to propgate speed and other settings from underlying device up for application usage.

Applied, thanks everyone.