Source-Changes-HG archive

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

[src/trunk]: src/sys bring in latest ALTQ from kjc. ALTQify some of the driv...



details:   https://anonhg.NetBSD.org/src/rev/ed9d32be3152
branches:  trunk
changeset: 523114:ed9d32be3152
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Mar 05 04:12:57 2002 +0000

description:
bring in latest ALTQ from kjc.  ALTQify some of the drivers.

diffstat:

 sys/altq/altq_blue.c        |   82 +++++++++-----------
 sys/altq/altq_conf.c        |   34 +-------
 sys/altq/altq_red.c         |   83 +++++++++-----------
 sys/altq/altq_rmclass.h     |    8 +-
 sys/altq/altq_subr.c        |  171 ++++++++++++++++++++++++++++---------------
 sys/altq/if_altq.h          |    7 +-
 sys/arch/macppc/dev/if_bm.c |    5 +-
 sys/arch/macppc/dev/if_gm.c |    5 +-
 sys/dev/ic/hd64570.c        |    7 +-
 sys/dev/ic/midway.c         |    5 +-
 sys/dev/ic/pdq_ifsubr.c     |    5 +-
 sys/dev/ieee1394/if_fw.c    |   15 +--
 sys/dev/isa/if_hp.c         |    7 +-
 sys/dev/isa/if_iy.c         |    6 +-
 sys/dev/ofw/ofnet.c         |    7 +-
 sys/dev/pci/if_tl.c         |   13 +-
 sys/dev/qbus/if_dmc.c       |   19 ++--
 sys/dev/qbus/if_il.c        |    7 +-
 sys/dev/usb/if_upl.c        |   34 +++++---
 sys/net/if_arcsubr.c        |   36 +++++---
 sys/net/if_ether.h          |    6 +-
 sys/net/if_ethersubr.c      |    6 +-
 sys/net/if_gif.c            |   26 +-----
 sys/net/if_ieee1394subr.c   |   28 ++++---
 sys/net/if_ppp.c            |   26 ++++++-
 sys/net/if_tun.c            |   77 +++++++++++++++----
 sys/net/ppp_tty.c           |   13 ++-
 sys/netinet/ip.h            |   14 +++-
 28 files changed, 427 insertions(+), 325 deletions(-)

diffs (truncated from 1917 to 300 lines):

diff -r 03738c2d41cb -r ed9d32be3152 sys/altq/altq_blue.c
--- a/sys/altq/altq_blue.c      Tue Mar 05 04:11:51 2002 +0000
+++ b/sys/altq/altq_blue.c      Tue Mar 05 04:12:57 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: altq_blue.c,v 1.4 2001/11/12 23:14:21 lukem Exp $      */
-/*     $KAME: altq_blue.c,v 1.7 2000/12/14 08:12:45 thorpej Exp $      */
+/*     $NetBSD: altq_blue.c,v 1.5 2002/03/05 04:12:57 itojun Exp $     */
+/*     $KAME: altq_blue.c,v 1.8 2002/01/07 11:25:40 kjc Exp $  */
 
 /*
  * Copyright (C) 1997-2000
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.4 2001/11/12 23:14:21 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.5 2002/03/05 04:12:57 itojun Exp $");
 
 #if defined(__FreeBSD__) || defined(__NetBSD__)
 #include "opt_altq.h"
@@ -550,46 +550,32 @@
        case AF_INET:
                if (flags & BLUEF_ECN4) {
                        struct ip *ip = (struct ip *)pktattr->pattr_hdr;
+                       u_int8_t otos;
+                       int sum;
            
                        if (ip->ip_v != 4)
                                return (0);     /* version mismatch! */
-                       if (ip->ip_tos & IPTOS_ECT) {
-                               /* ECN-capable, mark ECN bit. */
-                               if ((ip->ip_tos & IPTOS_CE) == 0) {
-#if (IPTOS_CE == 0x01)
-                                       u_short sum;
+                       if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_NOTECT)
+                               return (0);     /* not-ECT */
+                       if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_CE)
+                               return (1);     /* already marked */
 
