Skip to content

Commit

Permalink
mptcp: add a new sysctl checksum_enabled
Browse files Browse the repository at this point in the history
This patch added a new sysctl, named checksum_enabled, to control
whether DSS checksum can be enabled.

Acked-by: Paolo Abeni <[email protected]>
Reviewed-by: Mat Martineau <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
geliangtang authored and matttbe committed May 6, 2021
1 parent 72dbd97 commit caf02cd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Documentation/networking/mptcp-sysctl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ add_addr_timeout - INTEGER (seconds)
sysctl.

Default: 120

checksum_enabled - INTEGER
Control whether DSS checksum can be enabled.

DSS checksum can be enabled if the value is nonzero. This is a
per-namespace sysctl.

Default: 0
14 changes: 14 additions & 0 deletions net/mptcp/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct mptcp_pernet {

u8 mptcp_enabled;
unsigned int add_addr_timeout;
int checksum_enabled;
};

static struct mptcp_pernet *mptcp_get_pernet(struct net *net)
Expand All @@ -44,9 +45,15 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
{
pernet->mptcp_enabled = 1;
pernet->add_addr_timeout = TCP_RTO_MAX;
pernet->checksum_enabled = 0;
}

#ifdef CONFIG_SYSCTL
int mptcp_is_checksum_enabled(struct net *net)
{
return mptcp_get_pernet(net)->checksum_enabled;
}

static struct ctl_table mptcp_sysctl_table[] = {
{
.procname = "enabled",
Expand All @@ -65,6 +72,12 @@ static struct ctl_table mptcp_sysctl_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{
.procname = "checksum_enabled",
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{}
};

Expand All @@ -82,6 +95,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)

table[0].data = &pernet->mptcp_enabled;
table[1].data = &pernet->add_addr_timeout;
table[2].data = &pernet->checksum_enabled;

hdr = register_net_sysctl(net, MPTCP_SYSCTL_PATH, table);
if (!hdr)
Expand Down
2 changes: 1 addition & 1 deletion net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static inline void mptcp_subflow_delegated_done(struct mptcp_subflow_context *su

int mptcp_is_enabled(struct net *net);
unsigned int mptcp_get_add_addr_timeout(struct net *net);
static inline int mptcp_is_checksum_enabled(struct net *net) { return false; }
int mptcp_is_checksum_enabled(struct net *net);
void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow,
struct mptcp_options_received *mp_opt);
bool mptcp_subflow_data_available(struct sock *sk);
Expand Down

0 comments on commit caf02cd

Please sign in to comment.