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

bugfix: interception to free skbs based on incoming acks

ignore interception for DBG_LOG config of pacer module
parent 7f8fbfdd
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
struct ptcp_hook_heads ptcp_hook_heads = { struct ptcp_hook_heads ptcp_hook_heads = {
.print_sock_skb = LIST_HEAD_INIT(ptcp_hook_heads.print_sock_skb), .print_sock_skb = LIST_HEAD_INIT(ptcp_hook_heads.print_sock_skb),
.rx_do_clean = LIST_HEAD_INIT(ptcp_hook_heads.rx_do_clean),
.rx_handle_tcp_urg = LIST_HEAD_INIT(ptcp_hook_heads.rx_handle_tcp_urg), .rx_handle_tcp_urg = LIST_HEAD_INIT(ptcp_hook_heads.rx_handle_tcp_urg),
.rx_handle_dummy = LIST_HEAD_INIT(ptcp_hook_heads.rx_handle_dummy), .rx_handle_dummy = LIST_HEAD_INIT(ptcp_hook_heads.rx_handle_dummy),
.rx_disable_coalesce = LIST_HEAD_INIT(ptcp_hook_heads.rx_disable_coalesce), .rx_disable_coalesce = LIST_HEAD_INIT(ptcp_hook_heads.rx_disable_coalesce),
...@@ -53,6 +54,14 @@ void ptcp_print_sock_skb(struct sock *sk, struct sk_buff *skb, char *dbg_str) ...@@ -53,6 +54,14 @@ void ptcp_print_sock_skb(struct sock *sk, struct sk_buff *skb, char *dbg_str)
} }
EXPORT_SYMBOL(ptcp_print_sock_skb); EXPORT_SYMBOL(ptcp_print_sock_skb);
int ptcp_rx_do_clean(struct sock *sk, int prior_fackets, u32 prior_snd_una,
int *acked, void *sack_state, struct skb_mstamp *now)
{
return call_ptcp_int_hook(rx_do_clean, -1, sk, prior_fackets,
prior_snd_una, acked, sack_state, now);
}
EXPORT_SYMBOL(ptcp_rx_do_clean);
int ptcp_rx_handle_tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th) int ptcp_rx_handle_tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th)
{ {
return call_ptcp_int_hook(rx_handle_tcp_urg, -1, sk, skb, th); return call_ptcp_int_hook(rx_handle_tcp_urg, -1, sk, skb, th);
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <linux/tcp.h> #include <linux/tcp.h>
void ptcp_print_sock_skb(struct sock *sk, struct sk_buff *skb, char *dbg_str); void ptcp_print_sock_skb(struct sock *sk, struct sk_buff *skb, char *dbg_str);
int ptcp_rx_do_clean(struct sock *sk, int prior_fackets, u32 prior_snd_una,
int *acked, void *sack_state, struct skb_mstamp *now);
int ptcp_rx_handle_tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th); int ptcp_rx_handle_tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th);
int ptcp_rx_handle_dummy(struct sock *sk, struct sk_buff *skb); int ptcp_rx_handle_dummy(struct sock *sk, struct sk_buff *skb);
int ptcp_rx_disable_coalesce(struct sock *sk, struct sk_buff *to, int ptcp_rx_disable_coalesce(struct sock *sk, struct sk_buff *to,
......
...@@ -23,6 +23,20 @@ ptcp_impl_print_sock_skb(struct sock *sk, struct sk_buff *skb, char *dbg_str) ...@@ -23,6 +23,20 @@ ptcp_impl_print_sock_skb(struct sock *sk, struct sk_buff *skb, char *dbg_str)
} }
} }
int (*lnk_rx_do_clean) (struct sock *sk, int prior_fackets, u32 prior_snd_una,
int *acked, void *sack_state, struct skb_mstamp *now) = 0;
EXPORT_SYMBOL(lnk_rx_do_clean);
int ptcp_impl_rx_do_clean(struct sock *sk, int prior_fackets,
u32 prior_snd_una, int *acked, void *sack_state, struct skb_mstamp *now)
{
if (lnk_rx_do_clean) {
return lnk_rx_do_clean(sk, prior_fackets, prior_snd_una, acked,
sack_state, now);
}
return -1;
}
int (*lnk_rx_handle_tcp_urg) (struct sock *sk, struct sk_buff *skb, int (*lnk_rx_handle_tcp_urg) (struct sock *sk, struct sk_buff *skb,
struct tcphdr *th) = 0; struct tcphdr *th) = 0;
EXPORT_SYMBOL(lnk_rx_handle_tcp_urg); EXPORT_SYMBOL(lnk_rx_handle_tcp_urg);
...@@ -142,6 +156,7 @@ ptcp_impl_tx_adjust_urg(struct sock *sk, struct sk_buff *skb) ...@@ -142,6 +156,7 @@ ptcp_impl_tx_adjust_urg(struct sock *sk, struct sk_buff *skb)
struct ptcp_hook_list ptcp_hooks[NUM_PTCP_HOOKS] = { struct ptcp_hook_list ptcp_hooks[NUM_PTCP_HOOKS] = {
PTCP_HOOK_INIT(print_sock_skb, ptcp_impl_print_sock_skb), PTCP_HOOK_INIT(print_sock_skb, ptcp_impl_print_sock_skb),
PTCP_HOOK_INIT(rx_do_clean, ptcp_impl_rx_do_clean),
PTCP_HOOK_INIT(rx_handle_tcp_urg, ptcp_impl_rx_handle_tcp_urg), PTCP_HOOK_INIT(rx_handle_tcp_urg, ptcp_impl_rx_handle_tcp_urg),
PTCP_HOOK_INIT(rx_handle_dummy, ptcp_impl_rx_handle_dummy), PTCP_HOOK_INIT(rx_handle_dummy, ptcp_impl_rx_handle_dummy),
PTCP_HOOK_INIT(rx_disable_coalesce, ptcp_impl_rx_disable_coalesce), PTCP_HOOK_INIT(rx_disable_coalesce, ptcp_impl_rx_disable_coalesce),
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
union ptcp_list_options { union ptcp_list_options {
void (*print_sock_skb) (struct sock *sk, struct sk_buff *skb, char *dbg_str); void (*print_sock_skb) (struct sock *sk, struct sk_buff *skb, char *dbg_str);
int (*rx_do_clean) (struct sock *sk, int prior_fackets, u32 prior_snd_una,
int *acked, void *sack_state, struct skb_mstamp *now);
int (*rx_handle_tcp_urg) (struct sock *sk, struct sk_buff *skb, struct tcphdr *th); int (*rx_handle_tcp_urg) (struct sock *sk, struct sk_buff *skb, struct tcphdr *th);
int (*rx_handle_dummy) (struct sock *sk, struct sk_buff *skb); int (*rx_handle_dummy) (struct sock *sk, struct sk_buff *skb);
int (*rx_disable_coalesce) (struct sock *sk, struct sk_buff *to, int (*rx_disable_coalesce) (struct sock *sk, struct sk_buff *to,
...@@ -41,6 +43,7 @@ union ptcp_list_options { ...@@ -41,6 +43,7 @@ union ptcp_list_options {
struct ptcp_hook_heads { struct ptcp_hook_heads {
struct list_head print_sock_skb; struct list_head print_sock_skb;
struct list_head rx_do_clean;
struct list_head rx_handle_tcp_urg; struct list_head rx_handle_tcp_urg;
struct list_head rx_handle_dummy; struct list_head rx_handle_dummy;
struct list_head rx_disable_coalesce; struct list_head rx_disable_coalesce;
...@@ -62,7 +65,7 @@ struct ptcp_hook_list { ...@@ -62,7 +65,7 @@ struct ptcp_hook_list {
{ .head = &ptcp_hook_heads.HEAD, .hook = { . HEAD = HOOK } } { .head = &ptcp_hook_heads.HEAD, .hook = { . HEAD = HOOK } }
// increment this every time a new hook is added // increment this every time a new hook is added
#define NUM_PTCP_HOOKS 10 #define NUM_PTCP_HOOKS 11
extern struct ptcp_hook_heads ptcp_hook_heads; extern struct ptcp_hook_heads ptcp_hook_heads;
extern struct ptcp_hook_list ptcp_hooks[NUM_PTCP_HOOKS]; extern struct ptcp_hook_list ptcp_hooks[NUM_PTCP_HOOKS];
......
...@@ -3468,6 +3468,17 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, ...@@ -3468,6 +3468,17 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
bool rtt_update; bool rtt_update;
int flag = 0; int flag = 0;
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
char dbg[256];
int rskb = 0;
int ptcp_ret = ptcp_rx_do_clean(sk, prior_fackets, prior_snd_una, acked,
(void *) sack, now);
if (ptcp_ret == 0) {
return ptcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una, acked,
sack, now);
}
#endif
first_ackt.v64 = 0; first_ackt.v64 = 0;
while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) { while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) {
...@@ -4042,18 +4053,18 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) ...@@ -4042,18 +4053,18 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
if (!prior_packets) if (!prior_packets)
goto no_queue; goto no_queue;
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) //#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
if (lnk_rxtx_sync_shared_seq) { // if (lnk_rxtx_sync_shared_seq) {
flag |= ptcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una, &acked, // flag |= ptcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una, &acked,
&sack_state, &now); // &sack_state, &now);
} else { // } else {
#endif //#endif
/* See if we can take anything off of the retransmit queue. */ /* See if we can take anything off of the retransmit queue. */
flag |= tcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una, &acked, flag |= tcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una, &acked,
&sack_state, &now); &sack_state, &now);
#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) //#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP)
} // }
#endif /* CONFIG_XEN_SME && CONFIG_PACER_TCP */ //#endif /* CONFIG_XEN_SME && CONFIG_PACER_TCP */
if (tcp_ack_is_dubious(sk, flag)) { if (tcp_ack_is_dubious(sk, flag)) {
is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP)); is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP));
......
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