diff mbox series

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

Message ID 1582738882-15842-7-git-send-email-gvrose8192@gmail.com
State Superseded
Headers show
Series Add Linux kernel datapath support up to 5.5 | expand

Commit Message

Gregory Rose Feb. 26, 2020, 5:41 p.m. UTC
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@gmail.com>
---
 datapath/linux/compat/include/linux/kernel.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Yi-Hung Wei Feb. 28, 2020, 12:38 a.m. UTC | #1
On Wed, Feb 26, 2020 at 9:42 AM Greg Rose <gvrose8192@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@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
Gregory Rose Feb. 28, 2020, 5:06 p.m. UTC | #2
On 2/27/2020 4:38 PM, Yi-Hung Wei wrote:
> On Wed, Feb 26, 2020 at 9:42 AM Greg Rose <gvrose8192@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@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
diff mbox series

Patch

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 */