From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Geliang Tang <geliangtang@gmail.com>,
mptcp@lists.linux.dev, Geliang Tang <geliangtang@xiaomi.com>
Subject: Re: [PATCH mptcp-next v2 3/9] mptcp: add MAPPING_INFINITE mapping status
Date: Fri, 10 Sep 2021 10:22:32 -0700 (PDT) [thread overview]
Message-ID: <901848c-bd52-c78-756c-455a70b44e49@linux.intel.com> (raw)
In-Reply-To: <add72c536daafa4fadc76fab88ab437293c163d4.camel@redhat.com>
On Fri, 10 Sep 2021, Paolo Abeni wrote:
> On Thu, 2021-09-09 at 17:21 -0700, Mat Martineau wrote:
>> On Thu, 9 Sep 2021, Paolo Abeni wrote:
>>
>>> On Thu, 2021-09-09 at 19:51 +0800, Geliang Tang wrote:
>>>> From: Geliang Tang <geliangtang@xiaomi.com>
>>>>
>>>> This patch added a new mapping status named MAPPING_INFINITE. If the
>>>> MPTCP_INFINITE_DONE flag is set in get_mapping_status, return this new
>>>> status. And in subflow_check_data_avail, if this status is set, goto the
>>>> 'infinite' lable to fallback.
>>>>
>>>> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
>>>> ---
>>>> net/mptcp/subflow.c | 8 ++++++++
>>>> 1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
>>>> index 951aafb6021e..ad8efe56eab6 100644
>>>> --- a/net/mptcp/subflow.c
>>>> +++ b/net/mptcp/subflow.c
>>>> @@ -798,6 +798,7 @@ enum mapping_status {
>>>> MAPPING_INVALID,
>>>> MAPPING_EMPTY,
>>>> MAPPING_DATA_FIN,
>>>> + MAPPING_INFINITE,
>>>> MAPPING_DUMMY
>>>> };
>>>>
>>>> @@ -938,6 +939,9 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
>>>> if (!skb)
>>>> return MAPPING_EMPTY;
>>>>
>>>> + if (mptcp_check_infinite(ssk))
>>>> + return MAPPING_INFINITE;
>>>> +
>>>> if (mptcp_check_fallback(ssk))
>>>> return MAPPING_DUMMY;
>>>>
>>>> @@ -1121,6 +1125,9 @@ static bool subflow_check_data_avail(struct sock *ssk)
>>>>
>>>> status = get_mapping_status(ssk, msk);
>>>> trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
>>>> + if (unlikely(status == MAPPING_INFINITE))
>>>> + goto infinite;
>>>> +
>>>> if (unlikely(status == MAPPING_INVALID))
>>>> goto fallback;
>>>>
>>>> @@ -1192,6 +1199,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
>>>> return false;
>>>> }
>>>>
>>>> +infinite:
>>>> __mptcp_do_fallback(msk);
>>>> skb = skb_peek(&ssk->sk_receive_queue);
>>>> subflow->map_valid = 1;
>>>
>>> It looks like MAPPING_INFINITE has almost the same behavior
>>> of MAPPING_DUMMY.
>>
>> This is something else I asked for in the v1 review, to avoid reusing
>> MAPPING_INVALID in a confusing way :)
>
> I read that ;) I thought 'MAPPING_DUMMY' would be less confusing.
>
>> How about using a switch statement after get_mapping_status() instead of 4
>> if's in a row?
>
> Will be mostly the same, from generate code perspective, I think.
>
> What if we rename MAPPING_DUMMY into MAPPING_INFINITE, and we use only
> a single value? MAPPING_DUMMY is currently used after a fallback to
> implement the sort of infinite mapping we use there.
>
That's fine.
>>> I think we can avoid the new conditional in get_mapping_status().
>>> Eventually we could do all the error checking after the 'fallback:'
>>> label only if the msk has not fallen back yet:
>>>
>>> fallback:
>>> if (!__mptcp_check_fallback(msk)) {
>>> /* RFC 8684 section 3.7. */
>>> if (subflow->send_mp_fail) {
>>> ...
>>> if (subflow->mp_join || subflow->fully_established) {
>>
>> This condition also needs to check for the infinite mapping case, which is
>> why it seemed useful to have a separate MAPPING_ enum. Fallback is being
>> triggered here in response to the infinite mapping, so the subflow should
>> not be forced to close.
>
> My point is all about avoiding additional conditionals in the 'fast-
> path' / default receive path.
>
> I think we still could do that, and being able to discriminate here
> between infinite mapping received or not:
>
> - get_mapping_status() returns the same value in the dummy and infinite
> mapping case.
> - in the infinite mapping case, get_mapping_status() additionally sets
> subflow->map_data_len to 0,
- and in other cases, set it to nonzero.
> - in the above code - under 'if (!__mptcp_check_fallback(msk)) {' -
> subflow->map_data_len == 0 implies infinite mapping received,
>
> WDYT?
I think it works. I'm slightly uneasy with overloading
subflow->map_data_len from a code readability and maintenance perspective,
but if the optimization pays off it's manageable with some good comments.
--
Mat Martineau
Intel
next prev parent reply other threads:[~2021-09-10 17:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 11:51 [PATCH mptcp-next v2 0/9] The infinite mapping support Geliang Tang
2021-09-09 11:51 ` [PATCH mptcp-next v2 1/9] mptcp: add noncontiguous flag Geliang Tang
2021-09-09 13:25 ` Paolo Abeni
2021-09-10 0:00 ` Mat Martineau
2021-09-10 15:08 ` Paolo Abeni
2021-09-10 16:49 ` Mat Martineau
2021-09-09 11:51 ` [PATCH mptcp-next v2 2/9] mptcp: add MPTCP_INFINITE_DONE flag Geliang Tang
2021-09-09 13:31 ` Paolo Abeni
2021-09-09 11:51 ` [PATCH mptcp-next v2 3/9] mptcp: add MAPPING_INFINITE mapping status Geliang Tang
2021-09-09 13:39 ` Paolo Abeni
2021-09-10 0:21 ` Mat Martineau
2021-09-10 15:23 ` Paolo Abeni
2021-09-10 17:22 ` Mat Martineau [this message]
2021-09-09 11:51 ` [PATCH mptcp-next v2 4/9] mptcp: add start_seq in the msk Geliang Tang
2021-09-10 0:39 ` Mat Martineau
2021-09-09 11:51 ` [PATCH mptcp-next v2 5/9] mptcp: infinite mapping sending Geliang Tang
2021-09-09 13:54 ` Paolo Abeni
2021-09-09 11:51 ` [PATCH mptcp-next v2 6/9] mptcp: infinite mapping receiving Geliang Tang
2021-09-09 13:55 ` Paolo Abeni
2021-09-09 11:51 ` [PATCH mptcp-next v2 7/9] mptcp: add a mib for the infinite mapping sending Geliang Tang
2021-09-09 11:51 ` [PATCH mptcp-next v2 8/9] selftests: mptcp: add infinite map mibs check Geliang Tang
2021-09-09 11:51 ` [PATCH mptcp-next v2 9/9] DO-NOT-MERGE: mptcp: mp_fail test Geliang Tang
2021-09-09 14:23 ` Paolo Abeni
2021-09-22 3:50 ` Geliang Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=901848c-bd52-c78-756c-455a70b44e49@linux.intel.com \
--to=mathew.j.martineau@linux.intel.com \
--cc=geliangtang@gmail.com \
--cc=geliangtang@xiaomi.com \
--cc=mptcp@lists.linux.dev \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox