The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/altq/altq_wfq.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: altq_wfq.h,v 1.5.2.1 2008/09/14 20:55:26 bouyer Exp $  */
    2 /*      $KAME: altq_wfq.h,v 1.8 2003/07/10 12:07:49 kjc 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  *  March 27, 1997.  Written by Hiroshi Kyusojin of Keio University
   31  *  (kyu@mt.cs.keio.ac.jp).
   32  */
   33 
   34 #ifndef _ALTQ_ALTQ_WFQ_H_
   35 #define _ALTQ_ALTQ_WFQ_H_
   36 
   37 #include <altq/altq.h>
   38 
   39 #define DEFAULT_QSIZE   256
   40 #define MAX_QSIZE       2048
   41 
   42 struct wfq_interface{
   43         char wfq_ifacename[IFNAMSIZ];
   44 };
   45 
   46 struct wfq_getqid{
   47         struct wfq_interface    iface;
   48 #ifdef ALTQ3_CLFIER_COMPAT
   49         struct flowinfo         flow;
   50 #endif
   51         u_long                  qid;
   52 };
   53 
   54 struct wfq_setweight {
   55         struct wfq_interface    iface;
   56         int                     qid;
   57         int                     weight;
   58 };
   59 
   60 typedef struct each_queue_stats {
   61         int bytes;              /* bytes in this queue */
   62         int weight;             /* weight in percent */
   63         struct pktcntr xmit_cnt;
   64         struct pktcntr drop_cnt;
   65 } queue_stats;
   66 
   67 struct wfq_getstats {
   68         struct wfq_interface    iface;
   69         int                     qid;
   70         queue_stats             stats;
   71 };
   72 
   73 struct wfq_conf {
   74         struct wfq_interface    iface;
   75         int                     hash_policy;    /* hash policy */
   76         int                     nqueues;        /* number of queues */
   77         int                     qlimit;         /* queue size in bytes */
   78 };
   79 
   80 #define WFQ_HASH_DSTADDR        0       /* hash by dst address */
   81 #define WFQ_HASH_SRCPORT        1       /* hash by src port */
   82 #define WFQ_HASH_FULL           2       /* hash by all fields */
   83 #define WFQ_HASH_SRCADDR        3       /* hash by src address */
   84 
   85 #define WFQ_IF_ATTACH           _IOW('Q', 1, struct wfq_interface)
   86 #define WFQ_IF_DETACH           _IOW('Q', 2, struct wfq_interface)
   87 #define WFQ_ENABLE              _IOW('Q', 3, struct wfq_interface)
   88 #define WFQ_DISABLE             _IOW('Q', 4, struct wfq_interface)
   89 #define WFQ_CONFIG              _IOWR('Q', 6, struct wfq_conf)
   90 #define WFQ_GET_STATS           _IOWR('Q', 12, struct wfq_getstats)
   91 #define WFQ_GET_QID             _IOWR('Q', 30, struct wfq_getqid)
   92 #define WFQ_SET_WEIGHT          _IOWR('Q', 31, struct wfq_setweight)
   93 
   94 #ifdef _KERNEL
   95 
   96 #define HWM                     (64 * 1024)
   97 #define WFQ_QUOTA               512     /* quota bytes to send at a time */
   98 #define WFQ_ADDQUOTA(q)         ((q)->quota += WFQ_QUOTA * (q)->weight / 100)
   99 #define ENABLE                  0
  100 #define DISABLE                 1
  101 
  102 typedef struct weighted_fair_queue{
  103         struct weighted_fair_queue *next, *prev;
  104         struct mbuf *head, *tail;
  105         int bytes;                      /* bytes in this queue */
  106         int quota;                      /* bytes sent in this round */
  107         int weight;                     /* weight in percent */
  108 
  109         struct pktcntr xmit_cnt;
  110         struct pktcntr drop_cnt;
  111 } wfq;
  112 
  113 
  114 typedef struct wfqstate {
  115         struct wfqstate *next;          /* for wfqstate list */
  116         struct ifaltq *ifq;
  117         int nums;                       /* number of queues */
  118         int hwm;                        /* high water mark */
  119         int bytes;                      /* total bytes in all the queues */
  120         wfq *rrp;                       /* round robin pointer */
  121         wfq *queue;                     /* pointer to queue list */
  122 #ifdef ALTQ3_CLFIER_COMPAT
  123         u_long (*hash_func)(struct flowinfo *, int);
  124 #endif
  125         u_int32_t fbmask;               /* filter bitmask */
  126 } wfq_state_t;
  127 
  128 #endif /* _KERNEL */
  129 
  130 #endif /* _ALTQ_ALTQ_WFQ_H */

Cache object: 117e3ebb4cac20fe99de8b52a57475f9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.