Source-Changes-HG archive

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

[src/trunk]: src/sys/altq altq, cbq: change long to uint64_t for ILP32 archs



details:   https://anonhg.NetBSD.org/src/rev/977a50e10a89
branches:  trunk
changeset: 984750:977a50e10a89
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 21 06:47:33 2021 +0000

description:
altq, cbq: change long to uint64_t for ILP32 archs

PR kern/56319

diffstat:

 sys/altq/altq_cbq.h     |  14 +++++++-------
 sys/altq/altq_rmclass.c |  38 +++++++++++++++++++-------------------
 sys/altq/altq_rmclass.h |  22 +++++++++++-----------
 3 files changed, 37 insertions(+), 37 deletions(-)

diffs (253 lines):

diff -r 1961f815f44e -r 977a50e10a89 sys/altq/altq_cbq.h
--- a/sys/altq/altq_cbq.h       Wed Jul 21 06:45:10 2021 +0000
+++ b/sys/altq/altq_cbq.h       Wed Jul 21 06:47:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_cbq.h,v 1.10 2021/07/21 06:41:22 ozaki-r Exp $    */
+/*     $NetBSD: altq_cbq.h,v 1.11 2021/07/21 06:47:33 ozaki-r Exp $    */
 /*     $KAME: altq_cbq.h,v 1.12 2003/10/03 05:05:15 kjc Exp $  */
 
 /*
@@ -81,15 +81,15 @@
 
        /* other static class parameters useful for debugging */
        int             priority;
-       long            maxidle;
-       long            minidle;
-       long            offtime;
+       int64_t         maxidle;
+       int64_t         minidle;
+       int64_t         offtime;
        int             qmax;
-       u_long          ps_per_byte;
+       uint64_t        ps_per_byte;
        int             wrr_allot;
 
        int             qcnt;           /* # packets in queue */
-       long            avgidle;
+       int64_t         avgidle;
 
        /* red and rio related info */
        int             qtype;
