[MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC

Geliang Tang posted 1 patch 3 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/dcaratti/mptcp_net-next tags/patchew/213e62f81b8daf3309039a0679a6925c5122b0b2.1630565830.git.geliangtang@xiaomi.com
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Jakub Kicinski <kuba@kernel.org>, "David S. Miller" <davem@davemloft.net>
net/mptcp/options.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

[MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC

Posted by Geliang Tang 3 weeks, 2 days ago
From: Geliang Tang <geliangtang@xiaomi.com>

Since OPTIONS_MPTCP_MPC has been defined, use it instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
---
 net/mptcp/options.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 1ec6529c4326..cf4ef11916c9 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -749,8 +749,7 @@ static bool mptcp_established_options_mp_prio(struct sock *sk,
 	 * 'backup'. Also it makes no sense at all
 	 */
 	if (!subflow->send_mp_prio ||
-	    ((OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_SYNACK |
-	      OPTION_MPTCP_MPC_ACK) & opts->suboptions))
+	    (OPTIONS_MPTCP_MPC & opts->suboptions))
 		return false;
 
 	/* account for the trailing 'nop' option */
@@ -1327,8 +1326,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 						   TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
 			}
 		}
-	} else if ((OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_SYNACK |
-		    OPTION_MPTCP_MPC_ACK) & opts->suboptions) {
+	} else if (OPTIONS_MPTCP_MPC & opts->suboptions) {
 		u8 len, flag = MPTCP_CAP_HMAC_SHA256;
 
 		if (OPTION_MPTCP_MPC_SYN & opts->suboptions) {
-- 
2.31.1


Re: [MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC

Posted by Paolo Abeni 3 weeks, 2 days ago
On Thu, 2021-09-02 at 15:00 +0800, Geliang Tang wrote:
> From: Geliang Tang <geliangtang@xiaomi.com>
> 
> Since OPTIONS_MPTCP_MPC has been defined, use it instead of open-coding.
> 
> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
> ---
>  net/mptcp/options.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 1ec6529c4326..cf4ef11916c9 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -749,8 +749,7 @@ static bool mptcp_established_options_mp_prio(struct sock *sk,
>  	 * 'backup'. Also it makes no sense at all
>  	 */
>  	if (!subflow->send_mp_prio ||
> -	    ((OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_SYNACK |
> -	      OPTION_MPTCP_MPC_ACK) & opts->suboptions))
> +	    (OPTIONS_MPTCP_MPC & opts->suboptions))
>  		return false;
>  
>  	/* account for the trailing 'nop' option */
> @@ -1327,8 +1326,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
>  						   TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
>  			}
>  		}
> -	} else if ((OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_SYNACK |
> -		    OPTION_MPTCP_MPC_ACK) & opts->suboptions) {
> +	} else if (OPTIONS_MPTCP_MPC & opts->suboptions) {
>  		u8 len, flag = MPTCP_CAP_HMAC_SHA256;
>  
>  		if (OPTION_MPTCP_MPC_SYN & opts->suboptions) {


Nice clean-up! LGTM! 

Acked-by: Paolo Abeni <pabeni@redhat.com>

Side, note: I'm wondering if we should additionally switch-out of yoda-
style? 

e.g.:
	opts->suboptions & OPTIONS_MPTCP_MPC

/P