netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] ethtool: device independent rx_csum and get_flags routines
@ 2009-07-22 23:38 Sridhar Samudrala
  2009-07-27  2:49 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Sridhar Samudrala @ 2009-07-22 23:38 UTC (permalink / raw)
  To: David Miller, netdev

[PATCH net-next-2.6] ethtool: add device independent rx_csum and get_flags routines

This helps avoid error messages with ethtool -k on devices that
don't provide device specific routines.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

------------------------------------------------------------------

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d9d5160..cf36ff4 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -30,6 +30,11 @@ u32 ethtool_op_get_link(struct net_device *dev)
 	return netif_carrier_ok(dev) ? 1 : 0;
 }
 
+u32 ethtool_op_get_rx_csum(struct net_device *dev)
+{
+	return (dev->features & NETIF_F_ALL_CSUM) != 0;
+}
+
 u32 ethtool_op_get_tx_csum(struct net_device *dev)
 {
 	return (dev->features & NETIF_F_ALL_CSUM) != 0;
@@ -1004,7 +1009,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 		break;
 	case ETHTOOL_GRXCSUM:
 		rc = ethtool_get_value(dev, useraddr, ethcmd,
-				       dev->ethtool_ops->get_rx_csum);
+				       (dev->ethtool_ops->get_rx_csum ?
+					dev->ethtool_ops->get_rx_csum :
+					ethtool_op_get_rx_csum));
 		break;
 	case ETHTOOL_SRXCSUM:
 		rc = ethtool_set_rx_csum(dev, useraddr);
@@ -1068,7 +1075,9 @@ 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 ?
+					dev->ethtool_ops->get_flags :
+					ethtool_op_get_flags));
 		break;
 	case ETHTOOL_SFLAGS:
 		rc = ethtool_set_value(dev, useraddr,



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] ethtool: device independent rx_csum and get_flags routines
  2009-07-22 23:38 [PATCH net-next-2.6] ethtool: device independent rx_csum and get_flags routines Sridhar Samudrala
@ 2009-07-27  2:49 ` David Miller
  2009-07-27  9:18   ` [PATCH net-next-2.6] net: ethtool_op_get_rx_csum() should be public and exported Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-07-27  2:49 UTC (permalink / raw)
  To: sri; +Cc: netdev

From: Sridhar Samudrala <sri@us.ibm.com>
Date: Wed, 22 Jul 2009 16:38:22 -0700

> [PATCH net-next-2.6] ethtool: add device independent rx_csum and get_flags routines
> 
> This helps avoid error messages with ethtool -k on devices that
> don't provide device specific routines.
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next-2.6] net: ethtool_op_get_rx_csum() should be public and exported
  2009-07-27  2:49 ` David Miller
@ 2009-07-27  9:18   ` Eric Dumazet
  2009-07-27 18:36     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2009-07-27  9:18 UTC (permalink / raw)
  To: David Miller; +Cc: sri, netdev

David Miller a écrit :
> From: Sridhar Samudrala <sri@us.ibm.com>
> Date: Wed, 22 Jul 2009 16:38:22 -0700
> 
>> [PATCH net-next-2.6] ethtool: add device independent rx_csum and get_flags routines
>>
>> This helps avoid error messages with ethtool -k on devices that
>> don't provide device specific routines.
>>
>> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> 
> Applied.

I wonder if ethtool_op_get_rx_csum() should be static or is meant to be used by drivers ?

I guess it should be public and exported like ethtool_op_get_tx_csum()

[PATCH] net: ethtool_op_get_rx_csum() should be public and exported

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 include/linux/ethtool.h |    1 +
 net/core/ethtool.c      |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9b660bd..90c4a36 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -368,6 +368,7 @@ struct net_device;
 
 /* Some generic methods drivers may use in their ethtool_ops */
 u32 ethtool_op_get_link(struct net_device *dev);
+u32 ethtool_op_get_rx_csum(struct net_device *dev);
 u32 ethtool_op_get_tx_csum(struct net_device *dev);
 int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
 int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index cf36ff4..44e5711 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -34,11 +34,13 @@ u32 ethtool_op_get_rx_csum(struct net_device *dev)
 {
 	return (dev->features & NETIF_F_ALL_CSUM) != 0;
 }
+EXPORT_SYMBOL(ethtool_op_get_rx_csum);
 
 u32 ethtool_op_get_tx_csum(struct net_device *dev)
 {
 	return (dev->features & NETIF_F_ALL_CSUM) != 0;
 }
+EXPORT_SYMBOL(ethtool_op_get_tx_csum);
 
 int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
 {
@@ -1125,7 +1127,6 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 EXPORT_SYMBOL(ethtool_op_get_link);
 EXPORT_SYMBOL(ethtool_op_get_sg);
 EXPORT_SYMBOL(ethtool_op_get_tso);
-EXPORT_SYMBOL(ethtool_op_get_tx_csum);
 EXPORT_SYMBOL(ethtool_op_set_sg);
 EXPORT_SYMBOL(ethtool_op_set_tso);
 EXPORT_SYMBOL(ethtool_op_set_tx_csum);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: ethtool_op_get_rx_csum() should be public and exported
  2009-07-27  9:18   ` [PATCH net-next-2.6] net: ethtool_op_get_rx_csum() should be public and exported Eric Dumazet
@ 2009-07-27 18:36     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-07-27 18:36 UTC (permalink / raw)
  To: eric.dumazet; +Cc: sri, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 27 Jul 2009 11:18:11 +0200

> [PATCH] net: ethtool_op_get_rx_csum() should be public and exported
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Fair enough, applied, but now you are on the hook to add at
least one user of this :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-27 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 23:38 [PATCH net-next-2.6] ethtool: device independent rx_csum and get_flags routines Sridhar Samudrala
2009-07-27  2:49 ` David Miller
2009-07-27  9:18   ` [PATCH net-next-2.6] net: ethtool_op_get_rx_csum() should be public and exported Eric Dumazet
2009-07-27 18:36     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).