[BACK]Return to altq_red.h CVS log [TXT][DIR] Up to [local] / sys / altq

Annotation of sys/altq/altq_red.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: altq_red.h,v 1.5 2002/12/16 17:27:20 henning Exp $    */
        !             2: /*     $KAME: altq_red.h,v 1.5 2000/12/14 08:12:46 thorpej Exp $       */
        !             3:
        !             4: /*
        !             5:  * Copyright (C) 1997-2002
        !             6:  *     Sony Computer Science Laboratories Inc.  All rights reserved.
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms, with or without
        !             9:  * modification, are permitted provided that the following conditions
        !            10:  * are met:
        !            11:  * 1. Redistributions of source code must retain the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer.
        !            13:  * 2. Redistributions in binary form must reproduce the above copyright
        !            14:  *    notice, this list of conditions and the following disclaimer in the
        !            15:  *    documentation and/or other materials provided with the distribution.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
        !            18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            20:  * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
        !            21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            27:  * SUCH DAMAGE.
        !            28:  */
        !            29:
        !            30: #ifndef _ALTQ_ALTQ_RED_H_
        !            31: #define        _ALTQ_ALTQ_RED_H_
        !            32:
        !            33: #include <altq/altq_classq.h>
        !            34:
        !            35: /* red flags */
        !            36: #define        REDF_ECN4       0x01    /* use packet marking for IPv4 packets */
        !            37: #define        REDF_ECN6       0x02    /* use packet marking for IPv6 packets */
        !            38: #define        REDF_ECN        (REDF_ECN4 | REDF_ECN6)
        !            39: #define        REDF_FLOWVALVE  0x04    /* use flowvalve (aka penalty-box) */
        !            40:
        !            41: /*
        !            42:  * simpler versions of red parameters and statistics used by other
        !            43:  * disciplines (e.g., CBQ)
        !            44:  */
        !            45: struct redparams {
        !            46:        int     th_min;         /* red min threshold */
        !            47:        int     th_max;         /* red max threshold */
        !            48:        int     inv_pmax;       /* inverse of max drop probability */
        !            49: };
        !            50:
        !            51: struct redstats {
        !            52:        int             q_avg;
        !            53:        struct pktcntr  xmit_cnt;
        !            54:        struct pktcntr  drop_cnt;
        !            55:        u_int           drop_forced;
        !            56:        u_int           drop_unforced;
        !            57:        u_int           marked_packets;
        !            58: };
        !            59:
        !            60: #ifdef _KERNEL
        !            61:
        !            62: /* weight table structure for idle time calibration */
        !            63: struct wtab {
        !            64:        struct wtab     *w_next;
        !            65:        int              w_weight;
        !            66:        int              w_param_max;
        !            67:        int              w_refcount;
        !            68:        int32_t          w_tab[32];
        !            69: };
        !            70:
        !            71: typedef struct red {
        !            72:        int             red_pkttime;    /* average packet time in micro sec
        !            73:                                           used for idle calibration */
        !            74:        int             red_flags;      /* red flags */
        !            75:
        !            76:        /* red parameters */
        !            77:        int             red_weight;     /* weight for EWMA */
        !            78:        int             red_inv_pmax;   /* inverse of max drop probability */
        !            79:        int             red_thmin;      /* red min threshold */
        !            80:        int             red_thmax;      /* red max threshold */
        !            81:
        !            82:        /* variables for internal use */
        !            83:        int             red_wshift;     /* log(red_weight) */
        !            84:        int             red_thmin_s;    /* th_min scaled by avgshift */
        !            85:        int             red_thmax_s;    /* th_max scaled by avgshift */
        !            86:        int             red_probd;      /* drop probability denominator */
        !            87:
        !            88:        int             red_avg;        /* queue len avg scaled by avgshift */
        !            89:        int             red_count;      /* packet count since last dropped/
        !            90:                                           marked packet */
        !            91:        int             red_idle;       /* queue was empty */
        !            92:        int             red_old;        /* avg is above th_min */
        !            93:        struct wtab     *red_wtab;      /* weight table */
        !            94:        struct timeval   red_last;      /* time when the queue becomes idle */
        !            95:
        !            96:        struct {
        !            97:                struct pktcntr  xmit_cnt;
        !            98:                struct pktcntr  drop_cnt;
        !            99:                u_int           drop_forced;
        !           100:                u_int           drop_unforced;
        !           101:                u_int           marked_packets;
        !           102:        } red_stats;
        !           103: } red_t;
        !           104:
        !           105: /* red drop types */
        !           106: #define        DTYPE_NODROP    0       /* no drop */
        !           107: #define        DTYPE_FORCED    1       /* a "forced" drop */
        !           108: #define        DTYPE_EARLY     2       /* an "unforced" (early) drop */
        !           109:
        !           110: extern red_t           *red_alloc(int, int, int, int, int, int);
        !           111: extern void             red_destroy(red_t *);
        !           112: extern void             red_getstats(red_t *, struct redstats *);
        !           113: extern int              red_addq(red_t *, class_queue_t *, struct mbuf *,
        !           114:                             struct altq_pktattr *);
        !           115: extern struct mbuf     *red_getq(red_t *, class_queue_t *);
        !           116: extern int              drop_early(int, int, int);
        !           117: extern int              mark_ecn(struct mbuf *, struct altq_pktattr *, int);
        !           118: extern struct wtab     *wtab_alloc(int);
        !           119: extern int              wtab_destroy(struct wtab *);
        !           120: extern int32_t          pow_w(struct wtab *, int);
        !           121:
        !           122: #endif /* _KERNEL */
        !           123:
        !           124: #endif /* _ALTQ_ALTQ_RED_H_ */

CVSweb