[PATCH 6/7] [CCID3]: The receiver of a half-connection does not set window counter values

2007-12-02 Thread Arnaldo Carvalho de Melo
From: Gerrit Renker [EMAIL PROTECTED]

Only the sender sets window counters [RFC 4342, sections 5 and 8.1].

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Ian McDonald [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index c95dca8..5ff5aab 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -733,7 +733,6 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, 
struct sk_buff *skb)
return 0;
 
hcrx = ccid3_hc_rx_sk(sk);
-   DCCP_SKB_CB(skb)-dccpd_ccval = hcrx-ccid3hcrx_ccval_last_counter;
 
if (dccp_packet_without_ack(skb))
return 0;
-- 
1.5.3.4

-
To unsubscribe from this list: send the line unsubscribe dccp in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] [TFRC]: Provide central source file and debug facility

2007-12-02 Thread Arnaldo Carvalho de Melo
From: Gerrit Renker [EMAIL PROTECTED]

This patch changes the tfrc_lib module in the following manner:

 (1) a dedicated tfrc source file to call the packet history 
 loss interval init/exit functions.
 (2) a dedicated tfrc_pr_debug macro with toggle switch `tfrc_debug'.

Commiter note: renamed tfrc_module.c to tfrc.c, and made CONFIG_IP_DCCP_CCID3
select IP_DCCP_TFRC_LIB.

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Ian McDonald [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/dccp/ccids/Kconfig  |   13 ++---
 net/dccp/ccids/lib/Makefile |2 +-
 net/dccp/ccids/lib/packet_history.c |   27 ++-
 net/dccp/ccids/lib/packet_history.h |3 +-
 net/dccp/ccids/lib/tfrc.c   |   48 +++
 net/dccp/ccids/lib/tfrc.h   |   17 +---
 6 files changed, 75 insertions(+), 35 deletions(-)
 create mode 100644 net/dccp/ccids/lib/tfrc.c

diff --git a/net/dccp/ccids/Kconfig b/net/dccp/ccids/Kconfig
index 3d7d867..1227594 100644
--- a/net/dccp/ccids/Kconfig
+++ b/net/dccp/ccids/Kconfig
@@ -38,6 +38,7 @@ config IP_DCCP_CCID2_DEBUG
 config IP_DCCP_CCID3
tristate CCID3 (TCP-Friendly) (EXPERIMENTAL)
def_tristate IP_DCCP
+   select IP_DCCP_TFRC_LIB
---help---
  CCID 3 denotes TCP-Friendly Rate Control (TFRC), an equation-based
  rate-controlled congestion control mechanism.  TFRC is designed to
@@ -63,10 +64,6 @@ config IP_DCCP_CCID3
 
  If in doubt, say M.
 
-config IP_DCCP_TFRC_LIB
-   depends on IP_DCCP_CCID3
-   def_tristate IP_DCCP_CCID3
-
 config IP_DCCP_CCID3_DEBUG
  bool CCID3 debugging messages
  depends on IP_DCCP_CCID3
@@ -110,5 +107,13 @@ config IP_DCCP_CCID3_RTO
is serious network congestion: experimenting with larger values 
should
therefore not be performed on WANs.
 
+config IP_DCCP_TFRC_LIB
+   tristate
+   default n
+
+config IP_DCCP_TFRC_DEBUG
+   bool
+   depends on IP_DCCP_TFRC_LIB
+   default y if IP_DCCP_CCID3_DEBUG
 
 endmenu
diff --git a/net/dccp/ccids/lib/Makefile b/net/dccp/ccids/lib/Makefile
index 5f940a6..68c93e3 100644
--- a/net/dccp/ccids/lib/Makefile
+++ b/net/dccp/ccids/lib/Makefile
@@ -1,3 +1,3 @@
 obj-$(CONFIG_IP_DCCP_TFRC_LIB) += dccp_tfrc_lib.o
 
-dccp_tfrc_lib-y := loss_interval.o packet_history.o tfrc_equation.o
+dccp_tfrc_lib-y := tfrc.o tfrc_equation.o packet_history.o loss_interval.o
diff --git a/net/dccp/ccids/lib/packet_history.c 
b/net/dccp/ccids/lib/packet_history.c
index 4805de9..1d4d6ee 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -35,7 +35,6 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include linux/module.h
 #include linux/string.h
 #include packet_history.h
 
@@ -277,39 +276,19 @@ void dccp_rx_hist_purge(struct dccp_rx_hist *hist, struct 
list_head *list)
 
 EXPORT_SYMBOL_GPL(dccp_rx_hist_purge);
 
-extern int __init dccp_li_init(void);
-extern void dccp_li_exit(void);
-
-static __init int packet_history_init(void)
+__init int packet_history_init(void)
 {
-   if (dccp_li_init() != 0)
-   goto out;
-
tfrc_tx_hist = kmem_cache_create(tfrc_tx_hist,
 sizeof(struct tfrc_tx_hist_entry), 0,
 SLAB_HWCACHE_ALIGN, NULL);
-   if (tfrc_tx_hist == NULL)
-   goto out_li_exit;
 
-   return 0;
-out_li_exit:
-   dccp_li_exit();
-out:
-   return -ENOBUFS;
+   return tfrc_tx_hist == NULL ? -ENOBUFS : 0;
 }
-module_init(packet_history_init);
 
-static __exit void packet_history_exit(void)
+void packet_history_exit(void)
 {
if (tfrc_tx_hist != NULL) {
kmem_cache_destroy(tfrc_tx_hist);
tfrc_tx_hist = NULL;
}
-   dccp_li_exit();
 }
-module_exit(packet_history_exit);
-
-MODULE_AUTHOR(Ian McDonald [EMAIL PROTECTED], 
- Arnaldo Carvalho de Melo [EMAIL PROTECTED]);
-MODULE_DESCRIPTION(DCCP TFRC library);
-MODULE_LICENSE(GPL);
diff --git a/net/dccp/ccids/lib/packet_history.h 
b/net/dccp/ccids/lib/packet_history.h
index 0670f46..9a2642e 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -39,8 +39,7 @@
 #include linux/ktime.h
 #include linux/list.h
 #include linux/slab.h
-
-#include ../../dccp.h
+#include tfrc.h
 
 /* Number of later packets received before one is considered lost */
 #define TFRC_RECV_NUM_LATE_LOSS 3
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c
new file mode 100644
index 000..3a7a183
--- /dev/null
+++ b/net/dccp/ccids/lib/tfrc.c
@@ -0,0 +1,48 @@
+/*
+ * TFRC: main module holding the pieces of the TFRC library together
+ *
+ * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
+ * Copyright (c) 2007 Arnaldo Carvalho de Melo [EMAIL PROTECTED]
+ */
+#include 

[PATCH 2/7] [DCCP]: Introduce generic function to test for `data packets'

