Message ID | 20191104081105.10933-1-roid@mellanox.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev] compat: Add compat fix for old kernels | expand |
Bleep bloop. Greetings Roi Dayan, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: Line has non-spaces leading whitespace #29 FILE: acinclude.m4:191: x.firstuse = 1; Lines checked: 54, Warnings: 1, Errors: 0 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
On 2019-11-04 10:58 AM, 0-day Robot wrote: > Bleep bloop. Greetings Roi Dayan, I am a robot and I have tried out your patch. > Thanks for your contribution. > > I encountered some error that I wasn't expecting. See the details below. > > > checkpatch: > WARNING: Line has non-spaces leading whitespace > #29 FILE: acinclude.m4:191: > x.firstuse = 1; > > Lines checked: 54, Warnings: 1, Errors: 0 > > > Please check this out. If you feel there has been an error, please email aconole@redhat.com > > Thanks, > 0-day Robot > i'll send v2.
On Mon, Nov 04, 2019 at 10:11:05AM +0200, Roi Dayan wrote: > In kernels older than 4.8, struct tcf_t didn't have the firstuse. > If openvswitch is compiled with the compat pkt_cls.h then there is > a struct size mismatch between openvswitch and the kernel which cause > parsing netlink actions to fail. > After this commit parsing the netlink actions pass even if compiled with > the compat pkt_cls.h. > > Signed-off-by: Roi Dayan <roid@mellanox.com> > --- > acinclude.m4 | 8 ++++++++ > include/linux/pkt_cls.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/acinclude.m4 b/acinclude.m4 > index a0507cfe019e..12513b82747d 100644 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -186,6 +186,14 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [ > [Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])]) > > AC_COMPILE_IFELSE([ > + AC_LANG_PROGRAM([#include <linux/pkt_cls.h>], [ > + struct tcf_t x; > + x.firstuse = 1; > + ])], > + [AC_DEFINE([HAVE_TCF_T_FIRSTUSE], [1], > + [Define to 1 if struct tcf_t have firstuse.])]) > + I think you can use AC_CHECK_MEMBERS: AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h> ])
On 2019-11-05 11:04 PM, Ben Pfaff wrote: > On Mon, Nov 04, 2019 at 10:11:05AM +0200, Roi Dayan wrote: >> In kernels older than 4.8, struct tcf_t didn't have the firstuse. >> If openvswitch is compiled with the compat pkt_cls.h then there is >> a struct size mismatch between openvswitch and the kernel which cause >> parsing netlink actions to fail. >> After this commit parsing the netlink actions pass even if compiled with >> the compat pkt_cls.h. >> >> Signed-off-by: Roi Dayan <roid@mellanox.com> >> --- >> acinclude.m4 | 8 ++++++++ >> include/linux/pkt_cls.h | 2 ++ >> 2 files changed, 10 insertions(+) >> >> diff --git a/acinclude.m4 b/acinclude.m4 >> index a0507cfe019e..12513b82747d 100644 >> --- a/acinclude.m4 >> +++ b/acinclude.m4 >> @@ -186,6 +186,14 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [ >> [Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])]) >> >> AC_COMPILE_IFELSE([ >> + AC_LANG_PROGRAM([#include <linux/pkt_cls.h>], [ >> + struct tcf_t x; >> + x.firstuse = 1; >> + ])], >> + [AC_DEFINE([HAVE_TCF_T_FIRSTUSE], [1], >> + [Define to 1 if struct tcf_t have firstuse.])]) >> + > > I think you can use AC_CHECK_MEMBERS: > > AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h> > ]) > thanks, it works fine. I weren't aware of this macro. i'll send v3.
diff --git a/acinclude.m4 b/acinclude.m4 index a0507cfe019e..12513b82747d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -186,6 +186,14 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [ [Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])]) AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include <linux/pkt_cls.h>], [ + struct tcf_t x; + x.firstuse = 1; + ])], + [AC_DEFINE([HAVE_TCF_T_FIRSTUSE], [1], + [Define to 1 if struct tcf_t have firstuse.])]) + + AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include <linux/tc_act/tc_vlan.h>], [ int x = TCA_VLAN_PUSH_VLAN_PRIORITY; ])], diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 4adea59e7c36..b6926a79a0af 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h @@ -64,7 +64,9 @@ struct tcf_t { __u64 install; __u64 lastuse; __u64 expires; +#ifdef HAVE_TCF_T_FIRSTUSE __u64 firstuse; +#endif }; #define tc_gen \
In kernels older than 4.8, struct tcf_t didn't have the firstuse. If openvswitch is compiled with the compat pkt_cls.h then there is a struct size mismatch between openvswitch and the kernel which cause parsing netlink actions to fail. After this commit parsing the netlink actions pass even if compiled with the compat pkt_cls.h. Signed-off-by: Roi Dayan <roid@mellanox.com> --- acinclude.m4 | 8 ++++++++ include/linux/pkt_cls.h | 2 ++ 2 files changed, 10 insertions(+)