From dbd09191ae3512c6fb88735114593f76467381c0 Mon Sep 17 00:00:00 2001 From: Aastha Mehta <aasthakm@mpi-sws.org> Date: Thu, 27 Sep 2018 06:51:18 +0000 Subject: [PATCH] edit update_cwnd API, and pass caller type info --- .../net/ethernet/broadcom/bnx2x/sme/xen_sme.c | 18 ++++----- .../net/ethernet/broadcom/bnx2x/sme/xen_sme.h | 7 ++-- .../broadcom/bnx2x/sme/xen_sme_hooks.c | 12 +++--- .../broadcom/bnx2x/sme/xen_sme_hooks.h | 16 ++++++-- net/ipv4/tcp_input.c | 40 +++++++++---------- net/ipv4/tcp_output.c | 20 +++++----- 6 files changed, 59 insertions(+), 54 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.c b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.c index f98fd0401..29b6a74cc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.c +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.c @@ -17,20 +17,18 @@ void -(*lnk_update_cwnd) (struct sk_buff *skb, struct sock *sk, - int before_cwnd, int before_tp_in_flight, - int after_cwnd, int after_tp_in_flight, - int delivered, int dummy_delivered, char *extra_dbg_string) = 0; +(*lnk_update_cwnd) (struct sk_buff *skb, struct sock *sk, int caller, + int before_cwnd, int before_inflight, int after_cwnd, int after_inflight, + int delivered, int num_marked_lost, char *extra_dbg_string) = 0; EXPORT_SYMBOL(lnk_update_cwnd); static void -sme_update_cwnd(struct sk_buff *skb, struct sock *sk, - int before_cwnd, int before_tp_in_flight, - int after_cwnd, int after_tp_in_flight, - int delivered, int dummy_delivered, char *extra_dbg_string) +sme_update_cwnd(struct sk_buff *skb, struct sock *sk, int caller, + int before_cwnd, int before_inflight, int after_cwnd, int after_inflight, + int delivered, int num_marked_lost, char *extra_dbg_string) { if (lnk_update_cwnd) { - lnk_update_cwnd(skb, sk, before_cwnd, before_tp_in_flight, after_cwnd, - after_tp_in_flight, delivered, dummy_delivered, extra_dbg_string); + lnk_update_cwnd(skb, sk, caller, before_cwnd, before_inflight, after_cwnd, + after_inflight, delivered, num_marked_lost, extra_dbg_string); } } diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.h b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.h index 63beb1fb8..6dcdd4257 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.h +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme.h @@ -26,10 +26,9 @@ */ union sme_list_options { - void (*update_cwnd) (struct sk_buff *skb, struct sock *sk, - int before_cwnd, int before_tp_in_flight, - int after_cwnd, int after_tp_in_flight, - int delivered, int dummy_delivered, char *extra_dbg_string); + void (*update_cwnd) (struct sk_buff *skb, struct sock *sk, int caller, + int before_cwnd, int before_inflight, int after_cwnd, int after_inflight, + int delivered, int num_marked_lost, char *extra_dbg_string); int (*small_queue_check) (struct sk_buff *skb, struct sock *sk, unsigned int factor, char *extra_dbg_string); int (*intercept_select_queue) (struct net_device *dev, struct sk_buff *skb, diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.c b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.c index d29e3afa1..04df6bae9 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.c +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.c @@ -56,13 +56,13 @@ struct sme_hook_heads xen_sme_hook_heads = { // .print_xenvif_queue = LIST_HEAD_INIT(xen_sme_hook_heads.print_xenvif_queue), }; -void xsl_update_cwnd(struct sk_buff *skb, struct sock *sk, - int before_cwnd, int before_tp_in_flight, - int after_cwnd, int after_tp_in_flight, - int delivered, int dummy_delivered, char *extra_dbg_string) +void xsl_update_cwnd(struct sk_buff *skb, struct sock *sk, int caller, + int before_cwnd, int before_inflight, int after_cwnd, int after_inflight, + int delivered, int num_marked_lost, char *extra_dbg_string) { - return call_sme_void_hook(update_cwnd, skb, sk, before_cwnd, before_tp_in_flight, - after_cwnd, after_tp_in_flight, delivered, dummy_delivered, extra_dbg_string); + return call_sme_void_hook(update_cwnd, skb, sk, caller, + before_cwnd, before_inflight, after_cwnd, after_inflight, + delivered, num_marked_lost, extra_dbg_string); } EXPORT_SYMBOL(xsl_update_cwnd); diff --git a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.h b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.h index 18b313bba..44001db67 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.h +++ b/drivers/net/ethernet/broadcom/bnx2x/sme/xen_sme_hooks.h @@ -18,10 +18,18 @@ #include "../bnx2x.h" #include "sme_debug.h" -void xsl_update_cwnd(struct sk_buff *skb, struct sock *sk, - int before_cwnd, int before_tp_in_flight, - int after_cwnd, int after_tp_in_flight, - int delivered, int dummy_delivered, char *extra_dbg_string); +enum { + C_TCP_ACK = 0, + C_TCP_ENTER_LOSS, + C_TCP_UNDO_CWND_REDUCTION, + C_TCP_END_CWND_REDUCTION, + C_TCP_CWND_RESTART, + C_TCP_CWND_APP_LIMITED, +}; + +void xsl_update_cwnd(struct sk_buff *skb, struct sock *sk, int caller, + int before_cwnd, int before_inflight, int after_cwnd, int after_inflight, + int delivered, int num_marked_lost, char *extra_dbg_string); int xsl_small_queue_check(struct sk_buff *skb, struct sock *sk, unsigned int factor, char *extra_dbg_string); int xsl_intercept_select_queue(struct net_device *dev, struct sk_buff *skb, diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2d4c84438..d3dff691c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1981,7 +1981,7 @@ void tcp_enter_loss(struct sock *sk) bool mark_lost; #ifdef CONFIG_XEN_SME - int before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight; + int before_cwnd, before_inflight, after_cwnd, after_inflight; int num_mark_lost = 0; uint32_t prev_seq; int num_dummies = 0; @@ -1990,7 +1990,7 @@ void tcp_enter_loss(struct sock *sk) #ifdef CONFIG_XEN_SME before_cwnd = tp->snd_cwnd; - before_tp_in_flight = tcp_packets_in_flight(tp); + before_inflight = tcp_packets_in_flight(tp); #endif /* Reduce ssthresh if it has not yet been made inside this window. */ @@ -2083,9 +2083,9 @@ void tcp_enter_loss(struct sock *sk) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) after_cwnd = tp->snd_cwnd; - after_tp_in_flight = tcp_packets_in_flight(tp); - xsl_update_cwnd((struct sk_buff*)skb, (struct sock*)sk, - before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight, + after_inflight = tcp_packets_in_flight(tp); + xsl_update_cwnd((struct sk_buff*) skb, (struct sock*) sk, C_TCP_ENTER_LOSS, + before_cwnd, before_inflight, after_cwnd, after_inflight, -1, num_mark_lost, NULL); #endif @@ -2485,12 +2485,12 @@ static void tcp_undo_cwnd_reduction(struct sock *sk, bool unmark_loss) struct tcp_sock *tp = tcp_sk(sk); #ifdef CONFIG_XEN_SME - int before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight; + int before_cwnd, before_inflight, after_cwnd, after_inflight; #endif #ifdef CONFIG_XEN_SME before_cwnd = tp->snd_cwnd; - before_tp_in_flight = tcp_packets_in_flight(tp); + before_inflight = tcp_packets_in_flight(tp); #endif if (unmark_loss) { @@ -2523,9 +2523,9 @@ static void tcp_undo_cwnd_reduction(struct sock *sk, bool unmark_loss) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) after_cwnd = tp->snd_cwnd; - after_tp_in_flight = tcp_packets_in_flight(tp); - xsl_update_cwnd(NULL, (struct sock*)sk, - before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight, + after_inflight = tcp_packets_in_flight(tp); + xsl_update_cwnd(NULL, (struct sock*) sk, C_TCP_UNDO_CWND_REDUCTION, + before_cwnd, before_inflight, after_cwnd, after_inflight, -1, -1, NULL); #endif @@ -2659,7 +2659,7 @@ static inline void tcp_end_cwnd_reduction(struct sock *sk) struct tcp_sock *tp = tcp_sk(sk); #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) - int before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight; + int before_cwnd, before_inflight, after_cwnd, after_inflight; #endif if (inet_csk(sk)->icsk_ca_ops->cong_control) @@ -2667,7 +2667,7 @@ static inline void tcp_end_cwnd_reduction(struct sock *sk) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) before_cwnd = tp->snd_cwnd; - before_tp_in_flight = tcp_packets_in_flight(tp); + before_inflight = tcp_packets_in_flight(tp); #endif /* Reset cwnd to ssthresh in CWR or Recovery (unless it's undone) */ @@ -2680,9 +2680,9 @@ static inline void tcp_end_cwnd_reduction(struct sock *sk) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) after_cwnd = tp->snd_cwnd; - after_tp_in_flight = tcp_packets_in_flight(tp); - xsl_update_cwnd(NULL, (struct sock*)sk, - before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight, + after_inflight = tcp_packets_in_flight(tp); + xsl_update_cwnd(NULL, (struct sock*) sk, C_TCP_END_CWND_REDUCTION, + before_cwnd, before_inflight, after_cwnd, after_inflight, -1, -1, NULL); #endif @@ -4022,7 +4022,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) struct skb_mstamp now; #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) - int before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight; + int before_cwnd, before_inflight, after_cwnd, after_inflight; #if 0 char dbg[256]; memset(dbg, 0, 256); @@ -4152,16 +4152,16 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) tcp_rate_gen(sk, delivered, lost, &now, &rs); #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) before_cwnd = tp->snd_cwnd; - before_tp_in_flight = tcp_packets_in_flight(tp); + before_inflight = tcp_packets_in_flight(tp); #endif tcp_cong_control(sk, ack, delivered, flag, &rs); #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) after_cwnd = tp->snd_cwnd; - after_tp_in_flight = tcp_packets_in_flight(tp); - xsl_update_cwnd((struct sk_buff *) skb, (struct sock *) sk, - before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight, + after_inflight = tcp_packets_in_flight(tp); + xsl_update_cwnd((struct sk_buff *) skb, (struct sock *) sk, C_TCP_ACK, + before_cwnd, before_inflight, after_cwnd, after_inflight, delivered, -1, NULL); #endif diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 930906220..c33152ec0 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -164,10 +164,10 @@ void tcp_cwnd_restart(struct sock *sk, s32 delta) u32 cwnd = tp->snd_cwnd; #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) - int before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight; + int before_cwnd, before_inflight, after_cwnd, after_inflight; before_cwnd = tp->snd_cwnd; - before_tp_in_flight = tcp_packets_in_flight(tp); + before_inflight = tcp_packets_in_flight(tp); #endif tcp_ca_event(sk, CA_EVENT_CWND_RESTART); @@ -183,9 +183,9 @@ void tcp_cwnd_restart(struct sock *sk, s32 delta) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) after_cwnd = tp->snd_cwnd; - after_tp_in_flight = tcp_packets_in_flight(tp); - xsl_update_cwnd(NULL, (struct sock*)sk, - before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight, + after_inflight = tcp_packets_in_flight(tp); + xsl_update_cwnd(NULL, (struct sock*) sk, C_TCP_CWND_RESTART, + before_cwnd, before_inflight, after_cwnd, after_inflight, -1, -1, NULL); #endif @@ -1571,10 +1571,10 @@ static void tcp_cwnd_application_limited(struct sock *sk) struct tcp_sock *tp = tcp_sk(sk); #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) - int before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight; + int before_cwnd, before_inflight, after_cwnd, after_inflight; before_cwnd = tp->snd_cwnd; - before_tp_in_flight = tcp_packets_in_flight(tp); + before_inflight = tcp_packets_in_flight(tp); #endif if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && @@ -1592,9 +1592,9 @@ static void tcp_cwnd_application_limited(struct sock *sk) #if defined(CONFIG_XEN_SME) && defined(CONFIG_PACER_TCP) after_cwnd = tp->snd_cwnd; - after_tp_in_flight = tcp_packets_in_flight(tp); - xsl_update_cwnd(NULL, (struct sock*)sk, - before_cwnd, before_tp_in_flight, after_cwnd, after_tp_in_flight, + after_inflight = tcp_packets_in_flight(tp); + xsl_update_cwnd(NULL, (struct sock*) sk, C_TCP_CWND_APP_LIMITED, + before_cwnd, before_inflight, after_cwnd, after_inflight, -1, -1, NULL); #endif -- GitLab