-                                       ip->ip_tos |= IPTOS_CE;
-                                       /*
-                                        * optimized version when IPTOS_CE
-                                        * is 0x01.
-                                        *   HC' = HC -1   when HC > 0
-                                        *       = 0xfffe  when HC = 0
-                                        */
-                                       sum = ntohs(ip->ip_sum);
-                                       if (sum == 0)
-                                               sum = 0xfffe;
-                                       else
-                                               sum -= 1;
-                                       ip->ip_sum = htons(sum);
-#else /* IPTOS_CE != 0x01 */
-                                       long sum;
-
-                                       ip->ip_tos |= IPTOS_CE;
-                                       /*
-                                        * update checksum (from RFC1624)
-                                        *         HC' = ~(~HC + ~m + m')
-                                        */
-                                       sum = ~ntohs(ip->ip_sum) & 0xffff;
-                                       sum += 0xffff + IPTOS_CE;
-                                       sum = (sum >> 16) + (sum & 0xffff);
-                                       sum += (sum >> 16);  /* add carry */
-
-                                       ip->ip_sum = htons(~sum & 0xffff);
-#endif /* IPTOS_CE != 0x01 */
-                               }
-                               return (1);
-                       }
+                       /*
+                        * ecn-capable but not marked,
+                        * mark CE and update checksum
+                        */
+                       otos = ip->ip_tos;
+                       ip->ip_tos |= IPTOS_ECN_CE;
+                       /*
+                        * update checksum (from RFC1624)
+                        *         HC' = ~(~HC + ~m + m')
+                        */
+                       sum = ~ntohs(ip->ip_sum) & 0xffff;
+                       sum += (~otos & 0xffff) + ip->ip_tos;
+                       sum = (sum >> 16) + (sum & 0xffff);
+                       sum += (sum >> 16);  /* add carry */
+                       ip->ip_sum = htons(~sum & 0xffff);
+                       return (1);
                }
                break;
 #ifdef INET6
@@ -601,12 +587,18 @@
                        flowlabel = ntohl(ip6->ip6_flow);
                        if ((flowlabel >> 28) != 6)
                                return (0);     /* version mismatch! */
-                       if (flowlabel & (IPTOS_ECT << 20)) {
-                               /* ECN-capable, mark ECN bit. */
-                               flowlabel |= (IPTOS_CE << 20);
-                               ip6->ip6_flow = htonl(flowlabel);
-                               return (1);
-                       }
+                       if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
+                           (IPTOS_ECN_NOTECT << 20))
+                               return (0);     /* not-ECT */
+                       if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
+                           (IPTOS_ECN_CE << 20))
+                               return (1);     /* already marked */
+                       /*
+                        * ecn-capable but not marked,  mark CE
+                        */
+                       flowlabel |= (IPTOS_ECN_CE << 20);
+                       ip6->ip6_flow = htonl(flowlabel);
+                       return (1);
                }
                break;
 #endif  /* INET6 */
diff -r 03738c2d41cb -r ed9d32be3152 sys/altq/altq_conf.c
--- a/sys/altq/altq_conf.c      Tue Mar 05 04:11:51 2002 +0000
+++ b/sys/altq/altq_conf.c      Tue Mar 05 04:12:57 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: altq_conf.c,v 1.5 2001/11/12 23:14:21 lukem Exp $      */
-/*     $KAME: altq_conf.c,v 1.10 2000/12/14 08:12:45 thorpej Exp $     */
+/*     $NetBSD: altq_conf.c,v 1.6 2002/03/05 04:12:57 itojun Exp $     */
+/*     $KAME: altq_conf.c,v 1.13 2002/01/29 10:16:01 kjc Exp $ */
 
 /*
  * Copyright (C) 1997-2000
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_conf.c,v 1.5 2001/11/12 23:14:21 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_conf.c,v 1.6 2002/03/05 04:12:57 itojun Exp $");
 
 #if defined(__FreeBSD__) || defined(__NetBSD__)
 #include "opt_altq.h"
@@ -173,9 +173,9 @@
 #define        CDEV_MAJOR 96           /* FreeBSD official number */
 #elif defined(__OpenBSD__)
 #if defined(__i386__)
-#define        CDEV_MAJOR 67           /* OpenBSD i386 (not official) */
+#define        CDEV_MAJOR 74           /* OpenBSD i386 (official) */
 #elif defined(__alpha__)
-#define        CDEV_MAJOR 52           /* OpenBSD alpha (not official) */
+#define        CDEV_MAJOR 53           /* OpenBSD alpha (official) */
 #else
 #error arch not supported
 #endif
@@ -193,10 +193,6 @@
          altqioctl,    seltrue,        nommap,         nostrategy,     
          "altq",       CDEV_MAJOR,     nodump,         nopsize,  0,  -1 };
 #endif
-#elif defined(__OpenBSD__)
-static struct cdevsw altq_cdevsw = {
-       altqopen, altqclose, 0, 0, altqioctl, 0,
-       0, 0, 0, 0 };
 #endif
 
 #if !defined(__NetBSD__) && !defined(__OpenBSD__)
@@ -298,7 +294,6 @@
        return ENXIO;
 }
 
-
 #if !defined(__NetBSD__)
 static int altq_devsw_installed = 0;
 #endif
@@ -354,23 +349,6 @@
 
 SYSINIT(altqdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,altq_drvinit,NULL)
 
