[ovs-dev] openvswitch: add support for kernel 4.4

Ryan Moats rmoats at us.ibm.com
Tue Mar 15 18:53:40 UTC 2016


"dev" <dev-bounces at openvswitch.org> wrote on 03/15/2016 11:21:16 AM:

> From: Ryan Moats/Omaha/IBM at IBMUS
> To: "ovs dev" <dev at openvswitch.org>
> Date: 03/15/2016 11:22 AM
> Subject: Re: [ovs-dev] [ovs-dev, RESEND] openvswitch: add support
> for kernel 4.4
> Sent by: "dev" <dev-bounces at openvswitch.org>
>
>
> Found a pair of places where the patch wasn't clean...
>
> ---- original message ----
> > diff --git a/datapath/linux/compat/include/net/ip.h
> b/datapath/linux/compat/include/net/ip.h
> > index cd87bcc..b749301 100644
> > --- a/datapath/linux/compat/include/net/ip.h
> > +++ b/datapath/linux/compat/include/net/ip.h
> > @@ -66,8 +66,20 @@  static inline unsigned int rpl_ip_skb_dst_mtu(const
> struct sk_buff *skb)
> >  #define ip_skb_dst_mtu rpl_ip_skb_dst_mtu
> >  #endif /* HAVE_IP_SKB_DST_MTU */
> >
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
> > +#define NET_PARAM(x) struct net *x,
> > +#define NET_ARG(x) x,
> > +#define NET_DEV_NET(x) dev_net(x)
> > +#define NET_DECLARE_INIT(x,y)
> > +#else
> > +#define NET_PARAM(x)
> > +#define NET_ARG(x)
> > +#define NET_DEV_NET(x)
> > +#define NET_DECLARE_INIT(x,y) struct net *x = y;
> > +#endif
> > +
> >  #ifdef HAVE_IP_FRAGMENT_TAKES_SOCK
> > -#define OVS_VPORT_OUTPUT_PARAMS struct sock *sock, struct sk_buff *skb
> > +#define OVS_VPORT_OUTPUT_PARAMS NET_PARAM(net) struct sock *sock,
struct
> sk_buff *skb
> >  #else
> >  #define OVS_VPORT_OUTPUT_PARAMS struct sk_buff *skb
> >  #endif
> > @@ -89,12 +101,13 @@  static inline bool ip_defrag_user_in_between(u32
> user,
> >  #endif /* < v4.2 */
> >
> >  #ifndef HAVE_IP_DO_FRAGMENT
> > -static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff
> *skb,
> > +static inline int rpl_ip_do_fragment(NET_PARAM(net) struct sock *sk,
> struct sk_buff *skb,
> >                                   int
> (*output)(OVS_VPORT_OUTPUT_PARAMS))
> >  {
> >         unsigned int mtu = ip_skb_dst_mtu(skb);
> >         struct iphdr *iph = ip_hdr(skb);
> >         struct rtable *rt = skb_rtable(skb);
> > +       NET_DECLARE_INIT(net, dev_net(dev));
> >         struct net_device *dev = rt->dst.dev;
> >
> >         if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->
> ignore_df) ||
> > @@ -102,7 +115,7 @@  static inline int rpl_ip_do_fragment(struct sock
> *sk, struct sk_buff *skb,
> >                      IPCB(skb)->frag_max_size > mtu))) {
> >
> >                pr_warn("Dropping packet in ip_do_fragment()\n");
> > -              IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
> > +              IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS);
> >                kfree_skb(skb);
> >                return -EMSGSIZE;
> >         }
> > @@ -116,8 +129,7 @@  static inline int rpl_ip_do_fragment(struct sock
> *sk, struct sk_buff *skb,
> >  #define ip_do_fragment rpl_ip_do_fragment
> >  #endif /* IP_DO_FRAGMENT */
> >
> > -int rpl_ip_defrag(struct sk_buff *skb, u32 user);
> > -#define ip_defrag rpl_ip_defrag
> > +int rpl_ip_defrag(NET_PARAM(net) struct sk_buff *skb, u32 user);
> >
> >  int __init rpl_ipfrag_init(void);
> >  void rpl_ipfrag_fini(void);
>
> The above hunk fails on the whitespace after the new rpl_ip_defrag
> definition
>
> > @@ -127,14 +139,15 @@  void rpl_ipfrag_fini(void);
> >   * ("inet: frag: Always orphan skbs inside ip_defrag()"), but it
should
> be
> >   * always included in kernels 4.5+. */
> >  #if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
> > -static inline int rpl_ip_defrag(struct sk_buff *skb, u32 user)
> > +static inline int rpl_ip_defrag(NET_PARAM(net) struct sk_buff *skb,
u32
> user)
> >  {
> >         skb_orphan(skb);
> > -       return ip_defrag(skb, user);
> > +       return ip_defrag(NET_ARG(net) skb, user);
> >  }
> > -#define ip_defrag rpl_ip_defrag
> >  #endif
> >
> > +#define ip_defrag rpl_ip_defrag
> > +
> >  static inline int rpl_ipfrag_init(void) { return 0; }
> >  static inline void rpl_ipfrag_fini(void) { }
> >  #endif /* HAVE_CORRECT_MRU_HANDLING && OVS_FRAGMENT_BACKPORT */
>
> [snip]
>
> > diff --git a/datapath/linux/compat/include/net/vxlan.h
> b/datapath/linux/compat/include/net/vxlan.h
> > index b50cd17..230f3ad 100644
> > --- a/datapath/linux/compat/include/net/vxlan.h
> > +++ b/datapath/linux/compat/include/net/vxlan.h
> > @@ -218,10 +218,20 @@  struct vxlan_dev {
> >  struct net_device *rpl_vxlan_dev_create(struct net *net, const char
> *name,
> >                                  u8 name_assign_type,
> struct vxlan_config *conf);
> >
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
> > +static inline __be16 vxlan_dev_dst_port(struct vxlan_dev *vxlan,
> > +                                   unsigned short
> family)
> > +{
> > +       if (family == AF_INET6)
> > +              return inet_sk(vxlan->vn6_sock->sock->sk)->
> inet_sport;
> > +       return inet_sk(vxlan->vn4_sock->sock->sk)->inet_sport;
> > +}
> > +#else
> >  static inline __be16 vxlan_dev_dst_port(struct vxlan_dev *vxlan)
> >  {
> >         return inet_sport(vxlan->vn_sock->sock->sk);
> >  }
> > +#endif
> >
> >  static inline netdev_features_t vxlan_features_check(struct sk_buff
> *skb,
> >
> netdev_features_t features)
>
> The above patch set fails as well (but it wasn't obvious to me why)
>
> Ryan (regXboi)

Also discovered three places where system-traffic.at needs to be patched:

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 28adbdc..af857c3 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -181,9 +181,9 @@ AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct
\(table=0\) '50540000000a50

 dnl Check this output. We only see the latter two packets, not the first.
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
-NXT_PACKET_IN (xid=0x0): total_len=42 in_port=1 (via action) data_len=42
(unbuffered)
+NXT_PACKET_IN2 (xid=0x0): total_len=42 in_port=1 (via action) data_len=42
(unbuffered)

udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=1,tp_dst=2
 udp_csum:0
-NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=42 ct_state=est|rpl|
trk,in_port=2 (via action) data_len=42 (unbuffered)
+NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 ct_state=est|rpl|
trk,in_port=2 (via action) data_len=42 (unbuffered)

udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.1.1.2,nw_dst=10.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=0,tp_src=2,tp_dst=1
 udp_csum:0
 ])

@@ -925,9 +925,9 @@ AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 2 ct
\(table=0\) 'e64c473528c9c6

 dnl Check this output. We only see the latter two packets, not the first.
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
-NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=47 ct_state=new|
trk,in_port=1 (via action) data_len=47 (unbuffered)
+NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=47 ct_state=new|
trk,in_port=1 (via action) data_len=47 (unbuffered)

udp,vlan_tci=0x0000,dl_src=e6:4c:47:35:28:c9,dl_dst=c6:f9:4e:cb:72:db,nw_src=172.16.0.1,nw_dst=172.16.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=41614,tp_dst=5555
 udp_csum:2096
-NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=75 ct_state=rel|rpl|
trk,in_port=2 (via action) data_len=75 (unbuffered)
+NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=75 ct_state=rel|rpl|
trk,in_port=2 (via action) data_len=75 (unbuffered)

icmp,vlan_tci=0x0000,dl_src=c6:f9:4e:cb:72:db,dl_dst=e6:4c:47:35:28:c9,nw_src=172.16.0.2,nw_dst=172.16.0.1,nw_tos=192,nw_ecn=0,nw_ttl=64,icmp_type=3,icmp_code=3
 icmp_csum:553f
 ])

@@ -1426,6 +1426,7 @@ AT_CLEANUP

 AT_SETUP([conntrack - IPv6 Fragmentation over vxlan])
 AT_SKIP_IF([! ip link help 2>&1 | grep vxlan >/dev/null])
+OVS_CHECK_VXLAN()
 CHECK_CONNTRACK()

 OVS_TRAFFIC_VSWITCHD_START()
--
1.9.1

Ryan (regXboi)



More information about the dev mailing list