2022-01-20 09:10:22

by CGEL

[permalink] [raw]
Subject: [PATCH] ipv4: Namespaceify min_adv_mss sysctl knob

From: xu xin <[email protected]>

Different netns have different requirement on the setting of min_adv_mss
sysctl that the advertised MSS will be never lower than. The sysctl
min_adv_mss can indirectly affects the segmentation efficiency of TCP.

So enable min_adv_mss to be visible and configurable inside the netns.

Signed-off-by: CGEL ZTE <[email protected]>
Signed-off-by: xu xin <[email protected]>
---
include/net/netns/ipv4.h | 1 +
net/ipv4/route.c | 21 +++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 7855764..8fea3cb 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -87,6 +87,7 @@ struct netns_ipv4 {

u32 ip_rt_min_pmtu;
int ip_rt_mtu_expires;
+ int ip_rt_min_advmss;

struct local_ports ip_local_ports;

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index ff6f91c..e42e283 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -112,14 +112,13 @@

#define DEFAULT_MIN_PMTU (512 + 20 + 20)
#define DEFAULT_MTU_EXPIRES (10 * 60 * HZ)
-
+#define DEFAULT_MIN_ADVMSS 256
static int ip_rt_max_size;
static int ip_rt_redirect_number __read_mostly = 9;
static int ip_rt_redirect_load __read_mostly = HZ / 50;
static int ip_rt_redirect_silence __read_mostly = ((HZ / 50) << (9 + 1));
static int ip_rt_error_cost __read_mostly = HZ;
static int ip_rt_error_burst __read_mostly = 5 * HZ;
-static int ip_rt_min_advmss __read_mostly = 256;

static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT;

@@ -1298,9 +1297,10 @@ static void set_class_tag(struct rtable *rt, u32 tag)

static unsigned int ipv4_default_advmss(const struct dst_entry *dst)
{
+ struct net *net = dev_net(dst->dev);
unsigned int header_size = sizeof(struct tcphdr) + sizeof(struct iphdr);
unsigned int advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size,
- ip_rt_min_advmss);
+ net->ipv4.ip_rt_min_advmss);

return min(advmss, IPV4_MAX_PMTU - header_size);
}
@@ -3535,13 +3535,6 @@ static struct ctl_table ipv4_route_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
- {
- .procname = "min_adv_mss",
- .data = &ip_rt_min_advmss,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec,
- },
{ }
};

@@ -3569,6 +3562,13 @@ static struct ctl_table ipv4_route_netns_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
+ {
+ .procname = "min_adv_mss",
+ .data = &init_net.ipv4.ip_rt_min_advmss,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
{ },
};

@@ -3631,6 +3631,7 @@ static __net_init int netns_ip_rt_init(struct net *net)
/* Set default value for namespaceified sysctls */
net->ipv4.ip_rt_min_pmtu = DEFAULT_MIN_PMTU;
net->ipv4.ip_rt_mtu_expires = DEFAULT_MTU_EXPIRES;
+ net->ipv4.ip_rt_min_advmss = DEFAULT_MIN_ADVMSS;
return 0;
}

--
2.15.2


2022-01-21 05:22:28

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] ipv4: Namespaceify min_adv_mss sysctl knob

On Tue, 18 Jan 2022 12:40:55 +0000 [email protected] wrote:
> From: xu xin <[email protected]>
>
> Different netns have different requirement on the setting of min_adv_mss
> sysctl that the advertised MSS will be never lower than. The sysctl
> min_adv_mss can indirectly affects the segmentation efficiency of TCP.
>
> So enable min_adv_mss to be visible and configurable inside the netns.
>
> Signed-off-by: CGEL ZTE <[email protected]>

CGEL ZTE, whatever it is, is most definitely not a person so it can't
sign off patches. Please stop adding the CGEL task, you can tell us
what it stands for it you want us to suggest an alternative way of
marking.

As for the patch:

# Form letter - net-next is closed

We have already sent the networking pull request for 5.17
and therefore net-next is closed for new drivers, features,
code refactoring and optimizations. We are currently accepting
bug fixes only.

Please repost when net-next reopens after 5.17-rc1 is cut.

Look out for the announcement on the mailing list or check:
http://vger.kernel.org/~davem/net-next.html

RFC patches sent for review only are obviously welcome at any time.

2022-01-21 13:58:31

by CGEL

[permalink] [raw]
Subject: Re: Re: [PATCH] ipv4: Namespaceify min_adv_mss sysctl knob

> > From: xu xin <[email protected]>
> >
> > Different netns have different requirement on the setting of min_adv_mss
> > sysctl that the advertised MSS will be never lower than. The sysctl
> > min_adv_mss can indirectly affects the segmentation efficiency of TCP.
> >
> > So enable min_adv_mss to be visible and configurable inside the netns.
> >
> > Signed-off-by: CGEL ZTE <[email protected]>
>
> CGEL ZTE, whatever it is, is most definitely not a person so it can't
> sign off patches. Please stop adding the CGEL task, you can tell us
> what it stands for it you want us to suggest an alternative way of
> marking.

CGEL ZTE is a team(or project) focusing on Embedded Linux System. With
the support of the team, I can devote myself to the development and
maintenance of the kernel and related patch work.

I'm not sure how to mark it here accurately. I am willing to hear your
suggestions.

> # Form letter - net-next is closed
>
> We have already sent the networking pull request for 5.17
> and therefore net-next is closed for new drivers, features,
> code refactoring and optimizations. We are currently accepting
> bug fixes only.
>
> Please repost when net-next reopens after 5.17-rc1 is cut.
>
> Look out for the announcement on the mailing list or check:
> http://vger.kernel.org/~davem/net-next.html
>
> RFC patches sent for review only are obviously welcome at any time.

OK, thanks a lot.

2022-01-21 14:05:26

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] ipv4: Namespaceify min_adv_mss sysctl knob

On Wed, 19 Jan 2022 02:04:27 +0000 xu xin wrote:
> > > From: xu xin <[email protected]>
> > >
> > > Different netns have different requirement on the setting of min_adv_mss
> > > sysctl that the advertised MSS will be never lower than. The sysctl
> > > min_adv_mss can indirectly affects the segmentation efficiency of TCP.
> > >
> > > So enable min_adv_mss to be visible and configurable inside the netns.
> > >
> > > Signed-off-by: CGEL ZTE <[email protected]>
> >
> > CGEL ZTE, whatever it is, is most definitely not a person so it can't
> > sign off patches. Please stop adding the CGEL task, you can tell us
> > what it stands for it you want us to suggest an alternative way of
> > marking.
>
> CGEL ZTE is a team(or project) focusing on Embedded Linux System. With
> the support of the team, I can devote myself to the development and
> maintenance of the kernel and related patch work.
>
> I'm not sure how to mark it here accurately. I am willing to hear your
> suggestions.

What I've seen done in the past is adding the name of your team/project
after your name, in parenthesis, so it'd be something like:

Signed-off-by: xu xin (CGEL ZTE) <[email protected]>

Similarly for your other colleagues, for example:

Signed-off-by: Minghao Chi (CGEL ZTE) <[email protected]>

Some Intel, Oracle and VMware employees follow a similar pattern.