ethtool: Change ethtool_op_set_flags to validate flags
Subsystems (5)
PATCH 1/3 ethtool: Change ethtool_op_set_flags to validate flags
ethtool_op_set_flags() does not check for unsupported flags, and has no way of doing so. This means it is not suitable for use as a default implementation of ethtool_ops::set_flags.
Add a 'supported' parameter specifying the flags that the driver and hardware support, validate the requested flags against this, and change all current callers to pass this parameter.
Change some other trivial implementations of ethtool_ops::set_flags to call ethtool_op_set_flags().
--- drivers/net/cxgb4/cxgb4_main.c | 9 +-------- drivers/net/enic/enic_main.c | 1 - drivers/net/ixgbe/ixgbe_ethtool.c | 5 ++++- drivers/net/mv643xx_eth.c | 7 ++++++- drivers/net/myri10ge/myri10ge.c | 10 +++++++--- drivers/net/niu.c | 9 +-------- drivers/net/sfc/ethtool.c | 5 +---- drivers/net/sky2.c | 16 ++++++---------- include/linux/ethtool.h | 2 +- net/core/ethtool.c | 28 +++++----------------------- 10 files changed, 32 insertions(+), 60 deletions(-)
drivers/net/cxgb4/cxgb4_main.c +1 -8
@@ -1799,14 +1799,7 @@ static int set_tso(struct net_device *dev, u32 value)static int set_flags (struct net_device *dev,u32 flags) { -if (flags & ~ETH_FLAG_RXHASH ) -return -EOPNOTSUPP ; - -if (flags Ð_FLAG_RXHASH ) - dev->features |=NETIF_F_RXHASH ; -else - dev->features &= ~NETIF_F_RXHASH ; -return 0 ; +return ethtool_op_set_flags (dev, flags,ETH_FLAG_RXHASH ); }static struct ethtool_ops cxgb_ethtool_ops = {
drivers/net/enic/enic_main.c +0 -1
@@ -365,7 +365,6 @@ static const struct ethtool_ops enic_ethtool_ops = { .get_coalesce = enic_get_coalesce, .set_coalesce = enic_set_coalesce, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, };static void enic_free_wq_buf (struct vnic_wq *wq,struct vnic_wq_buf *buf)
drivers/net/ixgbe/ixgbe_ethtool.c +4 -1
@@ -2205,8 +2205,11 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data) {struct ixgbe_adapter *adapter =netdev_priv (netdev);bool need_reset = false; +int rc; -ethtool_op_set_flags (netdev, data); + rc =ethtool_op_set_flags (netdev, data,ETH_FLAG_LRO |ETH_FLAG_NTUPLE ); +if (rc) +return rc;/* if state changes we need to update adapter->flags and reset */ if (adapter->flags2 &IXGBE_FLAG2_RSC_CAPABLE ) {
drivers/net/mv643xx_eth.c +6 -1
@@ -1636,6 +1636,11 @@ static void mv643xx_eth_get_ethtool_stats(struct net_device *dev, } } +static int mv643xx_eth_set_flags (struct net_device *dev,u32 data) +{ +return ethtool_op_set_flags (dev, data,ETH_FLAG_LRO ); +} +static int mv643xx_eth_get_sset_count (struct net_device *dev,int sset) {if (sset ==ETH_SS_STATS )
@@ -1661,7 +1666,7 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = { .get_strings = mv643xx_eth_get_strings, .get_ethtool_stats = mv643xx_eth_get_ethtool_stats, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, + .set_flags = mv643xx_eth_set_flags, .get_sset_count = mv643xx_eth_get_sset_count, };
drivers/net/myri10ge/myri10ge.c +7 -3
@@ -1730,8 +1730,7 @@ static int myri10ge_set_rx_csum(struct net_device *netdev, u32 csum_enabled)if (csum_enabled) mgp->csum_flag =MXGEFW_FLAGS_CKSUM ;else { -u32 flags =ethtool_op_get_flags (netdev); - err =ethtool_op_set_flags (netdev, (flags & ~ETH_FLAG_LRO )); + netdev->features &= ~NETIF_F_LRO ; mgp->csum_flag =0 ; }
@@ -1900,6 +1899,11 @@ static u32 myri10ge_get_msglevel(struct net_device *netdev)return mgp->msg_enable; } +static int myri10ge_set_flags (struct net_device *netdev,u32 value) +{ +return ethtool_op_set_flags (netdev, value,ETH_FLAG_LRO ); +} +static const struct ethtool_ops myri10ge_ethtool_ops = { .get_settings = myri10ge_get_settings, .get_drvinfo = myri10ge_get_drvinfo,
@@ -1920,7 +1924,7 @@ static const struct ethtool_ops myri10ge_ethtool_ops = { .set_msglevel = myri10ge_set_msglevel, .get_msglevel = myri10ge_get_msglevel, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags + .set_flags = myri10ge_set_flags };static int myri10ge_allocate_rings (struct myri10ge_slice_state *ss)
drivers/net/niu.c +1 -8
@@ -7920,14 +7920,7 @@ static int niu_phys_id(struct net_device *dev, u32 data)static int niu_set_flags (struct net_device *dev,u32 data) { -if (data & (ETH_FLAG_LRO |ETH_FLAG_NTUPLE )) -return -EOPNOTSUPP ; - -if (data Ð_FLAG_RXHASH ) - dev->features |=NETIF_F_RXHASH ; -else - dev->features &= ~NETIF_F_RXHASH ; -return 0 ; +return ethtool_op_set_flags (dev, data,ETH_FLAG_RXHASH ); }static const struct ethtool_ops niu_ethtool_ops = {
drivers/net/sfc/ethtool.c +1 -4
@@ -551,10 +551,7 @@ static int efx_ethtool_set_flags(struct net_device *net_dev, u32 data)struct efx_nic *efx =netdev_priv (net_dev);u32 supported = efx->type->offload_features Ð_FLAG_RXHASH ; -if (data & ~supported) -return -EOPNOTSUPP ; - -return ethtool_op_set_flags (net_dev, data); +return ethtool_op_set_flags (net_dev, data, supported); } static void efx_ethtool_self_test(struct net_device *net_dev,
drivers/net/sky2.c +6 -10
@@ -4188,17 +4188,13 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eepromstatic int sky2_set_flags (struct net_device *dev,u32 data) {struct sky2_port *sky2 =netdev_priv (dev); +u32 supported = + (sky2->hw->flags &SKY2_HW_RSS_BROKEN ) ?0 :ETH_FLAG_RXHASH ; +int rc; -if (data & ~ETH_FLAG_RXHASH ) -return -EOPNOTSUPP ; - -if (data Ð_FLAG_RXHASH ) { -if (sky2->hw->flags &SKY2_HW_RSS_BROKEN ) -return -EINVAL ; - - dev->features |=NETIF_F_RXHASH ; - }else - dev->features &= ~NETIF_F_RXHASH ; + rc =ethtool_op_set_flags (dev, data, supported); +if (rc) +return rc;rx_set_rss (dev);
include/linux/ethtool.h +1 -1
@@ -457,7 +457,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);u32 ethtool_op_get_ufo (struct net_device *dev);int ethtool_op_set_ufo (struct net_device *dev,u32 data);u32 ethtool_op_get_flags (struct net_device *dev); -int ethtool_op_set_flags (struct net_device *dev,u32 data); +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported);void ethtool_ntuple_flush (struct net_device *dev);/**
net/core/ethtool.c +5 -23
@@ -144,31 +144,13 @@ u32 ethtool_op_get_flags(struct net_device *dev) }EXPORT_SYMBOL (ethtool_op_get_flags); -int ethtool_op_set_flags (struct net_device *dev,u32 data) +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported) { -const struct ethtool_ops *ops = dev->ethtool_ops; -unsigned long features = dev->features; - -if (data Ð_FLAG_LRO ) - features |=NETIF_F_LRO ; -else - features &= ~NETIF_F_LRO ; - -if (data Ð_FLAG_NTUPLE ) { -if (!ops->set_rx_ntuple) -return -EOPNOTSUPP ; - features |=NETIF_F_NTUPLE ; - }else { -/* safe to clear regardless */ - features &= ~NETIF_F_NTUPLE ; - } - -if (data Ð_FLAG_RXHASH ) - features |=NETIF_F_RXHASH ; -else - features &= ~NETIF_F_RXHASH ; +if (data & ~supported) +return -EINVAL ; - dev->features = features; + dev->features = ((dev->features & ~flags_dup_features) | + (data & flags_dup_features));return 0 ; }EXPORT_SYMBOL (ethtool_op_set_flags);
Signature · 7 lines
1.6.2.5 -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 2/3 netdev: Make ethtool_ops::set_flags() return -EINVAL for unsupported flags
The documented error code for attempts to set unsupported flags (or to clear flags that cannot be disabled) is EINVAL, not EOPNOTSUPP.
--- drivers/net/bnx2x_main.c | 2 +- drivers/net/netxen/netxen_nic_ethtool.c | 2 +- drivers/net/qlcnic/qlcnic_ethtool.c | 2 +- drivers/net/s2io.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnx2x_main.c +1 -1
@@ -10983,7 +10983,7 @@ static int bnx2x_set_flags(struct net_device *dev, u32 data)int rc =0 ;if (data & ~(ETH_FLAG_LRO |ETH_FLAG_RXHASH )) -return -EOPNOTSUPP ; +return -EINVAL ;if (bp->recovery_state !=BNX2X_RECOVERY_DONE ) {printk (KERN_ERR "Handling parity error recovery. Try again later\n" );
drivers/net/netxen/netxen_nic_ethtool.c +1 -1
@@ -888,7 +888,7 @@ static int netxen_nic_set_flags(struct net_device *netdev, u32 data)int hw_lro;if (data & ~ETH_FLAG_LRO ) -return -EOPNOTSUPP ; +return -EINVAL ;if (!(adapter->capabilities &NX_FW_CAPABILITY_HW_LRO ))return -EINVAL ;
drivers/net/qlcnic/qlcnic_ethtool.c +1 -1
@@ -984,7 +984,7 @@ static int qlcnic_set_flags(struct net_device *netdev, u32 data)int hw_lro;if (data & ~ETH_FLAG_LRO ) -return -EOPNOTSUPP ; +return -EINVAL ;if (!(adapter->capabilities &QLCNIC_FW_CAPABILITY_HW_LRO ))return -EINVAL ;
drivers/net/s2io.c +1 -1
@@ -6692,7 +6692,7 @@ static int s2io_ethtool_set_flags(struct net_device *dev, u32 data)int changed =0 ;if (data & ~ETH_FLAG_LRO ) -return -EOPNOTSUPP ; +return -EINVAL ;if (data Ð_FLAG_LRO ) {if (lro_enable) {
Signature · 7 lines
1.6.2.5 -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [PATCH net-next-2.6 2/3] netdev: Make ethtool_ops::set_flags() return -EINVAL for unsupported flags
Quoted 4 lines · Ben Hutchings
The documented error code for attempts to set unsupported flags (or to clear flags that cannot be disabled) is EINVAL, not EOPNOTSUPP.
Signed-off-by Ben Hutchings <[email protected]>
If that's what the document say...
Thanks Ben!
Re: [PATCH net-next-2.6 2/3] netdev: Make ethtool_ops::set_flags() return -EINVAL for unsupported flags
In reply to Ben HutchingsFrom: Ben Hutchings <[email protected]>
Date: Wed, 30 Jun 2010 13:46:56 +0100
Quoted 4 lines
The documented error code for attempts to set unsupported flags (or to clear flags that cannot be disabled) is EINVAL, not EOPNOTSUPP.
Signed-off-by Ben Hutchings <[email protected]>
Applied.
PATCH 3/3 vmxnet3: Remove incorrect implementation of ethtool_ops::get_flags()
In reply to Ben HutchingsOnly some netdev feature flags correspond directly to ethtool feature flags. ethtool_op_get_flags() does the right thing.
--- drivers/net/vmxnet3/vmxnet3_ethtool.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethtool.c +1 -7
@@ -275,12 +275,6 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) } } -static u32 -vmxnet3_get_flags (struct net_device *netdev) -{ -return netdev->features; -} -static int vmxnet3_set_flags (struct net_device *netdev,u32 data) {
@@ -559,7 +553,7 @@ static struct ethtool_ops vmxnet3_ethtool_ops = { .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .get_strings = vmxnet3_get_strings, - .get_flags = vmxnet3_get_flags, + .get_flags = ethtool_op_get_flags, .set_flags = vmxnet3_set_flags, .get_sset_count = vmxnet3_get_sset_count, .get_ethtool_stats = vmxnet3_get_ethtool_stats,
Signature · 6 lines
1.6.2.5 -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
RE: [Pv-drivers] [PATCH net-next-2.6 3/3] vmxnet3: Remove incorrect implementation of ethtool_ops::get_flags()
Thanks for fixing this, Ben! Had to look at ethtool-2.6.34 src to convince myself of the correctness. Looks good to me.
ps: I do wonder, however, why not always use ethtool_op_get_flags for all drivers, and mask whatever is returned by the driver specific dev->ethtool_ops->get_flags with flags_dup_features instead of this approach?
- Bhavesh
Bhavesh P. Davda
Quoted 57 lines
-----Original Message-----
From: [email protected] [mailto:pv-drivers- [email protected]] On Behalf Of Ben Hutchings
Sent: Wednesday, June 30, 2010 5:48 AM
To: David Miller
Cc: VMware, Inc.; [email protected]
Subject: [Pv-drivers] [PATCH net-next-2.6 3/3] vmxnet3: Remove incorrect implementation ofethtool_ops::get_flags()Only some netdev feature flags correspond directly to ethtool feature flags.
ethtool_op_get_flags()does the right thing.Signed-off-by Ben Hutchings <[email protected]>--- drivers/net/vmxnet3/vmxnet3_ethtool.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)drivers/net/vmxnet3/vmxnet3_ethtool.c +0
-6@@ -275,12 +275,6 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) } } -static u32 -vmxnet3_get_flags (struct net_device *netdev) -{ -return netdev->features; -} -static int vmxnet3_set_flags (struct net_device *netdev,u32 data){
drivers/net/vmxnet3/vmxnet3_ethtool.c +1
-2@@ -559,7 +553,7 @@ static struct ethtool_ops vmxnet3_ethtool_ops = { .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .get_strings = vmxnet3_get_strings, - .get_flags = vmxnet3_get_flags, + .get_flags = ethtool_op_get_flags, .set_flags = vmxnet3_set_flags, .get_sset_count = vmxnet3_get_sset_count, .get_ethtool_stats = vmxnet3_get_ethtool_stats, --1.6.2.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked._______________________________________________
Pv-drivers mailing list
[email protected]
http://mailman2.vmware.com/mailman/listinfo/pv-drivers
RE: [Pv-drivers] [PATCH net-next-2.6 3/3] vmxnet3: Remove incorrect implementation of ethtool_ops::get_flags()
Quoted 9 lines · Bhavesh Davda
Thanks for fixing this, Ben! Had to look at ethtool-2.6.34 src to convince myself of the correctness. Looks good to me.
Signed-off-by Bhavesh Davda <[email protected]>ps: I do wonder, however, why not always use
ethtool_op_get_flagsfor all drivers, and mask whatever is returned by the driver specificdev->ethtool_ops->get_flagswithflags_dup_featuresinstead of this approach?
I think you're right that ethtool_op_get_flags could be the implicit default (i.e. used if ethtool_ops::get_flags is NULL) and drivers should not have to set it. Following this change, no drivers in net-next-2.6 will be using any other implementation. However, I don't think ethtool_ops::get_flags should be removed - in future there are likely to be additional ethtool flags that do not correspond to net device feature flags, and some drivers will need a different implementation.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
RE: [Pv-drivers] [PATCH net-next-2.6 3/3] vmxnet3: Remove incorrect implementation of ethtool_ops::get_flags()
Quoted 25 lines
From: Ben Hutchings [mailto:[email protected]]
Sent: Wednesday, June 30, 2010 8:59 AMQuoted 9 lines · Bhavesh Davda
Thanks for fixing this, Ben! Had to look at ethtool-2.6.34 src to convince myself of the correctness. Looks good to me.
Signed-off-by Bhavesh Davda <[email protected]>ps: I do wonder, however, why not always use
ethtool_op_get_flagsfor all drivers, and mask whatever is returned by the driver specificdev->ethtool_ops->get_flagswithflags_dup_featuresinstead of this approach?I think you're right that
ethtool_op_get_flagscould be the implicit default (i.e. used ifethtool_ops::get_flagsis NULL) and drivers should
not have to set it. Following this change, no drivers in net-next-2.6 will be using any other implementation. However, I don't thinkethtool_ops::get_flagsshould be removed - in future there are likely to
be additional ethtool flags that do not correspond to net device feature
flags, and some drivers will need a different implementation.
Quoted 2 lines
Ben.
Hi Ben,
I'm not suggesting nuking ethtool_ops::get_flags. What I was suggesting is *always* calling ethtool_ops_get_flags from dev_ethtool for case ETHTOOL_GFLAGS, but doing something like this simple patch:
net/core/ethtool.c +4 -5
@@ -139,8 +139,9 @@ u32 ethtool_op_get_flags(struct net_device *dev)* handling for flags which are not so easily handled * by a simple masking operation */ - -return dev->features & flags_dup_features; +return (dev->ethtool_ops->get_flags ? + dev->ethtool_ops->get_flags (dev) : + dev->features) & flags_dup_features; }EXPORT_SYMBOL (ethtool_op_get_flags);
@@ -1495,9 +1496,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)break ;case ETHTOOL_GFLAGS : rc =ethtool_get_value (dev, useraddr, ethcmd, - (dev->ethtool_ops->get_flags ? - dev->ethtool_ops->get_flags : - ethtool_op_get_flags)); + ethtool_op_get_flags);break ;case ETHTOOL_SFLAGS : rc = ethtool_set_value(dev, useraddr,
Plus nuking all such code in the netdev drivers:
.get_flags = ethtool_op_get_flags,
This is still pretty fragile and could lead to infinite recursion if some drivers are missed. But you get the idea.
Thanks
- Bhavesh
Re: [PATCH net-next-2.6 3/3] vmxnet3: Remove incorrect implementation of ethtool_ops::get_flags()
In reply to Ben HutchingsFrom: Ben Hutchings <[email protected]>
Date: Wed, 30 Jun 2010 13:47:40 +0100
Quoted 4 lines
Only some netdev feature flags correspond directly to ethtool feature flags.
ethtool_op_get_flags()does the right thing.Signed-off-by Ben Hutchings <[email protected]>
Applied.
From: Ben Hutchings <[email protected]>
Date: Wed, 30 Jun 2010 13:44:32 +0100
Quoted 8 lines
ethtool_op_set_flags()does not check for unsupported flags, and has no way of doing so. This means it is not suitable for use as a default implementation ofethtool_ops::set_flags.Add a 'supported' parameter specifying the flags that the driver and hardware support, validate the requested flags against this, and change all current callers to pass this parameter.
Quoted 6 lines
Change some other trivial implementations of
ethtool_ops::set_flagsto callethtool_op_set_flags().Signed-off-by Ben Hutchings <[email protected]>Reviewed-by Stanislaw Gruszka <[email protected]>Acked-by Jeff Garzik <[email protected]>
Applied.
Quoted 33 lines · On Wed, 30 Jun 2010 13:44:32 +0100 Ben Hutchings wrote:
ethtool_op_set_flags()does not check for unsupported flags, and has no way of doing so. This means it is not suitable for use as a default implementation ofethtool_ops::set_flags.Add a 'supported' parameter specifying the flags that the driver and hardware support, validate the requested flags against this, and change all current callers to pass this parameter.
Change some other trivial implementations of
ethtool_ops::set_flagsto callethtool_op_set_flags().Signed-off-by Ben Hutchings <[email protected]>Reviewed-by Stanislaw Gruszka <[email protected]>Acked-by Jeff Garzik <[email protected]>--- drivers/net/cxgb4/cxgb4_main.c | 9 +-------- drivers/net/enic/enic_main.c | 1 - drivers/net/ixgbe/ixgbe_ethtool.c | 5 ++++- drivers/net/mv643xx_eth.c | 7 ++++++- drivers/net/myri10ge/myri10ge.c | 10 +++++++--- drivers/net/niu.c | 9 +-------- drivers/net/sfc/ethtool.c | 5 +---- drivers/net/sky2.c | 16 ++++++---------- include/linux/ethtool.h | 2 +- net/core/ethtool.c | 28 +++++----------------------- 10 files changed, 32 insertions(+), 60 deletions(-)include/linux/ethtool.h +0
-0
include/linux/ethtool.h int ethtool_op_set_tso(struct net_device *dev, u32 data); · line 460
Quoted 5 lines
include/linux/ethtool.h +1
-1@@ -457,7 +457,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);u32 ethtool_op_get_ufo (struct net_device *dev);int ethtool_op_set_ufo (struct net_device *dev,u32 data);u32 ethtool_op_get_flags (struct net_device *dev); -int ethtool_op_set_flags (struct net_device *dev,u32 data); +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported);
That one-line change is missing from linux-next-20100702, causing:
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c:157: warning: initialization from incompatible pointer type
but the change (below) to net/core/ethtool.c is merged. I don't quite see how this happened...
Quoted 35 lines
include/linux/ethtool.h +0
-0void ethtool_ntuple_flush (struct net_device *dev);/** net/core/ethtool.c +1
-21@@ -144,31 +144,13 @@ u32 ethtool_op_get_flags(struct net_device *dev) }EXPORT_SYMBOL (ethtool_op_get_flags); -int ethtool_op_set_flags (struct net_device *dev,u32 data) +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported) { -const struct ethtool_ops *ops = dev->ethtool_ops; -unsigned long features = dev->features; - -if (data Ð_FLAG_LRO ) - features |=NETIF_F_LRO ; -else - features &= ~NETIF_F_LRO ; - -if (data Ð_FLAG_NTUPLE ) { -if (!ops->set_rx_ntuple) -return -EOPNOTSUPP ; - features |=NETIF_F_NTUPLE ; - }else { -/* safe to clear regardless */ - features &= ~NETIF_F_NTUPLE ; - } - -if (data Ð_FLAG_RXHASH ) - features |=NETIF_F_RXHASH ; -else
net/core/ethtool.c u32 ethtool_op_get_flags(struct net_device *dev) · line 156
Quoted 10 lines
net/core/ethtool.c +4
-2- features &= ~NETIF_F_RXHASH ; +if (data & ~supported) +return -EINVAL ; - dev->features = features; + dev->features = ((dev->features & ~flags_dup_features) | + (data & flags_dup_features));return 0 ; }EXPORT_SYMBOL (ethtool_op_set_flags);
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
David Miller
maintainerFrom: Randy Dunlap <[email protected]>
Date: Fri, 2 Jul 2010 09:55:14 -0700
Quoted 11 lines · On Wed, 30 Jun 2010 13:44:32 +0100 Ben Hutchings wrote:
include/linux/ethtool.h int ethtool_op_set_tso(struct net_device *dev, u32 data); · line 460
Quoted 6 lines
include/linux/ethtool.h +1
-1@@ -457,7 +457,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);u32 ethtool_op_get_ufo (struct net_device *dev);int ethtool_op_set_ufo (struct net_device *dev,u32 data);u32 ethtool_op_get_flags (struct net_device *dev); -int ethtool_op_set_flags (struct net_device *dev,u32 data); +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported);That one-line change is missing from linux-next-20100702, causing:
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c:157: warning: initialization from incompatible pointer type
Strange, it's in net-next-2.6 for sure:
davem@sunset:~/src/GIT/net-next-2.6$ egrep ethtool_op_set_flags include/linux/ethtool.h int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
Quoted 13 lines · On Fri, 02 Jul 2010 22:07:11 -0700 (PDT) David Miller wrote:
From: Randy Dunlap <[email protected]>
Date: Fri, 2 Jul 2010 09:55:14 -0700Quoted 10 lines · On Wed, 30 Jun 2010 13:44:32 +0100 Ben Hutchings wrote:
include/linux/ethtool.h int ethtool_op_set_tso(struct net_device *dev, u32 data); · line 460
Quoted 6 lines
include/linux/ethtool.h +1
-1@@ -457,7 +457,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);u32 ethtool_op_get_ufo (struct net_device *dev);int ethtool_op_set_ufo (struct net_device *dev,u32 data);u32 ethtool_op_get_flags (struct net_device *dev); -int ethtool_op_set_flags (struct net_device *dev,u32 data); +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported);That one-line change is missing from linux-next-20100702, causing:
Quoted 6 lines
Quoted 1 line
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c:157: warning: initialization from incompatible pointer typeStrange, it's in net-next-2.6 for sure:
davem@sunset:~/src/GIT/net-next-2.6$ egrep ethtool_op_set_flags include/linux/ethtool.h int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
Yep, my bad.
In include/linux/ethtool.h, struct ethtool_ops, field/member 'set_flags':
int (*set_flags)(struct net_device *, u32);
Does that need another u32 for 'supported'? This is where the linux-next warnings are coming from.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Quoted 22 lines · Randy Dunlap
Quoted 13 lines · On Fri, 02 Jul 2010 22:07:11 -0700 (PDT) David Miller wrote:
From: Randy Dunlap <[email protected]>
Date: Fri, 2 Jul 2010 09:55:14 -0700Quoted 10 lines · On Wed, 30 Jun 2010 13:44:32 +0100 Ben Hutchings wrote:
include/linux/ethtool.h int ethtool_op_set_tso(struct net_device *dev, u32 data); · line 460
Quoted 6 lines
include/linux/ethtool.h +1
-1@@ -457,7 +457,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);u32 ethtool_op_get_ufo (struct net_device *dev);int ethtool_op_set_ufo (struct net_device *dev,u32 data);u32 ethtool_op_get_flags (struct net_device *dev); -int ethtool_op_set_flags (struct net_device *dev,u32 data); +int ethtool_op_set_flags (struct net_device *dev,u32 data,u32 supported);That one-line change is missing from linux-next-20100702, causing:
Quoted 6 lines
Quoted 1 line
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c:157: warning: initialization from incompatible pointer typeStrange, it's in net-next-2.6 for sure:
davem@sunset:~/src/GIT/net-next-2.6$ egrep ethtool_op_set_flags include/linux/ethtool.h int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
Quoted 8 lines
Yep, my bad.
In
include/linux/ethtool.h, structethtool_ops, field/member 'set_flags':int (*set_flags)(struct net_device *, u32);Does that need another u32 for 'supported'? This is where the linux-next warnings are coming from.
No, this is intentional. I just missed the users of ethtool_op_set_flags() in drivers/infiniband. I'll send a patch for those shortly.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 1/1 IB/{nes,ipoib}: Pass supported flags to ethtool_op_set_flags()
Following commit 1437ce3983bcbc0447a0dedcd644c14fe833d266 "ethtool:
Change ethtool_op_set_flags to validate flags", ethtool_op_set_flags takes a third parameter and cannot be used directly as an implementation of ethtool_ops::set_flags.
Changes nes and ipoib driver to pass in the appropriate value.
---
This is compile-tested only.
Dave, Roland, you'd better decide between yourselves should apply this.
Ben.
drivers/infiniband/hw/nes/nes_nic.c | 8 +++++++- drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/infiniband/hw/nes/nes_nic.c +7 -1
@@ -1567,6 +1567,12 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd } +static int nes_netdev_set_flags (struct net_device *netdev,u32 flags) +{ +return ethtool_op_set_flags (netdev, flags,ETH_FLAG_LRO ); +} + +static const struct ethtool_ops nes_ethtool_ops = { .get_link = ethtool_op_get_link, .get_settings = nes_netdev_get_settings,
@@ -1588,7 +1594,7 @@ static const struct ethtool_ops nes_ethtool_ops = { .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, + .set_flags = nes_netdev_set_flags, };
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c +6 -1
@@ -147,6 +147,11 @@ static void ipoib_get_ethtool_stats(struct net_device *dev, data[index++] = priv->lro.lro_mgr.stats.no_desc; } +static int ipoib_set_flags (struct net_device *dev,u32 flags) +{ +return ethtool_op_set_flags (dev, flags,ETH_FLAG_LRO ); +} +static const struct ethtool_ops ipoib_ethtool_ops = { .get_drvinfo = ipoib_get_drvinfo, .get_rx_csum = ipoib_get_rx_csum,
@@ -154,7 +159,7 @@ static const struct ethtool_ops ipoib_ethtool_ops = { .get_coalesce = ipoib_get_coalesce, .set_coalesce = ipoib_set_coalesce, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, + .set_flags = ipoib_set_flags, .get_strings = ipoib_get_strings, .get_sset_count = ipoib_get_sset_count, .get_ethtool_stats = ipoib_get_ethtool_stats,
Signature · 12 lines
1.7.1 -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next-2.6] IB/{nes,ipoib}: Pass supported flags to ethtool_op_set_flags()
Quoted 4 lines
Following commit
1437ce3983bcbc0447a0dedcd644c14fe833d266"ethtool:
Changeethtool_op_set_flagsto validate flags",ethtool_op_set_flagstakes a third parameter and cannot be used directly as an implementation ofethtool_ops::set_flags.
I assume this commit is in one of Dave's trees and breaks nes and ipoib because it changed the ethtool_op_set_flags prototype?
Quoted 1 line
Dave, Roland, you'd better decide between yourselves should apply this.
Since this depends on a commit already in Dave's tree, Dave should probably take it into the same tree. I guess there's no way to roll this into the original patch to avoid breaking bisects once this ends up upstream?
anyway,
drivers/infiniband/hw/nes/nes_nic.c static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd · line 1576
Quoted 7 lines
drivers/infiniband/hw/nes/nes_nic.c +6
-0+static int nes_netdev_set_flags (struct net_device *netdev,u32 flags) +{ +return ethtool_op_set_flags (netdev, flags,ETH_FLAG_LRO ); +} + +static const struct ethtool_ops nes_ethtool_ops = {
Also would have been a bit nicer to avoid adding a double blank line here, although that's obviously a trivial issue.
- R.
Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/index.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next-2.6] IB/{nes, ipoib}: Pass supported flags to ethtool_op_set_flags()
Quoted 7 lines · Roland Dreier
Quoted 4 lines
Following commit
1437ce3983bcbc0447a0dedcd644c14fe833d266"ethtool:
Changeethtool_op_set_flagsto validate flags",ethtool_op_set_flagstakes a third parameter and cannot be used directly as an implementation ofethtool_ops::set_flags.I assume this commit is in one of Dave's trees and breaks nes and ipoib because it changed the
ethtool_op_set_flagsprototype?
Right.
Quoted 6 lines
Quoted 1 line
Dave, Roland, you'd better decide between yourselves should apply this.
Since this depends on a commit already in Dave's tree, Dave should probably take it into the same tree. I guess there's no way to roll this into the original patch to avoid breaking bisects once this ends up upstream?
Unfortunately it's too late to do that.
Quoted 4 lines
anyway,
Acked-by Roland Dreier <[email protected]>
Quoted 10 lines
drivers/infiniband/hw/nes/nes_nic.c static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd · line 1576
Quoted 7 lines
drivers/infiniband/hw/nes/nes_nic.c +6
-0+static int nes_netdev_set_flags (struct net_device *netdev,u32 flags) +{ +return ethtool_op_set_flags (netdev, flags,ETH_FLAG_LRO ); +} + +static const struct ethtool_ops nes_ethtool_ops = {Also would have been a bit nicer to avoid adding a double blank line here, although that's obviously a trivial issue.
This spacing is consistent with the surrounding code.
Ben.
Signature · 14 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Re: [PATCH net-next-2.6] IB/{nes,ipoib}: Pass supported flags to ethtool_op_set_flags()
In reply to Roland DreierFrom: Roland Dreier <[email protected]>
Date: Sat, 03 Jul 2010 13:08:29 -0700
Quoted 6 lines
Quoted 4 lines
Following commit
1437ce3983bcbc0447a0dedcd644c14fe833d266"ethtool:
Changeethtool_op_set_flagsto validate flags",ethtool_op_set_flagstakes a third parameter and cannot be used directly as an implementation ofethtool_ops::set_flags.Acked-by Roland Dreier <[email protected]>
Applied, thanks guys.
Re: [PATCH net-next-2.6] IB/{nes, ipoib}: Pass supported flags to ethtool_op_set_flags()
In reply to Ben HutchingsQuoted 10 lines · Ben Hutchings
Following commit
1437ce3983bcbc0447a0dedcd644c14fe833d266"ethtool:
Changeethtool_op_set_flagsto validate flags",ethtool_op_set_flagstakes a third parameter and cannot be used directly as an implementation ofethtool_ops::set_flags.Changes nes and ipoib driver to pass in the appropriate value.
Signed-off-by Ben Hutchings <[email protected]>---
This is compile-tested only.
Ack, thanks.
Quoted 59 lines
Dave, Roland, you'd better decide between yourselves should apply this.
Ben.
drivers/infiniband/hw/nes/nes_nic.c | 8 +++++++- drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-)drivers/infiniband/hw/nes/nes_nic.c +7
-1@@ -1567,6 +1567,12 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd } +static int nes_netdev_set_flags (struct net_device *netdev,u32 flags) +{ +return ethtool_op_set_flags (netdev, flags,ETH_FLAG_LRO ); +} + +static const struct ethtool_ops nes_ethtool_ops = { .get_link = ethtool_op_get_link, .get_settings = nes_netdev_get_settings,@@ -1588,7 +1594,7 @@ static const struct ethtool_ops nes_ethtool_ops = { .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, + .set_flags = nes_netdev_set_flags, };drivers/infiniband/ulp/ipoib/ipoib_ethtool.c +6
-1@@ -147,6 +147,11 @@ static void ipoib_get_ethtool_stats(struct net_device *dev, data[index++] = priv->lro.lro_mgr.stats.no_desc; } +static int ipoib_set_flags (struct net_device *dev,u32 flags) +{ +return ethtool_op_set_flags (dev, flags,ETH_FLAG_LRO ); +} +static const struct ethtool_ops ipoib_ethtool_ops = { .get_drvinfo = ipoib_get_drvinfo, .get_rx_csum = ipoib_get_rx_csum,@@ -154,7 +159,7 @@ static const struct ethtool_ops ipoib_ethtool_ops = { .get_coalesce = ipoib_get_coalesce, .set_coalesce = ipoib_set_coalesce, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, + .set_flags = ipoib_set_flags, .get_strings = ipoib_get_strings, .get_sset_count = ipoib_get_sset_count, .get_ethtool_stats = ipoib_get_ethtool_stats,
Signature · 12 lines
~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired