* [PATCH] net: implement dev_disable_lro() hw_features compatibility
@ 2011-03-18 17:42 Michał Mirosław
2011-03-18 18:13 ` Ben Hutchings
0 siblings, 1 reply; 5+ messages in thread
From: Michał Mirosław @ 2011-03-18 17:42 UTC (permalink / raw)
To: netdev; +Cc: Ben Hutchings, David S. Miller
Implement compatibility with new hw_features for dev_disable_lro().
This is a transition path - dev_disable_lro() should be later
integrated into netdev_fix_features() after all drivers are converted.
There's no point in exporting __ethtool_set_flags() as it and dev_disable_lro()
are always built-in.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
Patch is build-tested only, as I don't have any LRO-capable hardware.
It might be prettier to move dev_disable_lro() to ethtool.c.
net/core/dev.c | 20 ++++++++++++--------
net/core/ethtool.c | 2 +-
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 0b88eba..105e082 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1353,14 +1353,18 @@ EXPORT_SYMBOL(dev_close);
*/
void dev_disable_lro(struct net_device *dev)
{
- if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
- dev->ethtool_ops->set_flags) {
- u32 flags = dev->ethtool_ops->get_flags(dev);
- if (flags & ETH_FLAG_LRO) {
- flags &= ~ETH_FLAG_LRO;
- dev->ethtool_ops->set_flags(dev, flags);
- }
- }
+ extern int __ethtool_set_flags(struct net_device *, u32);
+ u32 flags;
+
+ if (dev->ethtool_ops && dev->ethtool_ops->get_flags)
+ flags = dev->ethtool_ops->get_flags(dev);
+ else
+ flags = ethtool_op_get_flags(dev);
+
+ if (!(flags & ETH_FLAG_LRO))
+ return;
+
+ __ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO);
WARN_ON(dev->features & NETIF_F_LRO);
}
EXPORT_SYMBOL(dev_disable_lro);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index c1a71bb..7371177 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -513,7 +513,7 @@ static int ethtool_set_one_feature(struct net_device *dev,
}
}
-static int __ethtool_set_flags(struct net_device *dev, u32 data)
+int __ethtool_set_flags(struct net_device *dev, u32 data)
{
u32 changed;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: implement dev_disable_lro() hw_features compatibility
2011-03-18 17:42 [PATCH] net: implement dev_disable_lro() hw_features compatibility Michał Mirosław
@ 2011-03-18 18:13 ` Ben Hutchings
2011-03-18 19:43 ` David Miller
2011-03-19 2:56 ` [PATCH v2] " Michał Mirosław
0 siblings, 2 replies; 5+ messages in thread
From: Ben Hutchings @ 2011-03-18 18:13 UTC (permalink / raw)
To: Michał Mirosław; +Cc: netdev, David S. Miller
On Fri, 2011-03-18 at 18:42 +0100, Michał Mirosław wrote:
> Implement compatibility with new hw_features for dev_disable_lro().
Good point, but...
> This is a transition path - dev_disable_lro() should be later
> integrated into netdev_fix_features() after all drivers are converted.
>
> There's no point in exporting __ethtool_set_flags() as it and dev_disable_lro()
> are always built-in.
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>
> Patch is build-tested only, as I don't have any LRO-capable hardware.
> It might be prettier to move dev_disable_lro() to ethtool.c.
It *looks* right.
> net/core/dev.c | 20 ++++++++++++--------
> net/core/ethtool.c | 2 +-
> 2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 0b88eba..105e082 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1353,14 +1353,18 @@ EXPORT_SYMBOL(dev_close);
> */
> void dev_disable_lro(struct net_device *dev)
> {
> - if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
> - dev->ethtool_ops->set_flags) {
> - u32 flags = dev->ethtool_ops->get_flags(dev);
> - if (flags & ETH_FLAG_LRO) {
> - flags &= ~ETH_FLAG_LRO;
> - dev->ethtool_ops->set_flags(dev, flags);
> - }
> - }
> + extern int __ethtool_set_flags(struct net_device *, u32);
[...]
Local function declarations are a very bad idea, as they are not checked
against the function definition. Please declare the function in
<linux/ethtool.h>; that does not oblige us to export it.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: implement dev_disable_lro() hw_features compatibility
2011-03-18 18:13 ` Ben Hutchings
@ 2011-03-18 19:43 ` David Miller
2011-03-19 2:56 ` [PATCH v2] " Michał Mirosław
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-03-18 19:43 UTC (permalink / raw)
To: bhutchings; +Cc: mirq-linux, netdev
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 18 Mar 2011 18:13:06 +0000
> Local function declarations are a very bad idea, as they are not checked
> against the function definition. Please declare the function in
> <linux/ethtool.h>; that does not oblige us to export it.
Agreed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] net: implement dev_disable_lro() hw_features compatibility
2011-03-18 18:13 ` Ben Hutchings
2011-03-18 19:43 ` David Miller
@ 2011-03-19 2:56 ` Michał Mirosław
2011-03-22 8:00 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Michał Mirosław @ 2011-03-19 2:56 UTC (permalink / raw)
To: netdev; +Cc: Ben Hutchings, David S. Miller
Implement compatibility with new hw_features for dev_disable_lro().
This is a transition path - dev_disable_lro() should be later
integrated into netdev_fix_features() after all drivers are converted.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
Changes from v1:
- moved __ethtool_set_flags() prototype to ethtool.h
include/linux/ethtool.h | 3 +++
net/core/dev.c | 19 +++++++++++--------
net/core/ethtool.c | 2 +-
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index aac3e2e..c9bfe2d 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -614,6 +614,9 @@ enum ethtool_sfeatures_retval_bits {
#include <linux/rculist.h>
+/* needed by dev_disable_lro() */
+extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
+
struct ethtool_rx_ntuple_flow_spec_container {
struct ethtool_rx_ntuple_flow_spec fs;
struct list_head list;
diff --git a/net/core/dev.c b/net/core/dev.c
index 0b88eba..f453370 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1353,14 +1353,17 @@ EXPORT_SYMBOL(dev_close);
*/
void dev_disable_lro(struct net_device *dev)
{
- if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
- dev->ethtool_ops->set_flags) {
- u32 flags = dev->ethtool_ops->get_flags(dev);
- if (flags & ETH_FLAG_LRO) {
- flags &= ~ETH_FLAG_LRO;
- dev->ethtool_ops->set_flags(dev, flags);
- }
- }
+ u32 flags;
+
+ if (dev->ethtool_ops && dev->ethtool_ops->get_flags)
+ flags = dev->ethtool_ops->get_flags(dev);
+ else
+ flags = ethtool_op_get_flags(dev);
+
+ if (!(flags & ETH_FLAG_LRO))
+ return;
+
+ __ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO);
WARN_ON(dev->features & NETIF_F_LRO);
}
EXPORT_SYMBOL(dev_disable_lro);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index c1a71bb..7371177 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -513,7 +513,7 @@ static int ethtool_set_one_feature(struct net_device *dev,
}
}
-static int __ethtool_set_flags(struct net_device *dev, u32 data)
+int __ethtool_set_flags(struct net_device *dev, u32 data)
{
u32 changed;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: implement dev_disable_lro() hw_features compatibility
2011-03-19 2:56 ` [PATCH v2] " Michał Mirosław
@ 2011-03-22 8:00 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-03-22 8:00 UTC (permalink / raw)
To: mirq-linux; +Cc: netdev, bhutchings
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Sat, 19 Mar 2011 03:56:34 +0100 (CET)
> Implement compatibility with new hw_features for dev_disable_lro().
> This is a transition path - dev_disable_lro() should be later
> integrated into netdev_fix_features() after all drivers are converted.
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
I'll apply this, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-22 8:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-18 17:42 [PATCH] net: implement dev_disable_lro() hw_features compatibility Michał Mirosław
2011-03-18 18:13 ` Ben Hutchings
2011-03-18 19:43 ` David Miller
2011-03-19 2:56 ` [PATCH v2] " Michał Mirosław
2011-03-22 8:00 ` 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).