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