-#elif defined(__OpenBSD__)
-
-void
-altqattach(int unused)
-{
-       if (!altq_devsw_installed) {
-               bcopy(&altq_cdevsw,
-                     &cdevsw[CDEV_MAJOR],
-                     sizeof(struct cdevsw));
-               altq_devsw_installed = 1;
-               printf("altq: major number is %d\n", CDEV_MAJOR);
-       }
-}
-#elif defined(__NetBSD__)
-/* NetBSD requires no altqattach() */
-#else
-#error altqattach()??
 #endif
 
 #ifdef ALTQ_KLD
@@ -458,5 +436,5 @@
 
        return(error);
 }
-       
+
 #endif  /* ALTQ_KLD */
diff -r 03738c2d41cb -r ed9d32be3152 sys/altq/altq_red.c
--- a/sys/altq/altq_red.c       Tue Mar 05 04:11:51 2002 +0000
+++ b/sys/altq/altq_red.c       Tue Mar 05 04:12:57 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: altq_red.c,v 1.5 2001/11/12 23:14:22 lukem Exp $       */
-/*     $KAME: altq_red.c,v 1.8 2000/12/14 08:12:46 thorpej Exp $       */
+/*     $NetBSD: altq_red.c,v 1.6 2002/03/05 04:12:57 itojun Exp $      */
+/*     $KAME: altq_red.c,v 1.9 2002/01/07 11:25:40 kjc Exp $   */
 
 /*
  * Copyright (C) 1997-2000
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.5 2001/11/12 23:14:22 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.6 2002/03/05 04:12:57 itojun Exp $");
 
 #if defined(__FreeBSD__) || defined(__NetBSD__)
 #include "opt_altq.h"
@@ -851,46 +851,33 @@
        case AF_INET:
                if (flags & REDF_ECN4) {
                        struct ip *ip = (struct ip *)pktattr->pattr_hdr;
+                       u_int8_t otos;
+                       int sum;
            
                        if (ip->ip_v != 4)
                                return (0);     /* version mismatch! */
-                       if (ip->ip_tos & IPTOS_ECT) {
-                               /* ECN-capable, mark ECN bit. */
-                               if ((ip->ip_tos & IPTOS_CE) == 0) {
-#if (IPTOS_CE == 0x01)
-                                       u_short sum;
+
+                       if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_NOTECT)
+                               return (0);     /* not-ECT */
+                       if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_CE)
+                               return (1);     /* already marked */
 
-                                       ip->ip_tos |= IPTOS_CE;
-                                       /*
-                                        * optimized version when IPTOS_CE
-                                        * is 0x01.
-                                        *   HC' = HC -1   when HC > 0
-                                        *       = 0xfffe  when HC = 0
-                                        */
-                                       sum = ntohs(ip->ip_sum);
-                                       if (sum == 0)
-                                               sum = 0xfffe;
-                                       else
-                                               sum -= 1;
-                                       ip->ip_sum = htons(sum);
-#else /* IPTOS_CE != 0x01 */
-                                       long sum;
-
-                                       ip->ip_tos |= IPTOS_CE;
-                                       /*
-                                        * update checksum (from RFC1624)
-                                        *         HC' = ~(~HC + ~m + m')
-                                        */
-                                       sum = ~ntohs(ip->ip_sum) & 0xffff;
-                                       sum += 0xffff + IPTOS_CE;
-                                       sum = (sum >> 16) + (sum & 0xffff);
-                                       sum += (sum >> 16);  /* add carry */
-
-                                       ip->ip_sum = htons(~sum & 0xffff);
-#endif /* IPTOS_CE != 0x01 */
-                               }
-                               return (1);
-                       }
+                       /*
+                        * ecn-capable but not marked,
+                        * mark CE and update checksum
+                        */
+                       otos = ip->ip_tos;
+                       ip->ip_tos |= IPTOS_ECN_CE;
+                       /*
+                        * update checksum (from RFC1624)
+                        *         HC' = ~(~HC + ~m + m')
+                        */
+                       sum = ~ntohs(ip->ip_sum) & 0xffff;
+                       sum += (~otos & 0xffff) + ip->ip_tos;
+                       sum = (sum >> 16) + (sum & 0xffff);
+                       sum += (sum >> 16);  /* add carry */
+                       ip->ip_sum = htons(~sum & 0xffff);
+                       return (1);
                }
                break;
 #ifdef INET6
@@ -902,12 +889,18 @@
                        flowlabel = ntohl(ip6->ip6_flow);
                        if ((flowlabel >> 28) != 6)
                                return (0);     /* version mismatch! */
-                       if (flowlabel & (IPTOS_ECT << 20)) {
-                               /* ECN-capable, mark ECN bit. */
-                               flowlabel |= (IPTOS_CE << 20);
-                               ip6->ip6_flow = htonl(flowlabel);
-                               return (1);
-                       }
+                       if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
+                           (IPTOS_ECN_NOTECT << 20))
+                               return (0);     /* not-ECT */
+                       if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==



Home | Main Index | Thread Index | Old Index