2007-12-02 Thread Arnaldo Carvalho de Melo
From: Gerrit Renker [EMAIL PROTECTED]

as per  RFC 4340, sec. 7.7.

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Ian McDonald [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/dccp/dccp.h |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index ee97950..f4a5ea1 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -334,6 +334,7 @@ struct dccp_skb_cb {
 
 #define DCCP_SKB_CB(__skb) ((struct dccp_skb_cb *)((__skb)-cb[0]))
 
+/* RFC 4340, sec. 7.7 */
 static inline int dccp_non_data_packet(const struct sk_buff *skb)
 {
const __u8 type = DCCP_SKB_CB(skb)-dccpd_type;
@@ -346,6 +347,17 @@ static inline int dccp_non_data_packet(const struct 
sk_buff *skb)
   type == DCCP_PKT_SYNCACK;
 }
 
+/* RFC 4340, sec. 7.7 */
+static inline int dccp_data_packet(const struct sk_buff *skb)
+{
+   const __u8 type = DCCP_SKB_CB(skb)-dccpd_type;
+
+   return type == DCCP_PKT_DATA ||
+  type == DCCP_PKT_DATAACK  ||
+  type == DCCP_PKT_REQUEST  ||
+  type == DCCP_PKT_RESPONSE;
+}
+
 static inline int dccp_packet_without_ack(const struct sk_buff *skb)
 {
const __u8 type = DCCP_SKB_CB(skb)-dccpd_type;
-- 
1.5.3.4

-
To unsubscribe from this list: send the line unsubscribe dccp in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7] [TFRC]: Rename dccp_rx_ to tfrc_rx_

2007-12-02 Thread Arnaldo Carvalho de Melo
This is in preparation for merging the new rx history code written by Gerrit 
Renker.

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c  |   32 ++--
 net/dccp/ccids/lib/loss_interval.c  |   14 +++---
 net/dccp/ccids/lib/packet_history.c |   90 +-
 net/dccp/ccids/lib/packet_history.h |   48 +-
 4 files changed, 92 insertions(+), 92 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 07920bb..c95dca8 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -677,7 +677,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk)
 {
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
struct dccp_sock *dp = dccp_sk(sk);
-   struct dccp_rx_hist_entry *packet;
+   struct tfrc_rx_hist_entry *packet;
ktime_t now;
suseconds_t delta;
 
@@ -701,7 +701,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk)
return;
}
 
