All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC
@ 2021-09-02  7:00 Geliang Tang
  2021-09-02  8:54 ` Paolo Abeni
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2021-09-02  7:00 UTC (permalink / raw)
  To: mptcp, geliangtang; +Cc: Geliang Tang

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC
  2021-09-02  7:00 [MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC Geliang Tang
@ 2021-09-02  8:54 ` Paolo Abeni
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2021-09-02  8:54 UTC (permalink / raw)
  To: Geliang Tang, mptcp; +Cc: Geliang Tang

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-02  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02  7:00 [MPTCP][PATCH mptcp-next] mptcp: use OPTIONS_MPTCP_MPC Geliang Tang
2021-09-02  8:54 ` Paolo Abeni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.