aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ccid.h34
-rw-r--r--net/dccp/ccids/ccid3.c12
2 files changed, 37 insertions, 9 deletions
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
index 430a3c24f970..d27054ba2159 100644
--- a/net/dccp/ccid.h
+++ b/net/dccp/ccid.h
@@ -129,13 +129,41 @@ static inline int ccid_get_current_tx_ccid(struct dccp_sock *dp)
129extern void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk); 129extern void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk);
130extern void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk); 130extern void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk);
131 131
132/*
133 * Congestion control of queued data packets via CCID decision.
134 *
135 * The TX CCID performs its congestion-control by indicating whether and when a
136 * queued packet may be sent, using the return code of ccid_hc_tx_send_packet().
137 * The following modes are supported via the symbolic constants below:
138 * - timer-based pacing (CCID returns a delay value in milliseconds);
139 * - autonomous dequeueing (CCID internally schedules dccps_xmitlet).
140 */
141
142enum ccid_dequeueing_decision {
143 CCID_PACKET_SEND_AT_ONCE = 0x00000, /* "green light": no delay */
144 CCID_PACKET_DELAY_MAX = 0x0FFFF, /* maximum delay in msecs */
145 CCID_PACKET_DELAY = 0x10000, /* CCID msec-delay mode */
146 CCID_PACKET_WILL_DEQUEUE_LATER = 0x20000, /* CCID autonomous mode */
147 CCID_PACKET_ERR = 0xF0000, /* error condition */
148};
149
150static inline int ccid_packet_dequeue_eval(const int return_code)
151{
152 if (return_code < 0)
153 return CCID_PACKET_ERR;
154 if (return_code == 0)
155 return CCID_PACKET_SEND_AT_ONCE;
156 if (return_code <= CCID_PACKET_DELAY_MAX)
157 return CCID_PACKET_DELAY;
158 return return_code;
159}
160
132static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk, 161static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk,
133 struct sk_buff *skb) 162 struct sk_buff *skb)
134{ 163{
135 int rc = 0;
136 if (ccid->ccid_ops->ccid_hc_tx_send_packet != NULL) 164 if (ccid->ccid_ops->ccid_hc_tx_send_packet != NULL)
137 rc = ccid->ccid_ops->ccid_hc_tx_send_packet(sk, skb); 165 return ccid->ccid_ops->ccid_hc_tx_send_packet(sk, skb);
138 return rc; 166 return CCID_PACKET_SEND_AT_ONCE;
139} 167}
140 168
141static inline void ccid_hc_tx_packet_sent(struct ccid *ccid, struct sock *sk, 169static inline void ccid_hc_tx_packet_sent(struct ccid *ccid, struct sock *sk,
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 0751a8fa936a..0d406f82e433 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -269,11 +269,11 @@ out:
269 sock_put(sk); 269 sock_put(sk);
270} 270}
271 271
272/* 272/**
273 * returns 273 * ccid3_hc_tx_send_packet - Delay-based dequeueing of TX packets
274 * > 0: delay (in msecs) that should pass before actually sending 274 * @skb: next packet candidate to send on @sk
275 * = 0: can send immediately 275 * This function uses the convention of ccid_packet_dequeue_eval() and
276 * < 0: error condition; do not send packet 276 * returns a millisecond-delay value between 0 and t_mbi = 64000 msec.
277 */ 277 */
278static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) 278static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
279{ 279{
@@ -349,7 +349,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
349 349
350 /* set the nominal send time for the next following packet */ 350 /* set the nominal send time for the next following packet */
351 hctx->t_nom = ktime_add_us(hctx->t_nom, hctx->t_ipi); 351 hctx->t_nom = ktime_add_us(hctx->t_nom, hctx->t_ipi);
352 return 0; 352 return CCID_PACKET_SEND_AT_ONCE;
353} 353}
354 354
355static void ccid3_hc_tx_packet_sent(struct sock *sk, unsigned int len) 355static void ccid3_hc_tx_packet_sent(struct sock *sk, unsigned int len)