From bedf02f45b3614b6217a7be167cc13cd50b533cf Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Mon, 20 Apr 2015 18:19:53 -0700 Subject: [PATCH] datapath: Prevent linker error of unknown symbol. With the latest change of separating vports into their own modules, it is necessary to export all public functions in linux/compat/ directory. Also, we should prefix functions which replace the upstream ones with 'rpl_' and others with 'ovs_'. This will prevent the linker error when vport modules use those functions in the future. e.g., the to be merged vport-stt module will use the flex_array_* functions which are not currently exported. Co-authored-by: Tuan Nguyen Signed-off-by: Alex Wang Acked-by: Jesse Gross --- AUTHORS | 1 + datapath/linux/compat/dev-openvswitch.c | 20 ++++++---- datapath/linux/compat/exthdrs_core.c | 2 + datapath/linux/compat/flex_array.c | 27 +++++++++----- datapath/linux/compat/flow_dissector.c | 5 ++- datapath/linux/compat/genetlink-openvswitch.c | 3 ++ datapath/linux/compat/geneve.c | 24 ++++++------ datapath/linux/compat/gre.c | 16 ++++---- datapath/linux/compat/gso.c | 3 ++ datapath/linux/compat/gso.h | 2 +- .../linux/compat/include/linux/flex_array.h | 37 ++++++++++++++----- datapath/linux/compat/include/linux/ip.h | 1 + datapath/linux/compat/include/linux/net.h | 3 +- .../linux/compat/include/linux/netdevice.h | 21 ++++++----- .../compat/include/linux/reciprocal_div.h | 4 +- datapath/linux/compat/include/linux/skbuff.h | 13 ++++--- datapath/linux/compat/include/net/checksum.h | 7 ++-- datapath/linux/compat/include/net/genetlink.h | 6 +-- datapath/linux/compat/include/net/geneve.h | 21 ++++++----- datapath/linux/compat/include/net/gre.h | 10 ++--- .../linux/compat/include/net/ip_tunnels.h | 11 +++--- datapath/linux/compat/include/net/ipv6.h | 8 ++-- .../linux/compat/include/net/net_namespace.h | 6 ++- datapath/linux/compat/include/net/udp.h | 5 ++- .../linux/compat/include/net/udp_tunnel.h | 21 ++++++----- datapath/linux/compat/include/net/vxlan.h | 18 ++++----- datapath/linux/compat/ip_tunnels_core.c | 8 ++-- datapath/linux/compat/net_namespace.c | 7 +++- datapath/linux/compat/netdevice.c | 2 + datapath/linux/compat/reciprocal_div.c | 4 +- datapath/linux/compat/skbuff-openvswitch.c | 16 +++++--- datapath/linux/compat/udp.c | 5 ++- datapath/linux/compat/udp_tunnel.c | 26 ++++++------- datapath/linux/compat/utils.c | 12 ++++-- datapath/linux/compat/vxlan.c | 24 ++++++------ 35 files changed, 237 insertions(+), 162 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8973decb8..16e76b45b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -170,6 +170,7 @@ Thomas Lacroix thomas.lacroix@citrix.com Todd Deshane deshantm@gmail.com Tom Everman teverman@google.com Tsvi Slonim tsvi@toroki.com +Tuan Nguyen tuan.nguyen@veriksystems.com Tyler Coumbes coumbes@gmail.com Valient Gough vgough@pobox.com Vivien Bernet-Rollande vbr@soprive.net diff --git a/datapath/linux/compat/dev-openvswitch.c b/datapath/linux/compat/dev-openvswitch.c index 1035fe83d..256d58175 100644 --- a/datapath/linux/compat/dev-openvswitch.c +++ b/datapath/linux/compat/dev-openvswitch.c @@ -39,9 +39,9 @@ void dev_disable_lro(struct net_device *dev) { } static int nr_bridges; #ifdef HAVE_RHEL_OVS_HOOK -int netdev_rx_handler_register(struct net_device *dev, - openvswitch_handle_frame_hook_t *hook, - void *rx_handler_data) +int rpl_netdev_rx_handler_register(struct net_device *dev, + openvswitch_handle_frame_hook_t *hook, + void *rx_handler_data) { nr_bridges++; rcu_assign_pointer(dev->ax25_ptr, rx_handler_data); @@ -50,12 +50,13 @@ int netdev_rx_handler_register(struct net_device *dev, rcu_assign_pointer(openvswitch_handle_frame_hook, hook); return 0; } +EXPORT_SYMBOL_GPL(rpl_netdev_rx_handler_register); #else -int netdev_rx_handler_register(struct net_device *dev, - struct sk_buff *(*hook)(struct net_bridge_port *p, - struct sk_buff *skb), - void *rx_handler_data) +int rpl_netdev_rx_handler_register(struct net_device *dev, + struct sk_buff *(*hook)(struct net_bridge_port *p, + struct sk_buff *skb), + void *rx_handler_data) { nr_bridges++; if (dev->br_port) @@ -67,9 +68,10 @@ int netdev_rx_handler_register(struct net_device *dev, br_handle_frame_hook = hook; return 0; } +EXPORT_SYMBOL_GPL(rpl_netdev_rx_handler_register); #endif -void netdev_rx_handler_unregister(struct net_device *dev) +void rpl_netdev_rx_handler_unregister(struct net_device *dev) { nr_bridges--; #ifdef HAVE_RHEL_OVS_HOOK @@ -88,4 +90,6 @@ void netdev_rx_handler_unregister(struct net_device *dev) br_handle_frame_hook = NULL; #endif } +EXPORT_SYMBOL_GPL(rpl_netdev_rx_handler_unregister); + #endif diff --git a/datapath/linux/compat/exthdrs_core.c b/datapath/linux/compat/exthdrs_core.c index 56a17daaf..6692ce3f4 100644 --- a/datapath/linux/compat/exthdrs_core.c +++ b/datapath/linux/compat/exthdrs_core.c @@ -45,6 +45,7 @@ int rpl_ipv6_skip_exthdr(const struct sk_buff *skb, int start, *nexthdrp = nexthdr; return start; } +EXPORT_SYMBOL_GPL(rpl_ipv6_skip_exthdr); #endif /* Kernel version < 3.3 */ #ifndef HAVE_IP6_FH_F_SKIP_RH @@ -169,5 +170,6 @@ int rpl_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, *offset = start; return nexthdr; } +EXPORT_SYMBOL_GPL(rpl_ipv6_find_hdr); #endif diff --git a/datapath/linux/compat/flex_array.c b/datapath/linux/compat/flex_array.c index c39dd1b5f..ce73198ff 100644 --- a/datapath/linux/compat/flex_array.c +++ b/datapath/linux/compat/flex_array.c @@ -89,7 +89,7 @@ static inline int elements_fit_in_base(struct flex_array *fa) * capacity in the base structure. Also note that no effort is made * to efficiently pack objects across page boundaries. */ -struct flex_array *flex_array_alloc(int element_size, unsigned int total, +struct flex_array *rpl_flex_array_alloc(int element_size, unsigned int total, gfp_t flags) { struct flex_array *ret; @@ -118,6 +118,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total, FLEX_ARRAY_BASE_BYTES_LEFT); return ret; } +EXPORT_SYMBOL_GPL(rpl_flex_array_alloc); static int fa_element_to_part_nr(struct flex_array *fa, unsigned int element_nr) @@ -132,7 +133,7 @@ static int fa_element_to_part_nr(struct flex_array *fa, * This is to be used in cases where the base 'struct flex_array' * has been statically allocated and should not be free. */ -void flex_array_free_parts(struct flex_array *fa) +void rpl_flex_array_free_parts(struct flex_array *fa) { int part_nr; @@ -141,12 +142,14 @@ void flex_array_free_parts(struct flex_array *fa) for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) kfree(fa->parts[part_nr]); } +EXPORT_SYMBOL_GPL(rpl_flex_array_free_parts); -void flex_array_free(struct flex_array *fa) +void rpl_flex_array_free(struct flex_array *fa) { flex_array_free_parts(fa); kfree(fa); } +EXPORT_SYMBOL_GPL(rpl_flex_array_free); static unsigned int index_inside_part(struct flex_array *fa, unsigned int element_nr, @@ -191,7 +194,7 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags) * * Locking must be provided by the caller. */ -int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, +int rpl_flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, gfp_t flags) { int part_nr = 0; @@ -214,6 +217,7 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, memcpy(dst, src, fa->element_size); return 0; } +EXPORT_SYMBOL_GPL(rpl_flex_array_put); /** * flex_array_clear - clear element in array at @element_nr @@ -222,7 +226,7 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, * * Locking must be provided by the caller. */ -int flex_array_clear(struct flex_array *fa, unsigned int element_nr) +int rpl_flex_array_clear(struct flex_array *fa, unsigned int element_nr) { int part_nr = 0; struct flex_array_part *part; @@ -244,6 +248,7 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr) memset(dst, FLEX_ARRAY_FREE, fa->element_size); return 0; } +EXPORT_SYMBOL_GPL(rpl_flex_array_clear); /** * flex_array_prealloc - guarantee that array space exists @@ -260,7 +265,7 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr) * * Locking must be provided by the caller. */ -int flex_array_prealloc(struct flex_array *fa, unsigned int start, +int rpl_flex_array_prealloc(struct flex_array *fa, unsigned int start, unsigned int nr_elements, gfp_t flags) { int start_part; @@ -293,6 +298,7 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start, } return 0; } +EXPORT_SYMBOL_GPL(rpl_flex_array_prealloc); /** * flex_array_get - pull data back out of the array @@ -306,7 +312,7 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start, * * Locking must be provided by the caller. */ -void *flex_array_get(struct flex_array *fa, unsigned int element_nr) +void *rpl_flex_array_get(struct flex_array *fa, unsigned int element_nr) { int part_nr = 0; struct flex_array_part *part; @@ -325,6 +331,7 @@ void *flex_array_get(struct flex_array *fa, unsigned int element_nr) } return &part->elements[index_inside_part(fa, element_nr, part_nr)]; } +EXPORT_SYMBOL_GPL(rpl_flex_array_get); /** * flex_array_get_ptr - pull a ptr back out of the array @@ -335,7 +342,7 @@ void *flex_array_get(struct flex_array *fa, unsigned int element_nr) * flex_array_put_ptr(). This function should not be called if the * element in question was not set using the _put_ptr() helper. */ -void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr) +void *rpl_flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr) { void **tmp; @@ -345,6 +352,7 @@ void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr) return *tmp; } +EXPORT_SYMBOL_GPL(rpl_flex_array_get_ptr); static int part_is_free(struct flex_array_part *part) { @@ -365,7 +373,7 @@ static int part_is_free(struct flex_array_part *part) * * Locking must be provided by the caller. */ -int flex_array_shrink(struct flex_array *fa) +int rpl_flex_array_shrink(struct flex_array *fa) { struct flex_array_part *part; int part_nr; @@ -387,5 +395,6 @@ int flex_array_shrink(struct flex_array *fa) } return ret; } +EXPORT_SYMBOL_GPL(rpl_flex_array_shrink); #endif /* Linux version < 3.0.0 */ diff --git a/datapath/linux/compat/flow_dissector.c b/datapath/linux/compat/flow_dissector.c index a68f84f52..3f42dba6c 100644 --- a/datapath/linux/compat/flow_dissector.c +++ b/datapath/linux/compat/flow_dissector.c @@ -204,7 +204,7 @@ static __always_inline u32 __flow_hash_3words(u32 a, u32 b, u32 c) return jhash_3words(a, b, c, hashrnd); } -u32 __skb_get_hash(struct sk_buff *skb) +u32 rpl__skb_get_rxhash(struct sk_buff *skb) { struct flow_keys keys; u32 hash; @@ -231,5 +231,6 @@ u32 __skb_get_hash(struct sk_buff *skb) #endif return hash; } -EXPORT_SYMBOL_GPL(__skb_get_hash); +EXPORT_SYMBOL_GPL(rpl__skb_get_rxhash); + #endif diff --git a/datapath/linux/compat/genetlink-openvswitch.c b/datapath/linux/compat/genetlink-openvswitch.c index ab149c35d..9aea99777 100644 --- a/datapath/linux/compat/genetlink-openvswitch.c +++ b/datapath/linux/compat/genetlink-openvswitch.c @@ -21,6 +21,7 @@ void rpl_genl_notify(struct rpl_genl_family *family, struct sk_buff *skb, genl_notify(skb, net, portid, group, nlh, flags); #endif } +EXPORT_SYMBOL_GPL(rpl_genl_notify); int rpl___genl_register_family(struct rpl_genl_family *f) { @@ -52,4 +53,6 @@ error: return err; } +EXPORT_SYMBOL_GPL(rpl___genl_register_family); + #endif /* kernel version < 3.13.0 */ diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c index 48a306e93..9ec161c67 100644 --- a/datapath/linux/compat/geneve.c +++ b/datapath/linux/compat/geneve.c @@ -81,11 +81,11 @@ static void geneve_build_header(struct genevehdr *geneveh, * * This function will add other UDP tunnel headers. */ -int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, - struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos, - __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port, - __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt, - bool csum, bool xnet) +int rpl_geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, + struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos, + __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port, + __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt, + bool csum, bool xnet) { struct genevehdr *gnvh; int min_headroom; @@ -118,7 +118,7 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, tos, ttl, df, src_port, dst_port, xnet, !csum); } -EXPORT_SYMBOL_GPL(geneve_xmit_skb); +EXPORT_SYMBOL_GPL(rpl_geneve_xmit_skb); /* Callback from net/ipv4/udp.c to receive packets */ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb) @@ -221,13 +221,13 @@ static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port, return gs; } -struct geneve_sock *geneve_sock_add(struct net *net, __be16 port, - geneve_rcv_t *rcv, void *data, - bool no_share, bool ipv6) +struct geneve_sock *rpl_geneve_sock_add(struct net *net, __be16 port, + geneve_rcv_t *rcv, void *data, + bool no_share, bool ipv6) { return geneve_socket_create(net, port, rcv, data, ipv6); } -EXPORT_SYMBOL_GPL(geneve_sock_add); +EXPORT_SYMBOL_GPL(rpl_geneve_sock_add); static void rcu_free_gs(struct rcu_head *rcu) { @@ -236,9 +236,9 @@ static void rcu_free_gs(struct rcu_head *rcu) kfree(gs); } -void geneve_sock_release(struct geneve_sock *gs) +void rpl_geneve_sock_release(struct geneve_sock *gs) { udp_tunnel_sock_release(gs->sock); call_rcu(&gs->rcu, rcu_free_gs); } -EXPORT_SYMBOL_GPL(geneve_sock_release); +EXPORT_SYMBOL_GPL(rpl_geneve_sock_release); diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c index 06956f049..e2a759151 100644 --- a/datapath/linux/compat/gre.c +++ b/datapath/linux/compat/gre.c @@ -236,7 +236,7 @@ static const struct gre_protocol ipgre_protocol = { .handler = gre_cisco_rcv, }; -int gre_cisco_register(struct gre_cisco_protocol *newp) +int rpl_gre_cisco_register(struct gre_cisco_protocol *newp) { int err; @@ -250,9 +250,9 @@ int gre_cisco_register(struct gre_cisco_protocol *newp) return (cmpxchg((struct gre_cisco_protocol **)&gre_cisco_proto, NULL, newp) == NULL) ? 0 : -EBUSY; } -EXPORT_SYMBOL_GPL(gre_cisco_register); +EXPORT_SYMBOL_GPL(rpl_gre_cisco_register); -int gre_cisco_unregister(struct gre_cisco_protocol *proto) +int rpl_gre_cisco_unregister(struct gre_cisco_protocol *proto) { int ret; @@ -266,7 +266,7 @@ int gre_cisco_unregister(struct gre_cisco_protocol *proto) ret = gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO); return ret; } -EXPORT_SYMBOL_GPL(gre_cisco_unregister); +EXPORT_SYMBOL_GPL(rpl_gre_cisco_unregister); #endif /* !HAVE_GRE_CISCO_REGISTER */ @@ -287,7 +287,7 @@ static void gre_csum_fix(struct sk_buff *skb) skb->len - gre_offset, 0)); } -struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum) +struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb, bool gre_csum) { int type = gre_csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE; gso_fix_segment_t fix_segment; @@ -299,14 +299,14 @@ struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum) return ovs_iptunnel_handle_offloads(skb, gre_csum, type, fix_segment); } -EXPORT_SYMBOL_GPL(gre_handle_offloads); +EXPORT_SYMBOL_GPL(rpl_gre_handle_offloads); static bool is_gre_gso(struct sk_buff *skb) { return skb_is_gso(skb); } -void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, +void rpl_gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, int hdr_len) { struct gre_base_hdr *greh; @@ -337,7 +337,7 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, ovs_skb_set_inner_protocol(skb, tpi->proto); } -EXPORT_SYMBOL_GPL(gre_build_header); +EXPORT_SYMBOL_GPL(rpl_gre_build_header); #endif /* CONFIG_NET_IPGRE_DEMUX */ diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c index cad9b182d..552e7485c 100644 --- a/datapath/linux/compat/gso.c +++ b/datapath/linux/compat/gso.c @@ -167,6 +167,7 @@ drop: kfree_skb(skb); return err; } +EXPORT_SYMBOL_GPL(rpl_dev_queue_xmit); #endif /* 3.16 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) @@ -296,4 +297,6 @@ int rpl_ip_local_out(struct sk_buff *skb) } return ret; } +EXPORT_SYMBOL_GPL(rpl_ip_local_out); + #endif /* 3.18 */ diff --git a/datapath/linux/compat/gso.h b/datapath/linux/compat/gso.h index dce4c67c8..8f5b07628 100644 --- a/datapath/linux/compat/gso.h +++ b/datapath/linux/compat/gso.h @@ -127,7 +127,7 @@ static inline __be16 ovs_skb_get_inner_protocol(struct sk_buff *skb) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) #define ip_local_out rpl_ip_local_out -int ip_local_out(struct sk_buff *skb); +int rpl_ip_local_out(struct sk_buff *skb); static inline int skb_inner_mac_offset(const struct sk_buff *skb) { diff --git a/datapath/linux/compat/include/linux/flex_array.h b/datapath/linux/compat/include/linux/flex_array.h index 443c4af3b..d1e1b831c 100644 --- a/datapath/linux/compat/include/linux/flex_array.h +++ b/datapath/linux/compat/include/linux/flex_array.h @@ -66,22 +66,39 @@ struct flex_array { FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \ } -struct flex_array *flex_array_alloc(int element_size, unsigned int total, +#define flex_array_alloc rpl_flex_array_alloc +struct flex_array *rpl_flex_array_alloc(int element_size, unsigned int total, gfp_t flags); -int flex_array_prealloc(struct flex_array *fa, unsigned int start, + +#define flex_array_prealloc rpl_flex_array_prealloc +int rpl_flex_array_prealloc(struct flex_array *fa, unsigned int start, unsigned int nr_elements, gfp_t flags); -void flex_array_free(struct flex_array *fa); -void flex_array_free_parts(struct flex_array *fa); -int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, + +#define flex_array_free rpl_flex_array_free +void rpl_flex_array_free(struct flex_array *fa); + +#define flex_array_free_parts rpl_flex_array_free_parts +void rpl_flex_array_free_parts(struct flex_array *fa); + +#define flex_array_put rpl_flex_array_put +int rpl_flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, gfp_t flags); -int flex_array_clear(struct flex_array *fa, unsigned int element_nr); -void *flex_array_get(struct flex_array *fa, unsigned int element_nr); -int flex_array_shrink(struct flex_array *fa); -#define flex_array_put_ptr(fa, nr, src, gfp) \ +#define flex_array_clear rpl_flex_array_clear +int rpl_flex_array_clear(struct flex_array *fa, unsigned int element_nr); + +#define flex_array_get rpl_flex_array_get +void *rpl_flex_array_get(struct flex_array *fa, unsigned int element_nr); + +#define flex_array_shrink rpl_flex_array_shrink +int rpl_flex_array_shrink(struct flex_array *fa); + +#define flex_array_put_ptr rpl_flex_array_put_ptr +#define rpl_flex_array_put_ptr(fa, nr, src, gfp) \ flex_array_put(fa, nr, (void *)&(src), gfp) -void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr); +#define flex_array_get_ptr rpl_flex_array_get_ptr +void *rpl_flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr); #endif /* Linux version < 3.0.0 */ #endif /* __LINUX_FLEX_ARRAY_WRAPPER_H */ diff --git a/datapath/linux/compat/include/linux/ip.h b/datapath/linux/compat/include/linux/ip.h index 6ff715240..c64306e08 100644 --- a/datapath/linux/compat/include/linux/ip.h +++ b/datapath/linux/compat/include/linux/ip.h @@ -5,6 +5,7 @@ #ifndef HAVE_SKBUFF_HEADER_HELPERS #include + static inline struct iphdr *ip_hdr(const struct sk_buff *skb) { return (struct iphdr *)skb_network_header(skb); diff --git a/datapath/linux/compat/include/linux/net.h b/datapath/linux/compat/include/linux/net.h index d8bf621ce..9c947454e 100644 --- a/datapath/linux/compat/include/linux/net.h +++ b/datapath/linux/compat/include/linux/net.h @@ -30,7 +30,8 @@ do { \ #endif #ifndef net_get_random_once -bool __net_get_random_once(void *buf, int nbytes, bool *done, +#define __net_get_random_once rpl___net_get_random_once +bool rpl___net_get_random_once(void *buf, int nbytes, bool *done, atomic_t *done_key); #define ___NET_RANDOM_STATIC_KEY_INIT ATOMIC_INIT(0) diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h index 43a04a432..38315c251 100644 --- a/datapath/linux/compat/include/linux/netdevice.h +++ b/datapath/linux/compat/include/linux/netdevice.h @@ -50,18 +50,21 @@ extern void dev_disable_lro(struct net_device *dev); typedef struct sk_buff *(openvswitch_handle_frame_hook_t)(struct sk_buff *skb); extern openvswitch_handle_frame_hook_t *openvswitch_handle_frame_hook; -int netdev_rx_handler_register(struct net_device *dev, - openvswitch_handle_frame_hook_t *hook, - void *rx_handler_data); +#define netdev_rx_handler_register rpl_netdev_rx_handler_register +int rpl_netdev_rx_handler_register(struct net_device *dev, + openvswitch_handle_frame_hook_t *hook, + void *rx_handler_data); #else -int netdev_rx_handler_register(struct net_device *dev, - struct sk_buff *(*netdev_hook)(struct net_bridge_port *p, - struct sk_buff *skb), - void *rx_handler_data); +#define netdev_rx_handler_register rpl_netdev_rx_handler_register +int rpl_netdev_rx_handler_register(struct net_device *dev, + struct sk_buff *(*netdev_hook)(struct net_bridge_port *p, + struct sk_buff *skb), + void *rx_handler_data); #endif -void netdev_rx_handler_unregister(struct net_device *dev); +#define netdev_rx_handler_unregister rpl_netdev_rx_handler_unregister +void rpl_netdev_rx_handler_unregister(struct net_device *dev); #endif #ifndef HAVE_DEV_GET_BY_INDEX_RCU @@ -138,7 +141,7 @@ static inline struct net_device *netdev_master_upper_dev_get(struct net_device * #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) #define dev_queue_xmit rpl_dev_queue_xmit -int dev_queue_xmit(struct sk_buff *skb); +int rpl_dev_queue_xmit(struct sk_buff *skb); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) diff --git a/datapath/linux/compat/include/linux/reciprocal_div.h b/datapath/linux/compat/include/linux/reciprocal_div.h index 2def5c6ca..f50d8e4ee 100644 --- a/datapath/linux/compat/include/linux/reciprocal_div.h +++ b/datapath/linux/compat/include/linux/reciprocal_div.h @@ -25,10 +25,10 @@ struct reciprocal_value { u8 sh1, sh2; }; -struct reciprocal_value reciprocal_value(u32 d); +struct reciprocal_value rpl_reciprocal_value(u32 d); #define reciprocal_divide rpl_reciprocal_divide -static inline u32 reciprocal_divide(u32 a, struct reciprocal_value R) +static inline u32 rpl_reciprocal_divide(u32 a, struct reciprocal_value R) { u32 t = (u32)(((u64)a * R.m) >> 32); return (t + ((a - t) >> R.sh1)) >> R.sh2; diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h index dc3fea852..0ae6c133f 100644 --- a/datapath/linux/compat/include/linux/skbuff.h +++ b/datapath/linux/compat/include/linux/skbuff.h @@ -315,13 +315,14 @@ static inline void skb_tx_error(struct sk_buff *skb) #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) -unsigned int skb_zerocopy_headlen(const struct sk_buff *from); +#define skb_zerocopy_headlen rpl_skb_zerocopy_headlen +unsigned int rpl_skb_zerocopy_headlen(const struct sk_buff *from); #endif #ifndef HAVE_SKB_ZEROCOPY #define skb_zerocopy rpl_skb_zerocopy -int skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, - int hlen); +int rpl_skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, + int hlen); #endif #ifndef HAVE_SKB_CLEAR_HASH @@ -354,17 +355,17 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, #ifndef HAVE_SKB_ENSURE_WRITABLE #define skb_ensure_writable rpl_skb_ensure_writable -int skb_ensure_writable(struct sk_buff *skb, int write_len); +int rpl_skb_ensure_writable(struct sk_buff *skb, int write_len); #endif #ifndef HAVE_SKB_VLAN_POP #define skb_vlan_pop rpl_skb_vlan_pop -int skb_vlan_pop(struct sk_buff *skb); +int rpl_skb_vlan_pop(struct sk_buff *skb); #endif #ifndef HAVE_SKB_VLAN_PUSH #define skb_vlan_push rpl_skb_vlan_push -int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); +int rpl_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); #endif #endif diff --git a/datapath/linux/compat/include/net/checksum.h b/datapath/linux/compat/include/net/checksum.h index a40de4019..398df9324 100644 --- a/datapath/linux/compat/include/net/checksum.h +++ b/datapath/linux/compat/include/net/checksum.h @@ -37,8 +37,9 @@ static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) -void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, - const __be32 *from, const __be32 *to, - int pseudohdr); +#define inet_proto_csum_replace16 rpl_inet_proto_csum_replace16 +void rpl_inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, + const __be32 *from, const __be32 *to, + int pseudohdr); #endif #endif /* checksum.h */ diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h index edf681562..cf89d4c23 100644 --- a/datapath/linux/compat/include/net/genetlink.h +++ b/datapath/linux/compat/include/net/genetlink.h @@ -45,9 +45,9 @@ struct rpl_genl_family { #define genl_family rpl_genl_family #define genl_notify rpl_genl_notify -void genl_notify(struct genl_family *family, - struct sk_buff *skb, struct net *net, u32 portid, u32 group, - struct nlmsghdr *nlh, gfp_t flags); +void rpl_genl_notify(struct genl_family *family, + struct sk_buff *skb, struct net *net, u32 portid, u32 group, + struct nlmsghdr *nlh, gfp_t flags); static inline void *rpl_genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, struct genl_family *family, int flags, u8 cmd) diff --git a/datapath/linux/compat/include/net/geneve.h b/datapath/linux/compat/include/net/geneve.h index 402ef38a2..452dddbc3 100644 --- a/datapath/linux/compat/include/net/geneve.h +++ b/datapath/linux/compat/include/net/geneve.h @@ -77,17 +77,20 @@ struct geneve_sock { #define GENEVE_VER 0 #define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr)) -struct geneve_sock *geneve_sock_add(struct net *net, __be16 port, - geneve_rcv_t *rcv, void *data, - bool no_share, bool ipv6); +#define geneve_sock_add rpl_geneve_sock_add +struct geneve_sock *rpl_geneve_sock_add(struct net *net, __be16 port, + geneve_rcv_t *rcv, void *data, + bool no_share, bool ipv6); -void geneve_sock_release(struct geneve_sock *vs); +#define geneve_sock_release rpl_geneve_sock_release +void rpl_geneve_sock_release(struct geneve_sock *vs); -int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, - struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos, - __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port, - __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt, - bool csum, bool xnet); +#define geneve_xmit_skb rpl_geneve_xmit_skb +int rpl_geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, + struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos, + __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port, + __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt, + bool csum, bool xnet); #endif /*ifdef CONFIG_INET */ #endif /*ifdef__NET_GENEVE_WRAPPER_H */ diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h index 08f6ee1b1..f572ac94e 100644 --- a/datapath/linux/compat/include/net/gre.h +++ b/datapath/linux/compat/include/net/gre.h @@ -23,10 +23,10 @@ struct gre_cisco_protocol { }; #define gre_cisco_register rpl_gre_cisco_register -int gre_cisco_register(struct gre_cisco_protocol *proto); +int rpl_gre_cisco_register(struct gre_cisco_protocol *proto); #define gre_cisco_unregister rpl_gre_cisco_unregister -int gre_cisco_unregister(struct gre_cisco_protocol *proto); +int rpl_gre_cisco_unregister(struct gre_cisco_protocol *proto); #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) struct gre_base_hdr { @@ -84,11 +84,11 @@ static inline __be16 tnl_flags_to_gre_flags(__be16 tflags) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) #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); +void rpl_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); +struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb, bool gre_csum); #define ip_gre_calc_hlen rpl_ip_gre_calc_hlen static inline int ip_gre_calc_hlen(__be16 o_flags) diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index bb96ec318..3ed6f9193 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -24,12 +24,12 @@ struct sk_buff *ovs_iptunnel_handle_offloads(struct sk_buff *skb, void (*fix_segment)(struct sk_buff *)); #define iptunnel_xmit rpl_iptunnel_xmit -int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, - __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl, - __be16 df, bool xnet); +int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, + __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl, + __be16 df, bool xnet); #define iptunnel_pull_header rpl_iptunnel_pull_header -int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); +int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); #else @@ -80,6 +80,7 @@ struct tnl_ptk_info { #undef TUNNEL_OPTIONS_PRESENT #define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT) -bool skb_is_encapsulated(struct sk_buff *skb); +#define skb_is_encapsulated ovs_skb_is_encapsulated +bool ovs_skb_is_encapsulated(struct sk_buff *skb); #endif /* __NET_IP_TUNNELS_H */ diff --git a/datapath/linux/compat/include/net/ipv6.h b/datapath/linux/compat/include/net/ipv6.h index 450e3079a..18c7d301e 100644 --- a/datapath/linux/compat/include/net/ipv6.h +++ b/datapath/linux/compat/include/net/ipv6.h @@ -11,8 +11,8 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) #define ipv6_skip_exthdr rpl_ipv6_skip_exthdr -extern int ipv6_skip_exthdr(const struct sk_buff *skb, int start, - u8 *nexthdrp, __be16 *frag_offp); +extern int rpl_ipv6_skip_exthdr(const struct sk_buff *skb, int start, + u8 *nexthdrp, __be16 *frag_offp); #endif #ifndef HAVE_IP6_FH_F_SKIP_RH @@ -28,8 +28,8 @@ enum { * IP6_FH_F_SKIP_RH. */ #define ipv6_find_hdr rpl_ipv6_find_hdr -extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, - int target, unsigned short *fragoff, int *fragflg); +extern int rpl_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, + int target, unsigned short *fragoff, int *fragflg); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h index be64093dd..b7dbfe3fb 100644 --- a/datapath/linux/compat/include/net/net_namespace.h +++ b/datapath/linux/compat/include/net/net_namespace.h @@ -17,8 +17,10 @@ struct rpl_pernet_operations { #define register_pernet_device rpl_register_pernet_gen_device #define unregister_pernet_device rpl_unregister_pernet_gen_device -int compat_init_net(struct net *net, struct rpl_pernet_operations *pnet); -void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet); +#define compat_init_net ovs_compat_init_net +int ovs_compat_init_net(struct net *net, struct rpl_pernet_operations *pnet); +#define compat_exit_net ovs_compat_exit_net +void ovs_compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet); #define DEFINE_COMPAT_PNET_REG_FUNC(TYPE) \ \ diff --git a/datapath/linux/compat/include/net/udp.h b/datapath/linux/compat/include/net/udp.h index 02eb68878..fcb8f6a8e 100644 --- a/datapath/linux/compat/include/net/udp.h +++ b/datapath/linux/compat/include/net/udp.h @@ -55,8 +55,9 @@ static inline __sum16 udp_v4_check(int len, __be32 saddr, #endif #ifndef HAVE_UDP_SET_CSUM -void udp_set_csum(bool nocheck, struct sk_buff *skb, - __be32 saddr, __be32 daddr, int len); +#define udp_set_csum rpl_udp_set_csum +void rpl_udp_set_csum(bool nocheck, struct sk_buff *skb, + __be32 saddr, __be32 daddr, int len); #endif #endif diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h index 6c25ca54b..cf4d464fe 100644 --- a/datapath/linux/compat/include/net/udp_tunnel.h +++ b/datapath/linux/compat/include/net/udp_tunnel.h @@ -50,8 +50,8 @@ struct udp_port_cfg { }; #define udp_sock_create rpl_udp_sock_create -int udp_sock_create(struct net *net, struct udp_port_cfg *cfg, - struct socket **sockp); +int rpl_udp_sock_create(struct net *net, struct udp_port_cfg *cfg, + struct socket **sockp); typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb); typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk); @@ -65,17 +65,20 @@ struct udp_tunnel_sock_cfg { }; /* Setup the given (UDP) sock to receive UDP encapsulated packets */ -void setup_udp_tunnel_sock(struct net *net, struct socket *sock, - struct udp_tunnel_sock_cfg *sock_cfg); +#define setup_udp_tunnel_sock rpl_setup_udp_tunnel_sock +void rpl_setup_udp_tunnel_sock(struct net *net, struct socket *sock, + struct udp_tunnel_sock_cfg *sock_cfg); /* Transmit the skb using UDP encapsulation. */ -int udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb, - __be32 src, __be32 dst, __u8 tos, __u8 ttl, - __be16 df, __be16 src_port, __be16 dst_port, - bool xnet, bool nocheck); +#define udp_tunnel_xmit_skb rpl_udp_tunnel_xmit_skb +int rpl_udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb, + __be32 src, __be32 dst, __u8 tos, __u8 ttl, + __be16 df, __be16 src_port, __be16 dst_port, + bool xnet, bool nocheck); -void udp_tunnel_sock_release(struct socket *sock); +#define udp_tunnel_sock_release rpl_udp_tunnel_sock_release +void rpl_udp_tunnel_sock_release(struct socket *sock); void ovs_udp_gso(struct sk_buff *skb); void ovs_udp_csum_gso(struct sk_buff *skb); diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h index 7511c2e85..0d60c189c 100644 --- a/datapath/linux/compat/include/net/vxlan.h +++ b/datapath/linux/compat/include/net/vxlan.h @@ -130,19 +130,19 @@ struct vxlan_sock { }; #define vxlan_sock_add rpl_vxlan_sock_add -struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, - vxlan_rcv_t *rcv, void *data, - bool no_share, u32 flags); +struct vxlan_sock *rpl_vxlan_sock_add(struct net *net, __be16 port, + vxlan_rcv_t *rcv, void *data, + bool no_share, u32 flags); #define vxlan_sock_release rpl_vxlan_sock_release -void vxlan_sock_release(struct vxlan_sock *vs); +void rpl_vxlan_sock_release(struct vxlan_sock *vs); #define vxlan_xmit_skb rpl_vxlan_xmit_skb -int vxlan_xmit_skb(struct vxlan_sock *vs, - struct rtable *rt, struct sk_buff *skb, - __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, - __be16 src_port, __be16 dst_port, - struct vxlan_metadata *md, bool xnet, u32 vxflags); +int rpl_vxlan_xmit_skb(struct vxlan_sock *vs, + struct rtable *rt, struct sk_buff *skb, + __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, + __be16 src_port, __be16 dst_port, + struct vxlan_metadata *md, bool xnet, u32 vxflags); #endif /* !HAVE_VXLAN_METADATA */ #endif diff --git a/datapath/linux/compat/ip_tunnels_core.c b/datapath/linux/compat/ip_tunnels_core.c index f2c4ffd67..8ff7cd79f 100644 --- a/datapath/linux/compat/ip_tunnels_core.c +++ b/datapath/linux/compat/ip_tunnels_core.c @@ -135,7 +135,7 @@ error: } EXPORT_SYMBOL_GPL(ovs_iptunnel_handle_offloads); -int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto) +int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto) { if (unlikely(!pskb_may_pull(skb, hdr_len))) return -ENOMEM; @@ -168,15 +168,15 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto) skb->pkt_type = PACKET_HOST; return 0; } -EXPORT_SYMBOL_GPL(iptunnel_pull_header); +EXPORT_SYMBOL_GPL(rpl_iptunnel_pull_header); #endif -bool skb_is_encapsulated(struct sk_buff *skb) +bool ovs_skb_is_encapsulated(struct sk_buff *skb) { /* checking for inner protocol should be sufficient on newer kernel, but * old kernel just set encapsulation bit. */ return ovs_skb_get_inner_protocol(skb) || skb_encapsulation(skb); } -EXPORT_SYMBOL_GPL(skb_is_encapsulated); +EXPORT_SYMBOL_GPL(ovs_skb_is_encapsulated); diff --git a/datapath/linux/compat/net_namespace.c b/datapath/linux/compat/net_namespace.c index 1fba3b124..4a9b1d648 100644 --- a/datapath/linux/compat/net_namespace.c +++ b/datapath/linux/compat/net_namespace.c @@ -5,7 +5,7 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) -int compat_init_net(struct net *net, struct rpl_pernet_operations *pnet) +int ovs_compat_init_net(struct net *net, struct rpl_pernet_operations *pnet) { int err; void *ovs_net = kzalloc(pnet->size, GFP_KERNEL); @@ -28,8 +28,9 @@ err: kfree(ovs_net); return err; } +EXPORT_SYMBOL_GPL(ovs_compat_init_net); -void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet) +void ovs_compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet) { void *ovs_net = net_generic(net, *pnet->id); @@ -37,4 +38,6 @@ void compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet) pnet->exit(net); kfree(ovs_net); } +EXPORT_SYMBOL_GPL(ovs_compat_exit_net); + #endif diff --git a/datapath/linux/compat/netdevice.c b/datapath/linux/compat/netdevice.c index 1fb60f535..7bb8f7793 100644 --- a/datapath/linux/compat/netdevice.c +++ b/datapath/linux/compat/netdevice.c @@ -72,6 +72,7 @@ netdev_features_t rpl_netif_skb_features(struct sk_buff *skb) return harmonize_features(skb, protocol, features); } } +EXPORT_SYMBOL_GPL(rpl_netif_skb_features); #endif /* kernel version < 2.6.38 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) @@ -107,4 +108,5 @@ struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, return skb_gso; } EXPORT_SYMBOL_GPL(rpl_skb_gso_segment); + #endif /* kernel version < 3.16.0 */ diff --git a/datapath/linux/compat/reciprocal_div.c b/datapath/linux/compat/reciprocal_div.c index 90ce7b1ca..818502a0f 100644 --- a/datapath/linux/compat/reciprocal_div.c +++ b/datapath/linux/compat/reciprocal_div.c @@ -1,5 +1,6 @@ #include #include +#include #include /* @@ -7,7 +8,7 @@ * include/linux/reciprocal_div.h */ -struct reciprocal_value reciprocal_value(u32 d) +struct reciprocal_value rpl_reciprocal_value(u32 d) { struct reciprocal_value R; u64 m; @@ -23,3 +24,4 @@ struct reciprocal_value reciprocal_value(u32 d) return R; } +EXPORT_SYMBOL_GPL(rpl_reciprocal_value); diff --git a/datapath/linux/compat/skbuff-openvswitch.c b/datapath/linux/compat/skbuff-openvswitch.c index 23d8d296a..3ecf1fe29 100644 --- a/datapath/linux/compat/skbuff-openvswitch.c +++ b/datapath/linux/compat/skbuff-openvswitch.c @@ -37,7 +37,7 @@ static inline bool head_frag(const struct sk_buff *skb) * into skb_zerocopy(). */ unsigned int -skb_zerocopy_headlen(const struct sk_buff *from) +rpl_skb_zerocopy_headlen(const struct sk_buff *from) { unsigned int hlen = 0; @@ -51,6 +51,7 @@ skb_zerocopy_headlen(const struct sk_buff *from) return hlen; } +EXPORT_SYMBOL_GPL(rpl_skb_zerocopy_headlen); #ifndef HAVE_SKB_ZEROCOPY /** @@ -72,7 +73,7 @@ skb_zerocopy_headlen(const struct sk_buff *from) * -EFAULT: skb_copy_bits() found some problem with skb geometry */ int -skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen) +rpl_skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen) { int i, j = 0; int plen = 0; /* length of skb->head fragment */ @@ -125,11 +126,12 @@ skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen) return 0; } +EXPORT_SYMBOL_GPL(rpl_skb_zerocopy); #endif #endif #ifndef HAVE_SKB_ENSURE_WRITABLE -int skb_ensure_writable(struct sk_buff *skb, int write_len) +int rpl_skb_ensure_writable(struct sk_buff *skb, int write_len) { if (!pskb_may_pull(skb, write_len)) return -ENOMEM; @@ -139,6 +141,7 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len) return pskb_expand_head(skb, 0, 0, GFP_ATOMIC); } +EXPORT_SYMBOL_GPL(rpl_skb_ensure_writable); #endif #ifndef HAVE_SKB_VLAN_POP @@ -175,7 +178,7 @@ pull: return err; } -int skb_vlan_pop(struct sk_buff *skb) +int rpl_skb_vlan_pop(struct sk_buff *skb) { u16 vlan_tci; __be16 vlan_proto; @@ -207,10 +210,11 @@ int skb_vlan_pop(struct sk_buff *skb) __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); return 0; } +EXPORT_SYMBOL_GPL(rpl_skb_vlan_pop); #endif #ifndef HAVE_SKB_VLAN_PUSH -int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) +int rpl_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) { if (skb_vlan_tag_present(skb)) { unsigned int offset = skb->data - skb_mac_header(skb); @@ -235,6 +239,7 @@ int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); return 0; } +EXPORT_SYMBOL_GPL(rpl_skb_vlan_push); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) @@ -260,4 +265,5 @@ int rpl_pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, return 0; } EXPORT_SYMBOL(rpl_pskb_expand_head); + #endif diff --git a/datapath/linux/compat/udp.c b/datapath/linux/compat/udp.c index 834a86b71..487d317bb 100644 --- a/datapath/linux/compat/udp.c +++ b/datapath/linux/compat/udp.c @@ -7,8 +7,8 @@ /* Function to set UDP checksum for an IPv4 UDP packet. This is intended * for the simple case like when setting the checksum for a UDP tunnel. */ -void udp_set_csum(bool nocheck, struct sk_buff *skb, - __be32 saddr, __be32 daddr, int len) +void rpl_udp_set_csum(bool nocheck, struct sk_buff *skb, + __be32 saddr, __be32 daddr, int len) { struct udphdr *uh = udp_hdr(skb); @@ -39,5 +39,6 @@ void udp_set_csum(bool nocheck, struct sk_buff *skb, skb->ip_summed = CHECKSUM_UNNECESSARY; } } +EXPORT_SYMBOL_GPL(rpl_udp_set_csum); #endif /* Linux version < 3.16 */ diff --git a/datapath/linux/compat/udp_tunnel.c b/datapath/linux/compat/udp_tunnel.c index f64011387..0c7b2e659 100644 --- a/datapath/linux/compat/udp_tunnel.c +++ b/datapath/linux/compat/udp_tunnel.c @@ -13,8 +13,8 @@ #include #include -int udp_sock_create(struct net *net, struct udp_port_cfg *cfg, - struct socket **sockp) +int rpl_udp_sock_create(struct net *net, struct udp_port_cfg *cfg, + struct socket **sockp) { int err; struct socket *sock = NULL; @@ -95,10 +95,10 @@ error: *sockp = NULL; return err; } -EXPORT_SYMBOL_GPL(udp_sock_create); +EXPORT_SYMBOL_GPL(rpl_udp_sock_create); -void setup_udp_tunnel_sock(struct net *net, struct socket *sock, - struct udp_tunnel_sock_cfg *cfg) +void rpl_setup_udp_tunnel_sock(struct net *net, struct socket *sock, + struct udp_tunnel_sock_cfg *cfg) { struct sock *sk = sock->sk; @@ -115,7 +115,7 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock, udp_tunnel_encap_enable(sock); } -EXPORT_SYMBOL_GPL(setup_udp_tunnel_sock); +EXPORT_SYMBOL_GPL(rpl_setup_udp_tunnel_sock); void ovs_udp_gso(struct sk_buff *skb) { @@ -142,10 +142,10 @@ void ovs_udp_csum_gso(struct sk_buff *skb) } EXPORT_SYMBOL_GPL(ovs_udp_csum_gso); -int udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb, - __be32 src, __be32 dst, __u8 tos, __u8 ttl, - __be16 df, __be16 src_port, __be16 dst_port, - bool xnet, bool nocheck) +int rpl_udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb, + __be32 src, __be32 dst, __u8 tos, __u8 ttl, + __be16 df, __be16 src_port, __be16 dst_port, + bool xnet, bool nocheck) { struct udphdr *uh; @@ -162,14 +162,14 @@ int udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb, return iptunnel_xmit(skb->sk, rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df, xnet); } -EXPORT_SYMBOL_GPL(udp_tunnel_xmit_skb); +EXPORT_SYMBOL_GPL(rpl_udp_tunnel_xmit_skb); -void udp_tunnel_sock_release(struct socket *sock) +void rpl_udp_tunnel_sock_release(struct socket *sock) { rcu_assign_sk_user_data(sock->sk, NULL); kernel_sock_shutdown(sock, SHUT_RDWR); sk_release_kernel(sock->sk); } -EXPORT_SYMBOL_GPL(udp_tunnel_sock_release); +EXPORT_SYMBOL_GPL(rpl_udp_tunnel_sock_release); #endif /* Linux version < 3.20 */ diff --git a/datapath/linux/compat/utils.c b/datapath/linux/compat/utils.c index 9404e20f4..0ee6e803a 100644 --- a/datapath/linux/compat/utils.c +++ b/datapath/linux/compat/utils.c @@ -19,9 +19,9 @@ #include #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) -void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, - const __be32 *from, const __be32 *to, - int pseudohdr) +void rpl_inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, + const __be32 *from, const __be32 *to, + int pseudohdr) { __be32 diff[] = { ~from[0], ~from[1], ~from[2], ~from[3], @@ -37,10 +37,12 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, *sum = ~csum_fold(csum_partial(diff, sizeof(diff), csum_unfold(*sum))); } +EXPORT_SYMBOL_GPL(rpl_inet_proto_csum_replace16); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) -bool __net_get_random_once(void *buf, int nbytes, bool *done, + +bool rpl___net_get_random_once(void *buf, int nbytes, bool *done, atomic_t *done_key) { static DEFINE_SPINLOCK(lock); @@ -60,4 +62,6 @@ bool __net_get_random_once(void *buf, int nbytes, bool *done, return true; } +EXPORT_SYMBOL_GPL(rpl___net_get_random_once); + #endif diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c index 51135fac7..129f1717e 100644 --- a/datapath/linux/compat/vxlan.c +++ b/datapath/linux/compat/vxlan.c @@ -180,11 +180,11 @@ static void vxlan_build_gbp_hdr(struct vxlanhdr *vxh, u32 vxflags, gbp->policy_id = htons(md->gbp & VXLAN_GBP_ID_MASK); } -int vxlan_xmit_skb(struct vxlan_sock *vs, - struct rtable *rt, struct sk_buff *skb, - __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, - __be16 src_port, __be16 dst_port, - struct vxlan_metadata *md, bool xnet, u32 vxflags) +int rpl_vxlan_xmit_skb(struct vxlan_sock *vs, + struct rtable *rt, struct sk_buff *skb, + __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, + __be16 src_port, __be16 dst_port, + struct vxlan_metadata *md, bool xnet, u32 vxflags) { struct vxlanhdr *vxh; int min_headroom; @@ -225,7 +225,7 @@ int vxlan_xmit_skb(struct vxlan_sock *vs, ttl, df, src_port, dst_port, xnet, !udp_sum); } -EXPORT_SYMBOL_GPL(vxlan_xmit_skb); +EXPORT_SYMBOL_GPL(rpl_vxlan_xmit_skb); static void rcu_free_vs(struct rcu_head *rcu) { @@ -308,20 +308,20 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port, return vs; } -struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, - vxlan_rcv_t *rcv, void *data, - bool no_share, u32 flags) +struct vxlan_sock *rpl_vxlan_sock_add(struct net *net, __be16 port, + vxlan_rcv_t *rcv, void *data, + bool no_share, u32 flags) { return vxlan_socket_create(net, port, rcv, data, flags); } -EXPORT_SYMBOL_GPL(vxlan_sock_add); +EXPORT_SYMBOL_GPL(rpl_vxlan_sock_add); -void vxlan_sock_release(struct vxlan_sock *vs) +void rpl_vxlan_sock_release(struct vxlan_sock *vs) { ASSERT_OVSL(); queue_work(system_wq, &vs->del_work); } -EXPORT_SYMBOL_GPL(vxlan_sock_release); +EXPORT_SYMBOL_GPL(rpl_vxlan_sock_release); #endif /* !USE_UPSTREAM_VXLAN */ -- 2.20.1