Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41883
b: refs/heads/master
c: 7da7f45
h: refs/heads/master
i:
  41881: 694f2fe
  41879: de52a4f
v: v3
  • Loading branch information
Gerrit Renker authored and David S. Miller committed Dec 3, 2006
1 parent 834631d commit 73182a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 91cf5a17257e1d2ef936fbf0223c3436ca583af9
refs/heads/master: 7da7f456d7bc0e52009f882e8af0ac910293e157
40 changes: 18 additions & 22 deletions trunk/net/dccp/ccids/ccid3.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
sock_put(sk);
}

/*
* returns
* > 0: delay (in msecs) that should pass before actually sending
* = 0: can send immediately
* < 0: error condition; do not send packet
*/
static int ccid3_hc_tx_send_packet(struct sock *sk,
struct sk_buff *skb, int len)
{
Expand All @@ -255,7 +261,6 @@ static int ccid3_hc_tx_send_packet(struct sock *sk,
struct dccp_tx_hist_entry *new_packet;
struct timeval now;
long delay;
int rc = -ENOTCONN;

BUG_ON(hctx == NULL);

Expand All @@ -265,19 +270,18 @@ static int ccid3_hc_tx_send_packet(struct sock *sk,
* packets can have zero length, but why the comment about "pure ACK"?
*/
if (unlikely(len == 0))
goto out;
return -ENOTCONN;

/* See if last packet allocated was not sent */
new_packet = dccp_tx_hist_head(&hctx->ccid3hctx_hist);
if (new_packet == NULL || new_packet->dccphtx_sent) {
new_packet = dccp_tx_hist_entry_new(ccid3_tx_hist,
SLAB_ATOMIC);

rc = -ENOBUFS;
if (unlikely(new_packet == NULL)) {
DCCP_WARN("%s, sk=%p, not enough mem to add to history,"
"send refused\n", dccp_role(sk), sk);
goto out;
return -ENOBUFS;
}

dccp_tx_hist_add_entry(&hctx->ccid3hctx_hist, new_packet);
Expand All @@ -300,7 +304,6 @@ static int ccid3_hc_tx_send_packet(struct sock *sk,

/* Set t_0 for initial packet */
hctx->ccid3hctx_t_nom = now;
rc = 0;
break;
case TFRC_SSTATE_NO_FBACK:
case TFRC_SSTATE_FBACK:
Expand All @@ -313,28 +316,21 @@ static int ccid3_hc_tx_send_packet(struct sock *sk,
* else
* // send the packet in (t_nom - t_now) milliseconds.
*/
if (delay < hctx->ccid3hctx_delta)
rc = 0;
else
rc = delay/1000L;
if (delay >= hctx->ccid3hctx_delta)
return delay / 1000L;
break;
case TFRC_SSTATE_TERM:
DCCP_BUG("Illegal %s state TERM, sk=%p", dccp_role(sk), sk);
rc = -EINVAL;
break;
return -EINVAL;
}

/* Can we send? if so add options and add to packet history */
if (rc == 0) {
dp->dccps_hc_tx_insert_options = 1;
new_packet->dccphtx_ccval =
DCCP_SKB_CB(skb)->dccpd_ccval =
hctx->ccid3hctx_last_win_count;
timeval_add_usecs(&hctx->ccid3hctx_t_nom,
hctx->ccid3hctx_t_ipi);
}
out:
return rc;
/* prepare to send now (add options etc.) */
dp->dccps_hc_tx_insert_options = 1;
new_packet->dccphtx_ccval = DCCP_SKB_CB(skb)->dccpd_ccval =
hctx->ccid3hctx_last_win_count;
timeval_add_usecs(&hctx->ccid3hctx_t_nom, hctx->ccid3hctx_t_ipi);

return 0;
}

static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, int len)
Expand Down

0 comments on commit 73182a1

Please sign in to comment.