[PATCH mptcp-next v3 3/6] mptcp: drop inet6_sk in mptcp_nl_find_ssk

Geliang Tang posted 6 patches 6 days, 15 hours ago
There is a newer version of this series
[PATCH mptcp-next v3 3/6] mptcp: drop inet6_sk in mptcp_nl_find_ssk
Posted by Geliang Tang 6 days, 15 hours ago
From: Geliang Tang <tanggeliang@kylinos.cn>

In mptcp_nl_find_ssk(), 'issk' has already been got through inet_sk(). No
need to use inet6_sk() to get 'pinfo' again, just use issk->pinet6 instead.
This patch also drops this 'pinfo' variable.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm_userspace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index e53426a5fc52..de17b18b78fe 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -465,9 +465,7 @@ static struct sock *mptcp_nl_find_ssk(struct mptcp_sock *msk,
 			break;
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 		case AF_INET6: {
-			const struct ipv6_pinfo *pinfo = inet6_sk(ssk);
-
-			if (!ipv6_addr_equal(&local->addr6, &pinfo->saddr) ||
+			if (!ipv6_addr_equal(&local->addr6, &issk->pinet6->saddr) ||
 			    !ipv6_addr_equal(&remote->addr6, &ssk->sk_v6_daddr))
 				continue;
 			break;
-- 
2.43.0
Re: [PATCH mptcp-next v3 3/6] mptcp: drop inet6_sk in mptcp_nl_find_ssk
Posted by Geliang Tang 5 days, 22 hours ago
On Wed, 2025-01-15 at 17:59 +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> In mptcp_nl_find_ssk(), 'issk' has already been got through
> inet_sk(). No
> need to use inet6_sk() to get 'pinfo' again, just use issk->pinet6
> instead.
> This patch also drops this 'pinfo' variable.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  net/mptcp/pm_userspace.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index e53426a5fc52..de17b18b78fe 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -465,9 +465,7 @@ static struct sock *mptcp_nl_find_ssk(struct
> mptcp_sock *msk,
>  			break;
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
>  		case AF_INET6: {
> -			const struct ipv6_pinfo *pinfo =
> inet6_sk(ssk);
> -
> -			if (!ipv6_addr_equal(&local->addr6, &pinfo-
> >saddr) ||
> +			if (!ipv6_addr_equal(&local->addr6, &issk-
> >pinet6->saddr) ||

CI reports a warning here:

WARNING: line length of 84 exceeds 80 columns
#27: FILE: net/mptcp/pm_userspace.c:468:

Will update this in the next version.

Thanks,
-Geliang

>  			    !ipv6_addr_equal(&remote->addr6, &ssk-
> >sk_v6_daddr))
>  				continue;
>  			break;

Re: [PATCH mptcp-next v3 3/6] mptcp: drop inet6_sk in mptcp_nl_find_ssk
Posted by Matthieu Baerts 5 days, 17 hours ago
Hi Geliang,

16 Jan 2025 03:41:25 Geliang Tang <geliang@kernel.org>:

> On Wed, 2025-01-15 at 17:59 +0800, Geliang Tang wrote:
>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>
>> In mptcp_nl_find_ssk(), 'issk' has already been got through
>> inet_sk(). No
>> need to use inet6_sk() to get 'pinfo' again, just use issk->pinet6
>> instead.
>> This patch also drops this 'pinfo' variable.
>>
>> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
>> ---
>>  net/mptcp/pm_userspace.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
>> index e53426a5fc52..de17b18b78fe 100644
>> --- a/net/mptcp/pm_userspace.c
>> +++ b/net/mptcp/pm_userspace.c
>> @@ -465,9 +465,7 @@ static struct sock *mptcp_nl_find_ssk(struct
>> mptcp_sock *msk,
>>             break;
>>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
>>         case AF_INET6: {
>> -           const struct ipv6_pinfo *pinfo =
>> inet6_sk(ssk);
>> -
>> -           if (!ipv6_addr_equal(&local->addr6, &pinfo-
>>> saddr) ||
>> +           if (!ipv6_addr_equal(&local->addr6, &issk-
>>> pinet6->saddr) ||
>
> CI reports a warning here:
>
> WARNING: line length of 84 exceeds 80 columns
> #27: FILE: net/mptcp/pm_userspace.c:468:

Please note that this is a recommendation and not a strict rule.
It means that if going a bit over 80 helps for the clarity, that's
fine: no need to break lines and have something hard to read.

So up to you: check how it looks like when breaking the lines
before 80 characters.

Cheers,
Matt
Re: [PATCH mptcp-next v3 3/6] mptcp: drop inet6_sk in mptcp_nl_find_ssk
Posted by Geliang Tang 4 days, 18 hours ago
Hi Matt,

On Thu, 2025-01-16 at 08:31 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> 16 Jan 2025 03:41:25 Geliang Tang <geliang@kernel.org>:
> 
> > On Wed, 2025-01-15 at 17:59 +0800, Geliang Tang wrote:
> > > From: Geliang Tang <tanggeliang@kylinos.cn>
> > > 
> > > In mptcp_nl_find_ssk(), 'issk' has already been got through
> > > inet_sk(). No
> > > need to use inet6_sk() to get 'pinfo' again, just use issk-
> > > >pinet6
> > > instead.
> > > This patch also drops this 'pinfo' variable.
> > > 
> > > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > > ---
> > >  net/mptcp/pm_userspace.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> > > index e53426a5fc52..de17b18b78fe 100644
> > > --- a/net/mptcp/pm_userspace.c
> > > +++ b/net/mptcp/pm_userspace.c
> > > @@ -465,9 +465,7 @@ static struct sock *mptcp_nl_find_ssk(struct
> > > mptcp_sock *msk,
> > >             break;
> > >  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> > >         case AF_INET6: {
> > > -           const struct ipv6_pinfo *pinfo =
> > > inet6_sk(ssk);
> > > -
> > > -           if (!ipv6_addr_equal(&local->addr6, &pinfo-
> > > > saddr) ||
> > > +           if (!ipv6_addr_equal(&local->addr6, &issk-
> > > > pinet6->saddr) ||
> > 
> > CI reports a warning here:
> > 
> > WARNING: line length of 84 exceeds 80 columns
> > #27: FILE: net/mptcp/pm_userspace.c:468:
> 
> Please note that this is a recommendation and not a strict rule.
> It means that if going a bit over 80 helps for the clarity, that's
> fine: no need to break lines and have something hard to read.
> 
> So up to you: check how it looks like when breaking the lines
> before 80 characters.

If so, I prefer not to break the lines and ignore this warning
(recommendation). 

Thanks,
-Geliang

> 
> Cheers,
> Matt