All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] Re: [MPTCP][RFC PATCH mptcp-next 1/6] mptcp: add the outgoing MP_PRIO support
@ 2020-11-10  1:48 Mat Martineau
  0 siblings, 0 replies; 3+ messages in thread
From: Mat Martineau @ 2020-11-10  1:48 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 6767 bytes --]

On Thu, 5 Nov 2020, Geliang Tang wrote:

> This patch added the outgoing MP_PRIO logic:
>
> In mptcp_pm_mp_prio_send_ack, find the related subflow and subsocket
> according to the input parameter address, then set subflow's send_mp_prio
> flag to true, and save the input priority value to suflow's prio_bkup.
> Finally, send out a pure ACK on the related subsocket.
>
> In mptcp_established_options_mp_prio, check whether the subflow's
> send_mp_prio is set. If it is, this is the packet for send MP_PRIO. So
> save subflow->prio_bkup value to mptcp_out_options's prio_bkup, and
> change the option type to OPTION_MPTCP_PRIO.
>
> In mptcp_write_options, sent out the MP_PRIO suboption with
> mptcp_out_options's prio_bkup value.
>

Hi Geliang,

Thanks for working on this additional feature!


> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
> ---
> include/net/mptcp.h    |  1 +
> net/mptcp/options.c    | 36 ++++++++++++++++++++++++++++++++++++
> net/mptcp/pm_netlink.c | 30 ++++++++++++++++++++++++++++++
> net/mptcp/protocol.h   |  7 +++++++
> 4 files changed, 74 insertions(+)
>
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index 5694370be3d4..f71259fb04cd 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -51,6 +51,7 @@ struct mptcp_out_options {
> 	u8 rm_id;
> 	u8 join_id;
> 	u8 backup;
> +	u8 prio_bkup;

The existing 'backup' struct member can be used for this.

> 	u32 nonce;
> 	u64 thmac;
> 	u32 token;
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index f611fbcbd6d0..b74e6ab2d605 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -665,6 +665,30 @@ static bool mptcp_established_options_rm_addr(struct sock *sk,
> 	return true;
> }
>
> +static bool mptcp_established_options_mp_prio(struct sock *sk,
> +					      unsigned int *size,
> +					      unsigned int remaining,
> +					      struct mptcp_out_options *opts)
> +{
> +	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> +
> +	if (!subflow->send_mp_prio)
> +		return false;
> +
> +	if (remaining < TCPOLEN_MPTCP_PRIO)
> +		return false;
> +
> +	subflow->send_mp_prio = 0;

tcp_established_options() is called by tcp_current_mss(), so clearing 
send_mp_prio here will stop MP_PRIO from being sent sometimes.

> +
> +	*size = TCPOLEN_MPTCP_PRIO;
> +	opts->suboptions |= OPTION_MPTCP_PRIO;
> +	opts->prio_bkup = subflow->prio_bkup;
> +
> +	pr_debug("prio=%d", opts->prio_bkup);
> +
> +	return true;
> +}
> +
> bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> 			       unsigned int *size, unsigned int remaining,
> 			       struct mptcp_out_options *opts)
> @@ -707,6 +731,12 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> 		ret = true;
> 	}
>
> +	if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) {
> +		*size += opt_size;
> +		remaining -= opt_size;
> +		ret = true;
> +	}
> +
> 	return ret;
> }
>
> @@ -1138,6 +1168,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
> 				      0, opts->rm_id);
> 	}
>
> +	if (OPTION_MPTCP_PRIO & opts->suboptions) {
> +		*ptr++ = mptcp_option(MPTCPOPT_MP_PRIO,
> +				      TCPOLEN_MPTCP_PRIO,
> +				      opts->prio_bkup, TCPOPT_NOP);
> +	}
> +
> 	if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
> 		*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
> 				      TCPOLEN_MPTCP_MPJ_SYN,
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 069447424ddb..a243017c4892 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -441,6 +441,36 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
> 	}
> }
>
> +void mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
> +			       struct mptcp_addr_info *addr,
> +			       u8 prio_bkup)
> +{
> +	struct mptcp_subflow_context *subflow, *tmp;
> +
> +	if (list_empty(&msk->conn_list))
> +		return;
> +
> +	list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
> +		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> +		struct mptcp_addr_info local;
> +
> +		local_address((struct sock_common *)ssk, &local);
> +		if (!addresses_equal(&local, addr, false))
> +			continue;
> +
> +		subflow->send_mp_prio = 1;
> +		subflow->prio_bkup = prio_bkup;
> +		spin_unlock_bh(&msk->pm.lock);
> +		pr_debug("send ack for mp_prio");
> +		lock_sock(ssk);
> +		tcp_send_ack(ssk);
> +		release_sock(ssk);
> +		spin_lock_bh(&msk->pm.lock);
> +
> +		break;
> +	}
> +}
> +
> void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
> {
> 	struct mptcp_subflow_context *subflow, *tmp;
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index b01c1fae9d8f..a8ed1de1cb05 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -23,6 +23,7 @@
> #define OPTION_MPTCP_ADD_ADDR	BIT(6)
> #define OPTION_MPTCP_ADD_ADDR6	BIT(7)
> #define OPTION_MPTCP_RM_ADDR	BIT(8)
> +#define OPTION_MPTCP_PRIO	BIT(9)
>
> /* MPTCP option subtypes */
> #define MPTCPOPT_MP_CAPABLE	0
> @@ -59,6 +60,7 @@
> #define TCPOLEN_MPTCP_PORT_LEN		4
> #define TCPOLEN_MPTCP_ADD_ADDR_HMAC	8
> #define TCPOLEN_MPTCP_RM_ADDR_BASE	4
> +#define TCPOLEN_MPTCP_PRIO		4
>
> /* MPTCP MP_JOIN flags */
> #define MPTCPOPT_BACKUP		BIT(0)
> @@ -362,6 +364,7 @@ struct mptcp_subflow_context {
> 		map_valid : 1,
> 		mpc_map : 1,
> 		backup : 1,
> +		send_mp_prio : 1,
> 		rx_eof : 1,
> 		can_ack : 1,        /* only after processing the remote a key */
> 		disposable : 1;	    /* ctx can be free at ulp release time */
> @@ -373,6 +376,7 @@ struct mptcp_subflow_context {
> 	u8	hmac[MPTCPOPT_HMAC_LEN];
> 	u8	local_id;
> 	u8	remote_id;
> +	u8	prio_bkup;

The existing 'backup' bit in this struct is keeping track of the peer's 
requested backup flag, which affects the choice for the local msk to send 
on that subflow.

The existing 'request_bkup' bit is tracking which priority (backup or 
normal) we have requested from the peer. I think prio_bkup duplicates this 
bit.

>
> 	struct	sock *tcp_sock;	    /* tcp sk backpointer */
> 	struct	sock *conn;	    /* parent mptcp_sock */
> @@ -515,6 +519,9 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
> 				const struct mptcp_addr_info *addr);
> void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
> void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
> +void mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
> +			       struct mptcp_addr_info *addr,
> +			       u8 prio_bkup);
> void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
> struct mptcp_pm_add_entry *
> mptcp_pm_del_add_timer(struct mptcp_sock *msk,
> -- 
> 2.26.2

--
Mat Martineau
Intel

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

* [MPTCP] Re: [MPTCP][RFC PATCH mptcp-next 1/6] mptcp: add the outgoing MP_PRIO support
@ 2020-11-19 23:55 Mat Martineau
  0 siblings, 0 replies; 3+ messages in thread
From: Mat Martineau @ 2020-11-19 23:55 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 8488 bytes --]

On Thu, 19 Nov 2020, Geliang Tang wrote:

> Hi Mat,
>
> Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2020年11月10日周二 上午9:48写道:
>>
>> On Thu, 5 Nov 2020, Geliang Tang wrote:
>>
>>> This patch added the outgoing MP_PRIO logic:
>>>
>>> In mptcp_pm_mp_prio_send_ack, find the related subflow and subsocket
>>> according to the input parameter address, then set subflow's send_mp_prio
>>> flag to true, and save the input priority value to suflow's prio_bkup.
>>> Finally, send out a pure ACK on the related subsocket.
>>>
>>> In mptcp_established_options_mp_prio, check whether the subflow's
>>> send_mp_prio is set. If it is, this is the packet for send MP_PRIO. So
>>> save subflow->prio_bkup value to mptcp_out_options's prio_bkup, and
>>> change the option type to OPTION_MPTCP_PRIO.
>>>
>>> In mptcp_write_options, sent out the MP_PRIO suboption with
>>> mptcp_out_options's prio_bkup value.
>>>
>>
>> Hi Geliang,
>>
>> Thanks for working on this additional feature!
>>
>>
>>> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
>>> ---
>>> include/net/mptcp.h    |  1 +
>>> net/mptcp/options.c    | 36 ++++++++++++++++++++++++++++++++++++
>>> net/mptcp/pm_netlink.c | 30 ++++++++++++++++++++++++++++++
>>> net/mptcp/protocol.h   |  7 +++++++
>>> 4 files changed, 74 insertions(+)
>>>
>>> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
>>> index 5694370be3d4..f71259fb04cd 100644
>>> --- a/include/net/mptcp.h
>>> +++ b/include/net/mptcp.h
>>> @@ -51,6 +51,7 @@ struct mptcp_out_options {
>>>       u8 rm_id;
>>>       u8 join_id;
>>>       u8 backup;
>>> +     u8 prio_bkup;
>>
>> The existing 'backup' struct member can be used for this.
>>
>>>       u32 nonce;
>>>       u64 thmac;
>>>       u32 token;
>>> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
>>> index f611fbcbd6d0..b74e6ab2d605 100644
>>> --- a/net/mptcp/options.c
>>> +++ b/net/mptcp/options.c
>>> @@ -665,6 +665,30 @@ static bool mptcp_established_options_rm_addr(struct sock *sk,
>>>       return true;
>>> }
>>>
>>> +static bool mptcp_established_options_mp_prio(struct sock *sk,
>>> +                                           unsigned int *size,
>>> +                                           unsigned int remaining,
>>> +                                           struct mptcp_out_options *opts)
>>> +{
>>> +     struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
>>> +
>>> +     if (!subflow->send_mp_prio)
>>> +             return false;
>>> +
>>> +     if (remaining < TCPOLEN_MPTCP_PRIO)
>>> +             return false;
>>> +
>>> +     subflow->send_mp_prio = 0;
>>
>> tcp_established_options() is called by tcp_current_mss(), so clearing
>> send_mp_prio here will stop MP_PRIO from being sent sometimes.
>>
>
> Should we move this clearing to the end of this function? Or move it into
> mptcp_write_options? Please give me some hint for this.
>

Moving to mptcp_write_options() would be good.


Mat


>>> +
>>> +     *size = TCPOLEN_MPTCP_PRIO;
>>> +     opts->suboptions |= OPTION_MPTCP_PRIO;
>>> +     opts->prio_bkup = subflow->prio_bkup;
>>> +
>>> +     pr_debug("prio=%d", opts->prio_bkup);
>>> +
>>> +     return true;
>>> +}
>>> +
>>> bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
>>>                              unsigned int *size, unsigned int remaining,
>>>                              struct mptcp_out_options *opts)
>>> @@ -707,6 +731,12 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
>>>               ret = true;
>>>       }
>>>
>>> +     if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) {
>>> +             *size += opt_size;
>>> +             remaining -= opt_size;
>>> +             ret = true;
>>> +     }
>>> +
>>>       return ret;
>>> }
>>>
>>> @@ -1138,6 +1168,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
>>>                                     0, opts->rm_id);
>>>       }
>>>
>>> +     if (OPTION_MPTCP_PRIO & opts->suboptions) {
>>> +             *ptr++ = mptcp_option(MPTCPOPT_MP_PRIO,
>>> +                                   TCPOLEN_MPTCP_PRIO,
>>> +                                   opts->prio_bkup, TCPOPT_NOP);
>>> +     }
>>> +
>>>       if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
>>>               *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
>>>                                     TCPOLEN_MPTCP_MPJ_SYN,
>>> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
>>> index 069447424ddb..a243017c4892 100644
>>> --- a/net/mptcp/pm_netlink.c
>>> +++ b/net/mptcp/pm_netlink.c
>>> @@ -441,6 +441,36 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
>>>       }
>>> }
>>>
>>> +void mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
>>> +                            struct mptcp_addr_info *addr,
>>> +                            u8 prio_bkup)
>>> +{
>>> +     struct mptcp_subflow_context *subflow, *tmp;
>>> +
>>> +     if (list_empty(&msk->conn_list))
>>> +             return;
>>> +
>>> +     list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
>>> +             struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
>>> +             struct mptcp_addr_info local;
>>> +
>>> +             local_address((struct sock_common *)ssk, &local);
>>> +             if (!addresses_equal(&local, addr, false))
>>> +                     continue;
>>> +
>>> +             subflow->send_mp_prio = 1;
>>> +             subflow->prio_bkup = prio_bkup;
>>> +             spin_unlock_bh(&msk->pm.lock);
>>> +             pr_debug("send ack for mp_prio");
>>> +             lock_sock(ssk);
>>> +             tcp_send_ack(ssk);
>>> +             release_sock(ssk);
>>> +             spin_lock_bh(&msk->pm.lock);
>>> +
>>> +             break;
>>> +     }
>>> +}
>>> +
>>> void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
>>> {
>>>       struct mptcp_subflow_context *subflow, *tmp;
>>> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
>>> index b01c1fae9d8f..a8ed1de1cb05 100644
>>> --- a/net/mptcp/protocol.h
>>> +++ b/net/mptcp/protocol.h
>>> @@ -23,6 +23,7 @@
>>> #define OPTION_MPTCP_ADD_ADDR BIT(6)
>>> #define OPTION_MPTCP_ADD_ADDR6        BIT(7)
>>> #define OPTION_MPTCP_RM_ADDR  BIT(8)
>>> +#define OPTION_MPTCP_PRIO    BIT(9)
>>>
>>> /* MPTCP option subtypes */
>>> #define MPTCPOPT_MP_CAPABLE   0
>>> @@ -59,6 +60,7 @@
>>> #define TCPOLEN_MPTCP_PORT_LEN                4
>>> #define TCPOLEN_MPTCP_ADD_ADDR_HMAC   8
>>> #define TCPOLEN_MPTCP_RM_ADDR_BASE    4
>>> +#define TCPOLEN_MPTCP_PRIO           4
>>>
>>> /* MPTCP MP_JOIN flags */
>>> #define MPTCPOPT_BACKUP               BIT(0)
>>> @@ -362,6 +364,7 @@ struct mptcp_subflow_context {
>>>               map_valid : 1,
>>>               mpc_map : 1,
>>>               backup : 1,
>>> +             send_mp_prio : 1,
>>>               rx_eof : 1,
>>>               can_ack : 1,        /* only after processing the remote a key */
>>>               disposable : 1;     /* ctx can be free at ulp release time */
>>> @@ -373,6 +376,7 @@ struct mptcp_subflow_context {
>>>       u8      hmac[MPTCPOPT_HMAC_LEN];
>>>       u8      local_id;
>>>       u8      remote_id;
>>> +     u8      prio_bkup;
>>
>> The existing 'backup' bit in this struct is keeping track of the peer's
>> requested backup flag, which affects the choice for the local msk to send
>> on that subflow.
>>
>> The existing 'request_bkup' bit is tracking which priority (backup or
>> normal) we have requested from the peer. I think prio_bkup duplicates this
>> bit.
>>
>>>
>>>       struct  sock *tcp_sock;     /* tcp sk backpointer */
>>>       struct  sock *conn;         /* parent mptcp_sock */
>>> @@ -515,6 +519,9 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
>>>                               const struct mptcp_addr_info *addr);
>>> void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
>>> void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
>>> +void mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
>>> +                            struct mptcp_addr_info *addr,
>>> +                            u8 prio_bkup);
>>> void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
>>> struct mptcp_pm_add_entry *
>>> mptcp_pm_del_add_timer(struct mptcp_sock *msk,
>>> --
>>> 2.26.2

--
Mat Martineau
Intel

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

* [MPTCP] Re: [MPTCP][RFC PATCH mptcp-next 1/6] mptcp: add the outgoing MP_PRIO support
@ 2020-11-19 12:00 Geliang Tang
  0 siblings, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2020-11-19 12:00 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 8373 bytes --]

Hi Mat,

Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2020年11月10日周二 上午9:48写道:
>
> On Thu, 5 Nov 2020, Geliang Tang wrote:
>
> > This patch added the outgoing MP_PRIO logic:
> >
> > In mptcp_pm_mp_prio_send_ack, find the related subflow and subsocket
> > according to the input parameter address, then set subflow's send_mp_prio
> > flag to true, and save the input priority value to suflow's prio_bkup.
> > Finally, send out a pure ACK on the related subsocket.
> >
> > In mptcp_established_options_mp_prio, check whether the subflow's
> > send_mp_prio is set. If it is, this is the packet for send MP_PRIO. So
> > save subflow->prio_bkup value to mptcp_out_options's prio_bkup, and
> > change the option type to OPTION_MPTCP_PRIO.
> >
> > In mptcp_write_options, sent out the MP_PRIO suboption with
> > mptcp_out_options's prio_bkup value.
> >
>
> Hi Geliang,
>
> Thanks for working on this additional feature!
>
>
> > Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
> > ---
> > include/net/mptcp.h    |  1 +
> > net/mptcp/options.c    | 36 ++++++++++++++++++++++++++++++++++++
> > net/mptcp/pm_netlink.c | 30 ++++++++++++++++++++++++++++++
> > net/mptcp/protocol.h   |  7 +++++++
> > 4 files changed, 74 insertions(+)
> >
> > diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> > index 5694370be3d4..f71259fb04cd 100644
> > --- a/include/net/mptcp.h
> > +++ b/include/net/mptcp.h
> > @@ -51,6 +51,7 @@ struct mptcp_out_options {
> >       u8 rm_id;
> >       u8 join_id;
> >       u8 backup;
> > +     u8 prio_bkup;
>
> The existing 'backup' struct member can be used for this.
>
> >       u32 nonce;
> >       u64 thmac;
> >       u32 token;
> > diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> > index f611fbcbd6d0..b74e6ab2d605 100644
> > --- a/net/mptcp/options.c
> > +++ b/net/mptcp/options.c
> > @@ -665,6 +665,30 @@ static bool mptcp_established_options_rm_addr(struct sock *sk,
> >       return true;
> > }
> >
> > +static bool mptcp_established_options_mp_prio(struct sock *sk,
> > +                                           unsigned int *size,
> > +                                           unsigned int remaining,
> > +                                           struct mptcp_out_options *opts)
> > +{
> > +     struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> > +
> > +     if (!subflow->send_mp_prio)
> > +             return false;
> > +
> > +     if (remaining < TCPOLEN_MPTCP_PRIO)
> > +             return false;
> > +
> > +     subflow->send_mp_prio = 0;
>
> tcp_established_options() is called by tcp_current_mss(), so clearing
> send_mp_prio here will stop MP_PRIO from being sent sometimes.
>

Should we move this clearing to the end of this function? Or move it into
mptcp_write_options? Please give me some hint for this.

Thanks.

-Geliang

> > +
> > +     *size = TCPOLEN_MPTCP_PRIO;
> > +     opts->suboptions |= OPTION_MPTCP_PRIO;
> > +     opts->prio_bkup = subflow->prio_bkup;
> > +
> > +     pr_debug("prio=%d", opts->prio_bkup);
> > +
> > +     return true;
> > +}
> > +
> > bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> >                              unsigned int *size, unsigned int remaining,
> >                              struct mptcp_out_options *opts)
> > @@ -707,6 +731,12 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
> >               ret = true;
> >       }
> >
> > +     if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) {
> > +             *size += opt_size;
> > +             remaining -= opt_size;
> > +             ret = true;
> > +     }
> > +
> >       return ret;
> > }
> >
> > @@ -1138,6 +1168,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
> >                                     0, opts->rm_id);
> >       }
> >
> > +     if (OPTION_MPTCP_PRIO & opts->suboptions) {
> > +             *ptr++ = mptcp_option(MPTCPOPT_MP_PRIO,
> > +                                   TCPOLEN_MPTCP_PRIO,
> > +                                   opts->prio_bkup, TCPOPT_NOP);
> > +     }
> > +
> >       if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
> >               *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
> >                                     TCPOLEN_MPTCP_MPJ_SYN,
> > diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> > index 069447424ddb..a243017c4892 100644
> > --- a/net/mptcp/pm_netlink.c
> > +++ b/net/mptcp/pm_netlink.c
> > @@ -441,6 +441,36 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
> >       }
> > }
> >
> > +void mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
> > +                            struct mptcp_addr_info *addr,
> > +                            u8 prio_bkup)
> > +{
> > +     struct mptcp_subflow_context *subflow, *tmp;
> > +
> > +     if (list_empty(&msk->conn_list))
> > +             return;
> > +
> > +     list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
> > +             struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> > +             struct mptcp_addr_info local;
> > +
> > +             local_address((struct sock_common *)ssk, &local);
> > +             if (!addresses_equal(&local, addr, false))
> > +                     continue;
> > +
> > +             subflow->send_mp_prio = 1;
> > +             subflow->prio_bkup = prio_bkup;
> > +             spin_unlock_bh(&msk->pm.lock);
> > +             pr_debug("send ack for mp_prio");
> > +             lock_sock(ssk);
> > +             tcp_send_ack(ssk);
> > +             release_sock(ssk);
> > +             spin_lock_bh(&msk->pm.lock);
> > +
> > +             break;
> > +     }
> > +}
> > +
> > void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
> > {
> >       struct mptcp_subflow_context *subflow, *tmp;
> > diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> > index b01c1fae9d8f..a8ed1de1cb05 100644
> > --- a/net/mptcp/protocol.h
> > +++ b/net/mptcp/protocol.h
> > @@ -23,6 +23,7 @@
> > #define OPTION_MPTCP_ADD_ADDR BIT(6)
> > #define OPTION_MPTCP_ADD_ADDR6        BIT(7)
> > #define OPTION_MPTCP_RM_ADDR  BIT(8)
> > +#define OPTION_MPTCP_PRIO    BIT(9)
> >
> > /* MPTCP option subtypes */
> > #define MPTCPOPT_MP_CAPABLE   0
> > @@ -59,6 +60,7 @@
> > #define TCPOLEN_MPTCP_PORT_LEN                4
> > #define TCPOLEN_MPTCP_ADD_ADDR_HMAC   8
> > #define TCPOLEN_MPTCP_RM_ADDR_BASE    4
> > +#define TCPOLEN_MPTCP_PRIO           4
> >
> > /* MPTCP MP_JOIN flags */
> > #define MPTCPOPT_BACKUP               BIT(0)
> > @@ -362,6 +364,7 @@ struct mptcp_subflow_context {
> >               map_valid : 1,
> >               mpc_map : 1,
> >               backup : 1,
> > +             send_mp_prio : 1,
> >               rx_eof : 1,
> >               can_ack : 1,        /* only after processing the remote a key */
> >               disposable : 1;     /* ctx can be free at ulp release time */
> > @@ -373,6 +376,7 @@ struct mptcp_subflow_context {
> >       u8      hmac[MPTCPOPT_HMAC_LEN];
> >       u8      local_id;
> >       u8      remote_id;
> > +     u8      prio_bkup;
>
> The existing 'backup' bit in this struct is keeping track of the peer's
> requested backup flag, which affects the choice for the local msk to send
> on that subflow.
>
> The existing 'request_bkup' bit is tracking which priority (backup or
> normal) we have requested from the peer. I think prio_bkup duplicates this
> bit.
>
> >
> >       struct  sock *tcp_sock;     /* tcp sk backpointer */
> >       struct  sock *conn;         /* parent mptcp_sock */
> > @@ -515,6 +519,9 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
> >                               const struct mptcp_addr_info *addr);
> > void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
> > void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
> > +void mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
> > +                            struct mptcp_addr_info *addr,
> > +                            u8 prio_bkup);
> > void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
> > struct mptcp_pm_add_entry *
> > mptcp_pm_del_add_timer(struct mptcp_sock *msk,
> > --
> > 2.26.2
>
> --
> Mat Martineau
> Intel

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

end of thread, other threads:[~2020-11-19 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  1:48 [MPTCP] Re: [MPTCP][RFC PATCH mptcp-next 1/6] mptcp: add the outgoing MP_PRIO support Mat Martineau
2020-11-19 12:00 Geliang Tang
2020-11-19 23:55 Mat Martineau

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.