mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[TCP]: Move sack_ok access to obviously named funcs & cleanup
Previously code had IsReno/IsFack defined as macros that were local to tcp_input.c though sack_ok field has user elsewhere too for the same purpose. This changes them to static inlines as preferred according the current coding style and unifies the access to sack_ok across multiple files. Magic bitops of sack_ok for FACK and DSACK are also abstracted to functions with appropriate names. Note: - One sack_ok = 1 remains but that's self explanary, i.e., it enables sack - Couple of !IsReno cases are changed to tcp_is_sack - There were no users for IsDSack => I dropped it Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b9c4595bc4
commit
e60402d0a9
6 changed files with 80 additions and 42 deletions
|
@ -719,6 +719,34 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
|
|||
icsk->icsk_ca_ops->cwnd_event(sk, event);
|
||||
}
|
||||
|
||||
/* These functions determine how the current flow behaves in respect of SACK
|
||||
* handling. SACK is negotiated with the peer, and therefore it can vary
|
||||
* between different flows.
|
||||
*
|
||||
* tcp_is_sack - SACK enabled
|
||||
* tcp_is_reno - No SACK
|
||||
* tcp_is_fack - FACK enabled, implies SACK enabled
|
||||
*/
|
||||
static inline int tcp_is_sack(const struct tcp_sock *tp)
|
||||
{
|
||||
return tp->rx_opt.sack_ok;
|
||||
}
|
||||
|
||||
static inline int tcp_is_reno(const struct tcp_sock *tp)
|
||||
{
|
||||
return !tcp_is_sack(tp);
|
||||
}
|
||||
|
||||
static inline int tcp_is_fack(const struct tcp_sock *tp)
|
||||
{
|
||||
return tp->rx_opt.sack_ok & 2;
|
||||
}
|
||||
|
||||
static inline void tcp_enable_fack(struct tcp_sock *tp)
|
||||
{
|
||||
tp->rx_opt.sack_ok |= 2;
|
||||
}
|
||||
|
||||
static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
|
||||
{
|
||||
return tp->sacked_out + tp->lost_out;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue