Permalink
Browse files

ALTQ 2.0

  • Loading branch information...
1 parent 0d7c7b6 commit 0fca29c22ea9c7067d78438a11552ad91309c8c2 itojun committed Oct 2, 1999
View
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: altq_conf.c,v 1.1 1999/08/05 17:18:22 itojun Exp $
+ * $Id: altq_conf.c,v 1.1.1.1 1999/10/02 05:52:29 itojun Exp $
*/
#ifdef ALTQ
@@ -42,18 +42,12 @@
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/errno.h>
-#ifdef DEVFS
+#if defined(__FreeBSD__) && defined(DEVFS)
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#include <net/if_altq.h>
+#include <net/if.h>
#include <net/altq_conf.h>
-
-/* ioctl cmd type (copied from altq_var.h not to include netinet headers) */
-#if defined(__FreeBSD__) && (__FreeBSD__ < 3)
-typedef int ioctlcmd_t;
-#else
-typedef u_long ioctlcmd_t;
-#endif
+#include <netinet/altq.h>
#ifdef CBQ
altqdev_decl(cbq);
@@ -76,6 +70,15 @@ altqdev_decl(rio);
#ifdef LOCALQ
altqdev_decl(localq);
#endif
+#ifdef HFSC
+altqdev_decl(hfsc);
+#endif
+#ifdef CDNR
+altqdev_decl(cdnr);
+#endif
+#ifdef BLUE
+altqdev_decl(blue);
+#endif
/*
* altq minor device (discipline) table
@@ -117,6 +120,21 @@ static struct altqsw altqsw[] = { /* minor */
#else
{"noq", noopen, noclose, noioctl}, /* 7 (local use) */
#endif
+#ifdef HFSC
+ {"hfsc",hfscopen, hfscclose, hfscioctl}, /* 8 */
+#else
+ {"noq", noopen, noclose, noioctl}, /* 8 */
+#endif
+#ifdef CDNR
+ {"cdnr",cdnropen, cdnrclose, cdnrioctl}, /* 9 */
+#else
+ {"noq", noopen, noclose, noioctl}, /* 9 */
+#endif
+#ifdef BLUE
+ {"blue",blueopen, blueclose, blueioctl}, /* 10 */
+#else
+ {"noq", noopen, noclose, noioctl}, /* 10 */
+#endif
};
/*
@@ -127,9 +145,17 @@ int naltqsw = sizeof (altqsw) / sizeof (altqsw[0]);
static d_open_t altqopen;
static d_close_t altqclose;
static d_ioctl_t altqioctl;
+#ifdef __FreeBSD__
static void altq_drvinit __P((void *));
+#else
+void altqattach __P((int));
+#endif
-#define CDEV_MAJOR 96 /* FreeBSD official number */
+#if defined(__FreeBSD__)
+#define CDEV_MAJOR 96 /* FreeBSD official number */
+#elif defined(__NetBSD__)
+#define CDEV_MAJOR 65 /* not official */
+#endif
#ifndef __NetBSD__
static struct cdevsw altq_cdevsw =
@@ -185,7 +211,7 @@ altqioctl(dev, cmd, addr, flag, p)
}
-static altq_devsw_installed = 0;
+static int altq_devsw_installed = 0;
#ifdef __FreeBSD__
#ifdef DEVFS
View
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: altq_conf.h,v 1.1 1999/08/05 17:18:22 itojun Exp $
+ * $Id: altq_conf.h,v 1.1.1.1 1999/10/02 05:52:29 itojun Exp $
*/
#ifndef _NET_ALTQ_CONF_H_
#define _NET_ALTQ_CONF_H_
@@ -55,6 +55,10 @@ typedef int d_open_t __P((dev_t dev, int oflags, int devtype, struct proc *p));
typedef int d_close_t __P((dev_t dev, int fflag, int devtype, struct proc *p));
typedef int d_ioctl_t __P((dev_t dev, u_long cmd, caddr_t data,
int fflag, struct proc *p));
+
+#define noopen (dev_type_open((*))) enodev
+#define noclose (dev_type_close((*))) enodev
+#define noioctl (dev_type_ioctl((*))) enodev
#endif
/*
View
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_altq.h,v 1.1 1999/08/05 17:18:22 itojun Exp $
+ * $Id: if_altq.h,v 1.1.1.1 1999/10/02 05:52:29 itojun Exp $
*/
#ifndef _NET_IF_ALTQ_H_
#define _NET_IF_ALTQ_H_
@@ -42,28 +42,20 @@ struct pr_hdr {
#define ALTQF_READY 0x01 /* driver supports alternate queueing */
#define ALTQF_ENABLE 0x02 /* altq is in use */
#define ALTQF_ACCOUNTING 0x04 /* altq accounting is enabled */
+#define ALTQF_CNDTNING 0x08 /* altq traffic conditioning is enabled */
#define ALTQF_DRIVER1 0x40 /* driver specific */
-/* if_altqtype */
-#define ALTQT_NONE 0 /* reserved */
-#define ALTQT_CBQ 1 /* cbq */
-#define ALTQT_WFQ 2 /* wfq */
-#define ALTQT_AFMAP 3 /* afmap */
-#define ALTQT_FIFOQ 4 /* fifoq */
-#define ALTQT_RED 5 /* red */
-#define ALTQT_RIO 6 /* rio */
-#define ALTQT_LOCALQ 7 /* local use */
-#define ALTQT_MAX 8
-
/* if_altqflags set internally only: */
#define ALTQF_CANTCHANGE (ALTQF_READY)
#define ALTQ_IS_READY(ifp) ((ifp)->if_altqflags & ALTQF_READY)
#define ALTQ_IS_ON(ifp) ((ifp)->if_altqflags & ALTQF_ENABLE)
+#define ALTQ_IS_CNDTNING(ifp) ((ifp)->if_altqflags & ALTQF_CNDTNING)
#define SET_ACCOUNTING(ifp) ((ifp)->if_altqflags |= ALTQF_ACCOUNTING)
#define CLEAR_ACCOUNTING(ifp) ((ifp)->if_altqflags &= ~ALTQF_ACCOUNTING)
-
+#define SET_CNDTNING(ifp) ((ifp)->if_altqflags |= ALTQF_CNDTNING)
+#define CLEAR_CNDTNING(ifp) ((ifp)->if_altqflags &= ~ALTQF_CNDTNING)
/* if_altqenqueue 4th arg */
#define ALTEQ_NORMAL 0 /* normal queueing */
View
@@ -23,13 +23,27 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: altq.h,v 1.1 1999/08/05 17:18:17 itojun Exp $
+ * $Id: altq.h,v 1.1.1.1 1999/10/02 05:52:42 itojun Exp $
*/
#ifndef _NETINET_ALTQ_H_
#define _NETINET_ALTQ_H_
#include <netinet/in.h>
+/* altq discipline type */
+#define ALTQT_NONE 0 /* reserved */
+#define ALTQT_CBQ 1 /* cbq */
+#define ALTQT_WFQ 2 /* wfq */
+#define ALTQT_AFMAP 3 /* afmap */
+#define ALTQT_FIFOQ 4 /* fifoq */
+#define ALTQT_RED 5 /* red */
+#define ALTQT_RIO 6 /* rio */
+#define ALTQT_LOCALQ 7 /* local use */
+#define ALTQT_HFSC 8 /* hfsc */
+#define ALTQT_CDNR 9 /* traffic conditioner */
+#define ALTQT_BLUE 10 /* blue */
+#define ALTQT_MAX 10
+
/*
* common network flow info structure
*/
@@ -78,6 +92,7 @@ struct flowinfo_in6 {
* flow filters for AF_INET and AF_INET6
*/
struct flow_filter {
+ int ff_ruleno;
struct flowinfo_in ff_flow;
struct {
struct in_addr mask_dst;
@@ -90,6 +105,7 @@ struct flow_filter {
#ifdef SIN6_LEN
struct flow_filter6 {
+ int ff_ruleno;
struct flowinfo_in6 ff_flow6;
struct {
struct in6_addr mask6_dst;
@@ -104,4 +120,13 @@ struct flow_filter6 {
#include <netinet/altq_var.h>
#endif
+/* queue macros only in FreeBSD */
+#ifndef LIST_EMPTY
+#define LIST_EMPTY(head) ((head)->lh_first == NULL)
+#endif
+#ifndef LIST_FOREACH
+#define LIST_FOREACH(var, head, field) \
+ for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next)
+#endif
+
#endif /* _NETINET_ALTQ_H_ */
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: altq_afmap.c,v 1.2 1999/08/16 20:03:56 shin Exp $
+ * $Id: altq_afmap.c,v 1.1.1.1 1999/10/02 05:52:42 itojun Exp $
*/
/*
@@ -58,6 +58,7 @@
#include <net/altq_conf.h>
#include <netinet/in.h>
+#include <netinet/altq.h>
#include <netinet/altq_afmap.h>
LIST_HEAD(, afm_head) afhead_chain;
@@ -262,29 +263,29 @@ afm_match6(head, fp)
for (afm = head->afh_head.lh_first; afm != NULL;
afm = afm->afm_list.le_next) {
- if (afm->afm_flowinfo6.fi_flowlabel != 0 &&
- afm->afm_flowinfo6.fi_flowlabel != fp->fi_flowlabel)
+ if (afm->afm_flowinfo6.fi6_flowlabel != 0 &&
+ afm->afm_flowinfo6.fi6_flowlabel != fp->fi6_flowlabel)
continue;
#ifdef notyet
- if (!IN6_IS_ADDR_UNSPECIFIED(&afm->afm_flowinfo6.fi_dst) &&
- !IN6_ARE_ADDR_EQUAL(&afm->afm_flowinfo6.fi_dst,
- &fp->fi_dst))
+ if (!IN6_IS_ADDR_UNSPECIFIED(&afm->afm_flowinfo6.fi6_dst) &&
+ !IN6_ARE_ADDR_EQUAL(&afm->afm_flowinfo6.fi6_dst,
+ &fp->fi6_dst))
continue;
- if (afm->afm_flowinfo6.fi_dport != 0 &&
- afm->afm_flowinfo6.fi_dport != fp->fi_dport)
+ if (afm->afm_flowinfo6.fi6_dport != 0 &&
+ afm->afm_flowinfo6.fi6_dport != fp->fi6_dport)
continue;
#endif
- if (!IN6_IS_ADDR_UNSPECIFIED(&afm->afm_flowinfo6.fi_src) &&
- !IN6_ARE_ADDR_EQUAL(&afm->afm_flowinfo6.fi_src,
- &fp->fi_src))
+ if (!IN6_IS_ADDR_UNSPECIFIED(&afm->afm_flowinfo6.fi6_src) &&
+ !IN6_ARE_ADDR_EQUAL(&afm->afm_flowinfo6.fi6_src,
+ &fp->fi6_src))
continue;
#ifdef notyet
- if (afm->afm_flowinfo6.fi_sport != 0 &&
- afm->afm_flowinfo6.fi_sport != fp->fi_sport)
+ if (afm->afm_flowinfo6.fi6_sport != 0 &&
+ afm->afm_flowinfo6.fi6_sport != fp->fi6_sport)
continue;
#endif
- if (afm->afm_flowinfo6.fi_proto != 0 &&
- afm->afm_flowinfo6.fi_proto != fp->fi_proto)
+ if (afm->afm_flowinfo6.fi6_proto != 0 &&
+ afm->afm_flowinfo6.fi6_proto != fp->fi6_proto)
continue;
/* match found! */
return (afm);
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: altq_afmap.h,v 1.2 1999/08/16 20:03:56 shin Exp $
+ * $Id: altq_afmap.h,v 1.1.1.1 1999/10/02 05:52:42 itojun Exp $
*/
#ifndef _NETINET_ALTQ_AFMAP_H_
Oops, something went wrong.

0 comments on commit 0fca29c

Please sign in to comment.