Skip to content

Commit d1890de

Browse files
committed
datapath: Check for backported netdev_features_t.
This is apparently used by CentOS 6.5. Reported-by: Phil Daws <uxbod@splatnix.net> Reported-by: Edouard Bourguignon <madko@linuxed.net> Signed-off-by: Jesse Gross <jesse@nicira.com>
1 parent b7fd5e3 commit d1890de

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

acinclude.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
228228
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_by_index_rcu])
229229
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [__skb_gso_segment])
230230
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol])
231+
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t])
231232
232233
OVS_GREP_IFELSE([$KSRC/include/linux/rcupdate.h], [rcu_read_lock_held], [],
233234
[OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h],

datapath/linux/compat/include/linux/netdevice.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ static inline struct net_device *dev_get_by_index_rcu(struct net *net, int ifind
6060
#define NETIF_F_FSO 0
6161
#endif
6262

63+
#ifndef HAVE_NETDEV_FEATURES_T
64+
typedef u32 netdev_features_t;
65+
#endif
66+
6367
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
6468
#define skb_gso_segment rpl_skb_gso_segment
65-
struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, u32 features);
69+
struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb,
70+
netdev_features_t features);
6671

6772
#define netif_skb_features rpl_netif_skb_features
68-
u32 rpl_netif_skb_features(struct sk_buff *skb);
73+
netdev_features_t rpl_netif_skb_features(struct sk_buff *skb);
6974

7075
#define netif_needs_gso rpl_netif_needs_gso
7176
static inline int rpl_netif_needs_gso(struct sk_buff *skb, int features)
@@ -75,10 +80,6 @@ static inline int rpl_netif_needs_gso(struct sk_buff *skb, int features)
7580
}
7681
#endif
7782

78-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
79-
typedef u32 netdev_features_t;
80-
#endif
81-
8283
#ifndef HAVE___SKB_GSO_SEGMENT
8384
static inline struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
8485
netdev_features_t features,

datapath/linux/compat/netdevice.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
55
#ifndef HAVE_CAN_CHECKSUM_PROTOCOL
6-
static bool can_checksum_protocol(unsigned long features, __be16 protocol)
6+
static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
77
{
88
return ((features & NETIF_F_GEN_CSUM) ||
99
((features & NETIF_F_V4_CSUM) &&
@@ -31,7 +31,9 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
3131
return 0;
3232
}
3333

34-
static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features)
34+
static netdev_features_t harmonize_features(struct sk_buff *skb,
35+
__be16 protocol,
36+
netdev_features_t features)
3537
{
3638
if (!can_checksum_protocol(features, protocol)) {
3739
features &= ~NETIF_F_ALL_CSUM;
@@ -43,12 +45,12 @@ static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features
4345
return features;
4446
}
4547

46-
u32 rpl_netif_skb_features(struct sk_buff *skb)
48+
netdev_features_t rpl_netif_skb_features(struct sk_buff *skb)
4749
{
4850
unsigned long vlan_features = skb->dev->vlan_features;
4951

5052
__be16 protocol = skb->protocol;
51-
u32 features = skb->dev->features;
53+
netdev_features_t features = skb->dev->features;
5254

5355
if (protocol == htons(ETH_P_8021Q)) {
5456
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
@@ -68,7 +70,8 @@ u32 rpl_netif_skb_features(struct sk_buff *skb)
6870
}
6971
}
7072

71-
struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, u32 features)
73+
struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb,
74+
netdev_features_t features)
7275
{
7376
int vlan_depth = ETH_HLEN;
7477
__be16 type = skb->protocol;

0 commit comments

Comments
 (0)