@@ -112,7 +112,7 @@
 
 typedef struct cbq_class_spec {
        u_int           priority;
-       u_long          pico_sec_per_byte;
+       uint64_t        pico_sec_per_byte;
        u_int           maxq;
        u_int           maxidle;
        int             minidle;
diff -r 1961f815f44e -r 977a50e10a89 sys/altq/altq_rmclass.c
--- a/sys/altq/altq_rmclass.c   Wed Jul 21 06:45:10 2021 +0000
+++ b/sys/altq/altq_rmclass.c   Wed Jul 21 06:47:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_rmclass.c,v 1.26 2021/07/21 06:41:22 ozaki-r Exp $        */
+/*     $NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $        */
 /*     $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $      */
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.26 2021/07/21 06:41:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $");
 
 /* #ident "@(#)rm_class.c  1.48     97/12/05 SMI" */
 
@@ -194,7 +194,7 @@
  *     offtime = offtime * (8.0 / nsecPerByte);
  */
 struct rm_class *
-rmc_newclass(int pri, struct rm_ifdat *ifd, u_long psecPerByte,
+rmc_newclass(int pri, struct rm_ifdat *ifd, uint64_t psecPerByte,
     void (*action)(rm_class_t *, rm_class_t *), int maxq,
     struct rm_class *parent, struct rm_class *borrow, u_int maxidle,
     int minidle, u_int offtime, int pktsize, int flags)
@@ -253,18 +253,18 @@
        cl->flags_ = flags;
 
 #if 1 /* minidle is also scaled in ALTQ */
-       cl->minidle_ = ((long)minidle * (long)psecPerByte) / 8;
+       cl->minidle_ = ((int64_t)minidle * (int64_t)psecPerByte) / 8;
        if (cl->minidle_ > 0)
                cl->minidle_ = 0;
 #else
        cl->minidle_ = minidle;
 #endif
-       cl->maxidle_ = ((long)maxidle * (long)psecPerByte) / 8;
+       cl->maxidle_ = ((int64_t)maxidle * (int64_t)psecPerByte) / 8;
        if (cl->maxidle_ == 0)
                cl->maxidle_ = 1;
 #if 1 /* offtime is also scaled in ALTQ */
        cl->avgidle_ = cl->maxidle_;
-       cl->offtime_ = (((long)offtime * (long)psecPerByte) / 8) >> RM_FILTER_GAIN;
+       cl->offtime_ = (((int64_t)offtime * (int64_t)psecPerByte) / 8) >> RM_FILTER_GAIN;
        if (cl->offtime_ == 0)
                cl->offtime_ = 1;
 #else
@@ -347,7 +347,7 @@
 }
 
 int
-rmc_modclass(struct rm_class *cl, u_long psecPerByte, int maxq, u_int maxidle,
+rmc_modclass(struct rm_class *cl, uint64_t psecPerByte, int maxq, u_int maxidle,
     int minidle, u_int offtime, int pktsize)
 {
        struct rm_ifdat *ifd;
@@ -365,18 +365,18 @@
        qlimit(cl->q_) = maxq;
 
 #if 1 /* minidle is also scaled in ALTQ */
-       cl->minidle_ = ((long)minidle * (long)psecPerByte) / 8;
+       cl->minidle_ = ((int64_t)minidle * (int64_t)psecPerByte) / 8;
        if (cl->minidle_ > 0)
                cl->minidle_ = 0;
 #else
        cl->minidle_ = minidle;
 #endif
-       cl->maxidle_ = ((long)maxidle * (long)psecPerByte) / 8;
+       cl->maxidle_ = ((int64_t)maxidle * (int64_t)psecPerByte) / 8;
        if (cl->maxidle_ == 0)
                cl->maxidle_ = 1;
 #if 1 /* offtime is also scaled in ALTQ */
        cl->avgidle_ = cl->maxidle_;
-       cl->offtime_ = (((long)offtime * (long)psecPerByte) / 8) >> RM_FILTER_GAIN;
+       cl->offtime_ = (((int64_t)offtime * (int64_t)psecPerByte) / 8) >> RM_FILTER_GAIN;
        if (cl->offtime_ == 0)
                cl->offtime_ = 1;
 #else
@@ -661,7 +661,7 @@
  */
 
 int
-rmc_init(struct ifaltq *ifq, struct rm_ifdat *ifd, u_long psecPerByte,
+rmc_init(struct ifaltq *ifq, struct rm_ifdat *ifd, uint64_t psecPerByte,
     void (*restart)(struct ifaltq *), int maxq, int maxqueued, u_int maxidle,
     int minidle, u_int offtime, int flags)
 {
@@ -689,7 +689,7 @@
        ifd->efficient_ = (flags & RMCF_EFFICIENT) ? 1 : 0;
 #if 1
        ifd->maxiftime_ = mtu * psecPerByte / 1000 / 1000 * 16;
-       if ((long)mtu * psecPerByte > (long)10 * 1000000000)
+       if ((int64_t)mtu * psecPerByte > (int64_t)10 * 1000000000)
                ifd->maxiftime_ /= 4;
 #endif
 
@@ -1253,9 +1253,9 @@
 void
 rmc_update_class_util(struct rm_ifdat *ifd)
 {
-       long             idle, avgidle, pktlen;
-       long             pkt_time;
-       long             tidle;
+       int64_t          idle, avgidle, pktlen;
+       int64_t          pkt_time;
+       int64_t          tidle;
        rm_class_t      *cl, *cl0, *borrowed;
        rm_class_t      *borrows;
        struct timespec *nowp;
@@ -1267,7 +1267,7 @@
                return;
 
        cl0 = cl;
-       pktlen = (long)ifd->curlen_[ifd->qo_];
+       pktlen = (int64_t)ifd->curlen_[ifd->qo_];
        borrowed = ifd->borrowed_[ifd->qo_];
        borrows = borrowed;
 
@@ -1286,7 +1286,7 @@
        nowp = &ifd->now_[ifd->qo_];
        /* get pkt_time (for link) in usec */
 #if 1  /* use approximation */
-       pkt_time = (long)ifd->curlen_[ifd->qo_] * (long)ifd->ps_per_byte_;
+       pkt_time = (int64_t)ifd->curlen_[ifd->qo_] * (int64_t)ifd->ps_per_byte_;
        pkt_time = PSEC_TO_NSEC(pkt_time);
 #else
        pkt_time = ifd->curlen_[ifd->qo_] * ifd->ns_per_byte_ / 1000;
@@ -1329,7 +1329,7 @@
 
                /* get pkt_time (for class) in usec */
 #if 1  /* use approximation */
-               pkt_time = pktlen * (long)cl->ps_per_byte_;
+               pkt_time = pktlen * (int64_t)cl->ps_per_byte_;
                pkt_time = PSEC_TO_NSEC(pkt_time);
 #else
                pkt_time = pktlen * cl->ns_per_byte_ / 1000;
@@ -1485,7 +1485,7 @@
 rmc_delay_action(struct rm_class *cl, struct rm_class *borrow)
 {
        int     t;
-       long    ndelay, extradelay;
+       int64_t ndelay, extradelay;
 
        cl->stats_.overactions++;
        if (borrow != NULL)
diff -r 1961f815f44e -r 977a50e10a89 sys/altq/altq_rmclass.h
--- a/sys/altq/altq_rmclass.h   Wed Jul 21 06:45:10 2021 +0000
+++ b/sys/altq/altq_rmclass.h   Wed Jul 21 06:47:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_rmclass.h,v 1.11 2021/07/21 06:41:22 ozaki-r Exp $        */
+/*     $NetBSD: altq_rmclass.h,v 1.12 2021/07/21 06:47:33 ozaki-r Exp $        */
 /*     $KAME: altq_rmclass.h,v 1.10 2003/08/20 23:30:23 itojun Exp $   */
 
 /*
@@ -126,16 +126,16 @@
        rm_ifdat_t      *ifdat_;
        int             pri_;           /* Class priority. */
        int             depth_;         /* Class depth */
-       u_long          ps_per_byte_;   /* PicoSeconds per byte. */
+       uint64_t        ps_per_byte_;   /* PicoSeconds per byte. */
        u_int           maxrate_;       /* Bytes per second for this class. */
        u_int           allotment_;     /* Fraction of link bandwidth. */
        u_int           w_allotment_;   /* Weighted allotment for WRR */
        int             bytes_alloc_;   /* Allocation for round of WRR */
 
-       long            avgidle_;
-       long            maxidle_;
-       long            minidle_;
-       long            offtime_;
+       int64_t         avgidle_;
+       int64_t         maxidle_;
+       int64_t         minidle_;
+       int64_t         offtime_;
        int             sleeping_;      /* != 0 if delaying */
        int             qthresh_;       /* Queue threshold for formal link sharing */
        int             leaf_;          /* Note whether leaf class or not.*/
@@ -154,7 +154,7 @@
        struct altq_pktattr *pktattr_;  /* saved hdr used by RED/ECN */
        int             flags_;
 
-       long            last_pkttime_;  /* saved pkt_time */
+       int64_t         last_pkttime_;  /* saved pkt_time */
        struct timespec undertime_;     /* time can next send */
        struct timespec last_;          /* time last packet sent */
        struct timespec overtime_;
@@ -170,7 +170,7 @@
        int             queued_;        /* # pkts queued downstream */
        int             efficient_;     /* Link Efficency bit */
        int             wrr_;           /* Enable Weighted Round-Robin */
-       u_long          ps_per_byte_;   /* Link byte speed. */
+       uint64_t        ps_per_byte_;   /* Link byte speed. */
        int             maxqueued_;     /* Max packets to queue */
        int             maxpkt_;        /* Max packet size. */
        int             qi_;            /* In/out pointers for downstream */
@@ -226,14 +226,14 @@
 
 #define        is_a_parent_class(cl)   ((cl)->children_ != NULL)
 
-extern rm_class_t *rmc_newclass(int, struct rm_ifdat *, u_long,
+extern rm_class_t *rmc_newclass(int, struct rm_ifdat *, uint64_t,
                                void (*)(struct rm_class *, struct rm_class *),
                                int, struct rm_class *, struct rm_class *,
                                u_int, int, u_int, int, int);
 extern void    rmc_delete_class(struct rm_ifdat *, struct rm_class *);
-extern int     rmc_modclass(struct rm_class *, u_long, int,
+extern int     rmc_modclass(struct rm_class *, uint64_t, int,
                             u_int, int, u_int, int);
-extern int     rmc_init(struct ifaltq *, struct rm_ifdat *, u_long,
+extern int     rmc_init(struct ifaltq *, struct rm_ifdat *, uint64_t,
                         void (*)(struct ifaltq *),
                         int, int, u_int, int, u_int, int);
 extern int     rmc_queue_packet(struct rm_class *, mbuf_t *);



Home | Main Index | Thread Index | Old Index