diff mbox series

xfrm: kconfig: Fix XFRM_OFFLOAD dependency on XFRM

Message ID 20230724090044.2668064-1-ilia.lin@kernel.org (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series xfrm: kconfig: Fix XFRM_OFFLOAD dependency on XFRM | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch warning WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 48e01e001da3 ("ixgbe/ixgbevf: fix XFRM_ALGO dependency")' WARNING: use relative pathname instead of absolute in changelog text
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ilia Lin July 24, 2023, 9 a.m. UTC
If XFRM_OFFLOAD is configured, but XFRM is not, it will cause
compilation error on include xfrm.h:
 C 05:56:39 In file included from /src/linux/kernel_platform/msm-kernel/net/core/sock.c:127:
 C 05:56:39 /src/linux/kernel_platform/msm-kernel/include/net/xfrm.h:1932:30: error: no member named 'xfrm' in 'struct dst_entry'
 C 05:56:39         struct xfrm_state *x = dst->xfrm;
 C 05:56:39                                ~~~  ^

Making the XFRM_OFFLOAD select the XFRM.

Fixes: 48e01e001da31 ("ixgbe/ixgbevf: fix XFRM_ALGO dependency")
Reported-by: Ilia Lin <ilia.lin@kernel.org>
Signed-off-by: Ilia Lin <ilia.lin@kernel.org>
---
 net/xfrm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

--
2.25.1

Comments

Leon Romanovsky July 24, 2023, 6:11 p.m. UTC | #1
On Mon, Jul 24, 2023 at 12:00:44PM +0300, Ilia Lin wrote:
> If XFRM_OFFLOAD is configured, but XFRM is not

How did you do it?

>, it will cause
> compilation error on include xfrm.h:
>  C 05:56:39 In file included from /src/linux/kernel_platform/msm-kernel/net/core/sock.c:127:
>  C 05:56:39 /src/linux/kernel_platform/msm-kernel/include/net/xfrm.h:1932:30: error: no member named 'xfrm' in 'struct dst_entry'
>  C 05:56:39         struct xfrm_state *x = dst->xfrm;
>  C 05:56:39                                ~~~  ^
> 
> Making the XFRM_OFFLOAD select the XFRM.
> 
> Fixes: 48e01e001da31 ("ixgbe/ixgbevf: fix XFRM_ALGO dependency")
> Reported-by: Ilia Lin <ilia.lin@kernel.org>
> Signed-off-by: Ilia Lin <ilia.lin@kernel.org>
> ---
>  net/xfrm/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
> index 3adf31a83a79a..3fc2c1bcb5bbe 100644
> --- a/net/xfrm/Kconfig
> +++ b/net/xfrm/Kconfig
> @@ -10,6 +10,7 @@ config XFRM
> 
>  config XFRM_OFFLOAD
>  	bool
> +	select XFRM

struct dst_entry depends on CONFIG_XFRM and not on CONFIG_XFRM_OFFLOAD,
so it is unclear to me why do you need to add new "select XFRM" line.

   26 struct dst_entry {
   27         struct net_device       *dev;
   28         struct  dst_ops         *ops;
   29         unsigned long           _metrics;
   30         unsigned long           expires;
   31 #ifdef CONFIG_XFRM
   32         struct xfrm_state       *xfrm;
   33 #else
   34         void                    *__pad1;
   35 #endif
   36         int

Thanks
Ilia Lin July 25, 2023, 4:41 a.m. UTC | #2
Hi Leon,

This is exactly like I described:
* xfrm.h is included from the net/core/sock.c unconditionally.
* If CONFIG_XFRM_OFFLOAD is set, then the xfrm_dst_offload_ok() is
being compiled.
* If CONFIG_XFRM is not set, the struct dst_entry doesn't have the xfrm member.
* xfrm_dst_offload_ok() tries to access the dst->xfrm and that fails to compile.


Thanks,
Ilia Lin

On Mon, Jul 24, 2023 at 9:11 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Mon, Jul 24, 2023 at 12:00:44PM +0300, Ilia Lin wrote:
> > If XFRM_OFFLOAD is configured, but XFRM is not
>
> How did you do it?
>
> >, it will cause
> > compilation error on include xfrm.h:
> >  C 05:56:39 In file included from /src/linux/kernel_platform/msm-kernel/net/core/sock.c:127:
> >  C 05:56:39 /src/linux/kernel_platform/msm-kernel/include/net/xfrm.h:1932:30: error: no member named 'xfrm' in 'struct dst_entry'
> >  C 05:56:39         struct xfrm_state *x = dst->xfrm;
> >  C 05:56:39                                ~~~  ^
> >
> > Making the XFRM_OFFLOAD select the XFRM.
> >
> > Fixes: 48e01e001da31 ("ixgbe/ixgbevf: fix XFRM_ALGO dependency")
> > Reported-by: Ilia Lin <ilia.lin@kernel.org>
> > Signed-off-by: Ilia Lin <ilia.lin@kernel.org>
> > ---
> >  net/xfrm/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
> > index 3adf31a83a79a..3fc2c1bcb5bbe 100644
> > --- a/net/xfrm/Kconfig
> > +++ b/net/xfrm/Kconfig
> > @@ -10,6 +10,7 @@ config XFRM
> >
> >  config XFRM_OFFLOAD
> >       bool
> > +     select XFRM
>
> struct dst_entry depends on CONFIG_XFRM and not on CONFIG_XFRM_OFFLOAD,
> so it is unclear to me why do you need to add new "select XFRM" line.
>
>    26 struct dst_entry {
>    27         struct net_device       *dev;
>    28         struct  dst_ops         *ops;
>    29         unsigned long           _metrics;
>    30         unsigned long           expires;
>    31 #ifdef CONFIG_XFRM
>    32         struct xfrm_state       *xfrm;
>    33 #else
>    34         void                    *__pad1;
>    35 #endif
>    36         int
>
> Thanks
Leon Romanovsky July 25, 2023, 5:19 a.m. UTC | #3
On Tue, Jul 25, 2023 at 07:41:49AM +0300, Ilia Lin wrote:
> Hi Leon,

You was already asked do not top-post.
https://lore.kernel.org/netdev/20230718105446.GD8808@unreal/
Please stop it.

> 
> This is exactly like I described:
> * xfrm.h is included from the net/core/sock.c unconditionally.
> * If CONFIG_XFRM_OFFLOAD is set, then the xfrm_dst_offload_ok() is
> being compiled.
> * If CONFIG_XFRM is not set, the struct dst_entry doesn't have the xfrm member.
> * xfrm_dst_offload_ok() tries to access the dst->xfrm and that fails to compile.

I asked two questions. First one was "How did you set XFRM_OFFLOAD
without XFRM?".

Thanks


> 
> 
> Thanks,
> Ilia Lin
> 
> On Mon, Jul 24, 2023 at 9:11 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Mon, Jul 24, 2023 at 12:00:44PM +0300, Ilia Lin wrote:
> > > If XFRM_OFFLOAD is configured, but XFRM is not
> >
> > How did you do it?
> >
> > >, it will cause
> > > compilation error on include xfrm.h:
> > >  C 05:56:39 In file included from /src/linux/kernel_platform/msm-kernel/net/core/sock.c:127:
> > >  C 05:56:39 /src/linux/kernel_platform/msm-kernel/include/net/xfrm.h:1932:30: error: no member named 'xfrm' in 'struct dst_entry'
> > >  C 05:56:39         struct xfrm_state *x = dst->xfrm;
> > >  C 05:56:39                                ~~~  ^
> > >
> > > Making the XFRM_OFFLOAD select the XFRM.
> > >
> > > Fixes: 48e01e001da31 ("ixgbe/ixgbevf: fix XFRM_ALGO dependency")
> > > Reported-by: Ilia Lin <ilia.lin@kernel.org>
> > > Signed-off-by: Ilia Lin <ilia.lin@kernel.org>
> > > ---
> > >  net/xfrm/Kconfig | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
> > > index 3adf31a83a79a..3fc2c1bcb5bbe 100644
> > > --- a/net/xfrm/Kconfig
> > > +++ b/net/xfrm/Kconfig
> > > @@ -10,6 +10,7 @@ config XFRM
> > >
> > >  config XFRM_OFFLOAD
> > >       bool
> > > +     select XFRM
> >
> > struct dst_entry depends on CONFIG_XFRM and not on CONFIG_XFRM_OFFLOAD,
> > so it is unclear to me why do you need to add new "select XFRM" line.
> >
> >    26 struct dst_entry {
> >    27         struct net_device       *dev;
> >    28         struct  dst_ops         *ops;
> >    29         unsigned long           _metrics;
> >    30         unsigned long           expires;
> >    31 #ifdef CONFIG_XFRM
> >    32         struct xfrm_state       *xfrm;
> >    33 #else
> >    34         void                    *__pad1;
> >    35 #endif
> >    36         int
> >
> > Thanks
Ilia Lin July 25, 2023, 9:11 a.m. UTC | #4
On Tue, Jul 25, 2023 at 8:19 AM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Tue, Jul 25, 2023 at 07:41:49AM +0300, Ilia Lin wrote:
> > Hi Leon,
>
> You was already asked do not top-post.
> https://lore.kernel.org/netdev/20230718105446.GD8808@unreal/
> Please stop it.
>
> >
> > This is exactly like I described:
> > * xfrm.h is included from the net/core/sock.c unconditionally.
> > * If CONFIG_XFRM_OFFLOAD is set, then the xfrm_dst_offload_ok() is
> > being compiled.
> > * If CONFIG_XFRM is not set, the struct dst_entry doesn't have the xfrm member.
> > * xfrm_dst_offload_ok() tries to access the dst->xfrm and that fails to compile.
>
> I asked two questions. First one was "How did you set XFRM_OFFLOAD
> without XFRM?".
>
> Thanks
>
In driver Kconfig: "select XFRM_OFFLOAD"
>
> >
> >
> > Thanks,
> > Ilia Lin
> >
> > On Mon, Jul 24, 2023 at 9:11 PM Leon Romanovsky <leon@kernel.org> wrote:
> > >
> > > On Mon, Jul 24, 2023 at 12:00:44PM +0300, Ilia Lin wrote:
> > > > If XFRM_OFFLOAD is configured, but XFRM is not
> > >
> > > How did you do it?
> > >
> > > >, it will cause
> > > > compilation error on include xfrm.h:
> > > >  C 05:56:39 In file included from /src/linux/kernel_platform/msm-kernel/net/core/sock.c:127:
> > > >  C 05:56:39 /src/linux/kernel_platform/msm-kernel/include/net/xfrm.h:1932:30: error: no member named 'xfrm' in 'struct dst_entry'
> > > >  C 05:56:39         struct xfrm_state *x = dst->xfrm;
> > > >  C 05:56:39                                ~~~  ^
> > > >
> > > > Making the XFRM_OFFLOAD select the XFRM.
> > > >
> > > > Fixes: 48e01e001da31 ("ixgbe/ixgbevf: fix XFRM_ALGO dependency")
> > > > Reported-by: Ilia Lin <ilia.lin@kernel.org>
> > > > Signed-off-by: Ilia Lin <ilia.lin@kernel.org>
> > > > ---
> > > >  net/xfrm/Kconfig | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
> > > > index 3adf31a83a79a..3fc2c1bcb5bbe 100644
> > > > --- a/net/xfrm/Kconfig
> > > > +++ b/net/xfrm/Kconfig
> > > > @@ -10,6 +10,7 @@ config XFRM
> > > >
> > > >  config XFRM_OFFLOAD
> > > >       bool
> > > > +     select XFRM
> > >
> > > struct dst_entry depends on CONFIG_XFRM and not on CONFIG_XFRM_OFFLOAD,
> > > so it is unclear to me why do you need to add new "select XFRM" line.
> > >
> > >    26 struct dst_entry {
> > >    27         struct net_device       *dev;
> > >    28         struct  dst_ops         *ops;
> > >    29         unsigned long           _metrics;
> > >    30         unsigned long           expires;
> > >    31 #ifdef CONFIG_XFRM
> > >    32         struct xfrm_state       *xfrm;
> > >    33 #else
> > >    34         void                    *__pad1;
> > >    35 #endif
> > >    36         int
> > >
> > > Thanks
Leon Romanovsky July 25, 2023, 9:38 a.m. UTC | #5
On Tue, Jul 25, 2023 at 12:11:06PM +0300, Ilia Lin wrote:
> On Tue, Jul 25, 2023 at 8:19 AM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Tue, Jul 25, 2023 at 07:41:49AM +0300, Ilia Lin wrote:
> > > Hi Leon,
> >
> > You was already asked do not top-post.
> > https://lore.kernel.org/netdev/20230718105446.GD8808@unreal/
> > Please stop it.
> >
> > >
> > > This is exactly like I described:
> > > * xfrm.h is included from the net/core/sock.c unconditionally.
> > > * If CONFIG_XFRM_OFFLOAD is set, then the xfrm_dst_offload_ok() is
> > > being compiled.
> > > * If CONFIG_XFRM is not set, the struct dst_entry doesn't have the xfrm member.
> > > * xfrm_dst_offload_ok() tries to access the dst->xfrm and that fails to compile.
> >
> > I asked two questions. First one was "How did you set XFRM_OFFLOAD
> > without XFRM?".
> >
> > Thanks
> >
> In driver Kconfig: "select XFRM_OFFLOAD"

In driver Kconfig, one should use "depends on XFRM_OFFLOAD" and not "select XFRM_OFFLOAD".
Drivers shouldn't enable XFRM_OFFLOAD directly and all upstream users are safe here.

Thanks
Ilia Lin July 25, 2023, 10:15 a.m. UTC | #6
On Tue, Jul 25, 2023 at 12:38 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Tue, Jul 25, 2023 at 12:11:06PM +0300, Ilia Lin wrote:
> > On Tue, Jul 25, 2023 at 8:19 AM Leon Romanovsky <leon@kernel.org> wrote:
> > >
> > > On Tue, Jul 25, 2023 at 07:41:49AM +0300, Ilia Lin wrote:
> > > > Hi Leon,
> > >
> > > You was already asked do not top-post.
> > > https://lore.kernel.org/netdev/20230718105446.GD8808@unreal/
> > > Please stop it.
> > >
> > > >
> > > > This is exactly like I described:
> > > > * xfrm.h is included from the net/core/sock.c unconditionally.
> > > > * If CONFIG_XFRM_OFFLOAD is set, then the xfrm_dst_offload_ok() is
> > > > being compiled.
> > > > * If CONFIG_XFRM is not set, the struct dst_entry doesn't have the xfrm member.
> > > > * xfrm_dst_offload_ok() tries to access the dst->xfrm and that fails to compile.
> > >
> > > I asked two questions. First one was "How did you set XFRM_OFFLOAD
> > > without XFRM?".
> > >
> > > Thanks
> > >
> > In driver Kconfig: "select XFRM_OFFLOAD"
>
> In driver Kconfig, one should use "depends on XFRM_OFFLOAD" and not "select XFRM_OFFLOAD".
> Drivers shouldn't enable XFRM_OFFLOAD directly and all upstream users are safe here.

Thank you for that information, but the XFRM_OFFLOAD doesn't depend on
XFRM either.

>
> Thanks
Leon Romanovsky July 25, 2023, 10:27 a.m. UTC | #7
On Tue, Jul 25, 2023 at 01:15:12PM +0300, Ilia Lin wrote:
> On Tue, Jul 25, 2023 at 12:38 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Tue, Jul 25, 2023 at 12:11:06PM +0300, Ilia Lin wrote:
> > > On Tue, Jul 25, 2023 at 8:19 AM Leon Romanovsky <leon@kernel.org> wrote:
> > > >
> > > > On Tue, Jul 25, 2023 at 07:41:49AM +0300, Ilia Lin wrote:
> > > > > Hi Leon,
> > > >
> > > > You was already asked do not top-post.
> > > > https://lore.kernel.org/netdev/20230718105446.GD8808@unreal/
> > > > Please stop it.
> > > >
> > > > >
> > > > > This is exactly like I described:
> > > > > * xfrm.h is included from the net/core/sock.c unconditionally.
> > > > > * If CONFIG_XFRM_OFFLOAD is set, then the xfrm_dst_offload_ok() is
> > > > > being compiled.
> > > > > * If CONFIG_XFRM is not set, the struct dst_entry doesn't have the xfrm member.
> > > > > * xfrm_dst_offload_ok() tries to access the dst->xfrm and that fails to compile.
> > > >
> > > > I asked two questions. First one was "How did you set XFRM_OFFLOAD
> > > > without XFRM?".
> > > >
> > > > Thanks
> > > >
> > > In driver Kconfig: "select XFRM_OFFLOAD"
> >
> > In driver Kconfig, one should use "depends on XFRM_OFFLOAD" and not "select XFRM_OFFLOAD".
> > Drivers shouldn't enable XFRM_OFFLOAD directly and all upstream users are safe here.
> 
> Thank you for that information, but the XFRM_OFFLOAD doesn't depend on
> XFRM either.

Indirectly, XFRM_OFFLOAD depends on XFRM.

INET_ESP_OFFLOAD -> INET_ESP/XFRM_OFFLOAD -> XFRM_ESP -> XFRM_ALGO -> XFRM.

Thanks

> 
> >
> > Thanks
diff mbox series

Patch

diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
index 3adf31a83a79a..3fc2c1bcb5bbe 100644
--- a/net/xfrm/Kconfig
+++ b/net/xfrm/Kconfig
@@ -10,6 +10,7 @@  config XFRM

 config XFRM_OFFLOAD
 	bool
+	select XFRM

 config XFRM_ALGO
 	tristate