diff options
| -rw-r--r-- | net/dccp/ccids/lib/packet_history.h | 127 |
1 files changed, 67 insertions, 60 deletions
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h index 4198185c6d40..1f960c19ea1b 100644 --- a/net/dccp/ccids/lib/packet_history.h +++ b/net/dccp/ccids/lib/packet_history.h | |||
| @@ -49,6 +49,9 @@ | |||
| 49 | #define TFRC_WIN_COUNT_PER_RTT 4 | 49 | #define TFRC_WIN_COUNT_PER_RTT 4 |
| 50 | #define TFRC_WIN_COUNT_LIMIT 16 | 50 | #define TFRC_WIN_COUNT_LIMIT 16 |
| 51 | 51 | ||
| 52 | /* | ||
| 53 | * Transmitter History data structures and declarations | ||
| 54 | */ | ||
| 52 | struct dccp_tx_hist_entry { | 55 | struct dccp_tx_hist_entry { |
| 53 | struct list_head dccphtx_node; | 56 | struct list_head dccphtx_node; |
| 54 | u64 dccphtx_seqno:48, | 57 | u64 dccphtx_seqno:48, |
| @@ -57,34 +60,16 @@ struct dccp_tx_hist_entry { | |||
| 57 | struct timeval dccphtx_tstamp; | 60 | struct timeval dccphtx_tstamp; |
| 58 | }; | 61 | }; |
| 59 | 62 | ||
| 60 | struct dccp_rx_hist_entry { | ||
| 61 | struct list_head dccphrx_node; | ||
| 62 | u64 dccphrx_seqno:48, | ||
| 63 | dccphrx_ccval:4, | ||
| 64 | dccphrx_type:4; | ||
| 65 | u32 dccphrx_ndp; /* In fact it is from 8 to 24 bits */ | ||
| 66 | struct timeval dccphrx_tstamp; | ||
| 67 | }; | ||
| 68 | |||
| 69 | struct dccp_tx_hist { | 63 | struct dccp_tx_hist { |
| 70 | struct kmem_cache *dccptxh_slab; | 64 | struct kmem_cache *dccptxh_slab; |
| 71 | }; | 65 | }; |
| 72 | 66 | ||
| 73 | extern struct dccp_tx_hist *dccp_tx_hist_new(const char *name); | 67 | extern struct dccp_tx_hist *dccp_tx_hist_new(const char *name); |
| 74 | extern void dccp_tx_hist_delete(struct dccp_tx_hist *hist); | 68 | extern void dccp_tx_hist_delete(struct dccp_tx_hist *hist); |
| 75 | |||
| 76 | struct dccp_rx_hist { | ||
| 77 | struct kmem_cache *dccprxh_slab; | ||
| 78 | }; | ||
| 79 | |||
| 80 | extern struct dccp_rx_hist *dccp_rx_hist_new(const char *name); | ||
| 81 | extern void dccp_rx_hist_delete(struct dccp_rx_hist *hist); | ||
| 82 | extern struct dccp_rx_hist_entry * | ||
| 83 | dccp_rx_hist_find_data_packet(const struct list_head *list); | ||
| 84 | 69 | ||
| 85 | static inline struct dccp_tx_hist_entry * | 70 | static inline struct dccp_tx_hist_entry * |
| 86 | dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, | 71 | dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, |
| 87 | const gfp_t prio) | 72 | const gfp_t prio) |
| 88 | { | 73 | { |
| 89 | struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab, | 74 | struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab, |
| 90 | prio); | 75 | prio); |
| @@ -95,18 +80,20 @@ static inline struct dccp_tx_hist_entry * | |||
| 95 | return entry; | 80 | return entry; |
| 96 | } | 81 | } |
| 97 | 82 | ||
| 98 | static inline void dccp_tx_hist_entry_delete(struct dccp_tx_hist *hist, | 83 | static inline struct dccp_tx_hist_entry * |
| 99 | struct dccp_tx_hist_entry *entry) | 84 | dccp_tx_hist_head(struct list_head *list) |
| 100 | { | 85 | { |
| 101 | if (entry != NULL) | 86 | struct dccp_tx_hist_entry *head = NULL; |
| 102 | kmem_cache_free(hist->dccptxh_slab, entry); | 87 | |
| 88 | if (!list_empty(list)) | ||
| 89 | head = list_entry(list->next, struct dccp_tx_hist_entry, | ||
| 90 | dccphtx_node); | ||
| 91 | return head; | ||
| 103 | } | 92 | } |
| 104 | 93 | ||
| 105 | extern struct dccp_tx_hist_entry * | 94 | extern struct dccp_tx_hist_entry * |
| 106 | dccp_tx_hist_find_entry(const struct list_head *list, | 95 | dccp_tx_hist_find_entry(const struct list_head *list, |
| 107 | const u64 seq); | 96 | const u64 seq); |
| 108 | extern int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq, | ||
| 109 | u8 *ccval); | ||
| 110 | 97 | ||
| 111 | static inline void dccp_tx_hist_add_entry(struct list_head *list, | 98 | static inline void dccp_tx_hist_add_entry(struct list_head *list, |
| 112 | struct dccp_tx_hist_entry *entry) | 99 | struct dccp_tx_hist_entry *entry) |
| @@ -114,30 +101,45 @@ static inline void dccp_tx_hist_add_entry(struct list_head *list, | |||
| 114 | list_add(&entry->dccphtx_node, list); | 101 | list_add(&entry->dccphtx_node, list); |
| 115 | } | 102 | } |
| 116 | 103 | ||
| 104 | static inline void dccp_tx_hist_entry_delete(struct dccp_tx_hist *hist, | ||
| 105 | struct dccp_tx_hist_entry *entry) | ||
| 106 | { | ||
| 107 | if (entry != NULL) | ||
| 108 | kmem_cache_free(hist->dccptxh_slab, entry); | ||
| 109 | } | ||
| 110 | |||
| 111 | extern void dccp_tx_hist_purge(struct dccp_tx_hist *hist, | ||
| 112 | struct list_head *list); | ||
| 113 | |||
| 117 | extern void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist, | 114 | extern void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist, |
| 118 | struct list_head *list, | 115 | struct list_head *list, |
| 119 | struct dccp_tx_hist_entry *next); | 116 | struct dccp_tx_hist_entry *next); |
| 120 | 117 | ||
| 121 | extern void dccp_tx_hist_purge(struct dccp_tx_hist *hist, | 118 | /* |
| 122 | struct list_head *list); | 119 | * Receiver History data structures and declarations |
| 120 | */ | ||
| 121 | struct dccp_rx_hist_entry { | ||
| 122 | struct list_head dccphrx_node; | ||
| 123 | u64 dccphrx_seqno:48, | ||
| 124 | dccphrx_ccval:4, | ||
| 125 | dccphrx_type:4; | ||
| 126 | u32 dccphrx_ndp; /* In fact it is from 8 to 24 bits */ | ||
| 127 | struct timeval dccphrx_tstamp; | ||
| 128 | }; | ||
| 123 | 129 | ||
| 124 | static inline struct dccp_tx_hist_entry * | 130 | struct dccp_rx_hist { |
| 125 | dccp_tx_hist_head(struct list_head *list) | 131 | struct kmem_cache *dccprxh_slab; |
| 126 | { | 132 | }; |
| 127 | struct dccp_tx_hist_entry *head = NULL; | ||
| 128 | 133 | ||
| 129 | if (!list_empty(list)) | 134 | extern struct dccp_rx_hist *dccp_rx_hist_new(const char *name); |
| 130 | head = list_entry(list->next, struct dccp_tx_hist_entry, | 135 | extern void dccp_rx_hist_delete(struct dccp_rx_hist *hist); |
| 131 | dccphtx_node); | ||
| 132 | return head; | ||
| 133 | } | ||
| 134 | 136 | ||
| 135 | static inline struct dccp_rx_hist_entry * | 137 | static inline struct dccp_rx_hist_entry * |
| 136 | dccp_rx_hist_entry_new(struct dccp_rx_hist *hist, | 138 | dccp_rx_hist_entry_new(struct dccp_rx_hist *hist, |
| 137 | const struct sock *sk, | 139 | const struct sock *sk, |
| 138 | const u32 ndp, | 140 | const u32 ndp, |
| 139 | const struct sk_buff *skb, | 141 | const struct sk_buff *skb, |
| 140 | const gfp_t prio) | 142 | const gfp_t prio) |
| 141 | { | 143 | { |
| 142 | struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab, | 144 | struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab, |
| 143 | prio); | 145 | prio); |
| @@ -155,18 +157,8 @@ static inline struct dccp_rx_hist_entry * | |||
| 155 | return entry; | 157 | return entry; |
| 156 | } | 158 | } |
| 157 | 159 | ||
| 158 | static inline void dccp_rx_hist_entry_delete(struct dccp_rx_hist *hist, | ||
| 159 | struct dccp_rx_hist_entry *entry) | ||
| 160 | { | ||
| 161 | if (entry != NULL) | ||
| 162 | kmem_cache_free(hist->dccprxh_slab, entry); | ||
| 163 | } | ||
| 164 | |||
| 165 | extern void dccp_rx_hist_purge(struct dccp_rx_hist *hist, | ||
| 166 | struct list_head *list); | ||
| 167 | |||
| 168 | static inline struct dccp_rx_hist_entry * | 160 | static inline struct dccp_rx_hist_entry * |
| 169 | dccp_rx_hist_head(struct list_head *list) | 161 | dccp_rx_hist_head(struct list_head *list) |
| 170 | { | 162 | { |
| 171 | struct dccp_rx_hist_entry *head = NULL; | 163 | struct dccp_rx_hist_entry *head = NULL; |
| 172 | 164 | ||
| @@ -176,6 +168,27 @@ static inline struct dccp_rx_hist_entry * | |||
| 176 | return head; | 168 | return head; |
| 177 | } | 169 | } |
| 178 | 170 | ||
| 171 | extern int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq, | ||
| 172 | u8 *ccval); | ||
| 173 | extern struct dccp_rx_hist_entry * | ||
| 174 | dccp_rx_hist_find_data_packet(const struct list_head *list); | ||
| 175 | |||
| 176 | extern void dccp_rx_hist_add_packet(struct dccp_rx_hist *hist, | ||
| 177 | struct list_head *rx_list, | ||
| 178 | struct list_head *li_list, | ||
| 179 | struct dccp_rx_hist_entry *packet, | ||
| 180 | u64 nonloss_seqno); | ||
| 181 | |||
| 182 | static inline void dccp_rx_hist_entry_delete(struct dccp_rx_hist *hist, | ||
| 183 | struct dccp_rx_hist_entry *entry) | ||
| 184 | { | ||
| 185 | if (entry != NULL) | ||
| 186 | kmem_cache_free(hist->dccprxh_slab, entry); | ||
| 187 | } | ||
| 188 | |||
| 189 | extern void dccp_rx_hist_purge(struct dccp_rx_hist *hist, | ||
| 190 | struct list_head *list); | ||
| 191 | |||
| 179 | static inline int | 192 | static inline int |
| 180 | dccp_rx_hist_entry_data_packet(const struct dccp_rx_hist_entry *entry) | 193 | dccp_rx_hist_entry_data_packet(const struct dccp_rx_hist_entry *entry) |
| 181 | { | 194 | { |
| @@ -183,12 +196,6 @@ static inline int | |||
| 183 | entry->dccphrx_type == DCCP_PKT_DATAACK; | 196 | entry->dccphrx_type == DCCP_PKT_DATAACK; |
| 184 | } | 197 | } |
| 185 | 198 | ||
| 186 | extern void dccp_rx_hist_add_packet(struct dccp_rx_hist *hist, | ||
| 187 | struct list_head *rx_list, | ||
| 188 | struct list_head *li_list, | ||
| 189 | struct dccp_rx_hist_entry *packet, | ||
| 190 | u64 nonloss_seqno); | ||
| 191 | |||
| 192 | extern u64 dccp_rx_hist_detect_loss(struct list_head *rx_list, | 199 | extern u64 dccp_rx_hist_detect_loss(struct list_head *rx_list, |
| 193 | struct list_head *li_list, u8 *win_loss); | 200 | struct list_head *li_list, u8 *win_loss); |
| 194 | 201 | ||
