RE: [PATCH v12 net-next 12/15] tcp: accecn: AccECN option send control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 7/4/25 10:53 AM, chia-yu.chang@xxxxxxxxxxxxxxxxxxx wrote:
> > @@ -285,9 +297,33 @@ static inline void 
> > tcp_ecn_received_counters(struct sock *sk,
> >
> >               if (len > 0) {
> >                       u8 minlen = 
> > tcp_ecnfield_to_accecn_optfield(ecnfield);
> > +                     u32 oldbytes = tp->received_ecn_bytes[ecnfield - 
> > + 1];
> > +
> >                       tp->received_ecn_bytes[ecnfield - 1] += len;
> >                       tp->accecn_minlen = max_t(u8, tp->accecn_minlen,
> >                                                 minlen);
> > +
> > +                     /* Demand AccECN option at least every 2^22 bytes to
> > +                      * avoid overflowing the ECN byte counters.
> > +                      */
> > +                     if ((tp->received_ecn_bytes[ecnfield - 1] ^ oldbytes) &
> > +                         ~((1 << 22) - 1)) {
> 
> I don't understand the above statement, I don't think it yield the result expected according to the above comment.

Hi Paolo,

I was thinking to change it into GENMASK_U32() and comments like below.

It is intended to send AccECN option at least once per 2^22-byte increase in the counter.

But this is done by checking the bit edges (from bit 22) of the byte counters to avoid extra variables.

u32 oldbytes = tp->received_ecn_bytes[ecnfield - 1];
u32 bytes_mask = GENMASK_U32(31, 22);

tp->received_ecn_bytes[ecnfield - 1] += len;
tp->accecn_minlen = max_t(u8, tp->accecn_minlen,
                          minlen);

/* Send AccECN option if any ECN byte counter is
 * increased by at least 2^22 bytes.
 */
if ((tp->received_ecn_bytes[ecnfield - 1] ^ oldbytes) &
    bytes_mask) {
        tcp_accecn_opt_demand_min(sk, 1);
}

Would it make more sense to you?




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux