From patchwork Tue Oct 10 10:48:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Bhivare X-Patchwork-Id: 9995785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B61BC603B5 for ; Tue, 10 Oct 2017 10:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B14CD28500 for ; Tue, 10 Oct 2017 10:48:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A601A28503; Tue, 10 Oct 2017 10:48:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ED8C28500 for ; Tue, 10 Oct 2017 10:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755737AbdJJKs5 (ORCPT ); Tue, 10 Oct 2017 06:48:57 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:53178 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755723AbdJJKsz (ORCPT ); Tue, 10 Oct 2017 06:48:55 -0400 Received: by mail-pf0-f178.google.com with SMTP id a1so13571687pfj.9 for ; Tue, 10 Oct 2017 03:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2UBbboYs545CdOlE/Q1sZsLLdBJEz11Ilqtp8aMYwo8=; b=LB+0QwfdI/FEkqE+trv6WGILaLWoXEfpGpB48H9ND0e7Qk9wfH0aCS5dODXWoc3Lhe FVKPoVYeA64LotBGwcZChucH0AgvGXYLiQDEcOxbJQJ0Z+a7Zw+bI0y6WKI0CaW+gHr3 UE7c2g+jB21/giQK8gV+xYSWdVSGwN7T2wYw8= 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=2UBbboYs545CdOlE/Q1sZsLLdBJEz11Ilqtp8aMYwo8=; b=r9oPdIzpzemOudMGLGNHBcqiKqXhmm7zLAIKykjRC+PveLyWTP3RUMX/mCy6lYOLJK kijyuupiUq/a1yRCqeKm0zTntb7hnJk3Q63JD95uNcnyCmznQSz5R1MHFtASVOKXlUCx AGxsmhkExFJwkCJiWzxAh2iLsixWj2Zm9Zz1i/HD/57Ws616Y05GURerH4n9kWPCnTPp HH5XP7/wI2ivVqnYd8AwS6aCR574DEb1AWtmwcn7g2z8Enn5mWQXUm3D8G1CznE7iXoz eiAT0g0SncLM9xdxtasZTjkk3lxBincu1kSdRQlP/IK+TqKpEPLuFzKh7Pi5SMrxduot gqQQ== X-Gm-Message-State: AMCzsaVUerET48dkVHnYh81THZ9fKw0z8uzEs4X/pPNTl/NmrGGP9YcD o/RRpYsDh9u0QvmYinVGJ5jViA== X-Google-Smtp-Source: AOwi7QD2YpVAaqIoDRWMq2W+g/gGVOrolGBO8iO6vmyQIYFcU6ASmDydUQZeguSt0IcVmIe1xOj0Kw== X-Received: by 10.99.179.74 with SMTP id x10mr5945780pgt.336.1507632534370; Tue, 10 Oct 2017 03:48:54 -0700 (PDT) Received: from localhost.localdomain ([103.195.99.222]) by smtp.gmail.com with ESMTPSA id w13sm16131313pgq.13.2017.10.10.03.48.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 03:48:53 -0700 (PDT) From: Jitendra Bhivare To: cleech@redhat.com, lduncan@suse.com Cc: linux-scsi@vger.kernel.org, Jitendra Bhivare Subject: [PATCH 06/10] be2iscsi: Modify IOCTL to fetch user configured IQN Date: Tue, 10 Oct 2017 16:18:16 +0530 Message-Id: <1507632500-26445-7-git-send-email-jitendra.bhivare@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507632500-26445-1-git-send-email-jitendra.bhivare@broadcom.com> References: <1507632500-26445-1-git-send-email-jitendra.bhivare@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add version 1 of GET_HBA_NAME to fetch port specific IQN first. If it fails use version 0 to get the IQN. To use this old IQN names of interfaces needs to be cleared from the iscsiadm database. Signed-off-by: Jitendra Bhivare --- drivers/scsi/be2iscsi/be_iscsi.c | 12 ++++++++---- drivers/scsi/be2iscsi/be_mgmt.c | 7 ++++++- drivers/scsi/be2iscsi/be_mgmt.h | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index 512c52a..aef9764 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c @@ -762,11 +762,15 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, } break; case ISCSI_HOST_PARAM_INITIATOR_NAME: - status = beiscsi_get_initiator_name(phba, buf); + /* try fetching user configured name first */ + status = beiscsi_get_initiator_name(phba, buf, true); if (status < 0) { - beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, - "BS_%d : Retreiving Initiator Name Failed\n"); - return 0; + status = beiscsi_get_initiator_name(phba, buf, false); + if (status < 0) { + beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, + "BS_%d : Retreiving Initiator Name Failed\n"); + status = 0; + } } break; case ISCSI_HOST_PARAM_PORT_STATE: diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 0c25c10..713c7de 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c @@ -339,12 +339,14 @@ int beiscsi_modify_eq_delay(struct beiscsi_hba *phba, * beiscsi_get_initiator_name - read initiator name from flash * @phba: device priv structure * @name: buffer pointer + * @cfg: fetch user configured * */ -int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name) +int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg) { struct be_dma_mem nonemb_cmd; struct be_cmd_hba_name resp; + struct be_cmd_hba_name *req; int rc; rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI_INI, @@ -352,6 +354,9 @@ int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name) if (rc) return rc; + req = nonemb_cmd.va; + if (cfg) + req->hdr.version = 1; rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, &resp, sizeof(resp)); if (rc) { diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h index 665fd89..8d886f8 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.h +++ b/drivers/scsi/be2iscsi/be_mgmt.h @@ -178,7 +178,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, struct invldt_cmd_tbl *inv_tbl, unsigned int nents); -int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name); +int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg); int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type);