linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* xfrm4_state_afinfo size increase (was: Re: xfrm: Add a xfrm type offload.)
@ 2017-05-04  8:08 Geert Uytterhoeven
  2017-05-04  9:16 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2017-05-04  8:08 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Herbert Xu, David S. Miller, Linux Kernel Mailing List, netdev

Hi Steffen,

On Wed, May 3, 2017 at 3:05 AM, Linux Kernel Mailing List
<linux-kernel@vger.kernel.org> wrote:
> Web:        https://git.kernel.org/torvalds/c/9d389d7f84bbb3a294eb05f7dfe2076e291fc150
> Commit:     9d389d7f84bbb3a294eb05f7dfe2076e291fc150
> Parent:     c7ef8f0c020ac43c8a692bf989017c06ab1fdf0f
> Refname:    refs/heads/master
> Author:     Steffen Klassert <steffen.klassert@secunet.com>
> AuthorDate: Fri Apr 14 10:05:44 2017 +0200
> Committer:  Steffen Klassert <steffen.klassert@secunet.com>
> CommitDate: Fri Apr 14 10:05:44 2017 +0200
>
>     xfrm: Add a xfrm type offload.
>
>     We add a struct  xfrm_type_offload so that we have the offloaded
>     codepath separated to the non offloaded codepath. With this the
>     non offloade and the offloaded codepath can coexist.
>
>     Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
>  include/net/xfrm.h    | 28 +++++++++++++++-----
>  net/xfrm/xfrm_state.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 95 insertions(+), 6 deletions(-)
>
> diff --git a/include/net/xfrm.h b/include/net/xfrm.h
> index 9e3dc7b81a4d..159342f3e72b 100644
> --- a/include/net/xfrm.h
> +++ b/include/net/xfrm.h

> @@ -314,12 +316,14 @@ void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
>  int __xfrm_state_delete(struct xfrm_state *x);
>
>  struct xfrm_state_afinfo {
> -       unsigned int            family;
> -       unsigned int            proto;
> -       __be16                  eth_proto;
> -       struct module           *owner;
> -       const struct xfrm_type  *type_map[IPPROTO_MAX];
> -       struct xfrm_mode        *mode_map[XFRM_MODE_MAX];
> +       unsigned int                    family;
> +       unsigned int                    proto;
> +       __be16                          eth_proto;
> +       struct module                   *owner;
> +       const struct xfrm_type          *type_map[IPPROTO_MAX];
> +       const struct xfrm_type_offload  *type_offload_map[IPPROTO_MAX];
> +       struct xfrm_mode                *mode_map[XFRM_MODE_MAX];

Bloat-o-meter reports the addition of xfrm_state_afinfo.type_offload_map[]
increases the static kernel size by 1 KiB on 32-bit platforms (double on 64-bit
platforms):

function                                     old     new   delta
    xfrm4_state_afinfo                          1102    2126   +1024

While IPPROTO_MAX = 256, the defined list of IP protocols is spread
sparsely over the number space, but I assume all values may occur?

Perhaps type_offload_map[] (and type_map[] while at it) can be allocated at
runtime instead, when the feature is used?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: xfrm4_state_afinfo size increase (was: Re: xfrm: Add a xfrm type offload.)
  2017-05-04  8:08 xfrm4_state_afinfo size increase (was: Re: xfrm: Add a xfrm type offload.) Geert Uytterhoeven
@ 2017-05-04  9:16 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2017-05-04  9:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Herbert Xu, David S. Miller, Linux Kernel Mailing List, netdev

On Thu, May 04, 2017 at 10:08:07AM +0200, Geert Uytterhoeven wrote:
> > @@ -314,12 +316,14 @@ void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
> >  int __xfrm_state_delete(struct xfrm_state *x);
> >
> >  struct xfrm_state_afinfo {
> > -       unsigned int            family;
> > -       unsigned int            proto;
> > -       __be16                  eth_proto;
> > -       struct module           *owner;
> > -       const struct xfrm_type  *type_map[IPPROTO_MAX];
> > -       struct xfrm_mode        *mode_map[XFRM_MODE_MAX];
> > +       unsigned int                    family;
> > +       unsigned int                    proto;
> > +       __be16                          eth_proto;
> > +       struct module                   *owner;
> > +       const struct xfrm_type          *type_map[IPPROTO_MAX];
> > +       const struct xfrm_type_offload  *type_offload_map[IPPROTO_MAX];
> > +       struct xfrm_mode                *mode_map[XFRM_MODE_MAX];
> 
> Bloat-o-meter reports the addition of xfrm_state_afinfo.type_offload_map[]
> increases the static kernel size by 1 KiB on 32-bit platforms (double on 64-bit
> platforms):
> 
> function                                     old     new   delta
>     xfrm4_state_afinfo                          1102    2126   +1024
> 
> While IPPROTO_MAX = 256, the defined list of IP protocols is spread
> sparsely over the number space, but I assume all values may occur?

Actually no, I think we could boil this down to less than ten
really used protocols by mapping the IPPROTO numbers to some
XFRMPROTO numbers.

I'll look into this.

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-04  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04  8:08 xfrm4_state_afinfo size increase (was: Re: xfrm: Add a xfrm type offload.) Geert Uytterhoeven
2017-05-04  9:16 ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).