From patchwork Tue Oct 10 10:48:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Bhivare X-Patchwork-Id: 9995787 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 1EEF1603B5 for ; Tue, 10 Oct 2017 10:49:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19F5028500 for ; Tue, 10 Oct 2017 10:49:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EEE728503; Tue, 10 Oct 2017 10:49:00 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 9AA8A28500 for ; Tue, 10 Oct 2017 10:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755790AbdJJKs6 (ORCPT ); Tue, 10 Oct 2017 06:48:58 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:47644 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbdJJKs5 (ORCPT ); Tue, 10 Oct 2017 06:48:57 -0400 Received: by mail-pf0-f169.google.com with SMTP id z11so6868781pfk.4 for ; Tue, 10 Oct 2017 03:48:57 -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=t1mam+MGzj/KuKLGeclHOewPnMcytyO+nE1PWYXove8=; b=U4a9t10JVcu5TgRLjV4bEHRVfFGIhsrrCIUHUhDURRRcdFLLkZcFZtPvkIvL+SFd06 lYb7dT5K6qDkcaIAKApJL8HZmIE8HkG7m0fmbFz5Rk2kSOE61hZA9RMcR6QRjTAvFpz1 /nSSB2DQrjUAaKRcPZ68P17TvjyZ5ODOZzP38= 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=t1mam+MGzj/KuKLGeclHOewPnMcytyO+nE1PWYXove8=; b=gK7/EZdVG9FfUXVSkExarmquHabCSbdiUdPCTgxo7G8ozAwWePq+8fSVoPvnHlcK3s 6lDkcQGdgvNs0VaExyIk9+wc0sPlewecIfpmKQ5cvUyVgqN/cF/D9gdPqTQ0q+EXNpWp noQTeLjquOMRGvYnHKBzEfn8Cdo6JSA+bOW91wO5GhaN6hZii1G550+VcFCXwaJ0+B2N sctCwJy6pCPqrm6EKS6OY84PHWs+22YRYtvlHU/R5OY8WHMLzIByo/lpbGfL3cs0YMN7 o141czhVwyYedxY3nnYtb8w+u7YwE+lRqdjoeiTNth4ybLdtD8wCDDejim1ens+AUOHW f7uw== X-Gm-Message-State: AMCzsaU0BJdfruWb3NdZM8IRqcWueAbbkAx7bG2HFPsf0TVfZqu9a2ST 7UoW0tAar4jGqR30gp+gPPsAeg== X-Google-Smtp-Source: AOwi7QC7ZWaivKFBu1W69YazkdpNaasiLO2JaEeUjDLxoD9hD2Oz4Mqs6d5NLcIPEGukOl1i9qN6Hw== X-Received: by 10.101.86.79 with SMTP id m15mr11781297pgs.157.1507632537016; Tue, 10 Oct 2017 03:48:57 -0700 (PDT) Received: from localhost.localdomain ([103.195.99.222]) by smtp.gmail.com with ESMTPSA id w13sm16131313pgq.13.2017.10.10.03.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 03:48:56 -0700 (PDT) From: Jitendra Bhivare To: cleech@redhat.com, lduncan@suse.com Cc: linux-scsi@vger.kernel.org, Jitendra Bhivare Subject: [PATCH 07/10] be2iscsi: Add cmd to set host data Date: Tue, 10 Oct 2017 16:18:17 +0530 Message-Id: <1507632500-26445-8-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 Provide driver version in host data to FW. Signed-off-by: Jitendra Bhivare --- drivers/scsi/be2iscsi/be_cmds.c | 46 +++++++++++++++++++++++++++++++++++++++++ drivers/scsi/be2iscsi/be_cmds.h | 26 +++++++++++++++++++++++ drivers/scsi/be2iscsi/be_main.c | 2 ++ 3 files changed, 74 insertions(+) diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c index 6af448d..0499666 100644 --- a/drivers/scsi/be2iscsi/be_cmds.c +++ b/drivers/scsi/be2iscsi/be_cmds.c @@ -1522,6 +1522,52 @@ int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba) return ret; } +int beiscsi_set_host_data(struct beiscsi_hba *phba) +{ + struct be_ctrl_info *ctrl = &phba->ctrl; + struct be_cmd_set_host_data *ioctl; + struct be_mcc_wrb *wrb; + int ret = 0; + + if (is_chip_be2_be3r(phba)) + return ret; + + mutex_lock(&ctrl->mbox_lock); + wrb = wrb_from_mbox(&ctrl->mbox_mem); + memset(wrb, 0, sizeof(*wrb)); + ioctl = embedded_payload(wrb); + + be_wrb_hdr_prepare(wrb, sizeof(*ioctl), true, 0); + be_cmd_hdr_prepare(&ioctl->h.req_hdr, CMD_SUBSYSTEM_COMMON, + OPCODE_COMMON_SET_HOST_DATA, + EMBED_MBX_MAX_PAYLOAD_SIZE); + ioctl->param.req.param_id = BE_CMD_SET_HOST_PARAM_ID; + ioctl->param.req.param_len = + snprintf((char *)ioctl->param.req.param_data, + sizeof(ioctl->param.req.param_data), + "Linux iSCSI v%s", BUILD_STR); + ioctl->param.req.param_len = ALIGN(ioctl->param.req.param_len, 4); + if (ioctl->param.req.param_len > BE_CMD_MAX_DRV_VERSION) + ioctl->param.req.param_len = BE_CMD_MAX_DRV_VERSION; + ret = be_mbox_notify(ctrl); + if (!ret) { + beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, + "BG_%d : HBA set host driver version\n"); + } else { + /** + * Check "MCC_STATUS_INVALID_LENGTH" for SKH. + * Older FW versions return this error. + */ + if (ret == MCC_STATUS_ILLEGAL_REQUEST || + ret == MCC_STATUS_INVALID_LENGTH) + __beiscsi_log(phba, KERN_INFO, + "BG_%d : HBA failed to set host driver version\n"); + } + + mutex_unlock(&ctrl->mbox_lock); + return ret; +} + int beiscsi_set_uer_feature(struct beiscsi_hba *phba) { struct be_ctrl_info *ctrl = &phba->ctrl; diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h index 4f1ac97..5d5e8fb 100644 --- a/drivers/scsi/be2iscsi/be_cmds.h +++ b/drivers/scsi/be2iscsi/be_cmds.h @@ -230,6 +230,7 @@ struct be_mcc_mailbox { #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 #define OPCODE_COMMON_FUNCTION_RESET 61 #define OPCODE_COMMON_GET_PORT_NAME 77 +#define OPCODE_COMMON_SET_HOST_DATA 93 #define OPCODE_COMMON_SET_FEATURES 191 /** @@ -737,6 +738,30 @@ struct be_cmd_hba_name { u8 initiator_alias[BE_INI_ALIAS_LEN]; } __packed; +/******************** COMMON SET HOST DATA *******************/ +#define BE_CMD_SET_HOST_PARAM_ID 0x2 +#define BE_CMD_MAX_DRV_VERSION 0x30 +struct be_sethost_req { + u32 param_id; + u32 param_len; + u32 param_data[32]; +}; + +struct be_sethost_resp { + u32 rsvd0; +}; + +struct be_cmd_set_host_data { + union { + struct be_cmd_req_hdr req_hdr; + struct be_cmd_resp_hdr resp_hdr; + } h; + union { + struct be_sethost_req req; + struct be_sethost_resp resp; + } param; +} __packed; + /******************** COMMON SET Features *******************/ #define BE_CMD_SET_FEATURE_UER 0x10 #define BE_CMD_UER_SUPP_BIT 0x1 @@ -845,6 +870,7 @@ int beiscsi_get_fw_config(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba); int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba); int beiscsi_set_uer_feature(struct beiscsi_hba *phba); +int beiscsi_set_host_data(struct beiscsi_hba *phba); struct be_default_pdu_context { u32 dw[4]; diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 8f7e394..02144c5 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5325,6 +5325,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba) be2iscsi_enable_msix(phba); beiscsi_get_params(phba); + beiscsi_set_host_data(phba); /* Re-enable UER. If different TPE occurs then it is recoverable. */ beiscsi_set_uer_feature(phba); @@ -5623,6 +5624,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, } beiscsi_get_port_name(&phba->ctrl, phba); beiscsi_get_params(phba); + beiscsi_set_host_data(phba); beiscsi_set_uer_feature(phba); be2iscsi_enable_msix(phba);