netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Alexander Potapenko <glider@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	David Ahern <dsahern@kernel.org>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Simon Horman <simon.horman@corigine.com>,
	netdev@vger.kernel.org, linux-btrfs@vger.kernel.org,
	dm-devel@redhat.com, ntfs3@lists.linux.dev,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 00/14] ip_tunnel: convert __be16 tunnel flags to bitmaps
Date: Mon,  9 Oct 2023 17:10:12 +0200	[thread overview]
Message-ID: <20231009151026.66145-1-aleksander.lobakin@intel.com> (raw)

Derived from the PFCP support series[0] as this grew bigger (2 -> 14
commits) and involved more core bitmap changes. Only commits 10 and 11
are from the mentioned tree, the rest is new. PFCP itself still depends
on this series.

IP tunnels have their flags defined as `__be16`, including UAPI, and
after GTP was accepted, there are no more free bits left. UAPI (incl.
direct usage of one of the user structs) and explicit Endianness only
complicate things.
Since it would either way end up with hundreds of locs due to all that,
pick bitmaps right from the start to store the flags in the most native
and scalable format with rich API. I don't think it's worth trying to
praise luck and pick smth like u32 only to redo everything in x years :)
More details regarding the IP tunnel flags is in 11 and 14.

The rest is just a good bunch of prereqs and tests: a couple of new
helpers and extensions to the old ones, a few optimizations to partially
mitigate IP tunnel object code growth due to __be16 -> long, and
decouping one UAPI struct used throughout the whole kernel into the
userspace and the kernel space counterparts to eliminate the dependency.

[0] https://lore.kernel.org/netdev/20230721071532.613888-1-marcin.szycik@linux.intel.com

Alexander Lobakin (14):
  bitops: add missing prototype check
  bitops: make BYTES_TO_BITS() treewide-available
  bitops: let the compiler optimize __assign_bit()
  linkmode: convert linkmode_{test,set,clear,mod}_bit() to macros
  s390/cio: rename bitmap_size() -> idset_bitmap_size()
  fs/ntfs3: rename bitmap_size() -> ntfs3_bitmap_size()
  btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits()
  bitmap: introduce generic optimized bitmap_size()
  bitmap: extend bitmap_{get,set}_value8() to bitmap_{get,set}_bits()
  ip_tunnel: use a separate struct to store tunnel params in the kernel
  ip_tunnel: convert __be16 tunnel flags to bitmaps
  lib/bitmap: add compile-time test for __assign_bit() optimization
  lib/bitmap: add tests for bitmap_{get,set}_bits()
  lib/bitmap: add tests for IP tunnel flags conversion helpers

 drivers/md/dm-clone-metadata.c                |   5 -
 drivers/net/bareudp.c                         |  19 +-
 .../ethernet/mellanox/mlx5/core/en/tc_tun.h   |   2 +-
 .../mellanox/mlx5/core/en/tc_tun_encap.c      |   6 +-
 .../mellanox/mlx5/core/en/tc_tun_geneve.c     |  12 +-
 .../mellanox/mlx5/core/en/tc_tun_gre.c        |   8 +-
 .../mellanox/mlx5/core/en/tc_tun_vxlan.c      |   9 +-
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   |  16 +-
 .../ethernet/mellanox/mlxsw/spectrum_ipip.c   |  56 +++--
 .../ethernet/mellanox/mlxsw/spectrum_ipip.h   |   2 +-
 .../ethernet/mellanox/mlxsw/spectrum_span.c   |  10 +-
 .../ethernet/netronome/nfp/flower/action.c    |  27 ++-
 drivers/net/geneve.c                          |  44 ++--
 drivers/net/vxlan/vxlan_core.c                |  14 +-
 drivers/s390/cio/idset.c                      |  10 +-
 fs/btrfs/free-space-cache.c                   |   8 +-
 fs/ntfs3/bitmap.c                             |   4 +-
 fs/ntfs3/fsntfs.c                             |   2 +-
 fs/ntfs3/index.c                              |  11 +-
 fs/ntfs3/ntfs_fs.h                            |   2 +-
 fs/ntfs3/super.c                              |   2 +-
 include/linux/bitmap.h                        |  59 ++++--
 include/linux/bitops.h                        |  13 +-
 include/linux/cpumask.h                       |   2 +-
 include/linux/linkmode.h                      |  27 +--
 include/linux/netdevice.h                     |   7 +-
 include/net/dst_metadata.h                    |  10 +-
 include/net/flow_dissector.h                  |   2 +-
 include/net/gre.h                             |  70 +++---
 include/net/ip6_tunnel.h                      |   4 +-
 include/net/ip_tunnels.h                      | 136 ++++++++++--
 include/net/udp_tunnel.h                      |   4 +-
 include/uapi/linux/if_tunnel.h                |  33 +++
 kernel/trace/trace_probe.c                    |   2 -
 lib/math/prime_numbers.c                      |   2 -
 lib/test_bitmap.c                             | 200 +++++++++++++++++-
 net/bridge/br_vlan_tunnel.c                   |   9 +-
 net/core/filter.c                             |  26 +--
 net/core/flow_dissector.c                     |  20 +-
 net/ipv4/fou_bpf.c                            |   2 +-
 net/ipv4/gre_demux.c                          |   2 +-
 net/ipv4/ip_gre.c                             | 144 ++++++++-----
 net/ipv4/ip_tunnel.c                          | 109 +++++++---
 net/ipv4/ip_tunnel_core.c                     |  82 ++++---
 net/ipv4/ip_vti.c                             |  41 ++--
 net/ipv4/ipip.c                               |  33 +--
 net/ipv4/ipmr.c                               |   2 +-
 net/ipv4/udp_tunnel_core.c                    |   5 +-
 net/ipv6/addrconf.c                           |   3 +-
 net/ipv6/ip6_gre.c                            |  85 ++++----
 net/ipv6/ip6_tunnel.c                         |  14 +-
 net/ipv6/sit.c                                |  38 ++--
 net/netfilter/ipvs/ip_vs_core.c               |   6 +-
 net/netfilter/ipvs/ip_vs_xmit.c               |  20 +-
 net/netfilter/nft_tunnel.c                    |  44 ++--
 net/openvswitch/flow_netlink.c                |  61 +++---
 net/psample/psample.c                         |  26 +--
 net/sched/act_tunnel_key.c                    |  36 ++--
 net/sched/cls_flower.c                        |  27 +--
 tools/include/linux/bitmap.h                  |   8 +-
 tools/include/linux/bitops.h                  |   2 +
 tools/perf/util/probe-finder.c                |   2 -
 62 files changed, 1116 insertions(+), 571 deletions(-)

