Skip to content
Snippets Groups Projects
Commit 9d422405 authored by Aastha Mehta's avatar Aastha Mehta
Browse files

sync snd_nxt [1]: new fields to replace comparisons between write_seq, snd_nxt

required because write_seq will no longer be used to assign final seq# for pkts
parent b410295e
No related branches found
No related tags found
No related merge requests found
...@@ -248,6 +248,8 @@ struct tcp_sock { ...@@ -248,6 +248,8 @@ struct tcp_sock {
u32 shared_dummy_out; /* number of dummies since last sync on this variable */ u32 shared_dummy_out; /* number of dummies since last sync on this variable */
u32 shared_dummy_lsndtime; /* timestamp of last dummy sent by hypervisor */ u32 shared_dummy_lsndtime; /* timestamp of last dummy sent by hypervisor */
u32 loss_prior_cwnd; /* original value of snd_cwnd before entering loss */ u32 loss_prior_cwnd; /* original value of snd_cwnd before entering loss */
u64 gen_out; /* #bytes generated in tcp_sendmsg */
u64 xmit_out; /* #bytes generated in tcp_sendmsg and xmitted in tcp_write_xmit */
#endif #endif
u16 urg_data; /* Saved octet of OOB data and control flags */ u16 urg_data; /* Saved octet of OOB data and control flags */
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/memcontrol.h> #include <linux/memcontrol.h>
#if defined(CONFIG_PACER_TCP)
#include "../../drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.h"
#endif
extern struct inet_hashinfo tcp_hashinfo; extern struct inet_hashinfo tcp_hashinfo;
extern struct percpu_counter tcp_orphan_count; extern struct percpu_counter tcp_orphan_count;
...@@ -1769,7 +1773,16 @@ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) ...@@ -1769,7 +1773,16 @@ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
static inline bool tcp_stream_memory_free(const struct sock *sk) static inline bool tcp_stream_memory_free(const struct sock *sk)
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
u32 notsent_bytes = 0;
if (ptcp_is_paced_flow((struct sock *) sk) == 0) {
notsent_bytes = (u32) (tp->xmit_out - tp->gen_out);
} else {
notsent_bytes = tp->write_seq - tp->snd_nxt;
}
#else
u32 notsent_bytes = tp->write_seq - tp->snd_nxt; u32 notsent_bytes = tp->write_seq - tp->snd_nxt;
#endif
return notsent_bytes < tcp_notsent_lowat(tp); return notsent_bytes < tcp_notsent_lowat(tp);
} }
......
...@@ -1249,6 +1249,7 @@ new_segment: ...@@ -1249,6 +1249,7 @@ new_segment:
skb->ip_summed = CHECKSUM_PARTIAL; skb->ip_summed = CHECKSUM_PARTIAL;
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
tp->gen_out += PTCP_MTU;
ptcp_ret = ptcp_rxtx_sync_shared_seq(sk, skb, PTCP_MTU); ptcp_ret = ptcp_rxtx_sync_shared_seq(sk, skb, PTCP_MTU);
if (!ptcp_ret) { if (!ptcp_ret) {
ptcp_skb_entail(sk, skb); ptcp_skb_entail(sk, skb);
......
...@@ -497,6 +497,8 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, ...@@ -497,6 +497,8 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
newtp->shared_seq = newtp->write_seq; newtp->shared_seq = newtp->write_seq;
newtp->shared_dummy_out = 0; newtp->shared_dummy_out = 0;
newtp->shared_dummy_lsndtime = newtp->lsndtime; newtp->shared_dummy_lsndtime = newtp->lsndtime;
newtp->gen_out = 0;
newtp->xmit_out = 0;
#endif #endif
newtp->rx_opt.saw_tstamp = 0; newtp->rx_opt.saw_tstamp = 0;
......
...@@ -97,6 +97,7 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb) ...@@ -97,6 +97,7 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb)
tp->packets_out += tcp_skb_pcount(skb); tp->packets_out += tcp_skb_pcount(skb);
#else #else
update_var_atomic(&tp->packets_out, tcp_skb_pcount(skb)); update_var_atomic(&tp->packets_out, tcp_skb_pcount(skb));
tp->xmit_out += PTCP_MTU;
#if 0 #if 0
do { do {
curr_packets_out = tp->packets_out; curr_packets_out = tp->packets_out;
...@@ -2119,9 +2120,18 @@ static int tcp_mtu_probe(struct sock *sk) ...@@ -2119,9 +2120,18 @@ static int tcp_mtu_probe(struct sock *sk)
return -1; return -1;
} }
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
if (ptcp_is_paced_flow(sk) == 0) {
if (tp->gen_out - tp->xmit_out < size_needed)
return -1;
} else {
#endif
/* Have enough data in the send queue to probe? */ /* Have enough data in the send queue to probe? */
if (tp->write_seq - tp->snd_nxt < size_needed) if (tp->write_seq - tp->snd_nxt < size_needed)
return -1; return -1;
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
}
#endif
if (tp->snd_wnd < size_needed) if (tp->snd_wnd < size_needed)
return -1; return -1;
......
...@@ -173,6 +173,16 @@ void tcp_rate_check_app_limited(struct sock *sk) ...@@ -173,6 +173,16 @@ void tcp_rate_check_app_limited(struct sock *sk)
{ {
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
if (ptcp_is_paced_flow(sk) == 0) {
if (tp->gen_out - tp->xmit_out < tp->mss_cache &&
sk_wmem_alloc_get(sk) < SKB_TRUESIZE(1) &&
tcp_packets_in_flight(tp) < tp->snd_cwnd &&
tp->lost_out <= tp->retrans_out)
tp->app_limited =
(tp->delivered + tcp_packets_in_flight(tp)) ? : 1;
} else {
#endif
if (/* We have less than one packet to send. */ if (/* We have less than one packet to send. */
tp->write_seq - tp->snd_nxt < tp->mss_cache && tp->write_seq - tp->snd_nxt < tp->mss_cache &&
/* Nothing in sending host's qdisc queues or NIC tx queue. */ /* Nothing in sending host's qdisc queues or NIC tx queue. */
...@@ -183,4 +193,7 @@ void tcp_rate_check_app_limited(struct sock *sk) ...@@ -183,4 +193,7 @@ void tcp_rate_check_app_limited(struct sock *sk)
tp->lost_out <= tp->retrans_out) tp->lost_out <= tp->retrans_out)
tp->app_limited = tp->app_limited =
(tp->delivered + tcp_packets_in_flight(tp)) ? : 1; (tp->delivered + tcp_packets_in_flight(tp)) ? : 1;
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
}
#endif
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment