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: apply tweaks for PPP to only PPP interfaces



details:   https://anonhg.NetBSD.org/src/rev/b87c72d62d8c
branches:  trunk
changeset: 1022481:b87c72d62d8c
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 21 06:49:25 2021 +0000

description:
altq, cbq: apply tweaks for PPP to only PPP interfaces

diffstat:

 sys/altq/altq_rmclass.c |  47 ++++++++++++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diffs (80 lines):

diff -r 72810452944f -r b87c72d62d8c sys/altq/altq_rmclass.c
--- a/sys/altq/altq_rmclass.c   Wed Jul 21 06:48:28 2021 +0000
+++ b/sys/altq/altq_rmclass.c   Wed Jul 21 06:49:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $        */
+/*     $NetBSD: altq_rmclass.c,v 1.28 2021/07/21 06:49:25 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.27 2021/07/21 06:47:33 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.28 2021/07/21 06:49:25 ozaki-r Exp $");
 
 /* #ident "@(#)rm_class.c  1.48     97/12/05 SMI" */
 
@@ -62,6 +62,7 @@
 #include <sys/cprng.h>
 
 #include <net/if.h>
+#include <net/if_types.h>
 #ifdef ALTQ3_COMPAT
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
@@ -1291,32 +1292,32 @@
 #else
        pkt_time = ifd->curlen_[ifd->qo_] * ifd->ns_per_byte_ / 1000;
 #endif
-#if 1 /* ALTQ4PPP */
-       if (TS_LT(nowp, &ifd->ifnow_)) {
-               int iftime;
+       if (ifd->ifq_->altq_ifp->if_type == IFT_PPP) {
+               if (TS_LT(nowp, &ifd->ifnow_)) {
+                       int iftime;
 
-               /*
-                * make sure the estimated completion time does not go
-                * too far.  it can happen when the link layer supports
-                * data compression or the interface speed is set to
-                * a much lower value.
-                */
-               TS_DELTA(&ifd->ifnow_, nowp, iftime);
-               if (iftime+pkt_time < ifd->maxiftime_) {
+                       /*
+                        * make sure the estimated completion time does not go
+                        * too far.  it can happen when the link layer supports
+                        * data compression or the interface speed is set to
+                        * a much lower value.
+                        */
+                       TS_DELTA(&ifd->ifnow_, nowp, iftime);
+                       if (iftime+pkt_time < ifd->maxiftime_) {
+                               TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_);
+                       } else {
+                               TS_ADD_DELTA(nowp, ifd->maxiftime_, &ifd->ifnow_);
+                       }
+               } else {
+                       TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_);
+               }
+       } else {
+               if (TS_LT(nowp, &ifd->ifnow_)) {
                        TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_);
                } else {
-                       TS_ADD_DELTA(nowp, ifd->maxiftime_, &ifd->ifnow_);
+                       TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_);
                }
-       } else {
-               TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_);
        }
-#else
-       if (TS_LT(nowp, &ifd->ifnow_)) {
-               TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_);
-       } else {
-               TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_);
-       }
-#endif
 
        while (cl != NULL) {
                TS_DELTA(&ifd->ifnow_, &cl->last_, idle);



Home | Main Index | Thread Index | Old Index