dccp: Return-value convention of hc_tx_send_packet()
This patch reorganises the return value convention of the CCID TX sending function, to permit more flexible schemes, as required by subsequent patches. Currently the convention is * values < 0 mean error, * a value == 0 means "send now", and * a value x > 0 means "send in x milliseconds". The patch provides symbolic constants and a function to interpret return values. In addition, it caps the maximum positive return value to 0xFFFF milliseconds, corresponding to 65.535 seconds. This is possible since in CCID-3/4 the maximum possible inter-packet gap is fixed at t_mbi = 64 sec. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
de7fe7874d
commit
fe84f4140f
@@ -268,11 +268,11 @@ out:
|
||||
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
|
||||
/**
|
||||
* ccid3_hc_tx_send_packet - Delay-based dequeueing of TX packets
|
||||
* @skb: next packet candidate to send on @sk
|
||||
* This function uses the convention of ccid_packet_dequeue_eval() and
|
||||
* returns a millisecond-delay value between 0 and t_mbi = 64000 msec.
|
||||
*/
|
||||
static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
@@ -348,7 +348,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
/* set the nominal send time for the next following packet */
|
||||
hc->tx_t_nom = ktime_add_us(hc->tx_t_nom, hc->tx_t_ipi);
|
||||
return 0;
|
||||
return CCID_PACKET_SEND_AT_ONCE;
|
||||
}
|
||||
|
||||
static void ccid3_hc_tx_packet_sent(struct sock *sk, unsigned int len)
|
||||
|
Reference in New Issue
Block a user