: Migrate TX history to singly-linked list
PATCH 2/6 : Migrate TX history to singly-linked list
[TFRC]: Migrate TX history to singly-linked list
The patch set migrates TFRC TX history to a singly-linked list (implementing a suggestion by Arnaldo Carvalho de Melo) and prepares locking. Adding locking is important, since receiver and sender write/read asynchronously on the TX history.
This patch presents only the data structures, so that the remaining patches in the patch set are mostly self-explanatory.
Signed-off-by Gerrit Renker <[email protected]>
--- net/dccp/ccids/ccid3.h | 3 ++- net/dccp/ccids/lib/packet_history.c | 2 ++ net/dccp/ccids/lib/packet_history.h | 30 +++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 10 deletions(-)
net/dccp/ccids/lib/packet_history.c +2 -0
@@ -41,6 +41,8 @@/* * Transmitter History Routines */ +DEFINE_RWLOCK (tfrc_tx_hist_lock); +struct dccp_tx_hist *dccp_tx_hist_new (const char *name) {struct dccp_tx_hist *hist =kmalloc (sizeof (*hist),GFP_ATOMIC );
net/dccp/ccids/lib/packet_history.h +21 -9
@@ -52,18 +52,30 @@/* * Transmitter History data structures and declarations */ -struct dccp_tx_hist_entry { -struct list_head dccphtx_node; -u64 dccphtx_seqno; -struct timeval dccphtx_tstamp; -}; +extern struct dccp_tx_hist *dccp_tx_hist_new (const char *name); +extern void dccp_tx_hist_delete (struct dccp_tx_hist *hist); -struct dccp_tx_hist { -struct kmem_cache *dccptxh_slab; +/** +* tfrc_tx_hist - Simple singly-linked TX history list +* @next: next oldest entry (LIFO order) +* @seqno: sequence number of this entry +* @stamp: send time of packet with sequence number @seqno +*/ +struct tfrc_tx_hist { +struct tfrc_tx_hist *next; +u64 seqno; +ktime_t stamp; }; -extern struct dccp_tx_hist *dccp_tx_hist_new (const char *name); -extern void dccp_tx_hist_delete (struct dccp_tx_hist *hist); +/** +* tfrc_tx_hist_head - Head of TX history +* @first: begin of the list +* @cache: where list entries are allocated from +*/ +struct tfrc_tx_hist_head { +struct tfrc_tx_hist *first; +struct kmem_cache *cache; +};static inline struct dccp_tx_hist_entry * dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
net/dccp/ccids/ccid3.h +2 -1
@@ -40,6 +40,7 @@#include <linux/time.h> #include <linux/types.h> #include <linux/tfrc.h> +#include "lib/packet_history.h" #include "../ccid.h" /* Two seconds as per RFC 3448 4.2 */
@@ -111,7 +112,7 @@ struct ccid3_hc_tx_sock {ktime_t ccid3hctx_t_ld;ktime_t ccid3hctx_t_nom;u32 ccid3hctx_delta; -struct list_head ccid3hctx_hist; +struct tfrc_tx_hist_head ccid3hctx_hist;struct ccid3_options_received ccid3hctx_options_received; };
Quoted 3 lines · Gerrit Renker
[TFRC]: Migrate TX history to singly-linked list
Signed-off-by Gerrit Renker <[email protected]>
Signed-off-bu: Ian McDonald <[email protected]>
Signature · 3 lines
Web: http://wand.net.nz/~iam4/ Blog: http://iansblog.jandi.co.nz WAND Network Research Group