diff mbox

[ovs-dev] compat: Remove unused netdevice backport code.

Message ID 20170209005021.2809-1-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer Feb. 9, 2017, 12:50 a.m. UTC
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 datapath/linux/compat/include/linux/netdevice.h |  5 --
 datapath/linux/compat/netdevice.c               | 71 -------------------------
 2 files changed, 76 deletions(-)

Comments

Jarno Rajahalme April 28, 2017, 11:48 p.m. UTC | #1
Maybe mention in the commit message that these are unused due to older than X.Y.Z Linux kernel versions not being supported any more.

Acked-by: Jarno Rajahalme <jarno@ovn.org>


> On Feb 8, 2017, at 4:50 PM, Joe Stringer <joe@ovn.org> wrote:
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
> datapath/linux/compat/include/linux/netdevice.h |  5 --
> datapath/linux/compat/netdevice.c               | 71 -------------------------
> 2 files changed, 76 deletions(-)
> 
> diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
> index 9982fd7f686e..75315dc16e02 100644
> --- a/datapath/linux/compat/include/linux/netdevice.h
> +++ b/datapath/linux/compat/include/linux/netdevice.h
> @@ -89,11 +89,6 @@ struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, netdev_features_t featu
> }
> #endif
> 
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
> -#define netif_skb_features rpl_netif_skb_features
> -netdev_features_t rpl_netif_skb_features(struct sk_buff *skb);
> -#endif
> -
> #ifdef HAVE_NETIF_NEEDS_GSO_NETDEV
> #define netif_needs_gso rpl_netif_needs_gso
> static inline bool netif_needs_gso(struct sk_buff *skb,
> diff --git a/datapath/linux/compat/netdevice.c b/datapath/linux/compat/netdevice.c
> index e28b878eea16..c0ffbbd31bee 100644
> --- a/datapath/linux/compat/netdevice.c
> +++ b/datapath/linux/compat/netdevice.c
> @@ -4,77 +4,6 @@
> 
> #include "gso.h"
> 
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
> -#ifndef HAVE_CAN_CHECKSUM_PROTOCOL
> -static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
> -{
> -	return  ((features & NETIF_F_GEN_CSUM) ||
> -		((features & NETIF_F_V4_CSUM) &&
> -				protocol == htons(ETH_P_IP)) ||
> -		((features & NETIF_F_V6_CSUM) &&
> -				protocol == htons(ETH_P_IPV6)) ||
> -		((features & NETIF_F_FCOE_CRC) &&
> -				protocol == htons(ETH_P_FCOE)));
> -}
> -#endif
> -
> -static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
> -{
> -#ifdef CONFIG_HIGHMEM
> -	int i;
> -
> -	if (dev->features & NETIF_F_HIGHDMA)
> -		return 0;
> -
> -	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
> -		if (PageHighMem(skb_shinfo(skb)->frags[i].page))
> -			return 1;
> -
> -#endif
> -	return 0;
> -}
> -
> -static netdev_features_t harmonize_features(struct sk_buff *skb,
> -					    __be16 protocol,
> -					    netdev_features_t features)
> -{
> -	if (!can_checksum_protocol(features, protocol)) {
> -		features &= ~NETIF_F_ALL_CSUM;
> -		features &= ~NETIF_F_SG;
> -	} else if (illegal_highdma(skb->dev, skb)) {
> -		features &= ~NETIF_F_SG;
> -	}
> -
> -	return features;
> -}
> -
> -netdev_features_t rpl_netif_skb_features(struct sk_buff *skb)
> -{
> -	unsigned long vlan_features = skb->dev->vlan_features;
> -
> -	__be16 protocol = skb->protocol;
> -	netdev_features_t features = skb->dev->features;
> -
> -	if (protocol == htons(ETH_P_8021Q)) {
> -		struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
> -		protocol = veh->h_vlan_encapsulated_proto;
> -	} else if (!skb_vlan_tag_present(skb)) {
> -		return harmonize_features(skb, protocol, features);
> -	}
> -
> -	features &= (vlan_features | NETIF_F_HW_VLAN_TX);
> -
> -	if (protocol != htons(ETH_P_8021Q)) {
> -		return harmonize_features(skb, protocol, features);
> -	} else {
> -		features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
> -			NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_TX;
> -		return harmonize_features(skb, protocol, features);
> -	}
> -}
> -EXPORT_SYMBOL_GPL(rpl_netif_skb_features);
> -#endif	/* kernel version < 2.6.38 */
> -
> #ifdef OVS_USE_COMPAT_GSO_SEGMENTATION
> struct sk_buff *rpl__skb_gso_segment(struct sk_buff *skb,
> 				    netdev_features_t features,
> -- 
> 2.11.0
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Joe Stringer April 28, 2017, 11:59 p.m. UTC | #2
On 28 April 2017 at 16:48, Jarno Rajahalme <jarno@ovn.org> wrote:
> Maybe mention in the commit message that these are unused due to older than X.Y.Z Linux kernel versions not being supported any more.
>
> Acked-by: Jarno Rajahalme <jarno@ovn.org>

Done and applied to master, thanks.
diff mbox

Patch

diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index 9982fd7f686e..75315dc16e02 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -89,11 +89,6 @@  struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, netdev_features_t featu
 }
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
-#define netif_skb_features rpl_netif_skb_features
-netdev_features_t rpl_netif_skb_features(struct sk_buff *skb);
-#endif
-
 #ifdef HAVE_NETIF_NEEDS_GSO_NETDEV
 #define netif_needs_gso rpl_netif_needs_gso
 static inline bool netif_needs_gso(struct sk_buff *skb,
diff --git a/datapath/linux/compat/netdevice.c b/datapath/linux/compat/netdevice.c
index e28b878eea16..c0ffbbd31bee 100644
--- a/datapath/linux/compat/netdevice.c
+++ b/datapath/linux/compat/netdevice.c
@@ -4,77 +4,6 @@ 
 
 #include "gso.h"
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
-#ifndef HAVE_CAN_CHECKSUM_PROTOCOL
-static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
-{
-	return  ((features & NETIF_F_GEN_CSUM) ||
-		((features & NETIF_F_V4_CSUM) &&
-				protocol == htons(ETH_P_IP)) ||
-		((features & NETIF_F_V6_CSUM) &&
-				protocol == htons(ETH_P_IPV6)) ||
-		((features & NETIF_F_FCOE_CRC) &&
-				protocol == htons(ETH_P_FCOE)));
-}
-#endif
-
-static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
-{
-#ifdef CONFIG_HIGHMEM
-	int i;
-
-	if (dev->features & NETIF_F_HIGHDMA)
-		return 0;
-
-	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
-		if (PageHighMem(skb_shinfo(skb)->frags[i].page))
-			return 1;
-
-#endif
-	return 0;
-}
-
-static netdev_features_t harmonize_features(struct sk_buff *skb,
-					    __be16 protocol,
-					    netdev_features_t features)
-{
-	if (!can_checksum_protocol(features, protocol)) {
-		features &= ~NETIF_F_ALL_CSUM;
-		features &= ~NETIF_F_SG;
-	} else if (illegal_highdma(skb->dev, skb)) {
-		features &= ~NETIF_F_SG;
-	}
-
-	return features;
-}
-
-netdev_features_t rpl_netif_skb_features(struct sk_buff *skb)
-{
-	unsigned long vlan_features = skb->dev->vlan_features;
-
-	__be16 protocol = skb->protocol;
-	netdev_features_t features = skb->dev->features;
-
-	if (protocol == htons(ETH_P_8021Q)) {
-		struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
-		protocol = veh->h_vlan_encapsulated_proto;
-	} else if (!skb_vlan_tag_present(skb)) {
-		return harmonize_features(skb, protocol, features);
-	}
-
-	features &= (vlan_features | NETIF_F_HW_VLAN_TX);
-
-	if (protocol != htons(ETH_P_8021Q)) {
-		return harmonize_features(skb, protocol, features);
-	} else {
-		features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
-			NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_TX;
-		return harmonize_features(skb, protocol, features);
-	}
-}
-EXPORT_SYMBOL_GPL(rpl_netif_skb_features);
-#endif	/* kernel version < 2.6.38 */
-
 #ifdef OVS_USE_COMPAT_GSO_SEGMENTATION
 struct sk_buff *rpl__skb_gso_segment(struct sk_buff *skb,
 				    netdev_features_t features,