Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp287600imu; Thu, 8 Nov 2018 01:47:27 -0800 (PST) X-Google-Smtp-Source: AJdET5e8EGoq0siE2RsghUmEfR2LXxfs1Svv7KDeKnA2ARyw1PTibHChnv3eRQPdd9JpArWPWG9Q X-Received: by 2002:a65:6295:: with SMTP id f21-v6mr3241939pgv.167.1541670447805; Thu, 08 Nov 2018 01:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541670447; cv=none; d=google.com; s=arc-20160816; b=XUI1VBbUcA9PkNAWMO1ecCQB35eq/p4P724ACBxsIQWmWZvwe5Dse/BWqr1Qv2lXfq XUS1H/iiEyXmZKUZU7WdZ6zzJe4k6HjH2TSLRTvoPAbasPJUXs32ErPQnb9dL2VEtxhe v5Be6ihcCx2Orx5Gyct1fSZdHAdeFwNpUAVOhy+i+qvVfx/MvAikItB/YcTZwv0dibYT mwnEpIx0WySjptAHBdu+MjZ1B/ZdfSWDy0u+OnjpAz+8Yb6SLS9GJ5ZDZxYF+z6lz3yf Z5y0hjc7tYZC53rWvrHmuB4zUh60BOwI9i2DaV4MEcogSPYZc5fsZiKcZ2ASdFwmUoxV +YnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=40O0OiiBPjRULGBSxYQTY6aVsFDkHO40gtJ3fu6SCu0=; b=diGQu9JONsZfxwcIYgLvukfFY2GD/Vl3UXGCwofebwM+lxIVWEVkY53WWhILOuqq9d OEUocm98t+vszjTDombHLCE3bloD2btLNsjAehaLNGQgisUjE3zMFl8DYPVvt6J2eN3F lqoIGEVE2ydN9ZS7tcxzgK0B3MCvvrlHcFp+5kBsm8CiM+95ty70NMMGzQff8WpBp8Vu qKy8mOoj7QUTBTbdjySgE0e0ILjixa0DVN2pipa0gkIt7/c1h35zd+OlV4hTYJE7+Yfv GuVqSqnbmh8Ni9ejs5zL7utyQnaxDEa5LYl3G3whuBW+3vGWGRFiZ476r6pVyr8dka+v A1tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M9TcNcKL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12-v6si3696320pfn.111.2018.11.08.01.47.13; Thu, 08 Nov 2018 01:47:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M9TcNcKL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbeKHTVO (ORCPT + 99 others); Thu, 8 Nov 2018 14:21:14 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36111 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726595AbeKHTVO (ORCPT ); Thu, 8 Nov 2018 14:21:14 -0500 Received: by mail-pl1-f193.google.com with SMTP id w24-v6so9302259plq.3; Thu, 08 Nov 2018 01:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=40O0OiiBPjRULGBSxYQTY6aVsFDkHO40gtJ3fu6SCu0=; b=M9TcNcKLkAQrFw1OMuIcAox3i1qd5Dw/64Om57Qo7kq2+RMFnWhUeyMoo9/0Mr8wDo tdHPoToYQfXqhTGJR242eltRDWrsHncLKI8StBcJ/EMJuE5fRfPjWe82mJr3MfqGadGo zIrp+84G78FOitV8XuLQ71xpBMIEjgufQeh9ioxuvhhizaEGsaszaOmZQyrWeq7xi5xy Ex6bIgZP/35EMpmYkOP6gkftWKqXQYiulONZq8eVoPVKrFVTaJKYYEiYIO6APys3ea6B GQ/HltSXJbgqJIvxwM7su0CX1yHLfBJvIIxFwwOfTZUKMAGFGTYcXk1iAA0g1uK8tWCl P7xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=40O0OiiBPjRULGBSxYQTY6aVsFDkHO40gtJ3fu6SCu0=; b=gjKFHe7UEg/oDMMmBdQ0rTFO3fhNYd8x+x5lmJmcVg6KPcq0anz24nVGwGDuAFP/j7 mkqQ70BYlV6R7pX+djqt4Uk4e2cKOHoUeeo7IkvVTVxoziN2AddbAClTeS9uyldc0ZB/ ddW8Z6iXZOmC0cysirQH+QTk4Q13lb1iMrqJFpPhGSQ/C9EgqglG0S5e1IWPPoEoJ8gR 6mIirYnmVLkEXx194a1wbfpDKZw8206hJ3VRAX0B/zgIGkZ5xpQiUoajrY2NfGK50YsT a+4SAIpAQ8RNyK8QwkE+8RcyszSKUMkM+Umls+giZnx1VvygRx4AdaaJJsKqWyxEKQeO DOdA== X-Gm-Message-State: AGRZ1gLnwr98jStT4CNeezknGir6xDz6qy49Ozr48RxSHU5alVnCrfYw 0XKF2JgH9vB55SetfbOj4Fo= X-Received: by 2002:a17:902:4624:: with SMTP id o33-v6mr3895422pld.285.1541670392680; Thu, 08 Nov 2018 01:46:32 -0800 (PST) Received: from localhost.localdomain ([2405:204:54a3:4742:28e4:be46:8b17:69ab]) by smtp.gmail.com with ESMTPSA id d126-v6sm4881728pgc.32.2018.11.08.01.46.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Nov 2018 01:46:31 -0800 (PST) From: Suraj Singh To: davem@davemloft.net Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, suraj1998@gmail.com Subject: [PATCH] staging: net: ipv4: tcp_westwood: fixed warnings and checks Date: Thu, 8 Nov 2018 15:16:17 +0530 Message-Id: <1541670377-17483-1-git-send-email-suraj1998@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541425985-31869-1-git-send-email-suraj1998@gmail.com> References: <1541425985-31869-1-git-send-email-suraj1998@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixed warnings and checks for TCP Westwood Signed-off-by: Suraj Singh --- net/ipv4/tcp_westwood.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c index bec9caf..8879152 100644 --- a/net/ipv4/tcp_westwood.c +++ b/net/ipv4/tcp_westwood.c @@ -43,11 +43,10 @@ struct westwood { }; /* TCP Westwood functions and constants */ -#define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */ -#define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */ +#define TCP_WESTWOOD_RTT_MIN (HZ / 20) /* 50ms */ +#define TCP_WESTWOOD_INIT_RTT (20 * HZ) /* maybe too conservative?! */ -/* - * @tcp_westwood_create +/* @tcp_westwood_create * This function initializes fields used in TCP Westwood+, * it is called after the initial SYN, so the sequence numbers * are correct but new passive connections we have no @@ -73,8 +72,7 @@ static void tcp_westwood_init(struct sock *sk) w->first_ack = 1; } -/* - * @westwood_do_filter +/* @westwood_do_filter * Low-pass filter. Implemented using constant coefficients. */ static inline u32 westwood_do_filter(u32 a, u32 b) @@ -94,8 +92,7 @@ static void westwood_filter(struct westwood *w, u32 delta) } } -/* - * @westwood_pkts_acked +/* @westwood_pkts_acked * Called after processing group of packets. * but all westwood needs is the last sample of srtt. */ @@ -108,8 +105,7 @@ static void tcp_westwood_pkts_acked(struct sock *sk, w->rtt = usecs_to_jiffies(sample->rtt_us); } -/* - * @westwood_update_window +/* @westwood_update_window * It updates RTT evaluation window if it is the right moment to do * it. If so it calls filter for evaluating bandwidth. */ @@ -127,8 +123,7 @@ static void westwood_update_window(struct sock *sk) w->first_ack = 0; } - /* - * See if a RTT-window has passed. + /* See if a RTT-window has passed. * Be careful since if RTT is less than * 50ms we don't filter but we continue 'building the sample'. * This minimum limit was chosen since an estimation on small @@ -149,12 +144,12 @@ static inline void update_rtt_min(struct westwood *w) if (w->reset_rtt_min) { w->rtt_min = w->rtt; w->reset_rtt_min = 0; - } else + } else { w->rtt_min = min(w->rtt, w->rtt_min); + } } -/* - * @westwood_fast_bw +/* @westwood_fast_bw * It is called when we are in fast path. In particular it is called when * header prediction is successful. In such case in fact update is * straight forward and doesn't need any particular care. @@ -171,8 +166,7 @@ static inline void westwood_fast_bw(struct sock *sk) update_rtt_min(w); } -/* - * @westwood_acked_count +/* @westwood_acked_count * This function evaluates cumul_ack for evaluating bk in case of * delayed or partial acks. */ @@ -207,8 +201,7 @@ static inline u32 westwood_acked_count(struct sock *sk) return w->cumul_ack; } -/* - * TCP Westwood +/* TCP Westwood * Here limit is evaluated as Bw estimation*RTTmin (for obtaining it * in packets we use mss_cache). Rttmin is guaranteed to be >= 2 * so avoids ever returning 0. -- 2.7.4