Skip to contentSkip to conversation

: Avoid congestion control on zero-sized data packets

PATCH Applied Gerrit Renker 3 participants 3 messages Nov 24, 2006 – Nov 26, 2006 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 : Avoid congestion control on zero-sized data packets

[CCID 3]: Avoid congestion control on zero-sized data packets

This resolves an `XXX' in ccid3_hc_tx_send_packet().

The function is only called on Data and DataAck packets and returns a negative result on zero-sized messages. This is a reasonable policy since CCID 3 is a congestion-control module and congestion control on zero-sized Data(Ack) packets is in a way pathological.

The patch uses a more suitable error code for this case, it returns the Posix.1 code EBADMSG' ("Not a data message") instead of ENOTCONN'.

As a result of ignoring zero-sized packets, a the condition for a warning "First packet is data" in ccid3_hc_tx_packet_sent is always satisfied; this message has been removed since it will always be printed.

---
 net/dccp/ccids/ccid3.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
net/dccp/ccids/ccid3.c +5 -9
@@ -282,13 +282,13 @@ static int ccid3_hc_tx_send_packet(struc
 
 	BUG_ON(hctx = NULL);
 
-	/* Check if pure ACK or Terminating*/
 	/*
-	 * XXX: We only call this function for DATA and DATAACK, on, these
-	 * packets can have zero length, but why the comment about "pure ACK"?
+	 * This function is called only for Data and DataAck packets. Sending
+	 * zero-sized Data(Ack)s is theoretically possible, but for congestion
+	 * control this case is pathological - ignore it.
 	 */
 	if (unlikely(len = 0))
-		return -ENOTCONN;
+		return -EBADMSG;
 
 	/* See if last packet allocated was not sent */
 	new_packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist);
@@ -411,11 +411,7 @@ static void ccid3_hc_tx_packet_sent(stru
 
 	switch (hctx->ccid3hctx_state) {
 	case TFRC_SSTATE_NO_SENT:
-		/* if first wasn't pure ack */
-		if (len != 0)
-			DCCP_CRIT("%s, First packet sent is noted "
-				  "as a data packet",  dccp_role(sk));
-		return;
+		/* fall through */
 	case TFRC_SSTATE_NO_FBACK:
 		/* t_nom, t_ipi, delta do not change until feedback arrives */
 		return;
#1 lore raw
Quoted 44 lines · Gerrit Renker

[CCID 3]: Avoid congestion control on zero-sized data packets

This resolves an `XXX' in ccid3_hc_tx_send_packet().

The function is only called on Data and DataAck packets and returns a negative result on zero-sized messages. This is a reasonable policy since CCID 3 is a congestion-control module and congestion control on zero-sized Data(Ack) packets is in a way pathological.

The patch uses a more suitable error code for this case, it returns the Posix.1 code EBADMSG' ("Not a data message") instead of ENOTCONN'.

As a result of ignoring zero-sized packets, a the condition for a warning "First packet is data" in ccid3_hc_tx_packet_sent is always satisfied; this message has been removed since it will always be printed.

---
 net/dccp/ccids/ccid3.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
net/dccp/ccids/ccid3.c +4 -4
@@ -282,13 +282,13 @@ static int ccid3_hc_tx_send_packet(struc
 
        BUG_ON(hctx = NULL);
 
-       /* Check if pure ACK or Terminating*/
        /*
-        * XXX: We only call this function for DATA and DATAACK, on, these
-        * packets can have zero length, but why the comment about "pure ACK"?
+        * This function is called only for Data and DataAck packets. Sending
+        * zero-sized Data(Ack)s is theoretically possible, but for congestion
+        * control this case is pathological - ignore it.
         */
        if (unlikely(len = 0))
-               return -ENOTCONN;
+               return -EBADMSG;
 
        /* See if last packet allocated was not sent */
        new_packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist);
@@ -411,11 +411,7 @@ static void ccid3_hc_tx_packet_sent(stru
 
        switch (hctx->ccid3hctx_state) {

net/dccp/ccids/ccid3.c static void ccid3_hc_tx_packet_sent(stru · line 417

Quoted 10 lines
net/dccp/ccids/ccid3.c +1 -5
        case TFRC_SSTATE_NO_SENT:
-               /* if first wasn't pure ack */
-               if (len != 0)
-                       DCCP_CRIT("%s, First packet sent is noted "
-                                 "as a data packet",  dccp_role(sk));
-               return;
+               /* fall through */
        case TFRC_SSTATE_NO_FBACK:
                /* t_nom, t_ipi, delta do not change until feedback arrives */
                return;

Thanks, applied.

- Arnaldo

#2 lore raw
In reply to Gerrit Renker
Quoted 2 lines · Gerrit Renker

[CCID 3]: Avoid congestion control on zero-sized data packets

I think in both of these functions we should change len to unsigned or make more explicit checks as we can have problems with negative integers. This already exists though so patch causes no further problems and tidies things up.

Ian

Signature · 7 lines
Ian McDonald
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand