[TCP] TCP YEAH: Use vegas dont copy it.
Rather than using a copy of vegas code, the YEAH code should just have it exported so there is common code. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
164891aadf
commit
7752237e9f
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <net/tcp.h>
|
||||
|
||||
#include "tcp_vegas.h"
|
||||
|
||||
/* Default values of the Vegas variables, in fixed-point representation
|
||||
* with V_PARAM_SHIFT bits to the right of the binary point.
|
||||
*/
|
||||
@@ -54,17 +56,6 @@ module_param(gamma, int, 0644);
|
||||
MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)");
|
||||
|
||||
|
||||
/* Vegas variables */
|
||||
struct vegas {
|
||||
u32 beg_snd_nxt; /* right edge during last RTT */
|
||||
u32 beg_snd_una; /* left edge during last RTT */
|
||||
u32 beg_snd_cwnd; /* saves the size of the cwnd */
|
||||
u8 doing_vegas_now;/* if true, do vegas for this RTT */
|
||||
u16 cntRTT; /* # of RTTs measured within last RTT */
|
||||
u32 minRTT; /* min of RTTs measured within last RTT (in usec) */
|
||||
u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */
|
||||
};
|
||||
|
||||
/* There are several situations when we must "re-start" Vegas:
|
||||
*
|
||||
* o when a connection is established
|
||||
@@ -81,7 +72,7 @@ struct vegas {
|
||||
* Instead we must wait until the completion of an RTT during
|
||||
* which we actually receive ACKs.
|
||||
*/
|
||||
static inline void vegas_enable(struct sock *sk)
|
||||
static void vegas_enable(struct sock *sk)
|
||||
{
|
||||
const struct tcp_sock *tp = tcp_sk(sk);
|
||||
struct vegas *vegas = inet_csk_ca(sk);
|
||||
@@ -104,13 +95,14 @@ static inline void vegas_disable(struct sock *sk)
|
||||
vegas->doing_vegas_now = 0;
|
||||
}
|
||||
|
||||
static void tcp_vegas_init(struct sock *sk)
|
||||
void tcp_vegas_init(struct sock *sk)
|
||||
{
|
||||
struct vegas *vegas = inet_csk_ca(sk);
|
||||
|
||||
vegas->baseRTT = 0x7fffffff;
|
||||
vegas_enable(sk);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_vegas_init);
|
||||
|
||||
/* Do RTT sampling needed for Vegas.
|
||||
* Basically we:
|
||||
@@ -120,7 +112,7 @@ static void tcp_vegas_init(struct sock *sk)
|
||||
* o min-filter RTT samples from a much longer window (forever for now)
|
||||
* to find the propagation delay (baseRTT)
|
||||
*/
|
||||
static void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
|
||||
void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
|
||||
{
|
||||
struct vegas *vegas = inet_csk_ca(sk);
|
||||
u32 vrtt;
|
||||
@@ -138,8 +130,9 @@ static void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
|
||||
vegas->minRTT = min(vegas->minRTT, vrtt);
|
||||
vegas->cntRTT++;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_vegas_pkts_acked);
|
||||
|
||||
static void tcp_vegas_state(struct sock *sk, u8 ca_state)
|
||||
void tcp_vegas_state(struct sock *sk, u8 ca_state)
|
||||
{
|
||||
|
||||
if (ca_state == TCP_CA_Open)
|
||||
@@ -147,6 +140,7 @@ static void tcp_vegas_state(struct sock *sk, u8 ca_state)
|
||||
else
|
||||
vegas_disable(sk);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_vegas_state);
|
||||
|
||||
/*
|
||||
* If the connection is idle and we are restarting,
|
||||
@@ -157,12 +151,13 @@ static void tcp_vegas_state(struct sock *sk, u8 ca_state)
|
||||
* packets, _then_ we can make Vegas calculations
|
||||
* again.
|
||||
*/
|
||||
static void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
|
||||
void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
|
||||
{
|
||||
if (event == CA_EVENT_CWND_RESTART ||
|
||||
event == CA_EVENT_TX_START)
|
||||
tcp_vegas_init(sk);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);
|
||||
|
||||
static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack,
|
||||
u32 seq_rtt, u32 in_flight, int flag)
|
||||
@@ -339,8 +334,7 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack,
|
||||
}
|
||||
|
||||
/* Extract info for Tcp socket info provided via netlink. */
|
||||
static void tcp_vegas_get_info(struct sock *sk, u32 ext,
|
||||
struct sk_buff *skb)
|
||||
void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
|
||||
{
|
||||
const struct vegas *ca = inet_csk_ca(sk);
|
||||
if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
|
||||
@@ -354,6 +348,7 @@ static void tcp_vegas_get_info(struct sock *sk, u32 ext,
|
||||
nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcp_vegas_get_info);
|
||||
|
||||
static struct tcp_congestion_ops tcp_vegas = {
|
||||
.flags = TCP_CONG_RTT_STAMP,
|
||||
|
Reference in New Issue
Block a user