On Fri, Jul 07, 2023 at 10:43:21AM +0200, Claudio Jeker wrote:
> On Fri, Jul 07, 2023 at 11:38:58AM +0300, YASUOKA Masahiko wrote:
> > Hi,
> > 
> > Does using 64 bit for timer in tcpcb require this?
> 
> Not sure about this but one comment below.

When we introduced struct tcp_info, we discussed if we should make
values 64 bit to be prepared for future.  Conclusion was 32 bit are
enough.  There are no other 64 bit fields in it.

As we want to keep the ABI stable, I would stay with 32.

Values are relative to tcp_now(), so it will overflow after 49 days.
The struct is only informing userland, this rare incorrectness is
not relevant for me.

bluhm

> > Index: sys/netinet/tcp.h
> > ===================================================================
> > RCS file: /cvs/src/sys/netinet/tcp.h,v
> > retrieving revision 1.24
> > diff -u -p -r1.24 tcp.h
> > --- sys/netinet/tcp.h       19 May 2023 01:04:39 -0000      1.24
> > +++ sys/netinet/tcp.h       7 Jul 2023 08:33:26 -0000
> > @@ -194,9 +194,9 @@ struct tcp_info {
> >     uint32_t        tcpi_snd_wl2;
> >     uint32_t        tcpi_snd_max;
> >     uint32_t        tcpi_ts_recent;
> > -   uint32_t        tcpi_ts_recent_age;
> > +   uint64_t        tcpi_ts_recent_age;
> >     uint32_t        tcpi_rfbuf_cnt;
> > -   uint32_t        tcpi_rfbuf_ts;
> > +   uint64_t        tcpi_rfbuf_ts;
> >     uint32_t        tcpi_so_rcv_sb_cc;
> >     uint32_t        tcpi_so_rcv_sb_hiwat;
> >     uint32_t        tcpi_so_rcv_sb_lowat;
> > Index: usr.bin/tcpbench/tcpbench.c
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/tcpbench/tcpbench.c,v
> > retrieving revision 1.69
> > diff -u -p -r1.69 tcpbench.c
> > --- usr.bin/tcpbench/tcpbench.c     22 May 2023 12:53:04 -0000      1.69
> > +++ usr.bin/tcpbench/tcpbench.c     7 Jul 2023 08:33:26 -0000
> > @@ -51,6 +51,7 @@
> >  #include <poll.h>
> >  #include <paths.h>
> >  #include <math.h>
> > +#include <inttypes.h>
> >  
> >  #define DEFAULT_PORT "12345"
> >  #define DEFAULT_STATS_INTERVAL 1000 /* ms */
> > @@ -411,7 +412,7 @@ tcp_stats_display(unsigned long long tot
> >                     P(tcpi, rcv_up, "%u")
> >                     P(tcpi, rcv_wscale, "%hhu")
> >                     P(tcpi, rfbuf_cnt, "%u")
> > -                   P(tcpi, rfbuf_ts, "%u")
> > +                   P(tcpi, rfbuf_ts, "%" PRIu64)
> 
> I don't think we need these ugly PRIu64 here. Just use %llu since in
> OpenBSD uint64_t is always a unsigned long long.
> 
> >                     P(tcpi, rtt, "%u")
> >                     P(tcpi, rttmin, "%u")
> >                     P(tcpi, rttvar, "%u")
> > @@ -436,7 +437,7 @@ tcp_stats_display(unsigned long long tot
> >                     P(tcpi, so_snd_sb_lowat, "%u")
> >                     P(tcpi, so_snd_sb_wat, "%u")
> >                     P(tcpi, ts_recent, "%u")
> > -                   P(tcpi, ts_recent_age, "%u")
> > +                   P(tcpi, ts_recent_age, "%" PRIu64)
> >  #undef S
> >  #undef P
> >             }
> 
> -- 
> :wq Claudio

Reply via email to