svn commit: r341507 - head/sys/net/altq
Eric van Gyzen
vangyzen at FreeBSD.org
Tue Dec 4 23:46:45 UTC 2018
Author: vangyzen
Date: Tue Dec 4 23:46:43 2018
New Revision: 341507
URL: https://svnweb.freebsd.org/changeset/base/341507
Log:
altq: remove ALTQ3_COMPAT code
This code has apparently never compiled on FreeBSD since its
introduction in 2004 (r130365). It has certainly not compiled
since 2006, when r164033 added #elsif [sic] preprocessor directives.
The code was left in the tree to reduce the diff from upstream (KAME).
Since that upstream is no longer relevant, remove the long-dead code.
This commit is the direct result of:
unifdef -m -UALTQ3_COMPAT sys/net/altq/*
A later commit will do some manual cleanup.
I do not plan to MFC this. If that would help you, go for it.
Modified:
head/sys/net/altq/altq.h
head/sys/net/altq/altq_cbq.c
head/sys/net/altq/altq_cbq.h
head/sys/net/altq/altq_cdnr.c
head/sys/net/altq/altq_hfsc.c
head/sys/net/altq/altq_hfsc.h
head/sys/net/altq/altq_priq.c
head/sys/net/altq/altq_priq.h
head/sys/net/altq/altq_red.c
head/sys/net/altq/altq_red.h
head/sys/net/altq/altq_rio.c
head/sys/net/altq/altq_rio.h
head/sys/net/altq/altq_rmclass.c
head/sys/net/altq/altq_subr.c
Modified: head/sys/net/altq/altq.h
==============================================================================
--- head/sys/net/altq/altq.h Tue Dec 4 22:52:15 2018 (r341506)
+++ head/sys/net/altq/altq.h Tue Dec 4 23:46:43 2018 (r341507)
@@ -38,17 +38,7 @@
#define ALTQ3_CLFIER_COMPAT /* for compatibility with altq-3 classifier */
#endif
-#ifdef ALTQ3_COMPAT
-#include <sys/param.h>
-#include <sys/ioccom.h>
-#include <sys/queue.h>
-#include <netinet/in.h>
-#ifndef IFNAMSIZ
-#define IFNAMSIZ 16
-#endif
-#endif /* ALTQ3_COMPAT */
-
/* altq discipline type */
#define ALTQT_NONE 0 /* reserved */
#define ALTQT_CBQ 1 /* cbq */
@@ -67,12 +57,6 @@
#define ALTQT_CODEL 14 /* CoDel */
#define ALTQT_MAX 15 /* should be max discipline type + 1 */
-#ifdef ALTQ3_COMPAT
-struct altqreq {
- char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
- u_long arg; /* request-specific argument */
-};
-#endif
/* simple token backet meter profile */
struct tb_profile {
@@ -80,87 +64,8 @@ struct tb_profile {
u_int32_t depth; /* depth in bytes */
};
-#ifdef ALTQ3_COMPAT
-struct tbrreq {
- char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct tb_profile tb_prof; /* token bucket profile */
-};
-#ifdef ALTQ3_CLFIER_COMPAT
/*
- * common network flow info structure
- */
-struct flowinfo {
- u_char fi_len; /* total length */
- u_char fi_family; /* address family */
- u_int8_t fi_data[46]; /* actually longer; address family
- specific flow info. */
-};
-
-/*
- * flow info structure for internet protocol family.
- * (currently this is the only protocol family supported)
- */
-struct flowinfo_in {
- u_char fi_len; /* sizeof(struct flowinfo_in) */
- u_char fi_family; /* AF_INET */
- u_int8_t fi_proto; /* IPPROTO_XXX */
- u_int8_t fi_tos; /* type-of-service */
- struct in_addr fi_dst; /* dest address */
- struct in_addr fi_src; /* src address */
- u_int16_t fi_dport; /* dest port */
- u_int16_t fi_sport; /* src port */
- u_int32_t fi_gpi; /* generalized port id for ipsec */
- u_int8_t _pad[28]; /* make the size equal to
- flowinfo_in6 */
-};
-
-#ifdef SIN6_LEN
-struct flowinfo_in6 {
- u_char fi6_len; /* sizeof(struct flowinfo_in6) */
- u_char fi6_family; /* AF_INET6 */
- u_int8_t fi6_proto; /* IPPROTO_XXX */
- u_int8_t fi6_tclass; /* traffic class */
- u_int32_t fi6_flowlabel; /* ipv6 flowlabel */
- u_int16_t fi6_dport; /* dest port */
- u_int16_t fi6_sport; /* src port */
- u_int32_t fi6_gpi; /* generalized port id */
- struct in6_addr fi6_dst; /* dest address */
- struct in6_addr fi6_src; /* src address */
-};
-#endif /* INET6 */
-
-/*
- * 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;
- struct in_addr mask_src;
- u_int8_t mask_tos;
- u_int8_t _pad[3];
- } ff_mask;
- u_int8_t _pad2[24]; /* make the size equal to flow_filter6 */
-};
-
-#ifdef SIN6_LEN
-struct flow_filter6 {
- int ff_ruleno;
- struct flowinfo_in6 ff_flow6;
- struct {
- struct in6_addr mask6_dst;
- struct in6_addr mask6_src;
- u_int8_t mask6_tclass;
- u_int8_t _pad[3];
- } ff_mask6;
-};
-#endif /* INET6 */
-#endif /* ALTQ3_CLFIER_COMPAT */
-#endif /* ALTQ3_COMPAT */
-
-/*
* generic packet counter
*/
struct pktcntr {
@@ -171,33 +76,6 @@ struct pktcntr {
#define PKTCNTR_ADD(cntr, len) \
do { (cntr)->packets++; (cntr)->bytes += len; } while (/*CONSTCOND*/ 0)
-#ifdef ALTQ3_COMPAT
-/*
- * altq related ioctls
- */
-#define ALTQGTYPE _IOWR('q', 0, struct altqreq) /* get queue type */
-#if 0
-/*
- * these ioctls are currently discipline-specific but could be shared
- * in the future.
- */
-#define ALTQATTACH _IOW('q', 1, struct altqreq) /* attach discipline */
-#define ALTQDETACH _IOW('q', 2, struct altqreq) /* detach discipline */
-#define ALTQENABLE _IOW('q', 3, struct altqreq) /* enable discipline */
-#define ALTQDISABLE _IOW('q', 4, struct altqreq) /* disable discipline*/
-#define ALTQCLEAR _IOW('q', 5, struct altqreq) /* (re)initialize */
-#define ALTQCONFIG _IOWR('q', 6, struct altqreq) /* set config params */
-#define ALTQADDCLASS _IOWR('q', 7, struct altqreq) /* add a class */
-#define ALTQMODCLASS _IOWR('q', 8, struct altqreq) /* modify a class */
-#define ALTQDELCLASS _IOWR('q', 9, struct altqreq) /* delete a class */
-#define ALTQADDFILTER _IOWR('q', 10, struct altqreq) /* add a filter */
-#define ALTQDELFILTER _IOWR('q', 11, struct altqreq) /* delete a filter */
-#define ALTQGETSTATS _IOWR('q', 12, struct altqreq) /* get statistics */
-#define ALTQGETCNTR _IOWR('q', 13, struct altqreq) /* get a pkt counter */
-#endif /* 0 */
-#define ALTQTBRSET _IOW('q', 14, struct tbrreq) /* set tb regulator */
-#define ALTQTBRGET _IOWR('q', 15, struct tbrreq) /* get tb regulator */
-#endif /* ALTQ3_COMPAT */
#ifdef _KERNEL
#include <net/altq/altq_var.h>
Modified: head/sys/net/altq/altq_cbq.c
==============================================================================
--- head/sys/net/altq/altq_cbq.c Tue Dec 4 22:52:15 2018 (r341506)
+++ head/sys/net/altq/altq_cbq.c Tue Dec 4 23:46:43 2018 (r341507)
@@ -44,10 +44,6 @@
#include <sys/proc.h>
#include <sys/errno.h>
#include <sys/time.h>
-#ifdef ALTQ3_COMPAT
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#endif
#include <net/if.h>
#include <net/if_var.h>
@@ -58,16 +54,7 @@
#include <netpfil/pf/pf_mtag.h>
#include <net/altq/altq.h>
#include <net/altq/altq_cbq.h>
-#ifdef ALTQ3_COMPAT
-#include <net/altq/altq_conf.h>
-#endif
-#ifdef ALTQ3_COMPAT
-/*
- * Local Data structures.
- */
-static cbq_state_t *cbq_list = NULL;
-#endif
/*
* Forward Declarations.
@@ -82,22 +69,7 @@ static struct mbuf *cbq_dequeue(struct ifaltq *, int);
static void cbqrestart(struct ifaltq *);
static void get_class_stats(class_stats_t *, struct rm_class *);
static void cbq_purge(cbq_state_t *);
-#ifdef ALTQ3_COMPAT
-static int cbq_add_class(struct cbq_add_class *);
-static int cbq_delete_class(struct cbq_delete_class *);
-static int cbq_modify_class(struct cbq_modify_class *);
-static int cbq_class_create(cbq_state_t *, struct cbq_add_class *,
- struct rm_class *, struct rm_class *);
-static int cbq_clear_hierarchy(struct cbq_interface *);
-static int cbq_set_enable(struct cbq_interface *, int);
-static int cbq_ifattach(struct cbq_interface *);
-static int cbq_ifdetach(struct cbq_interface *);
-static int cbq_getstats(struct cbq_getstats *);
-static int cbq_add_filter(struct cbq_add_filter *);
-static int cbq_delete_filter(struct cbq_delete_filter *);
-#endif /* ALTQ3_COMPAT */
-
/*
* int
* cbq_class_destroy(cbq_mod_state_t *, struct rm_class *) - This
@@ -123,10 +95,6 @@ cbq_class_destroy(cbq_state_t *cbqp, struct rm_class *
cbqp->ifnp.root_ = NULL;
if (cl == cbqp->ifnp.default_)
cbqp->ifnp.default_ = NULL;
-#ifdef ALTQ3_COMPAT
- if (cl == cbqp->ifnp.ctl_)
- cbqp->ifnp.ctl_ = NULL;
-#endif
return (0);
}
@@ -179,10 +147,6 @@ cbq_clear_interface(cbq_state_t *cbqp)
cbqp->ifnp.root_ = NULL;
if (cl == cbqp->ifnp.default_)
cbqp->ifnp.default_ = NULL;
-#ifdef ALTQ3_COMPAT
- if (cl == cbqp->ifnp.ctl_)
- cbqp->ifnp.ctl_ = NULL;
-#endif
}
}
}
@@ -512,10 +476,6 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct
cl = NULL;
if ((t = pf_find_mtag(m)) != NULL)
cl = clh_to_clp(cbqp, t->qid);
-#ifdef ALTQ3_COMPAT
- else if ((ifq->altq_flags & ALTQF_CLASSIFY) && pktattr != NULL)
- cl = pktattr->pattr_class;
-#endif
if (cl == NULL) {
cl = cbqp->ifnp.default_;
if (cl == NULL) {
@@ -523,11 +483,6 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct
return (ENOBUFS);
}
}
-#ifdef ALTQ3_COMPAT
- if (pktattr != NULL)
- cl->pktattr_ = pktattr; /* save proto hdr used by ECN */
- else
-#endif
cl->pktattr_ = NULL;
len = m_pktlen(m);
if (rmc_queue_packet(cl, m) != 0) {
@@ -606,564 +561,5 @@ static void cbq_purge(cbq_state_t *cbqp)
if (ALTQ_IS_ENABLED(cbqp->ifnp.ifq_))
cbqp->ifnp.ifq_->ifq_len = 0;
}
-#ifdef ALTQ3_COMPAT
-
-static int
-cbq_add_class(acp)
- struct cbq_add_class *acp;
-{
- char *ifacename;
- struct rm_class *borrow, *parent;
- cbq_state_t *cbqp;
-
- ifacename = acp->cbq_iface.cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- /* check parameters */
- if (acp->cbq_class.priority >= CBQ_MAXPRI ||
- acp->cbq_class.maxq > CBQ_MAXQSIZE)
- return (EINVAL);
-
- /* Get pointers to parent and borrow classes. */
- parent = clh_to_clp(cbqp, acp->cbq_class.parent_class_handle);
- borrow = clh_to_clp(cbqp, acp->cbq_class.borrow_class_handle);
-
- /*
- * A class must borrow from it's parent or it can not
- * borrow at all. Hence, borrow can be null.
- */
- if (parent == NULL && (acp->cbq_class.flags & CBQCLF_ROOTCLASS) == 0) {
- printf("cbq_add_class: no parent class!\n");
- return (EINVAL);
- }
-
- if ((borrow != parent) && (borrow != NULL)) {
- printf("cbq_add_class: borrow class != parent\n");
- return (EINVAL);
- }
-
- return cbq_class_create(cbqp, acp, parent, borrow);
-}
-
-static int
-cbq_delete_class(dcp)
- struct cbq_delete_class *dcp;
-{
- char *ifacename;
- struct rm_class *cl;
- cbq_state_t *cbqp;
-
- ifacename = dcp->cbq_iface.cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- if ((cl = clh_to_clp(cbqp, dcp->cbq_class_handle)) == NULL)
- return (EINVAL);
-
- /* if we are a parent class, then return an error. */
- if (is_a_parent_class(cl))
- return (EINVAL);
-
- /* if a filter has a reference to this class delete the filter */
- acc_discard_filters(&cbqp->cbq_classifier, cl, 0);
-
- return cbq_class_destroy(cbqp, cl);
-}
-
-static int
-cbq_modify_class(acp)
- struct cbq_modify_class *acp;
-{
- char *ifacename;
- struct rm_class *cl;
- cbq_state_t *cbqp;
-
- ifacename = acp->cbq_iface.cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- /* Get pointer to this class */
- if ((cl = clh_to_clp(cbqp, acp->cbq_class_handle)) == NULL)
- return (EINVAL);
-
- if (rmc_modclass(cl, acp->cbq_class.nano_sec_per_byte,
- acp->cbq_class.maxq, acp->cbq_class.maxidle,
- acp->cbq_class.minidle, acp->cbq_class.offtime,
- acp->cbq_class.pktsize) < 0)
- return (EINVAL);
- return (0);
-}
-
-/*
- * struct rm_class *
- * cbq_class_create(cbq_mod_state_t *cbqp, struct cbq_add_class *acp,
- * struct rm_class *parent, struct rm_class *borrow)
- *
- * This function create a new traffic class in the CBQ class hierarchy of
- * given parameters. The class that created is either the root, default,
- * or a new dynamic class. If CBQ is not initilaized, the root class
- * will be created.
- */
-static int
-cbq_class_create(cbqp, acp, parent, borrow)
- cbq_state_t *cbqp;
- struct cbq_add_class *acp;
- struct rm_class *parent, *borrow;
-{
- struct rm_class *cl;
- cbq_class_spec_t *spec = &acp->cbq_class;
- u_int32_t chandle;
- int i;
-
- /*
- * allocate class handle
- */
- for (i = 1; i < CBQ_MAX_CLASSES; i++)
- if (cbqp->cbq_class_tbl[i] == NULL)
- break;
- if (i == CBQ_MAX_CLASSES)
- return (EINVAL);
- chandle = i; /* use the slot number as class handle */
-
- /*
- * create a class. if this is a root class, initialize the
- * interface.
- */
- if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_ROOTCLASS) {
- rmc_init(cbqp->ifnp.ifq_, &cbqp->ifnp, spec->nano_sec_per_byte,
- cbqrestart, spec->maxq, RM_MAXQUEUED,
- spec->maxidle, spec->minidle, spec->offtime,
- spec->flags);
- cl = cbqp->ifnp.root_;
- } else {
- cl = rmc_newclass(spec->priority,
- &cbqp->ifnp, spec->nano_sec_per_byte,
- rmc_delay_action, spec->maxq, parent, borrow,
- spec->maxidle, spec->minidle, spec->offtime,
- spec->pktsize, spec->flags);
- }
- if (cl == NULL)
- return (ENOMEM);
-
- /* return handle to user space. */
- acp->cbq_class_handle = chandle;
-
- cl->stats_.handle = chandle;
- cl->stats_.depth = cl->depth_;
-
- /* save the allocated class */
- cbqp->cbq_class_tbl[i] = cl;
-
- if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_DEFCLASS)
- cbqp->ifnp.default_ = cl;
- if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_CTLCLASS)
- cbqp->ifnp.ctl_ = cl;
-
- return (0);
-}
-
-static int
-cbq_add_filter(afp)
- struct cbq_add_filter *afp;
-{
- char *ifacename;
- cbq_state_t *cbqp;
- struct rm_class *cl;
-
- ifacename = afp->cbq_iface.cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- /* Get the pointer to class. */
- if ((cl = clh_to_clp(cbqp, afp->cbq_class_handle)) == NULL)
- return (EINVAL);
-
- return acc_add_filter(&cbqp->cbq_classifier, &afp->cbq_filter,
- cl, &afp->cbq_filter_handle);
-}
-
-static int
-cbq_delete_filter(dfp)
- struct cbq_delete_filter *dfp;
-{
- char *ifacename;
- cbq_state_t *cbqp;
-
- ifacename = dfp->cbq_iface.cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- return acc_delete_filter(&cbqp->cbq_classifier,
- dfp->cbq_filter_handle);
-}
-
-/*
- * cbq_clear_hierarchy deletes all classes and their filters on the
- * given interface.
- */
-static int
-cbq_clear_hierarchy(ifacep)
- struct cbq_interface *ifacep;
-{
- char *ifacename;
- cbq_state_t *cbqp;
-
- ifacename = ifacep->cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- return cbq_clear_interface(cbqp);
-}
-
-/*
- * static int
- * cbq_set_enable(struct cbq_enable *ep) - this function processed the
- * ioctl request to enable class based queueing. It searches the list
- * of interfaces for the specified interface and then enables CBQ on
- * that interface.
- *
- * Returns: 0, for no error.
- * EBADF, for specified inteface not found.
- */
-
-static int
-cbq_set_enable(ep, enable)
- struct cbq_interface *ep;
- int enable;
-{
- int error = 0;
- cbq_state_t *cbqp;
- char *ifacename;
-
- ifacename = ep->cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- switch (enable) {
- case ENABLE:
- if (cbqp->ifnp.root_ == NULL || cbqp->ifnp.default_ == NULL ||
- cbqp->ifnp.ctl_ == NULL) {
- if (cbqp->ifnp.root_ == NULL)
- printf("No Root Class for %s\n", ifacename);
- if (cbqp->ifnp.default_ == NULL)
- printf("No Default Class for %s\n", ifacename);
- if (cbqp->ifnp.ctl_ == NULL)
- printf("No Control Class for %s\n", ifacename);
- error = EINVAL;
- } else if ((error = altq_enable(cbqp->ifnp.ifq_)) == 0) {
- cbqp->cbq_qlen = 0;
- }
- break;
-
- case DISABLE:
- error = altq_disable(cbqp->ifnp.ifq_);
- break;
- }
- return (error);
-}
-
-static int
-cbq_getstats(gsp)
- struct cbq_getstats *gsp;
-{
- char *ifacename;
- int i, n, nclasses;
- cbq_state_t *cbqp;
- struct rm_class *cl;
- class_stats_t stats, *usp;
- int error = 0;
-
- ifacename = gsp->iface.cbq_ifacename;
- nclasses = gsp->nclasses;
- usp = gsp->stats;
-
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
- if (nclasses <= 0)
- return (EINVAL);
-
- for (n = 0, i = 0; n < nclasses && i < CBQ_MAX_CLASSES; n++, i++) {
- while ((cl = cbqp->cbq_class_tbl[i]) == NULL)
- if (++i >= CBQ_MAX_CLASSES)
- goto out;
-
- get_class_stats(&stats, cl);
- stats.handle = cl->stats_.handle;
-
- if ((error = copyout((caddr_t)&stats, (caddr_t)usp++,
- sizeof(stats))) != 0)
- return (error);
- }
-
- out:
- gsp->nclasses = n;
- return (error);
-}
-
-static int
-cbq_ifattach(ifacep)
- struct cbq_interface *ifacep;
-{
- int error = 0;
- char *ifacename;
- cbq_state_t *new_cbqp;
- struct ifnet *ifp;
-
- ifacename = ifacep->cbq_ifacename;
- if ((ifp = ifunit(ifacename)) == NULL)
- return (ENXIO);
- if (!ALTQ_IS_READY(&ifp->if_snd))
- return (ENXIO);
-
- /* allocate and initialize cbq_state_t */
- new_cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK);
- if (new_cbqp == NULL)
- return (ENOMEM);
- bzero(new_cbqp, sizeof(cbq_state_t));
- CALLOUT_INIT(&new_cbqp->cbq_callout);
-
- new_cbqp->cbq_qlen = 0;
- new_cbqp->ifnp.ifq_ = &ifp->if_snd; /* keep the ifq */
-
- /*
- * set CBQ to this ifnet structure.
- */
- error = altq_attach(&ifp->if_snd, ALTQT_CBQ, new_cbqp,
- cbq_enqueue, cbq_dequeue, cbq_request,
- &new_cbqp->cbq_classifier, acc_classify);
- if (error) {
- free(new_cbqp, M_DEVBUF);
- return (error);
- }
-
- /* prepend to the list of cbq_state_t's. */
- new_cbqp->cbq_next = cbq_list;
- cbq_list = new_cbqp;
-
- return (0);
-}
-
-static int
-cbq_ifdetach(ifacep)
- struct cbq_interface *ifacep;
-{
- char *ifacename;
- cbq_state_t *cbqp;
-
- ifacename = ifacep->cbq_ifacename;
- if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL)
- return (EBADF);
-
- (void)cbq_set_enable(ifacep, DISABLE);
-
- cbq_clear_interface(cbqp);
-
- /* remove CBQ from the ifnet structure. */
- (void)altq_detach(cbqp->ifnp.ifq_);
-
- /* remove from the list of cbq_state_t's. */
- if (cbq_list == cbqp)
- cbq_list = cbqp->cbq_next;
- else {
- cbq_state_t *cp;
-
- for (cp = cbq_list; cp != NULL; cp = cp->cbq_next)
- if (cp->cbq_next == cbqp) {
- cp->cbq_next = cbqp->cbq_next;
- break;
- }
- ASSERT(cp != NULL);
- }
-
- /* deallocate cbq_state_t */
- free(cbqp, M_DEVBUF);
-
- return (0);
-}
-
-/*
- * cbq device interface
- */
-
-altqdev_decl(cbq);
-
-int
-cbqopen(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
-#if (__FreeBSD_version > 500000)
- struct thread *p;
-#else
- struct proc *p;
-#endif
-{
- return (0);
-}
-
-int
-cbqclose(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
-#if (__FreeBSD_version > 500000)
- struct thread *p;
-#else
- struct proc *p;
-#endif
-{
- struct ifnet *ifp;
- struct cbq_interface iface;
- int err, error = 0;
-
- while (cbq_list) {
- ifp = cbq_list->ifnp.ifq_->altq_ifp;
- sprintf(iface.cbq_ifacename, "%s", ifp->if_xname);
- err = cbq_ifdetach(&iface);
- if (err != 0 && error == 0)
- error = err;
- }
-
- return (error);
-}
-
-int
-cbqioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- ioctlcmd_t cmd;
- caddr_t addr;
- int flag;
-#if (__FreeBSD_version > 500000)
- struct thread *p;
-#else
- struct proc *p;
-#endif
-{
- int error = 0;
-
- /* check cmd for superuser only */
- switch (cmd) {
- case CBQ_GETSTATS:
- /* currently only command that an ordinary user can call */
- break;
- default:
-#if (__FreeBSD_version > 700000)
- error = priv_check(p, PRIV_ALTQ_MANAGE);
-#elsif (__FreeBSD_version > 400000)
- error = suser(p);
-#else
- error = suser(p->p_ucred, &p->p_acflag);
-#endif
- if (error)
- return (error);
- break;
- }
-
- switch (cmd) {
-
- case CBQ_ENABLE:
- error = cbq_set_enable((struct cbq_interface *)addr, ENABLE);
- break;
-
- case CBQ_DISABLE:
- error = cbq_set_enable((struct cbq_interface *)addr, DISABLE);
- break;
-
- case CBQ_ADD_FILTER:
- error = cbq_add_filter((struct cbq_add_filter *)addr);
- break;
-
- case CBQ_DEL_FILTER:
- error = cbq_delete_filter((struct cbq_delete_filter *)addr);
- break;
-
- case CBQ_ADD_CLASS:
- error = cbq_add_class((struct cbq_add_class *)addr);
- break;
-
- case CBQ_DEL_CLASS:
- error = cbq_delete_class((struct cbq_delete_class *)addr);
- break;
-
- case CBQ_MODIFY_CLASS:
- error = cbq_modify_class((struct cbq_modify_class *)addr);
- break;
-
- case CBQ_CLEAR_HIERARCHY:
- error = cbq_clear_hierarchy((struct cbq_interface *)addr);
- break;
-
- case CBQ_IF_ATTACH:
- error = cbq_ifattach((struct cbq_interface *)addr);
- break;
-
- case CBQ_IF_DETACH:
- error = cbq_ifdetach((struct cbq_interface *)addr);
- break;
-
- case CBQ_GETSTATS:
- error = cbq_getstats((struct cbq_getstats *)addr);
- break;
-
- default:
- error = EINVAL;
- break;
- }
-
- return error;
-}
-
-#if 0
-/* for debug */
-static void cbq_class_dump(int);
-
-static void cbq_class_dump(i)
- int i;
-{
- struct rm_class *cl;
- rm_class_stats_t *s;
- struct _class_queue_ *q;
-
- if (cbq_list == NULL) {
- printf("cbq_class_dump: no cbq_state found\n");
- return;
- }
- cl = cbq_list->cbq_class_tbl[i];
-
- printf("class %d cl=%p\n", i, cl);
- if (cl != NULL) {
- s = &cl->stats_;
- q = cl->q_;
-
- printf("pri=%d, depth=%d, maxrate=%d, allotment=%d\n",
- cl->pri_, cl->depth_, cl->maxrate_, cl->allotment_);
- printf("w_allotment=%d, bytes_alloc=%d, avgidle=%d, maxidle=%d\n",
- cl->w_allotment_, cl->bytes_alloc_, cl->avgidle_,
- cl->maxidle_);
- printf("minidle=%d, offtime=%d, sleeping=%d, leaf=%d\n",
- cl->minidle_, cl->offtime_, cl->sleeping_, cl->leaf_);
- printf("handle=%d, depth=%d, packets=%d, bytes=%d\n",
- s->handle, s->depth,
- (int)s->xmit_cnt.packets, (int)s->xmit_cnt.bytes);
- printf("over=%d\n, borrows=%d, drops=%d, overactions=%d, delays=%d\n",
- s->over, s->borrows, (int)s->drop_cnt.packets,
- s->overactions, s->delays);
- printf("tail=%p, head=%p, qlen=%d, qlim=%d, qthresh=%d,qtype=%d\n",
- q->tail_, q->head_, q->qlen_, q->qlim_,
- q->qthresh_, q->qtype_);
- }
-}
-#endif /* 0 */
-
-#ifdef KLD_MODULE
-
-static struct altqsw cbq_sw =
- {"cbq", cbqopen, cbqclose, cbqioctl};
-
-ALTQ_MODULE(altq_cbq, ALTQT_CBQ, &cbq_sw);
-MODULE_DEPEND(altq_cbq, altq_red, 1, 1, 1);
-MODULE_DEPEND(altq_cbq, altq_rio, 1, 1, 1);
-
-#endif /* KLD_MODULE */
-#endif /* ALTQ3_COMPAT */
#endif /* ALTQ_CBQ */
Modified: head/sys/net/altq/altq_cbq.h
==============================================================================
--- head/sys/net/altq/altq_cbq.h Tue Dec 4 22:52:15 2018 (r341506)
+++ head/sys/net/altq/altq_cbq.h Tue Dec 4 23:46:43 2018 (r341507)
@@ -71,9 +71,6 @@ CTASSERT(CBQCLF_CODEL == RMCF_CODEL);
/* class flags for special classes */
#define CBQCLF_ROOTCLASS 0x1000 /* root class */
#define CBQCLF_DEFCLASS 0x2000 /* default class */
-#ifdef ALTQ3_COMPAT
-#define CBQCLF_CTLCLASS 0x4000 /* control class */
-#endif
#define CBQCLF_CLASSMASK 0xf000 /* class mask */
#define CBQ_MAXQSIZE 200
@@ -114,89 +111,7 @@ typedef struct _cbq_class_stats_ {
* header.
*/
-#ifdef ALTQ3_COMPAT
-/*
- * Define structures associated with IOCTLS for cbq.
- */
-/*
- * Define the CBQ interface structure. This must be included in all
- * IOCTL's such that the CBQ driver may find the appropriate CBQ module
- * associated with the network interface to be affected.
- */
-struct cbq_interface {
- char cbq_ifacename[IFNAMSIZ];
-};
-
-typedef struct cbq_class_spec {
- u_int priority;
- u_int nano_sec_per_byte;
- u_int maxq;
- u_int maxidle;
- int minidle;
- u_int offtime;
- u_int32_t parent_class_handle;
- u_int32_t borrow_class_handle;
-
- u_int pktsize;
- int flags;
-} cbq_class_spec_t;
-
-struct cbq_add_class {
- struct cbq_interface cbq_iface;
-
- cbq_class_spec_t cbq_class;
- u_int32_t cbq_class_handle;
-};
-
-struct cbq_delete_class {
- struct cbq_interface cbq_iface;
- u_int32_t cbq_class_handle;
-};
-
-struct cbq_modify_class {
- struct cbq_interface cbq_iface;
-
- cbq_class_spec_t cbq_class;
- u_int32_t cbq_class_handle;
-};
-
-struct cbq_add_filter {
- struct cbq_interface cbq_iface;
- u_int32_t cbq_class_handle;
- struct flow_filter cbq_filter;
-
- u_long cbq_filter_handle;
-};
-
-struct cbq_delete_filter {
- struct cbq_interface cbq_iface;
- u_long cbq_filter_handle;
-};
-
-/* number of classes are returned in nclasses field */
-struct cbq_getstats {
- struct cbq_interface iface;
- int nclasses;
- class_stats_t *stats;
-};
-
-/*
- * Define IOCTLs for CBQ.
- */
-#define CBQ_IF_ATTACH _IOW('Q', 1, struct cbq_interface)
-#define CBQ_IF_DETACH _IOW('Q', 2, struct cbq_interface)
-#define CBQ_ENABLE _IOW('Q', 3, struct cbq_interface)
-#define CBQ_DISABLE _IOW('Q', 4, struct cbq_interface)
-#define CBQ_CLEAR_HIERARCHY _IOW('Q', 5, struct cbq_interface)
-#define CBQ_ADD_CLASS _IOWR('Q', 7, struct cbq_add_class)
-#define CBQ_DEL_CLASS _IOW('Q', 8, struct cbq_delete_class)
-#define CBQ_MODIFY_CLASS _IOWR('Q', 9, struct cbq_modify_class)
-#define CBQ_ADD_FILTER _IOWR('Q', 10, struct cbq_add_filter)
-#define CBQ_DEL_FILTER _IOW('Q', 11, struct cbq_delete_filter)
-#define CBQ_GETSTATS _IOWR('Q', 12, struct cbq_getstats)
-#endif /* ALTQ3_COMPAT */
-
#ifdef _KERNEL
/*
* Define macros only good for kernel drivers and modules.
@@ -207,20 +122,11 @@ struct cbq_getstats {
#define CBQ_MAX_CLASSES 256
-#ifdef ALTQ3_COMPAT
-#define CBQ_MAX_FILTERS 256
-#define DISABLE 0x00
-#define ENABLE 0x01
-#endif /* ALTQ3_COMPAT */
-
/*
* Define State structures.
*/
typedef struct cbqstate {
-#ifdef ALTQ3_COMPAT
- struct cbqstate *cbq_next;
-#endif
int cbq_qlen; /* # of packets in cbq */
struct rm_class *cbq_class_tbl[CBQ_MAX_CLASSES];
Modified: head/sys/net/altq/altq_cdnr.c
==============================================================================
--- head/sys/net/altq/altq_cdnr.c Tue Dec 4 22:52:15 2018 (r341506)
+++ head/sys/net/altq/altq_cdnr.c Tue Dec 4 23:46:43 2018 (r341507)
@@ -53,1330 +53,5 @@
#include <net/altq/if_altq.h>
#include <net/altq/altq.h>
-#ifdef ALTQ3_COMPAT
-#include <net/altq/altq_conf.h>
-#endif
#include <net/altq/altq_cdnr.h>
-#ifdef ALTQ3_COMPAT
-/*
- * diffserv traffic conditioning module
- */
-
-int altq_cdnr_enabled = 0;
-
-/* traffic conditioner is enabled by ALTQ_CDNR option in opt_altq.h */
-#ifdef ALTQ_CDNR
-
-/* cdnr_list keeps all cdnr's allocated. */
-static LIST_HEAD(, top_cdnr) tcb_list;
-
-static int altq_cdnr_input(struct mbuf *, int);
-static struct top_cdnr *tcb_lookup(char *ifname);
-static struct cdnr_block *cdnr_handle2cb(u_long);
-static u_long cdnr_cb2handle(struct cdnr_block *);
-static void *cdnr_cballoc(struct top_cdnr *, int,
- struct tc_action *(*)(struct cdnr_block *, struct cdnr_pktinfo *));
-static void cdnr_cbdestroy(void *);
-static int tca_verify_action(struct tc_action *);
-static void tca_import_action(struct tc_action *, struct tc_action *);
-static void tca_invalidate_action(struct tc_action *);
-
-static int generic_element_destroy(struct cdnr_block *);
-static struct top_cdnr *top_create(struct ifaltq *);
-static int top_destroy(struct top_cdnr *);
-static struct cdnr_block *element_create(struct top_cdnr *, struct tc_action *);
-static int element_destroy(struct cdnr_block *);
-static void tb_import_profile(struct tbe *, struct tb_profile *);
-static struct tbmeter *tbm_create(struct top_cdnr *, struct tb_profile *,
- struct tc_action *, struct tc_action *);
-static int tbm_destroy(struct tbmeter *);
-static struct tc_action *tbm_input(struct cdnr_block *, struct cdnr_pktinfo *);
-static struct trtcm *trtcm_create(struct top_cdnr *,
- struct tb_profile *, struct tb_profile *,
- struct tc_action *, struct tc_action *, struct tc_action *,
- int);
-static int trtcm_destroy(struct trtcm *);
-static struct tc_action *trtcm_input(struct cdnr_block *, struct cdnr_pktinfo *);
-static struct tswtcm *tswtcm_create(struct top_cdnr *,
- u_int32_t, u_int32_t, u_int32_t,
- struct tc_action *, struct tc_action *, struct tc_action *);
-static int tswtcm_destroy(struct tswtcm *);
-static struct tc_action *tswtcm_input(struct cdnr_block *, struct cdnr_pktinfo *);
-
-static int cdnrcmd_if_attach(char *);
-static int cdnrcmd_if_detach(char *);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list