]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/net/classq/classq_sfb.h
xnu-2782.30.5.tar.gz
[apple/xnu.git] / bsd / net / classq / classq_sfb.h
index 911ad31ef20ff89d037ac595b4b2f9e98c1559bd..f401b0eb57c948029c8920346360cc6ded600878 100644 (file)
 
 #ifdef PRIVATE
 #ifdef BSD_KERNEL_PRIVATE
-#include <net/classq/if_classq.h>
 #include <stdbool.h>
 #include <sys/time.h>
+#include <net/flowadv.h>
+#include <net/classq/if_classq.h>
 #endif /* BSD_KERNEL_PRIVATE */
 
 #ifdef __cplusplus
@@ -56,14 +57,16 @@ struct sfbstats {
        u_int64_t               dequeue_avg;
        u_int64_t               rehash_intval;
        u_int64_t               num_rehash;
-       u_int64_t               null_flowhash;
+       u_int64_t               null_flowid;
        u_int64_t               flow_controlled;
        u_int64_t               flow_feedback;
+       u_int64_t               dequeue_stall;
 };
 
 struct sfbbinstats {
        int16_t         pmark;          /* marking probability in Q format */
        u_int16_t       pkts;           /* number of packets */
+       u_int32_t       bytes;          /* number of bytes */
 };
 
 struct sfb_stats {
@@ -71,6 +74,11 @@ struct sfb_stats {
        u_int32_t               dropthresh;
        u_int32_t               clearpkts;
        u_int32_t               current;
+       u_int64_t               target_qdelay;
+       u_int64_t               update_interval;
+       u_int64_t               min_estdelay;
+       u_int32_t               delay_fcthreshold;
+       u_int32_t               flags;
        struct sfbstats         sfbstats;
        struct sfbbins {
                struct sfbbinstats stats[SFB_LEVELS][SFB_BINS];
@@ -78,28 +86,28 @@ struct sfb_stats {
 };
 
 #ifdef BSD_KERNEL_PRIVATE
-struct sfb_bin_fcentry {
-       SLIST_ENTRY(sfb_bin_fcentry) fce_link;
-       u_int32_t       fce_flowhash;
-};
-
-SLIST_HEAD(sfb_fc_list, sfb_bin_fcentry);
-
 struct sfb_bins {
        u_int32_t               fudge;
        struct sfbbinstats      stats[SFB_LEVELS][SFB_BINS];
        struct timespec         freezetime[SFB_LEVELS][SFB_BINS];
 };
 
+struct sfb_fcl {
+       u_int32_t               cnt;
+       struct flowadv_fclist   fclist;
+};
+
 /* SFB flags */
 #define        SFBF_ECN4       0x01    /* use packet marking for IPv4 packets */
 #define        SFBF_ECN6       0x02    /* use packet marking for IPv6 packets */
 #define        SFBF_ECN        (SFBF_ECN4 | SFBF_ECN6)
 #define        SFBF_FLOWCTL    0x04    /* enable flow control advisories */
+#define        SFBF_DELAYBASED 0x08    /* queueing is delay based */
+#define        SFBF_DELAYHIGH  0x10    /* Estimated delay is greater than target */
 #define        SFBF_SUSPENDED  0x1000  /* queue is suspended */
 
 #define        SFBF_USERFLAGS                                                  \
-       (SFBF_ECN4 | SFBF_ECN6 | SFBF_FLOWCTL)
+       (SFBF_ECN4 | SFBF_ECN6 | SFBF_FLOWCTL | SFBF_DELAYBASED)
 
 typedef struct sfb {
        /* variables for internal use */
@@ -110,10 +118,19 @@ typedef struct sfb {
        u_int16_t       sfb_drop_thresh;
        u_int32_t       sfb_clearpkts;
        u_int64_t       sfb_eff_rate;   /* last known effective rate */
-       struct timespec sfb_getqtime;   /* last dequeue timestamp */
+       struct timespec sfb_getqtime;   /* last dequeue timestamp */
        struct timespec sfb_holdtime;   /* random holdtime in nsec */
        struct ifnet    *sfb_ifp;       /* back pointer to ifnet */
 
+       /* target queue delay and interval for queue sizing */
+       u_int64_t       sfb_target_qdelay;
+       struct timespec sfb_update_interval;
+       u_int64_t       sfb_fc_threshold; /* for flow control feedback */ 
+
+       /* variables for computing estimated delay of the queue */
+       u_int64_t       sfb_min_qdelay;
+       struct timespec sfb_update_time;
+
        /* moving hash function */
        struct timespec sfb_hinterval;  /* random reset interval in sec */
        struct timespec sfb_nextreset;  /* reset deadline */
@@ -127,7 +144,7 @@ typedef struct sfb {
        struct sfb_bins (*sfb_bins)[2];
 
        /* Flow control lists for current set */
-       struct sfb_fc_list (*sfb_fc_lists)[SFB_BINS];
+       struct sfb_fc (*sfb_fc_lists)[SFB_BINS];
 
        /* statistics */
        struct sfbstats sfb_stats __attribute__((aligned(8)));