From 1167f89061c05b45b35c38901fa52057c51109dc Mon Sep 17 00:00:00 2001 From: Aastha Mehta <aasthakm@mpi-sws.org> Date: Thu, 13 Sep 2018 07:31:35 +0000 Subject: [PATCH] intercept in retransmit_skb to increment profile slots --- .../net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.c | 7 +++++++ .../net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.h | 1 + .../ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.c | 13 +++++++++++++ .../ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.h | 4 +++- net/ipv4/tcp_output.c | 3 +++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.c b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.c index 9b9796829..22e1adb2e 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.c +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.c @@ -48,6 +48,7 @@ struct ptcp_hook_heads ptcp_hook_heads = { .rxtx_sync_shared_seq = LIST_HEAD_INIT(ptcp_hook_heads.rxtx_sync_shared_seq), .tx_adjust_urg = LIST_HEAD_INIT(ptcp_hook_heads.tx_adjust_urg), .tx_incr_tail = LIST_HEAD_INIT(ptcp_hook_heads.tx_incr_tail), + .tx_incr_profile = LIST_HEAD_INIT(ptcp_hook_heads.tx_incr_profile), .is_paced_flow = LIST_HEAD_INIT(ptcp_hook_heads.is_paced_flow), .get_retransmit_skb = LIST_HEAD_INIT(ptcp_hook_heads.get_retransmit_skb), }; @@ -137,6 +138,12 @@ int ptcp_tx_incr_tail(struct sock *sk, struct sk_buff *skb) } EXPORT_SYMBOL(ptcp_tx_incr_tail); +int ptcp_tx_incr_profile(struct sock *sk, struct sk_buff *skb) +{ + return call_ptcp_int_hook(tx_incr_profile, -1, sk, skb); +} +EXPORT_SYMBOL(ptcp_tx_incr_profile); + int ptcp_is_paced_flow(struct sock *sk) { return call_ptcp_int_hook(is_paced_flow, -1, sk); diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.h b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.h index 6b0b153ca..b491b8715 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.h +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks.h @@ -33,6 +33,7 @@ int ptcp_tx_adjust_seq(struct sock *sk, struct sk_buff *skb, int copy, int copie int ptcp_rxtx_sync_shared_seq(struct sock *sk, struct sk_buff *skb, int write); int ptcp_tx_adjust_urg(struct sock *sk, struct sk_buff *skb); int ptcp_tx_incr_tail(struct sock *sk, struct sk_buff *skb); +int ptcp_tx_incr_profile(struct sock *sk, struct sk_buff *skb); int ptcp_is_paced_flow(struct sock *sk); int ptcp_get_retransmit_skb(struct sock *sk, struct sk_buff **skb_p); diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.c b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.c index a9002a077..c32ef0eed 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.c +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.c @@ -178,6 +178,18 @@ ptcp_impl_tx_incr_tail(struct sock *sk, struct sk_buff *skb) return -1; } +int (*lnk_tx_incr_profile) (struct sock *sk, struct sk_buff *skb) = 0; +EXPORT_SYMBOL(lnk_tx_incr_profile); +static int +ptcp_impl_tx_incr_profile(struct sock *sk, struct sk_buff *skb) +{ + if (lnk_tx_incr_profile) { + return lnk_tx_incr_profile(sk, skb); + } + + return -1; +} + int (*lnk_is_paced_flow) (struct sock *sk) = 0; EXPORT_SYMBOL(lnk_is_paced_flow); static int @@ -216,6 +228,7 @@ struct ptcp_hook_list ptcp_hooks[NUM_PTCP_HOOKS] = { PTCP_HOOK_INIT(rxtx_sync_shared_seq, ptcp_impl_rxtx_sync_shared_seq), PTCP_HOOK_INIT(tx_adjust_urg, ptcp_impl_tx_adjust_urg), PTCP_HOOK_INIT(tx_incr_tail, ptcp_impl_tx_incr_tail), + PTCP_HOOK_INIT(tx_incr_profile, ptcp_impl_tx_incr_profile), PTCP_HOOK_INIT(is_paced_flow, ptcp_impl_is_paced_flow), PTCP_HOOK_INIT(get_retransmit_skb, ptcp_impl_get_retransmit_skb), }; diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.h b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.h index c9b50b9eb..6e8a14272 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.h +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/ptcp_hooks_impl.h @@ -41,6 +41,7 @@ union ptcp_list_options { int (*rxtx_sync_shared_seq) (struct sock *sk, struct sk_buff *skb, int write); int (*tx_adjust_urg) (struct sock *sk, struct sk_buff *skb); int (*tx_incr_tail) (struct sock *sk, struct sk_buff *skb); + int (*tx_incr_profile) (struct sock *sk, struct sk_buff *skb); int (*is_paced_flow) (struct sock *sk); int (*get_retransmit_skb) (struct sock *sk, struct sk_buff **skb_p); }; @@ -59,6 +60,7 @@ struct ptcp_hook_heads { struct list_head rxtx_sync_shared_seq; struct list_head tx_adjust_urg; struct list_head tx_incr_tail; + struct list_head tx_incr_profile; struct list_head is_paced_flow; struct list_head get_retransmit_skb; }; @@ -73,7 +75,7 @@ struct ptcp_hook_list { { .head = &ptcp_hook_heads.HEAD, .hook = { . HEAD = HOOK } } // increment this every time a new hook is added -#define NUM_PTCP_HOOKS 15 +#define NUM_PTCP_HOOKS 16 extern struct ptcp_hook_heads ptcp_hook_heads; extern struct ptcp_hook_list ptcp_hooks[NUM_PTCP_HOOKS]; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 633e8f68c..54629cb62 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2981,6 +2981,9 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN) __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); tp->total_retrans += segs; +#if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) + ptcp_tx_incr_profile(sk, skb); +#endif } return err; } -- GitLab