diff mbox series

[mptcp-next] mptcp: use OPTIONS_MPTCP_MPC

Message ID 213e62f81b8daf3309039a0679a6925c5122b0b2.1630565830.git.geliangtang@xiaomi.com (mailing list archive)
State Superseded, archived
Headers show
Series [mptcp-next] mptcp: use OPTIONS_MPTCP_MPC | expand

Commit Message

Geliang Tang Sept. 2, 2021, 7 a.m. UTC
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(-)

Comments

Paolo Abeni Sept. 2, 2021, 8:54 a.m. UTC | #1
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
diff mbox series

Patch

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) {