-   packet = dccp_rx_hist_find_data_packet(hcrx-ccid3hcrx_hist);
+   packet = tfrc_rx_hist_find_data_packet(hcrx-ccid3hcrx_hist);
if (unlikely(packet == NULL)) {
DCCP_WARN(%s(%p), no data packet in history!\n,
  dccp_role(sk), sk);
@@ -709,7 +709,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk)
}
 
hcrx-ccid3hcrx_tstamp_last_feedback = now;
-   hcrx-ccid3hcrx_ccval_last_counter   = packet-dccphrx_ccval;
+   hcrx-ccid3hcrx_ccval_last_counter   = packet-tfrchrx_ccval;
hcrx-ccid3hcrx_bytes_recv   = 0;
 
if (hcrx-ccid3hcrx_p == 0)
@@ -752,12 +752,12 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, 
struct sk_buff *skb)
 }
 
 static int ccid3_hc_rx_detect_loss(struct sock *sk,
-   struct dccp_rx_hist_entry *packet)
+   struct tfrc_rx_hist_entry *packet)
 {
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
-   struct dccp_rx_hist_entry *rx_hist =
-   dccp_rx_hist_head(hcrx-ccid3hcrx_hist);
-   u64 seqno = packet-dccphrx_seqno;
+   struct tfrc_rx_hist_entry *rx_hist =
+   tfrc_rx_hist_head(hcrx-ccid3hcrx_hist);
+   u64 seqno = packet-tfrchrx_seqno;
u64 tmp_seqno;
int loss = 0;
u8 ccval;
@@ -766,9 +766,9 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
tmp_seqno = hcrx-ccid3hcrx_seqno_nonloss;
 
if (!rx_hist ||
-  follows48(packet-dccphrx_seqno, hcrx-ccid3hcrx_seqno_nonloss)) {
+  follows48(packet-tfrchrx_seqno, hcrx-ccid3hcrx_seqno_nonloss)) {
hcrx-ccid3hcrx_seqno_nonloss = seqno;
-   hcrx-ccid3hcrx_ccval_nonloss = packet-dccphrx_ccval;
+   hcrx-ccid3hcrx_ccval_nonloss = packet-tfrchrx_ccval;
goto detect_out;
}
 
@@ -789,7 +789,7 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
dccp_inc_seqno(tmp_seqno);
hcrx-ccid3hcrx_seqno_nonloss = tmp_seqno;
dccp_inc_seqno(tmp_seqno);
-   while (dccp_rx_hist_find_entry(hcrx-ccid3hcrx_hist,
+   while (tfrc_rx_hist_find_entry(hcrx-ccid3hcrx_hist,
   tmp_seqno, ccval)) {
hcrx-ccid3hcrx_seqno_nonloss = tmp_seqno;
hcrx-ccid3hcrx_ccval_nonloss = ccval;
@@ -799,13 +799,13 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
 
/* FIXME - this code could be simplified with above while */
/* but works at moment */
-   if (follows48(packet-dccphrx_seqno, hcrx-ccid3hcrx_seqno_nonloss)) {
+   if (follows48(packet-tfrchrx_seqno, hcrx-ccid3hcrx_seqno_nonloss)) {
hcrx-ccid3hcrx_seqno_nonloss = seqno;
-   hcrx-ccid3hcrx_ccval_nonloss = packet-dccphrx_ccval;
+   hcrx-ccid3hcrx_ccval_nonloss = packet-tfrchrx_ccval;
}
 
 detect_out:
-   dccp_rx_hist_add_packet(hcrx-ccid3hcrx_hist,
+   tfrc_rx_hist_add_packet(hcrx-ccid3hcrx_hist,
hcrx-ccid3hcrx_li_hist, packet,
hcrx-ccid3hcrx_seqno_nonloss);
return loss;
@@ -815,7 +815,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct 
sk_buff *skb)
 {
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
const struct dccp_options_received *opt_recv;
-   struct dccp_rx_hist_entry *packet;
+   struct tfrc_rx_hist_entry *packet;
u32 p_prev, r_sample, rtt_prev;
int loss, payload_size;
ktime_t now;
@@ -850,7 +850,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct 
sk_buff *skb)
return;
}
 
-   packet = dccp_rx_hist_entry_new(opt_recv-dccpor_ndp, skb, GFP_ATOMIC);
+   packet = tfrc_rx_hist_entry_new(opt_recv-dccpor_ndp, skb, GFP_ATOMIC);
if (unlikely(packet ==