#ifndef _NET_PKTSCHED_PKTSCHED_TCQ_H_
#define _NET_PKTSCHED_PKTSCHED_TCQ_H_
#ifdef PRIVATE
#include <net/pktsched/pktsched.h>
#include <net/classq/classq.h>
#include <net/classq/classq_red.h>
#include <net/classq/classq_rio.h>
#include <net/classq/classq_blue.h>
#include <net/classq/classq_sfb.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TCQ_MAXPRI 4
#define TQCF_RED 0x0001
#define TQCF_ECN 0x0002
#define TQCF_RIO 0x0004
#define TQCF_CLEARDSCP 0x0010
#define TQCF_BLUE 0x0100
#define TQCF_SFB 0x0200
#define TQCF_FLOWCTL 0x0400
#define TQCF_DEFAULTCLASS 0x1000
#ifdef BSD_KERNEL_PRIVATE
#define TQCF_LAZY 0x10000000
#endif
#define TQCF_USERFLAGS \
(TQCF_RED | TQCF_ECN | TQCF_RIO | TQCF_CLEARDSCP | TQCF_BLUE | \
TQCF_SFB | TQCF_FLOWCTL | TQCF_DEFAULTCLASS)
#ifdef BSD_KERNEL_PRIVATE
#define TQCF_BITS \
"\020\1RED\2ECN\3RIO\5CLEARDSCP\11BLUE\12SFB\13FLOWCTL\15DEFAULT" \
"\35LAZY"
#else
#define TQCF_BITS \
"\020\1RED\2ECN\3RIO\5CLEARDSCP\11BLUE\12SFB\13FLOWCTL"
#endif
struct tcq_classstats {
u_int32_t class_handle;
u_int32_t priority;
u_int32_t qlength;
u_int32_t qlimit;
u_int32_t period;
struct pktcntr xmitcnt;
struct pktcntr dropcnt;
classq_type_t qtype;
union {
struct red_stats red[RIO_NDROPPREC];
struct blue_stats blue;
struct sfb_stats sfb;
};
classq_state_t qstate;
};
#ifdef BSD_KERNEL_PRIVATE
struct tcq_class {
u_int32_t cl_handle;
class_queue_t cl_q;
u_int32_t cl_qflags;
union {
void *ptr;
struct red *red;
struct rio *rio;
struct blue *blue;
struct sfb *sfb;
} cl_qalg;
int32_t cl_pri;
u_int32_t cl_flags;
struct tcq_if *cl_tif;
u_int32_t cl_period;
struct pktcntr cl_xmitcnt;
struct pktcntr cl_dropcnt;
};
#define cl_red cl_qalg.red
#define cl_rio cl_qalg.rio
#define cl_blue cl_qalg.blue
#define cl_sfb cl_qalg.sfb
#define TCQIFF_ALTQ 0x1
struct tcq_if {
struct ifclassq *tif_ifq;
int tif_maxpri;
u_int32_t tif_flags;
u_int32_t tif_throttle;
struct tcq_class *tif_default;
struct tcq_class *tif_classes[TCQ_MAXPRI];
};
#define TCQIF_IFP(_tif) ((_tif)->tif_ifq->ifcq_ifp)
struct if_ifclassq_stats;
extern void tcq_init(void);
extern struct tcq_if *tcq_alloc(struct ifnet *, int, boolean_t);
extern int tcq_destroy(struct tcq_if *);
extern void tcq_purge(struct tcq_if *);
extern void tcq_event(struct tcq_if *, cqev_t);
extern int tcq_add_queue(struct tcq_if *, int, u_int32_t, int, u_int32_t,
struct tcq_class **);
extern int tcq_remove_queue(struct tcq_if *, u_int32_t);
extern int tcq_get_class_stats(struct tcq_if *, u_int32_t,
struct tcq_classstats *);
extern int tcq_enqueue(struct tcq_if *, struct tcq_class *, struct mbuf *,
struct pf_mtag *);
extern struct mbuf *tcq_dequeue_tc(struct tcq_if *, mbuf_svc_class_t,
cqdq_op_t);
extern int tcq_setup_ifclassq(struct ifclassq *, u_int32_t);
extern int tcq_teardown_ifclassq(struct ifclassq *ifq);
extern int tcq_getqstats_ifclassq(struct ifclassq *, u_int32_t qid,
struct if_ifclassq_stats *);
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif