Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4292616pxb; Tue, 17 Nov 2020 17:14:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1ozGi4dv+vDs3nlMF6CNWZ030wn2dFd4m00FtrJvoXrarDfrhsFatsNTEgb9f65v+VPPh X-Received: by 2002:a50:8e0e:: with SMTP id 14mr12772059edw.171.1605662058062; Tue, 17 Nov 2020 17:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605662058; cv=none; d=google.com; s=arc-20160816; b=EpPhe7rnWxZoywv1PYXB2lNQyQyK3rLqpQTLdllZkLmSuGBBR2UsFhPy1swQQIYMBk pcgQHmjBU5cLv51ymnuEK1TNb3qtKPmtMdTl5j+K9tlLeI3etCJwFFErNVtNiCjFZKNT LLBGdhzZH1frLNbnn2leX45KTolhOamGohBt6O0eD4Q5A4e0TKvfX/uuK71GyeVwtlUU y/0EVk2KDo0lsDM/3WTOWC3JqqZHmQZQtYrIpvilWFn4YzFKIk4uX53+RmLRj8TebCN1 m/IutJNDuVaeJmFCweF7lXYNe6g9yZ/FZWlb3C2EhtP1eTwh3hLwYtMYNJ11HZo2u7TM B+gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LSyIP//E1kr/UpSMXW5SEKPnBCVX3G7oPATqzrZa3qc=; b=nPjTtncR10/iZJPldyPP1joDUwV7LgzI45qr1Gv3MM/z114VjqgePzihgFiVqwwHA9 CE2d8/AJyPOmkIa/S3an+K7EtIUpiFKd129WA1eVsVs95GH1XMdobfwOPibhrl1b0k82 AVQIZkhYshm123Luy2mPUexpSfWjL7XmPn/rPWC6osVOwhlzGIyoaUtAV37eUu/Ihmwi SGH4pKu8a+VC58e01Mm0yBXqHQnGpwpfv294CHH9p4kViZ0U15vsJe9SCjcH2wdOTzer Y+ST2eNucJAmCgaFdCMNOnvRoW6KwsKToy/ga9ONgHZkmzCX4tQP5drGkp2bR7TRiQzz eXxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Fje5IudK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si14103255eje.577.2020.11.17.17.13.55; Tue, 17 Nov 2020 17:14:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Fje5IudK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728863AbgKRBLR (ORCPT + 99 others); Tue, 17 Nov 2020 20:11:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59438 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgKRBLP (ORCPT ); Tue, 17 Nov 2020 20:11:15 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AI11bOG016714; Tue, 17 Nov 2020 20:11:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=LSyIP//E1kr/UpSMXW5SEKPnBCVX3G7oPATqzrZa3qc=; b=Fje5IudKFAiImsrB/lqeEZdXcrUrSVeo/8rA3ef+rcwOWyeI6gSo08G/nP4gXmqtqk0a HReP558dVDw+21OJxjOCnGOeP/yD16Maw/vBM48TkrZZ4Tabr38G/0TLGERuBVHcD0+U 7epjxBGVfbzuc+e8jrN+uOX0uBQugDEi8zjj92P2Xker8rr4Y+qzRoIxfgpYIjg3ctX/ kwK03qAsol7KUlhGxzLYPsMUyvf/52nTAV9moBltSP12kNhji1FJHOwwV4Bt53YTMSjj Lkl/JNlspWAHVEaDifUrz/iBVJBCBb+qMvhpXQmyovGBYnj20nEy5Lbjw3fKO7ULopy9 5Q== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 34v9pfxg2r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Nov 2020 20:11:09 -0500 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AI11riP014915; Wed, 18 Nov 2020 01:11:08 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma03wdc.us.ibm.com with ESMTP id 34t6v92mqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Nov 2020 01:11:08 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AI1B1SV49938714 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 01:11:01 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A3A8BE054; Wed, 18 Nov 2020 01:11:07 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA286BE04F; Wed, 18 Nov 2020 01:11:06 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 18 Nov 2020 01:11:06 +0000 (GMT) From: Tyrel Datwyler To: james.bottomley@hansenpartnership.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com, Tyrel Datwyler Subject: [PATCH v3 3/6] ibmvfc: add helper for testing capability flags Date: Tue, 17 Nov 2020 19:11:01 -0600 Message-Id: <20201118011104.296999-4-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201118011104.296999-1-tyreld@linux.ibm.com> References: <20201118011104.296999-1-tyreld@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-17_15:2020-11-17,2020-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 priorityscore=1501 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180000 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Testing the NPIV Login response capabilities is a long winded process of dereferencing the vhost->login_buf->resp.capabilities field, then byte swapping that value to host endian, and performing the bitwise test. Currently we only ever check this in ibmvfc_cancel_all(), but follow-up patches will need to regularly check for targetWWPN and channelization support. Add a helper to simplify checking various VIOS capabilities, namely ibmvfc_check_caps(). Signed-off-by: Tyrel Datwyler --- drivers/scsi/ibmvscsi/ibmvfc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index d33b24668367..a68602cd1255 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -138,6 +138,13 @@ static void ibmvfc_tgt_move_login(struct ibmvfc_target *); static const char *unknown_error = "unknown error"; +static int ibmvfc_check_caps(struct ibmvfc_host *vhost, unsigned long cap_flags) +{ + u64 host_caps = be64_to_cpu(vhost->login_buf->resp.capabilities); + + return (host_caps & cap_flags) ? 1 : 0; +} + #ifdef CONFIG_SCSI_IBMVFC_TRACE /** * ibmvfc_trc_start - Log a start trace entry @@ -2240,7 +2247,7 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) tmf->common.length = cpu_to_be16(sizeof(*tmf)); tmf->scsi_id = cpu_to_be64(rport->port_id); int_to_scsilun(sdev->lun, &tmf->lun); - if (!(be64_to_cpu(vhost->login_buf->resp.capabilities) & IBMVFC_CAN_SUPPRESS_ABTS)) + if (!ibmvfc_check_caps(vhost, IBMVFC_CAN_SUPPRESS_ABTS)) type &= ~IBMVFC_TMF_SUPPRESS_ABTS; if (vhost->state == IBMVFC_ACTIVE) tmf->flags = cpu_to_be32((type | IBMVFC_TMF_LUA_VALID)); -- 2.27.0