pktsched_fq_codel.h [plain text]
#ifndef _NET_PKTSCHED_FQ_CODEL_H_
#define _NET_PKTSCHED_FQ_CODEL_H_
#ifdef PRIVATE
#include <sys/types.h>
#include <sys/param.h>
#ifdef BSD_KERNEL_PRIVATE
#include <net/flowadv.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BSD_KERNEL_PRIVATE
struct fcl_stat {
u_int32_t fcl_flow_control;
u_int32_t fcl_flow_feedback;
u_int32_t fcl_dequeue_stall;
u_int32_t fcl_flow_control_fail;
u_int64_t fcl_drop_overflow;
u_int64_t fcl_drop_early;
u_int32_t fcl_drop_memfailure;
u_int32_t fcl_flows_cnt;
u_int32_t fcl_newflows_cnt;
u_int32_t fcl_oldflows_cnt;
u_int64_t fcl_pkt_cnt;
u_int64_t fcl_dequeue;
u_int64_t fcl_dequeue_bytes;
u_int64_t fcl_byte_cnt;
u_int32_t fcl_throttle_on;
u_int32_t fcl_throttle_off;
u_int32_t fcl_throttle_drops;
u_int32_t fcl_dup_rexmts;
};
#define FQ_IF_HASH_TAG_SIZE 8
#define FQ_IF_HASH_TAG_SHIFT 24
#define FQ_IF_HASH_TAG_MASK 0xFF
#define FQ_IF_HASH_TABLE_SIZE (1 << FQ_IF_HASH_TAG_SIZE)
#define FQ_IF_MAX_PKT_LIMIT 2048
#define FQ_IF_DEFAULT_QUANTUM 1500
#define FQ_IF_MAX_CLASSES 10
struct flowq;
typedef u_int32_t pktsched_bitmap_t;
struct if_ifclassq_stats;
enum fq_if_state {
FQ_IF_ER = 0,
FQ_IF_IR = 1,
FQ_IF_EB = 2,
FQ_IF_IB = 3,
FQ_IF_MAX_STATE
};
#define FQ_IF_BK_SYS_INDEX 9
#define FQ_IF_BK_INDEX 8
#define FQ_IF_BE_INDEX 7
#define FQ_IF_RD_INDEX 6
#define FQ_IF_OAM_INDEX 5
#define FQ_IF_AV_INDEX 4
#define FQ_IF_RV_INDEX 3
#define FQ_IF_VI_INDEX 2
#define FQ_IF_VO_INDEX 1
#define FQ_IF_CTL_INDEX 0
typedef SLIST_HEAD(, flowq) flowq_list_t;
typedef STAILQ_HEAD(, flowq) flowq_stailq_t;
typedef struct fq_if_classq {
u_int32_t fcl_pri;
u_int32_t fcl_service_class;
u_int32_t fcl_quantum;
u_int32_t fcl_drr_max;
int64_t fcl_budget;
flowq_stailq_t fcl_new_flows;
flowq_stailq_t fcl_old_flows;
struct fcl_stat fcl_stat;
} fq_if_classq_t;
typedef struct fq_codel_sched_data {
struct ifclassq *fqs_ifq;
u_int64_t fqs_target_qdelay;
u_int64_t fqs_update_interval;
flowq_list_t fqs_flows[FQ_IF_HASH_TABLE_SIZE];
pktsched_bitmap_t fqs_bitmaps[FQ_IF_MAX_STATE];
u_int32_t fqs_pkt_droplimit;
u_int8_t fqs_throttle;
fq_if_classq_t fqs_classq[FQ_IF_MAX_CLASSES];
struct flowadv_fclist fqs_fclist;
struct flowq *fqs_large_flow;
} fq_if_t;
#endif
struct fq_codel_classstats {
u_int32_t fcls_pri;
u_int32_t fcls_service_class;
u_int32_t fcls_quantum;
u_int32_t fcls_drr_max;
int64_t fcls_budget;
u_int64_t fcls_target_qdelay;
u_int64_t fcls_update_interval;
u_int32_t fcls_flow_control;
u_int32_t fcls_flow_feedback;
u_int32_t fcls_dequeue_stall;
u_int32_t fcls_flow_control_fail;
u_int64_t fcls_drop_overflow;
u_int64_t fcls_drop_early;
u_int32_t fcls_drop_memfailure;
u_int32_t fcls_flows_cnt;
u_int32_t fcls_newflows_cnt;
u_int32_t fcls_oldflows_cnt;
u_int64_t fcls_pkt_cnt;
u_int64_t fcls_dequeue;
u_int64_t fcls_dequeue_bytes;
u_int64_t fcls_byte_cnt;
u_int32_t fcls_throttle_on;
u_int32_t fcls_throttle_off;
u_int32_t fcls_throttle_drops;
u_int32_t fcls_dup_rexmts;
};
#ifdef BSD_KERNEL_PRIVATE
extern void fq_codel_scheduler_init(void);
extern struct flowq *fq_if_hash_pkt(fq_if_t *, u_int32_t, mbuf_svc_class_t,
u_int64_t, boolean_t);
extern boolean_t fq_if_at_drop_limit(fq_if_t *);
extern void fq_if_drop_packet(fq_if_t *);
extern void fq_if_is_flow_heavy(fq_if_t *, struct flowq *);
extern boolean_t fq_if_add_fcentry(fq_if_t *, struct pkthdr *,
fq_if_classq_t *);
extern void fq_if_flow_feedback(fq_if_t *, struct flowq *, fq_if_classq_t *);
extern int fq_if_setup_ifclassq(struct ifclassq *ifq, u_int32_t flags);
extern int fq_if_teardown_ifclassq(struct ifclassq *ifq);
extern int fq_if_getqstats_ifclassq(struct ifclassq *ifq, u_int32_t qid,
struct if_ifclassq_stats *ifqs);
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif