mptcp: add the address ID assignment bitmap
authorGeliang Tang <geliangtang@gmail.com>
Sat, 9 Jan 2021 00:47:55 +0000 (16:47 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sun, 10 Jan 2021 02:18:43 +0000 (18:18 -0800)
commitefd5a4c04e1835acc64eb44818247ca88e80b294
tree88df5aa2525bea2408b680aef3998f85ed879439
parent43b3983437ed4a3458591daf7777529cd72c8fd0
mptcp: add the address ID assignment bitmap

Currently the address ID set by the netlink PM from user-space is
overridden by the kernel. This patch added the address ID assignment
bitmap to allow user-space to set the address ID.

Use a per netns bitmask id_bitmap (256 bits) to keep track of in-use IDs.
And use next_id to keep track of the highest ID currently in use. If the
user-space provides an ID at endpoint creation time, try to use it. If
already in use, endpoint creation fails. Otherwise pick the first ID
available after the highest currently in use, with wrap-around.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/pm_netlink.c