[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <55250cb000ce8cb00f01f1e3e6a8791fe9c3081e.1308596963.git.mirq-linux@rere.qmqm.pl>
Date: Mon, 20 Jun 2011 21:14:55 +0200 (CEST)
From: Michał Mirosław <mirq-linux@...e.qmqm.pl>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Ben Hutchings <bhutchings@...arflare.com>
Subject: [RFT PATCH 9/9] net: move NOCACHE_COPY checks to netdev_fix_features()
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
include/linux/netdev_features.h | 3 ++-
net/core/dev.c | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 86d6193..9f24781 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -146,6 +146,7 @@ enum {
#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
/* changeable features with no special hardware requirements */
-#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
+#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO | \
+ NETIF_F_NOCACHE_COPY)
#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/net/core/dev.c b/net/core/dev.c
index 7e58353..30782b7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5250,6 +5250,19 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
}
}
+ /* No cache copy is a win only with real HW with HW checksumming */
+ if (features & NETIF_F_NOCACHE_COPY) {
+ if (!(features & NETIF_F_ALL_CSUM)) {
+ netdev_dbg(dev,
+ "Dropping NETIF_F_NOCACHE_COPY since it needs HW checksumming.\n");
+ features &= ~NETIF_F_NOCACHE_COPY;
+ } else if (features & NETIF_F_NO_CSUM) {
+ netdev_dbg(dev,
+ "Dropping NETIF_F_NOCACHE_COPY for virtual device.\n");
+ features &= ~NETIF_F_NOCACHE_COPY;
+ }
+ }
+
return features;
}
@@ -5465,14 +5478,6 @@ int register_netdevice(struct net_device *dev)
dev->features |= NETIF_F_SOFT_FEATURES;
dev->wanted_features = dev->features & dev->hw_features;
- /* Turn on no cache copy if HW is doing checksum */
- dev->hw_features |= NETIF_F_NOCACHE_COPY;
- if ((dev->features & NETIF_F_ALL_CSUM) &&
- !(dev->features & NETIF_F_NO_CSUM)) {
- dev->wanted_features |= NETIF_F_NOCACHE_COPY;
- dev->features |= NETIF_F_NOCACHE_COPY;
- }
-
/* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
* vlan_dev_init() will do the dev->features check, so these features
* are enabled only if supported by underlying device.
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists