aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/lib
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-11-29 19:47:15 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:55:19 -0500
commit9108d5f4b2cd82f55ad178caa0be66a866a06dcc (patch)
treec706ab8146fa93ab56c72037b7daa2a6f78e4062 /net/dccp/ccids/lib
parent95bdfccb2bf4ea21c0065772c6a2c75cbaf6ad0d (diff)
[TFRC]: Hide tx history details from the CCIDs
Based on a previous patch by Gerrit Renker. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids/lib')
-rw-r--r--net/dccp/ccids/lib/packet_history.c33
-rw-r--r--net/dccp/ccids/lib/packet_history.h17
2 files changed, 34 insertions, 16 deletions
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c
index 139736064713..4805de996568 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -39,12 +39,24 @@
39#include <linux/string.h> 39#include <linux/string.h>
40#include "packet_history.h" 40#include "packet_history.h"
41 41
42/**
43 * tfrc_tx_hist_entry - Simple singly-linked TX history list
44 * @next: next oldest entry (LIFO order)
45 * @seqno: sequence number of this entry
46 * @stamp: send time of packet with sequence number @seqno
47 */
48struct tfrc_tx_hist_entry {
49 struct tfrc_tx_hist_entry *next;
50 u64 seqno;
51 ktime_t stamp;
52};
53
42/* 54/*
43 * Transmitter History Routines 55 * Transmitter History Routines
44 */ 56 */
45static struct kmem_cache *tfrc_tx_hist; 57static struct kmem_cache *tfrc_tx_hist;
46 58
47struct tfrc_tx_hist_entry * 59static struct tfrc_tx_hist_entry *
48 tfrc_tx_hist_find_entry(struct tfrc_tx_hist_entry *head, u64 seqno) 60 tfrc_tx_hist_find_entry(struct tfrc_tx_hist_entry *head, u64 seqno)
49{ 61{
50 while (head != NULL && head->seqno != seqno) 62 while (head != NULL && head->seqno != seqno)
@@ -52,7 +64,6 @@ struct tfrc_tx_hist_entry *
52 64
53 return head; 65 return head;
54} 66}
55EXPORT_SYMBOL_GPL(tfrc_tx_hist_find_entry);
56 67
57int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno) 68int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno)
58{ 69{
@@ -83,6 +94,24 @@ void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp)
83} 94}
84EXPORT_SYMBOL_GPL(tfrc_tx_hist_purge); 95EXPORT_SYMBOL_GPL(tfrc_tx_hist_purge);
85 96
97u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head, const u64 seqno,
98 const ktime_t now)
99{
100 u32 rtt = 0;
101 struct tfrc_tx_hist_entry *packet = tfrc_tx_hist_find_entry(head, seqno);
102
103 if (packet != NULL) {
104 rtt = ktime_us_delta(now, packet->stamp);
105 /*
106 * Garbage-collect older (irrelevant) entries:
107 */
108 tfrc_tx_hist_purge(&packet->next);
109 }
110
111 return rtt;
112}
113EXPORT_SYMBOL_GPL(tfrc_tx_hist_rtt);
114
86/* 115/*
87 * Receiver History Routines 116 * Receiver History Routines
88 */ 117 */
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h
index 5c07182dd659..0670f46dd53c 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -48,23 +48,12 @@
48#define TFRC_WIN_COUNT_PER_RTT 4 48#define TFRC_WIN_COUNT_PER_RTT 4
49#define TFRC_WIN_COUNT_LIMIT 16 49#define TFRC_WIN_COUNT_LIMIT 16
50 50
51/** 51struct tfrc_tx_hist_entry;
52 * tfrc_tx_hist_entry - Simple singly-linked TX history list
53 * @next: next oldest entry (LIFO order)
54 * @seqno: sequence number of this entry
55 * @stamp: send time of packet with sequence number @seqno
56 */
57struct tfrc_tx_hist_entry {
58 struct tfrc_tx_hist_entry *next;
59 u64 seqno;
60 ktime_t stamp;
61};
62 52
63extern int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno); 53extern int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno);
64extern void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp); 54extern void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp);
65 55extern u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head,
66extern struct tfrc_tx_hist_entry * 56 const u64 seqno, const ktime_t now);
67 tfrc_tx_hist_find_entry(struct tfrc_tx_hist_entry *head, u64 ackno);
68 57
69/* 58/*
70 * Receiver History data structures and declarations 59 * Receiver History data structures and declarations