Skip to content

Commit

Permalink
mptcp: fullmesh: raise addresses limit from 8 to 16
Browse files Browse the repository at this point in the history
This allows fullmesh path manager to use up-to 16 addresses instead of
the previous limit of 8.

Note that this increases the size of 'struct mptcp_cb' considerably.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
  • Loading branch information
arter97 committed Jan 28, 2021
1 parent 793343d commit 443fcdf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion include/net/mptcp.h
Expand Up @@ -329,7 +329,7 @@ struct mptcp_cb {
__u32 mptcp_loc_token;
__u32 mptcp_rem_token;

#define MPTCP_PM_SIZE 608
#define MPTCP_PM_SIZE 720
u8 mptcp_pm[MPTCP_PM_SIZE] __aligned(8);
const struct mptcp_pm_ops *pm_ops;

Expand Down
42 changes: 21 additions & 21 deletions net/mptcp/mptcp_fullmesh.c
Expand Up @@ -20,32 +20,32 @@ enum {
/* Max number of local or remote addresses we can store.
* When changing, see the bitfield below in fullmesh_rem4/6.
*/
#define MPTCP_MAX_ADDR 8
#define MPTCP_MAX_ADDR 16

struct fullmesh_rem4 {
u8 rem4_id;
u8 bitfield;
u8 retry_bitfield;
u16 bitfield;
u16 retry_bitfield;
__be16 port;
struct in_addr addr;
};

struct fullmesh_rem6 {
u8 rem6_id;
u8 bitfield;
u8 retry_bitfield;
u16 bitfield;
u16 retry_bitfield;
__be16 port;
struct in6_addr addr;
};

struct mptcp_loc_addr {
struct mptcp_loc4 locaddr4[MPTCP_MAX_ADDR];
u8 loc4_bits;
u8 next_v4_index;
u16 loc4_bits;
u16 next_v4_index;

struct mptcp_loc6 locaddr6[MPTCP_MAX_ADDR];
u8 loc6_bits;
u8 next_v6_index;
u16 loc6_bits;
u16 next_v6_index;
struct rcu_head rcu;
};

Expand All @@ -71,13 +71,13 @@ struct fullmesh_priv {
struct mptcp_cb *mpcb;

u16 remove_addrs; /* Addresses to remove */
u8 announced_addrs_v4; /* IPv4 Addresses we did announce */
u8 announced_addrs_v6; /* IPv6 Addresses we did announce */
u16 announced_addrs_v4; /* IPv4 Addresses we did announce */
u16 announced_addrs_v6; /* IPv6 Addresses we did announce */

u8 add_addr; /* Are we sending an add_addr? */

u8 rem4_bits;
u8 rem6_bits;
u16 rem4_bits;
u16 rem6_bits;

/* Have we established the additional subflows for primary pair? */
u8 first_pair:1;
Expand Down Expand Up @@ -115,12 +115,12 @@ static struct fullmesh_priv *fullmesh_get_priv(const struct mptcp_cb *mpcb)
}

/* Find the first free index in the bitfield */
static int __mptcp_find_free_index(u8 bitfield, u8 base)
static int __mptcp_find_free_index(u16 bitfield, u16 base)
{
int i;

/* There are anyways no free bits... */
if (bitfield == 0xff)
if (bitfield == 0xffff)
goto exit;

i = ffs(~(bitfield >> base)) - 1;
Expand All @@ -136,7 +136,7 @@ static int __mptcp_find_free_index(u8 bitfield, u8 base)
return -1;
}

static int mptcp_find_free_index(u8 bitfield)
static int mptcp_find_free_index(u16 bitfield)
{
return __mptcp_find_free_index(bitfield, 0);
}
Expand Down Expand Up @@ -510,7 +510,7 @@ static void create_subflow_worker(struct work_struct *work)

mptcp_for_each_bit_set(fmp->rem4_bits, i) {
struct fullmesh_rem4 *rem;
u8 remaining_bits;
u16 remaining_bits;

rem = &fmp->remaddr4[i];
remaining_bits = ~(rem->bitfield) & mptcp_local->loc4_bits;
Expand Down Expand Up @@ -558,7 +558,7 @@ static void create_subflow_worker(struct work_struct *work)
}
mptcp_for_each_bit_set(fmp->rem6_bits, i) {
struct fullmesh_rem6 *rem;
u8 remaining_bits;
u16 remaining_bits;

rem = &fmp->remaddr6[i];
remaining_bits = ~(rem->bitfield) & mptcp_local->loc6_bits;
Expand Down Expand Up @@ -646,7 +646,7 @@ static int mptcp_find_address(const struct mptcp_loc_addr *mptcp_local,
int if_idx)
{
int i;
u8 loc_bits;
u16 loc_bits;
bool found = false;

if (family == AF_INET)
Expand Down Expand Up @@ -680,7 +680,7 @@ static int mptcp_find_address_transp(const struct mptcp_loc_addr *mptcp_local,
sa_family_t family, int if_idx)
{
bool found = false;
u8 loc_bits;
u16 loc_bits;
int i;

if (family == AF_INET)
Expand Down Expand Up @@ -1564,7 +1564,7 @@ static void full_mesh_addr_signal(struct sock *sk, unsigned *size,
struct mptcp_loc_addr *mptcp_local;
struct mptcp_fm_ns *fm_ns = fm_get_ns(sock_net(sk));
int remove_addr_len;
u8 unannouncedv4 = 0, unannouncedv6 = 0;
u16 unannouncedv4 = 0, unannouncedv6 = 0;
bool meta_v4 = meta_sk->sk_family == AF_INET;

mpcb->addr_signal = 0;
Expand Down

0 comments on commit 443fcdf

Please sign in to comment.