---
Not sure whether it's fine to have that all in one series, but OTOH
there's not much stuff I could split (like, 3 commits), it either
depends directly (new helpers etc.) or will just generate suboptimal
code w/o some of the commits.

I'm also thinking of which tree this would ideally be taken through.
The main subject is networking, but most of the commits are generic.
My idea is to push this via Yury / bitmaps and then ask the netdev
maintainers to pull his tree before they take PFCP (dependent on this
one).

Speaking of bitmap_{read,write}() from [1] vs bitmap_{get,set}_bits()
from #09: they don't really conflict, because the former are
generic-generic and support bound crossing, while the latter require
the width to be a pow-2 and the offset to be a multiple of the width
in order to preserve the optimization level as close to the current
bitmap_{get,set}_value8() as possible...

Old pfcp -> bitmap changelog:

As for former commits (now 10 and 11), almost all of the changes were
suggested by Andy, notably: stop violating bitmap API, use
__assign_bit() where appropriate, and add more tests to make sure
everything works as expected. Apart from that, add simple wrappers for
bitmap_*() used in the IP tunnel code to avoid manually specifying
``__IP_TUNNEL_FLAG_NUM`` each time.

[1] https://lore.kernel.org/lkml/20231006134529.2816540-2-glider@google.com
-- 
2.41.0


             reply	other threads:[~2023-10-09 15:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 15:10 Alexander Lobakin [this message]
2023-10-09 15:10 ` [PATCH 01/14] bitops: add missing prototype check Alexander Lobakin
2023-10-09 15:10 ` [PATCH 02/14] bitops: make BYTES_TO_BITS() treewide-available Alexander Lobakin
2023-10-09 15:10 ` [PATCH 03/14] bitops: let the compiler optimize __assign_bit() Alexander Lobakin
2023-10-09 16:18   ` Yury Norov
2023-10-11  7:25     ` Alexander Lobakin
2023-10-09 15:10 ` [PATCH 04/14] linkmode: convert linkmode_{test,set,clear,mod}_bit() to macros Alexander Lobakin
2023-10-09 15:10 ` [PATCH 05/14] s390/cio: rename bitmap_size() -> idset_bitmap_size() Alexander Lobakin
2023-10-09 16:35   ` Yury Norov
2023-10-11  7:28     ` Alexander Lobakin
2023-10-09 15:10 ` [PATCH 06/14] fs/ntfs3: rename bitmap_size() -> ntfs3_bitmap_size() Alexander Lobakin
2023-10-09 16:50   ` Yury Norov
2023-10-11  7:36     ` Alexander Lobakin
2023-10-09 15:10 ` [PATCH 07/14] btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits() Alexander Lobakin
2023-10-09 15:23   ` David Sterba
2023-10-09 15:10 ` [PATCH 08/14] bitmap: introduce generic optimized bitmap_size() Alexander Lobakin
2023-10-09 17:04   ` Yury Norov
2023-10-09 15:10 ` [PATCH 09/14] bitmap: extend bitmap_{get,set}_value8() to bitmap_{get,set}_bits() Alexander Lobakin
2023-10-09 16:31   ` Yury Norov
2023-10-11  9:33     ` Alexander Lobakin
2023-10-11 10:36       ` Andy Shevchenko
2023-10-15  2:20       ` Yury Norov
2023-10-09 15:10 ` [PATCH 10/14] ip_tunnel: use a separate struct to store tunnel params in the kernel Alexander Lobakin
2023-10-09 15:10 ` [PATCH 11/14] ip_tunnel: convert __be16 tunnel flags to bitmaps Alexander Lobakin
2023-10-09 15:10 ` [PATCH 12/14] lib/bitmap: add compile-time test for __assign_bit() optimization Alexander Lobakin
2023-10-09 15:10 ` [PATCH 13/14] lib/bitmap: add tests for bitmap_{get,set}_bits() Alexander Lobakin
2023-10-09 15:10 ` [PATCH 14/14] lib/bitmap: add tests for IP tunnel flags conversion helpers Alexander Lobakin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231009151026.66145-1-aleksander.lobakin@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dm-devel@redhat.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=glider@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=netdev@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=simon.horman@corigine.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).