[ovs-dev] [PATCH 6/6] datapath: Add support for 4.1 kernel.
Pravin Shelar
pshelar at nicira.com
Mon Sep 14 18:13:21 UTC 2015
On Thu, Jul 30, 2015 at 12:24 PM, Jesse Gross <jesse at nicira.com> wrote:
> On Wed, Jul 29, 2015 at 12:53 PM, Joe Stringer <joestringer at nicira.com> wrote:
...
>> diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h
>> index b7dbfe3..05c48f4 100644
>> --- a/datapath/linux/compat/include/net/net_namespace.h
>> +++ b/datapath/linux/compat/include/net/net_namespace.h
>> @@ -51,4 +51,33 @@ static void rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_p
>> #define DEFINE_COMPAT_PNET_REG_FUNC(TYPE)
>> #endif /* 2.6.33 */
>>
>> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
>> +typedef struct {
>> +#ifdef CONFIG_NET_NS
>> + struct net *net;
>> +#endif
>> +} possible_net_t;
>> +
>> +static inline void rpl_write_pnet(possible_net_t *pnet, struct net *net)
>> +{
>> +#ifdef CONFIG_NET_NS
>> + pnet->net = net;
>> +#endif
>> +}
>> +
>> +static inline struct net *rpl_read_pnet(const possible_net_t *pnet)
>> +{
>> +#ifdef CONFIG_NET_NS
>> + return pnet->net;
>> +#else
>> + return &init_net;
>> +#endif
>> +}
>> +#else /* Linux >= 4.1 */
>> +#define hold_net(x) (x)
>> +#define release_net(x) (x)
>> +#define rpl_read_pnet read_pnet
>> +#define rpl_write_pnet write_pnet
>> +#endif /* Linux >= 4.1 */
>> +
>> #endif /* net/net_namespace.h wrapper */
>
> Can we just drop use of hold_net()/release_net()? The commit message
> says that they were disabled even on old kernels.
>
hold_net()/release_net() are still used on older kernel if debugging
is turned on. So we need to keep those function calls.
More information about the dev
mailing list