[ovs-dev] [PATCH 7/8] datapath: Add support for kernel 4.6

pravin shelar pshelar at ovn.org
Tue Jul 19 15:42:21 UTC 2016


On Mon, Jul 18, 2016 at 11:51 AM, Jesse Gross <jesse at kernel.org> wrote:
> On Mon, Jul 18, 2016 at 4:24 AM, Pravin B Shelar <pshelar at ovn.org> wrote:
>> diff --git a/datapath/linux/compat/include/linux/if_ether.h b/datapath/linux/compat/include/linux/if_ether.h
>> index b2cb56d..ac0f1ed 100644
>> --- a/datapath/linux/compat/include/linux/if_ether.h
>> +++ b/datapath/linux/compat/include/linux/if_ether.h
>> @@ -11,10 +11,9 @@
>>  #define ETH_P_8021AD    0x88A8          /* 802.1ad Service VLAN         */
>>  #endif
>>
>> -#ifndef HAVE_INNER_ETH_HDR
>> +#define inner_eth_hdr rpl_inner_eth_hdr
>>  static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
>>  {
>>         return (struct ethhdr *)skb_inner_mac_header(skb);
>>  }
>>  #endif
>> -#endif
>
> Why do we need this change? It looks like inner_eth_hdr() and
> skb_inner_mac_header() are the same on all kernel versions that we
> support.
>

inner_eth_hdr is defined for 4.6 kernel. I have to back port it.
Since it is really simple function I decided to avoid the configure
grep and just rename it.

>> diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h
>> index ded7f30..5ba1cbf 100644
>> --- a/datapath/linux/compat/include/net/udp_tunnel.h
>> +++ b/datapath/linux/compat/include/net/udp_tunnel.h
> [...]
>>  static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
>> -                                                bool udp_csum,
>> -                                                bool is_vxlan)
>> +                                                bool udp_csum)
>>  {
>>         int type = 0;
>>
>> @@ -178,14 +164,8 @@ static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
>>         else
>>                 fix_segment = ovs_udp_csum_gso;
>>
>> -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
>> -       if (!is_vxlan)
>> -               type = 0;
>> -#endif
>
> I don't know that it is safe to remove this. The intention was to
> avoid problems that assumed UDP_TUNNEL offloads really meant VXLAN on
> kernels where VXLAN was the only UDP tunnel.
>
right, I missed it.
At present this function is not used by vxlan, so type reset can done
unconditionally.

>> diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c
>> index dd23059..c9cc809 100644
>> --- a/datapath/linux/compat/lisp.c
>> +++ b/datapath/linux/compat/lisp.c
>> @@ -290,6 +290,29 @@ static struct rtable *lisp_get_rt(struct sk_buff *skb,
>>         return ip_route_output_key(net, fl);
>>  }
>>
>> +/* this is to handle the return type change in handle-offload
>> + * functions.
>> + */
>> +#if !defined(HAVE_UDP_TUNNEL_HANDLE_OFFLOAD_RET_SKB) || !defined(USE_UPSTREAM_TUNNEL)
>> +static struct sk_buff *
>> +__udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum)
>> +{
>> +       int err;
>> +
>> +       if (skb_is_gso(skb) && skb_is_encapsulated(skb)) {
>> +               return ERR_PTR(-ENOSYS);
>> +       }
>> +       err = udp_tunnel_handle_offloads(skb, udp_csum);
>> +       if (err) {
>> +               kfree_skb(skb);
>> +               return NULL;
>> +       }
>> +       return skb;
>> +}
>> +#else
>> +#define __udp_tunnel_handle_offloads udp_tunnel_handle_offloads
>> +#endif
>
> Aren't the checks in __udp_tunnel_handle_offloads() mostly about the
> fact that we don't have a device layer to deal with offloads? In that
> case, I think they would still be needed in all situations with
> LISP/STT.

right, it should be done for lisp. For STT I will send separate patch.



More information about the dev mailing list