macvlan: add support for ethtool get settings
Subsystems (2)
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(sreturn 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)
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 nlist_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 ; }
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).
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.
David Miller
maintainerRe: [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?
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 +0100Quoted 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.
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.
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.
Acked-by Patrick McHardy <[email protected]>
Applied, thanks everyone.