[ovs-dev] [PATCH V2 06/11] compat: Add FIELD_SIZEOF macro

Gregory Rose gvrose8192 at gmail.com
Fri Feb 28 17:06:15 UTC 2020


On 2/27/2020 4:38 PM, Yi-Hung Wei wrote:
> On Wed, Feb 26, 2020 at 9:42 AM Greg Rose <gvrose8192 at gmail.com> wrote:
>> The FIELD_SIZEOF macro is removed in Linux kernel release 5.5 but
>> is still needed in our out of tree kernel module for compatibility
>> with older kernels.
>>
>> Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
>> ---
>>   datapath/linux/compat/include/linux/kernel.h | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h
>> index 2e81abc..8529b1d 100644
>> --- a/datapath/linux/compat/include/linux/kernel.h
>> +++ b/datapath/linux/compat/include/linux/kernel.h
>> @@ -32,4 +32,8 @@
>>   #define U32_MAX                ((u32)~0U)
>>   #endif
>>
>> +#ifndef FIELD_SIZEOF
>> +#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
>> +#endif
>> +
>>   #endif /* linux/kernel.h */
>> --
> Hi Greg,
>
> Thanks for the patch. I think we generally want to keep files in
> ./datapath/*.c|h to be in sync with upstream kernel, and we backports
> the missing function in the older kernel.
>
> As upstream patch c593642c8be04 ("treewide: Use sizeof_field() macro")
> replaces FIELD_SIZEOF with sizeof_field(), should we update
> FIELD_SIZEOF to sizeof_field() in datapath.c and flow.h and backports
> sizeof_field() if necessary?
>
> Thanks,
>
> -Yi-Hung

OK, sure.  I have my own doubts about whether we'll be continuing to support
the out of tree kernel modules going forward as we move to afxdp but for now
we can go ahead and keep in sync as you suggest.  I'll  rework the patch.

Thanks,

- Greg


More information about the dev mailing list