Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1426880imm; Fri, 22 Jun 2018 17:04:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfSZlHMbRg4wm8xuOn3LfPGbRLAA/c8XjLUpfVa5gbVoKsdopX0gXmuCdozXvKTjFrWKiK X-Received: by 2002:a63:b407:: with SMTP id s7-v6mr3194091pgf.334.1529712240232; Fri, 22 Jun 2018 17:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529712240; cv=none; d=google.com; s=arc-20160816; b=eOR6ljQzGNGU4pcR3/tuhpyxmQttqhqcQuZNPhrSWCTRDyZrn57qoRnEVx4pUZKBjt IMM/C7D5yJnEabCXf/3kBP7H9/iHSA8gDrimLNu8egdlf+z7JhbLtQJjUvibheqqzMoh QQb5C7h9UyjZsNOtamCdna6JEGavOI445Fs9APTQ881L20FJq6cKZnrk1kKRkJ2xeRJE zHRWRbgOqNqpXpdh/SqECXfDM1+rgBj/g5KdMQT2dlkdYgdgeFf7nkWwK0fiY/p9Lpr+ kJw7u4j1uiUv5SQ+0mvOeFHWG63aRnORqCY50QUb/I4XWT8rJ1H2jU8kd+YtJSeJ/otR K+2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Nd7TTbJDGJsKAyqSQSgpwwB6b1OMLeCP9eFVr/UArTs=; b=0lNqZUffLY3LzzA/1QeNJ0yXj0ugfTRu5/ZfeSUKR/LKEdUf8BRRhqaw6zl6zvExpg BSiQ/gOUR1Umfb+fHl1yFWT3G2QCCGeoU5kY/xQDpsLb7A1qp89Z7HKNKyuEaSx08QDv Y0eRtzoDEW6QqJBgmA50ceLSowk9Pj0hiR/aGrG+YY8sMom79g28qvcez1yJFUiBPR7l 3MRmOF4gu3+PAkwt+yaxE3Eg9/tDXY4b21cBm0yKX3WqDq58+suCGeo4JREvfCmBionb 0KuJpeR+wdZMdZ3/vEpzkNUfw7Y9C3dU264ZZ6T0E9ma6lt0OtJf3WFCMbqwAhi3TGut EVZw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i62-v6si8632317pfc.255.2018.06.22.17.03.45; Fri, 22 Jun 2018 17:04:00 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934468AbeFWABq (ORCPT + 99 others); Fri, 22 Jun 2018 20:01:46 -0400 Received: from mga01.intel.com ([192.55.52.88]:47366 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934003AbeFWABo (ORCPT ); Fri, 22 Jun 2018 20:01:44 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2018 17:01:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,259,1526367600"; d="scan'208";a="239540989" Received: from ssaleem-mobl4.amr.corp.intel.com (HELO ssaleem-mobl1) ([10.255.34.80]) by fmsmga005.fm.intel.com with SMTP; 22 Jun 2018 17:01:41 -0700 Received: by ssaleem-mobl1 (sSMTP sendmail emulation); Fri, 22 Jun 2018 19:01:39 -0500 Date: Fri, 22 Jun 2018 19:01:37 -0500 From: Shiraz Saleem To: Arnd Bergmann Cc: "Latif, Faisal" , Doug Ledford , Jason Gunthorpe , "David S. Miller" , "y2038@lists.linaro.org" , "netdev@vger.kernel.org" , "Orosco, Henry" , "Nikolova, Tatyana E" , "Ismail, Mustafa" , Jia-Ju Bai , Yuval Shaia , Bart Van Assche , Kees Cook , "Reshetova, Elena" , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] infiniband: i40iw, nes: don't use wall time for TCP sequence numbers Message-ID: <20180623000137.GA17264@ssaleem-MOBL4.amr.corp.intel.com> References: <20180618144443.137068-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180618144443.137068-1-arnd@arndb.de> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 08:44:17AM -0600, Arnd Bergmann wrote: > The nes infiniband driver uses current_kernel_time() to get a nanosecond > granunarity timestamp to initialize its tcp sequence counters. This is > one of only a few remaining users of that deprecated function, so we > should try to get rid of it. > > Aside from using a deprecated API, there are several problems I see here: > > - Using a CLOCK_REALTIME based time source makes it predictable in > case the time base is synchronized. > - Using a coarse timestamp means it only gets updated once per jiffie, > making it even more predictable in order to avoid having to access > the hardware clock source > - The upper 2 bits are always zero because the nanoseconds are at most > 999999999. > > For the Linux TCP implementation, we use secure_tcp_seq(), which appears > to be appropriate here as well, and solves all the above problems. > > I'm doing the same change in both versions of the nes driver, with > i40iw being a later copy of the same code. > > Signed-off-by: Arnd Bergmann > --- Thanks Arnd for the patch! [...] > @@ -2164,7 +2165,6 @@ static struct i40iw_cm_node *i40iw_make_cm_node( > struct i40iw_cm_listener *listener) > { > struct i40iw_cm_node *cm_node; > - struct timespec ts; > int oldarpindex; > int arpindex; > struct net_device *netdev = iwdev->netdev; > @@ -2214,8 +2214,10 @@ static struct i40iw_cm_node *i40iw_make_cm_node( > cm_node->tcp_cntxt.rcv_wscale = I40IW_CM_DEFAULT_RCV_WND_SCALE; > cm_node->tcp_cntxt.rcv_wnd = > I40IW_CM_DEFAULT_RCV_WND_SCALED >> I40IW_CM_DEFAULT_RCV_WND_SCALE; > - ts = current_kernel_time(); > - cm_node->tcp_cntxt.loc_seq_num = ts.tv_nsec; > + cm_node->tcp_cntxt.loc_seq_num = secure_tcp_seq(htonl(cm_node->loc_addr[0]), > + htonl(cm_node->rem_addr[0]), > + htons(cm_node->loc_port), > + htons(cm_node->rem_port)); Should we not be using secure_tcpv6_seq() when we are ipv6? Shiraz > cm_node->tcp_cntxt.mss = (cm_node->ipv4) ? (iwdev->vsi.mtu - I40IW_MTU_TO_MSS_IPV4) : > (iwdev->vsi.mtu - I40IW_MTU_TO_MSS_IPV6); > >