#ifndef _PKTSCHED_PKTSCHED_H_
#define _PKTSCHED_PKTSCHED_H_
#ifdef PRIVATE
#ifdef __cplusplus
extern "C" {
#endif
#define PKTSCHEDT_NONE 0
#define PKTSCHEDT_CBQ 1
#define PKTSCHEDT_HFSC 2
#define PKTSCHEDT_PRIQ 3
#define PKTSCHEDT_FAIRQ 4
#define PKTSCHEDT_TCQ 5
#define PKTSCHEDT_QFQ 6
#define PKTSCHEDT_MAX 7
#ifdef BSD_KERNEL_PRIVATE
#include <mach/mach_time.h>
#include <sys/sysctl.h>
#include <libkern/libkern.h>
#define PKTSCHEDF_QALG_RED 0x1
#define PKTSCHEDF_QALG_RIO 0x2
#define PKTSCHEDF_QALG_BLUE 0x4
#define PKTSCHEDF_QALG_SFB 0x8
#define PKTSCHEDF_QALG_ECN 0x10
#define PKTSCHEDF_QALG_FLOWCTL 0x20
#define PKTSCHEDF_QALG_DELAYBASED 0x40
struct callout {
void *c_arg;
void (*c_func)(void *);
};
#define CALLOUT_INIT(c) do { \
(void) memset((c), 0, sizeof (*(c))); \
} while ( 0)
#define CALLOUT_RESET(c, t, f, a) do { \
(c)->c_arg = (a); \
(c)->c_func = (f); \
timeout((f), (a), (t)); \
} while ( 0)
#define CALLOUT_STOP(c) untimeout((c)->c_func, (c)->c_arg)
#define CALLOUT_INITIALIZER { NULL, NULL }
typedef void (timeout_t)(void *);
typedef u_int32_t pktsched_bitmap_t;
static inline boolean_t
pktsched_bit_tst(u_int32_t ix, pktsched_bitmap_t *pData)
{
return (*pData & (1 << ix));
}
static inline void
pktsched_bit_set(u_int32_t ix, pktsched_bitmap_t *pData)
{
*pData |= (1 << ix);
}
static inline void
pktsched_bit_clr(u_int32_t ix, pktsched_bitmap_t *pData)
{
*pData &= ~(1 << ix);
}
static inline pktsched_bitmap_t
pktsched_ffs(pktsched_bitmap_t pData)
{
return (ffs(pData));
}
static inline pktsched_bitmap_t
pktsched_fls(pktsched_bitmap_t pData)
{
return ((sizeof (pktsched_bitmap_t) << 3) - clz(pData));
}
static inline pktsched_bitmap_t
__fls(pktsched_bitmap_t word)
{
VERIFY(word != 0);
return (pktsched_fls(word) - 1);
}
#define read_machclk() mach_absolute_time()
extern u_int32_t machclk_freq;
extern u_int64_t machclk_per_sec;
extern u_int32_t pktsched_verbose;
SYSCTL_DECL(_net_pktsched);
struct if_ifclassq_stats;
extern void pktsched_init(void);
extern int pktsched_setup(struct ifclassq *, u_int32_t, u_int32_t);
extern int pktsched_teardown(struct ifclassq *);
extern int pktsched_getqstats(struct ifclassq *, u_int32_t,
struct if_ifclassq_stats *);
extern u_int64_t pktsched_abs_to_nsecs(u_int64_t);
extern u_int64_t pktsched_nsecs_to_abstime(u_int64_t);
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif