mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-12 11:21:55 +00:00
Allow up to 16 WANs on x86/x86_64
This commit is contained in:
parent
02870c4ef7
commit
b556b63a9d
1 changed files with 162 additions and 0 deletions
|
@ -0,0 +1,162 @@
|
|||
From 443fcdfe3545d63ebac785e359ac42995bd7e014 Mon Sep 17 00:00:00 2001
|
||||
From: Park Ju Hyung <qkrwngud825@gmail.com>
|
||||
Date: Thu, 28 Jan 2021 13:11:32 +0900
|
||||
Subject: [PATCH] mptcp: fullmesh: raise addresses limit from 8 to 16
|
||||
|
||||
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>
|
||||
---
|
||||
include/net/mptcp.h | 2 +-
|
||||
net/mptcp/mptcp_fullmesh.c | 42 +++++++++++++++++++-------------------
|
||||
2 files changed, 22 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
|
||||
index 8da833dd1712..07e5314b628c 100644
|
||||
--- a/include/net/mptcp.h
|
||||
+++ b/include/net/mptcp.h
|
||||
@@ -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;
|
||||
|
||||
diff --git a/net/mptcp/mptcp_fullmesh.c b/net/mptcp/mptcp_fullmesh.c
|
||||
index 5424960256e6..c95fb6b60531 100644
|
||||
--- a/net/mptcp/mptcp_fullmesh.c
|
||||
+++ b/net/mptcp/mptcp_fullmesh.c
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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;
|
Loading…
Reference in a new issue