netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netdevice: Prefer NETIF_F_HW_CSUM when intersecting features
@ 2017-04-20  1:12 Vladislav Yasevich
  2017-04-20  6:13 ` Michal Kubecek
  2017-04-20 18:36 ` Alexander Duyck
  0 siblings, 2 replies; 5+ messages in thread
From: Vladislav Yasevich @ 2017-04-20  1:12 UTC (permalink / raw)
  To: netdev; +Cc: tom, mkubecek, Vladislav Yasevich

While hardware device use either NETIF_F_(IP|IPV6)_CSUM or
NETIF_F_HW_CSUM, all of the software devices use HW_CSUM.
This results in an interesting situation when the software
device is configured on top of hw device using (IP|IPV6)_CSUM.
In this situation, the user can't turn off checksum offloading
features on the software device.

This patch resolves that by prefering the NETIF_F_HW_CSUM setting
when computing a feature intersect.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
 include/linux/netdevice.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 97456b25..3d811c1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4019,9 +4019,9 @@ static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
 {
 	if ((f1 ^ f2) & NETIF_F_HW_CSUM) {
 		if (f1 & NETIF_F_HW_CSUM)
-			f1 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
+			f2 |= NETIF_F_HW_CSUM;
 		else
-			f2 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
+			f1 |= NETIF_F_HW_CSUM;
 	}
 
 	return f1 & f2;
-- 
2.7.4

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

end of thread, other threads:[~2017-04-20 19:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20  1:12 [PATCH net] netdevice: Prefer NETIF_F_HW_CSUM when intersecting features Vladislav Yasevich
2017-04-20  6:13 ` Michal Kubecek
2017-04-20 15:20   ` Vlad Yasevich
2017-04-20 18:36 ` Alexander Duyck
2017-04-20 19:07   ` Vlad Yasevich

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).