Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1820649imm; Mon, 3 Sep 2018 10:16:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ7HoHajRbTu9NZwAEuwf3scxv/Vfca0G6cYWf7sVTYg8LrnYclRyCW55gvU9e7i9txPt+n X-Received: by 2002:a17:902:b78a:: with SMTP id e10-v6mr29830812pls.79.1535995006566; Mon, 03 Sep 2018 10:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995006; cv=none; d=google.com; s=arc-20160816; b=T4hpwqPw+jvQUbaGUOnM8Y7LyMgb2jUzUQC78C0Ut3LsQIiPG7umAS7xYKScmKQ7UK DF/f7o9V8hLRfP0JOrSFdA1A4Rbiy2nzYXQAmR3ZTkU8stnYP5WL2SGFLro08Cnlf2HE AOGilidXf69xpojCGQyEVmbRuBciJ62yoNk71G5P9+ZfrErmYcOhoOXtKzte+d0nFTxs MJPZBP5IiSZ+AWEtV0g60absKIwe7xZLBJd5hnryGWa+YNpaLfT2w/4tSivxlSVcBu9Q p5AhQ6EQo08BWWpNT7YYBpTUBKpUmn7ez2pQUGLU3k7CGneSRoC06i34RsFVbBYCGL58 J3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CDuI8NS8ciASMr3wBx0azN49lp7I96B+q6LxNyyS9yI=; b=Aat/ym0KuSYIGlo8BUMECrVVR6hIwNiVSXwpf2x5FgnycJwR29fZmMhO9yJ3xd3yNZ rHfGRB849Uwj/N9L3p4XahKLdx6mzRtorXUNiSEG7HfRyy/XFMex8hP60q/OHfQ8p72h yhFHGk6mMSemOgpyWSKjr6IIxVyiKGUOe1WeZPIObipIYEieynTd5dfs/zPIxbmDva9b y37erYKtut6wLDKKWlzMK3xlAV98K0jo3fSfoyNTG/PocmBxLf0SrisinVVt82F3gwQj d9zZu0xI2HBnd5hPWvjT7CfbHc8eqK9eFh2HFO9qmpqGtMnWDVospZ2Ra++Zaywo5AxU d8mA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p66-v6si19716184pfp.237.2018.09.03.10.16.31; Mon, 03 Sep 2018 10:16:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729627AbeICVgc (ORCPT + 99 others); Mon, 3 Sep 2018 17:36:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42390 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728054AbeICVgb (ORCPT ); Mon, 3 Sep 2018 17:36:31 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 49256D06; Mon, 3 Sep 2018 17:15:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Varun Prakash , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 010/165] scsi: target: iscsi: cxgbit: fix max iso npdu calculation Date: Mon, 3 Sep 2018 18:54:56 +0200 Message-Id: <20180903165655.530127497@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Varun Prakash [ Upstream commit 1b350ea0c2f4df9aa30426614c8eb755a8c32814 ] - rounddown CXGBIT_MAX_ISO_PAYLOAD by csk->emss before calculating max_iso_npdu to get max TCP payload in multiple of mss. - call cxgbit_set_digest() before cxgbit_set_iso_npdu() to set csk->submode, it is used in calculating number of iso pdus. Signed-off-by: Varun Prakash Reviewed-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/target/iscsi/cxgbit/cxgbit_target.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) --- a/drivers/target/iscsi/cxgbit/cxgbit_target.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c @@ -652,6 +652,7 @@ static int cxgbit_set_iso_npdu(struct cx struct iscsi_param *param; u32 mrdsl, mbl; u32 max_npdu, max_iso_npdu; + u32 max_iso_payload; if (conn->login->leading_connection) { param = iscsi_find_param_from_key(MAXBURSTLENGTH, @@ -670,8 +671,10 @@ static int cxgbit_set_iso_npdu(struct cx mrdsl = conn_ops->MaxRecvDataSegmentLength; max_npdu = mbl / mrdsl; - max_iso_npdu = CXGBIT_MAX_ISO_PAYLOAD / - (ISCSI_HDR_LEN + mrdsl + + max_iso_payload = rounddown(CXGBIT_MAX_ISO_PAYLOAD, csk->emss); + + max_iso_npdu = max_iso_payload / + (ISCSI_HDR_LEN + mrdsl + cxgbit_digest_len[csk->submode]); csk->max_iso_npdu = min(max_npdu, max_iso_npdu); @@ -741,6 +744,9 @@ static int cxgbit_set_params(struct iscs if (conn_ops->MaxRecvDataSegmentLength > cdev->mdsl) conn_ops->MaxRecvDataSegmentLength = cdev->mdsl; + if (cxgbit_set_digest(csk)) + return -1; + if (conn->login->leading_connection) { param = iscsi_find_param_from_key(ERRORRECOVERYLEVEL, conn->param_list); @@ -764,7 +770,7 @@ static int cxgbit_set_params(struct iscs if (is_t5(cdev->lldi.adapter_type)) goto enable_ddp; else - goto enable_digest; + return 0; } if (test_bit(CDEV_ISO_ENABLE, &cdev->flags)) { @@ -781,10 +787,6 @@ enable_ddp: } } -enable_digest: - if (cxgbit_set_digest(csk)) - return -1; - return 0; }