From: Paolo Abeni <pabeni@redhat.com>
To: "Chia-Yu Chang (Nokia)" <chia-yu.chang@nokia-bell-labs.com>,
"edumazet@google.com" <edumazet@google.com>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"corbet@lwn.net" <corbet@lwn.net>,
"horms@kernel.org" <horms@kernel.org>,
"dsahern@kernel.org" <dsahern@kernel.org>,
"kuniyu@amazon.com" <kuniyu@amazon.com>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"dave.taht@gmail.com" <dave.taht@gmail.com>,
"jhs@mojatatu.com" <jhs@mojatatu.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"stephen@networkplumber.org" <stephen@networkplumber.org>,
"xiyou.wangcong@gmail.com" <xiyou.wangcong@gmail.com>,
"jiri@resnulli.us" <jiri@resnulli.us>,
"davem@davemloft.net" <davem@davemloft.net>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"donald.hunter@gmail.com" <donald.hunter@gmail.com>,
"ast@fiberby.net" <ast@fiberby.net>,
"liuhangbin@gmail.com" <liuhangbin@gmail.com>,
"shuah@kernel.org" <shuah@kernel.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
"ij@kernel.org" <ij@kernel.org>,
"ncardwell@google.com" <ncardwell@google.com>,
"Koen De Schepper (Nokia)" <koen.de_schepper@nokia-bell-labs.com>,
"g.white@cablelabs.com" <g.white@cablelabs.com>,
"ingemar.s.johansson@ericsson.com"
<ingemar.s.johansson@ericsson.com>,
"mirja.kuehlewind@ericsson.com" <mirja.kuehlewind@ericsson.com>,
"cheshire@apple.com" <cheshire@apple.com>,
"rs.ietf@gmx.at" <rs.ietf@gmx.at>,
"Jason_Livingood@comcast.com" <Jason_Livingood@comcast.com>,
"vidhi_goel@apple.com" <vidhi_goel@apple.com>
Subject: Re: [PATCH v8 net-next 09/15] tcp: accecn: AccECN option
Date: Tue, 24 Jun 2025 08:39:36 +0200 [thread overview]
Message-ID: <ed5283a7-674b-4c5a-aade-c4f220485ce8@redhat.com> (raw)
In-Reply-To: <PAXPR07MB7984375C1887F1507F4E4726A37CA@PAXPR07MB7984.eurprd07.prod.outlook.com>
Hi,
I'm sorry for the late reply.
On 6/21/25 1:22 AM, Chia-Yu Chang (Nokia) wrote:
> From: Paolo Abeni <pabeni@redhat.com Sent: Tuesday, June 17, 2025 11:27 AM
>> CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.
>> On 6/10/25 2:53 PM, chia-yu.chang@nokia-bell-labs.com wrote:
>>> @@ -294,6 +295,9 @@ struct tcp_sock {
>>> rate_app_limited:1; /* rate_{delivered,interval_us} limited? */
>>> u8 received_ce_pending:4, /* Not yet transmit cnt of received_ce */
>>> unused2:4;
>>> + u8 accecn_minlen:2,/* Minimum length of AccECN option sent */
>>> + est_ecnfield:2,/* ECN field for AccECN delivered
>>> + estimates */
>>
>> It's unclear to me why you didn't use the 4 bits avail in 'unused2', instead of adding more fragmented bitfields.
>>
> Hi Paolo,
>
> This is becuase some bits of unused2 will be used in latter patches.
I see. Still it would be more clear to use the avail unused space first.
The final effect/layout would be the same. Or add an explicit note in
the commit message.
>>> @@ -4236,6 +4375,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
>>> if (tcp_ecn_mode_accecn(tp))
>>> ecn_count = tcp_accecn_process(sk, skb,
>>> tp->delivered -
>>> delivered,
>>> +
>>> + sack_state.delivered_bytes,
>>> &flag);
>>>
>>> tcp_in_ack_event(sk, flag);
>>> @@ -4275,6 +4415,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
>>> if (tcp_ecn_mode_accecn(tp))
>>> ecn_count = tcp_accecn_process(sk, skb,
>>> tp->delivered -
>>> delivered,
>>> +
>>> + sack_state.delivered_bytes,
>>> &flag);
>>
>> The two above chunks suggest you could move more code into
>> tcp_accecn_process()
>
> I do not get your point here.
>
> These two chunks reflect a new argument is added to tcp_accecn_process().
>
> But the value of this argument is computed by other fnuctions already, so not sure how to move code into tcp_accecn_process().
My point is that the 2 above chunks are identical, so you could possibly
move more (idenical) code into the helper and reduce the code duplication.
>>> static void tcp_options_write(struct tcphdr *th, struct tcp_sock *tp,
>>> tp->duplicate_sack : tp->selective_acks;
>>> int this_sack;
>>>
>>> - *ptr++ = htonl((TCPOPT_NOP << 24) |
>>> - (TCPOPT_NOP << 16) |
>>> + *ptr++ = htonl((leftover_bytes << 16) |
>>> (TCPOPT_SACK << 8) |
>>> (TCPOLEN_SACK_BASE + (opts->num_sack_blocks *
>>>
>>> TCPOLEN_SACK_PERBLOCK)));
>>
>> Here leftover_size/bytes are consumed and not updated, which should be safe as they will not be used later in this function, but looks inconsistent.
>>
>> The whole options handling looks very fragile to me. I really would prefer something simpler (i.e. just use the avail space if any) if that would work.
>
> I would still use leftover_size/bytes, but make it more consistent.
>
> As this part of code already pass AccECN packetdrill tests.
>
>>
>>> @@ -957,6 +1068,17 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
>>> }
>>> }
>>>
>>> + /* Simultaneous open SYN/ACK needs AccECN option but not SYN */
>>> + if (unlikely((TCP_SKB_CB(skb)->tcp_flags & TCPHDR_ACK) &&
>>> + tcp_ecn_mode_accecn(tp) &&
>>> + sock_net(sk)->ipv4.sysctl_tcp_ecn_option &&
>>> + remaining >= TCPOLEN_ACCECN_BASE)) {
>>> + u32 saving = tcp_synack_options_combine_saving(opts);
>>> +
>>> + opts->ecn_bytes = synack_ecn_bytes;
>>> + remaining -= tcp_options_fit_accecn(opts, 0, remaining, saving);
>>> + }
>>> +
>>> bpf_skops_hdr_opt_len(sk, skb, NULL, NULL, 0, opts, &remaining);
>>>
>>> return MAX_TCP_OPTION_SPACE - remaining;
>>
>> [...]
>>> @@ -1036,6 +1159,14 @@ static unsigned int tcp_synack_options(const
>>> struct sock *sk,
>>>
>>> smc_set_option_cond(tcp_sk(sk), ireq, opts, &remaining);
>>>
>>> + if (treq->accecn_ok && sock_net(sk)->ipv4.sysctl_tcp_ecn_option &&
>>> + remaining >= TCPOLEN_ACCECN_BASE) {
>>> + u32 saving = tcp_synack_options_combine_saving(opts);
>>> +
>>> + opts->ecn_bytes = synack_ecn_bytes;
>>> + remaining -= tcp_options_fit_accecn(opts, 0, remaining, saving);
>>> + }
>>> +
>>> bpf_skops_hdr_opt_len((struct sock *)sk, skb, req, syn_skb,
>>> synack_type, opts, &remaining);
>>>
>>
>> The similarities of the above 2 chuncks hints you could move more code into tcp_options_fit_accecn().
>>
>> /P
>
> I also do not get it, because tcp_options_fit_accecn() will be called with different argument values.
>
> So, I would prefer to keep as it is.
AFAICS the 3 lines inside the if branch are identical. You could create
an helper for that.
Side note: I'm spending quite a bit of time trimming the irrelevant part
of the reply to make it as straightforward as possible. Please do the
same: having to navigate hundred of lines of unrelated quoted text to
find a single line of contents maximize the chances of missing it.
Thanks,
Paolo
/P
next prev parent reply other threads:[~2025-06-24 6:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 12:52 [PATCH v8 net-next 00/15] AccECN protocol patch series chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 01/15] tcp: reorganize SYN ECN code chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 02/15] tcp: fast path functions later chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 03/15] tcp: reorganize tcp_sock_write_txrx group for variables later chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 04/15] tcp: AccECN core chia-yu.chang
2025-06-17 8:03 ` Paolo Abeni
2025-06-20 8:57 ` Chia-Yu Chang (Nokia)
2025-06-10 12:53 ` [PATCH v8 net-next 05/15] tcp: accecn: AccECN negotiation chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 06/15] tcp: accecn: add AccECN rx byte counters chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 07/15] tcp: accecn: AccECN needs to know delivered bytes chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 08/15] tcp: sack option handling improvements chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 09/15] tcp: accecn: AccECN option chia-yu.chang
2025-06-17 9:27 ` Paolo Abeni
2025-06-17 18:43 ` Ilpo Järvinen
2025-06-20 23:22 ` Chia-Yu Chang (Nokia)
2025-06-24 6:39 ` Paolo Abeni [this message]
2025-06-10 12:53 ` [PATCH v8 net-next 10/15] tcp: accecn: AccECN option send control chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 11/15] tcp: accecn: AccECN option failure handling chia-yu.chang
2025-06-17 9:44 ` Paolo Abeni
2025-06-10 12:53 ` [PATCH v8 net-next 12/15] tcp: accecn: AccECN option ceb/cep heuristic chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 13/15] tcp: accecn: AccECN ACE field multi-wrap heuristic chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 14/15] tcp: accecn: try to fit AccECN option with SACK chia-yu.chang
2025-06-10 12:53 ` [PATCH v8 net-next 15/15] tcp: try to avoid safer when ACKs are thinned chia-yu.chang
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=ed5283a7-674b-4c5a-aade-c4f220485ce8@redhat.com \
--to=pabeni@redhat.com \
--cc=Jason_Livingood@comcast.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@fiberby.net \
--cc=bpf@vger.kernel.org \
--cc=cheshire@apple.com \
--cc=chia-yu.chang@nokia-bell-labs.com \
--cc=corbet@lwn.net \
--cc=dave.taht@gmail.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=g.white@cablelabs.com \
--cc=horms@kernel.org \
--cc=ij@kernel.org \
--cc=ingemar.s.johansson@ericsson.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=koen.de_schepper@nokia-bell-labs.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=mirja.kuehlewind@ericsson.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=rs.ietf@gmx.at \
--cc=shuah@kernel.org \
--cc=stephen@networkplumber.org \
--cc=vidhi_goel@apple.com \
--cc=xiyou.wangcong@gmail.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;
as well as URLs for NNTP newsgroup(s).