Changes are mostly related API changes in vlan, GRE restructuring. Signed-off-by: Pravin B Shelar <pshe...@nicira.com> --- datapath/actions.c | 4 +- datapath/datapath.c | 2 +- datapath/linux/Modules.mk | 1 + datapath/linux/compat/include/linux/if_vlan.h | 11 ++++ .../linux/compat/include/linux/netdev_features.h | 12 ++++ datapath/linux/compat/include/net/gre.h | 62 ++++++++++--------- datapath/vport-internal_dev.c | 3 +- 7 files changed, 62 insertions(+), 33 deletions(-) create mode 100644 datapath/linux/compat/include/linux/netdev_features.h
diff --git a/datapath/actions.c b/datapath/actions.c index 0a2def6..4347f69 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -100,7 +100,7 @@ static int pop_vlan(struct sk_buff *skb) if (unlikely(err)) return err; - __vlan_hwaccel_put_tag(skb, ntohs(tci)); + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(tci)); return 0; } @@ -120,7 +120,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla + (2 * ETH_ALEN), VLAN_HLEN, 0)); } - __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); + __vlan_hwaccel_put_tag(skb, vlan->vlan_tpid, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); return 0; } diff --git a/datapath/datapath.c b/datapath/datapath.c index e5e0616..4c5bd2c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -63,7 +63,7 @@ #include "vport-netdev.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \ - LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) + LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) #error Kernels before 2.6.18 or after 3.9 are not supported by this version of Open vSwitch. #endif diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk index edaeabb..5f9c792 100644 --- a/datapath/linux/Modules.mk +++ b/datapath/linux/Modules.mk @@ -48,6 +48,7 @@ openvswitch_headers += \ linux/compat/include/linux/mutex.h \ linux/compat/include/linux/net.h \ linux/compat/include/linux/netdevice.h \ + linux/compat/include/linux/netdev_features.h \ linux/compat/include/linux/netfilter_bridge.h \ linux/compat/include/linux/netfilter_ipv4.h \ linux/compat/include/linux/netlink.h \ diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h index b8b1961..b0fc167 100644 --- a/datapath/linux/compat/include/linux/if_vlan.h +++ b/datapath/linux/compat/include/linux/if_vlan.h @@ -89,4 +89,15 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vh skb->protocol = htons(ETH_P_802_2); } #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) +static inline struct sk_buff *rpl___vlan_hwaccel_put_tag(struct sk_buff *skb, + __be16 vlan_proto, + u16 vlan_tci) +{ + return __vlan_hwaccel_put_tag(skb, vlan_tci); +} +#define __vlan_hwaccel_put_tag rpl___vlan_hwaccel_put_tag +#endif + #endif /* linux/if_vlan.h wrapper */ diff --git a/datapath/linux/compat/include/linux/netdev_features.h b/datapath/linux/compat/include/linux/netdev_features.h new file mode 100644 index 0000000..0259413 --- /dev/null +++ b/datapath/linux/compat/include/linux/netdev_features.h @@ -0,0 +1,12 @@ +#ifndef __LINUX_NETDEV_FEATURES_WRAPPER_H +#define __LINUX_NETDEV_FEATURES_WRAPPER_H + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) +#include_next <linux/netdev_features.h> +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) +#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX +#endif + +#endif diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h index bd0c3d4..5f46aed 100644 --- a/datapath/linux/compat/include/net/gre.h +++ b/datapath/linux/compat/include/net/gre.h @@ -21,41 +21,13 @@ int gre_del_protocol(const struct gre_protocol *proto, u8 version); #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) struct gre_base_hdr { __be16 flags; __be16 protocol; }; #define GRE_HEADER_SECTION 4 -#define MAX_GRE_PROTO_PRIORITY 255 -struct gre_cisco_protocol { - int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi); - u8 priority; -}; - -#define gre_build_header rpl_gre_build_header -void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, - int hdr_len); - -#define gre_handle_offloads rpl_gre_handle_offloads -struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum); - -int gre_cisco_register(struct gre_cisco_protocol *proto); -int gre_cisco_unregister(struct gre_cisco_protocol *proto); - -static inline int ip_gre_calc_hlen(__be16 o_flags) -{ - int addend = 4; - - if (o_flags & TUNNEL_CSUM) - addend += 4; - if (o_flags & TUNNEL_KEY) - addend += 4; - if (o_flags & TUNNEL_SEQ) - addend += 4; - return addend; -} - static inline __be16 gre_flags_to_tnl_flags(__be16 flags) { __be16 tflags = 0; @@ -99,4 +71,36 @@ static inline __be16 tnl_flags_to_gre_flags(__be16 tflags) return flags; } +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */ + +#define MAX_GRE_PROTO_PRIORITY 255 +struct gre_cisco_protocol { + int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi); + u8 priority; +}; + +int gre_cisco_register(struct gre_cisco_protocol *proto); +int gre_cisco_unregister(struct gre_cisco_protocol *proto); + +#define gre_build_header rpl_gre_build_header +void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, + int hdr_len); + +#define gre_handle_offloads rpl_gre_handle_offloads +struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum); + +static inline int ip_gre_calc_hlen(__be16 o_flags) +{ + int addend = 4; + + if (o_flags & TUNNEL_CSUM) + addend += 4; + if (o_flags & TUNNEL_KEY) + addend += 4; + if (o_flags & TUNNEL_SEQ) + addend += 4; + return addend; +} + + #endif diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index 9ee1c42..db55ee0 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -22,6 +22,7 @@ #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/ethtool.h> +#include <linux/netdev_features.h> #include <linux/skbuff.h> #include <linux/version.h> @@ -188,7 +189,7 @@ static void do_setup(struct net_device *netdev) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) netdev->vlan_features = netdev->features; - netdev->features |= NETIF_F_HW_VLAN_TX; + netdev->features |= NETIF_F_HW_VLAN_CTAG_TX; #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) -- 1.7.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev