From patchwork Fri Oct 9 17:14:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 11826893 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C038D16C1 for ; Fri, 9 Oct 2020 17:14:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F82E2226B for ; Fri, 9 Oct 2020 17:14:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="YPC87ufe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390102AbgJIROV (ORCPT ); Fri, 9 Oct 2020 13:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390184AbgJIROQ (ORCPT ); Fri, 9 Oct 2020 13:14:16 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B201C0613D5 for ; Fri, 9 Oct 2020 10:14:16 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id f19so7378124pfj.11 for ; Fri, 09 Oct 2020 10:14:16 -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 :mime-version; bh=mBr4VVWbIPHI9dt+SfjHl21QAMf9SN1eHinMWaY6dDg=; b=YPC87ufe3YnG2s7dzqWX75+y35DXtul0HqaF5Hnuzk4h80kwcCcHBF9eeMOLUtTRaM FrnZIgPyHbBUbR0jhx5s8+qEEhjmzPew5Cc/9ou3HbBuSJMUVO8QLKtRded30OvRkL0T oOXH/gpATkjJLKzugvt/1SYTfEBUZdLh/JtbE= 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:mime-version; bh=mBr4VVWbIPHI9dt+SfjHl21QAMf9SN1eHinMWaY6dDg=; b=s2JdCqbSHkdgacD/a7IF7TDUTsxVwHbCxXClMKbtTNErY9Ll4rAThzM74BmSujUeQZ n3radoa6y23Tk9DFuoyGrD7L0tLy1oza2CfZioQqHzg9p/1F74GON6kFceLNkh8DFe2v gcQGLqlO52Hu9SYgExqwggE32T7q1pT9WTZ0PbhBYsC2q3/tPESZ2r8lFDkVz6nN7cZw DF57clY5nYo+SecBlTjtXPZXJ6elGofD5kKB+3RxYkp8MNo6uaC8/fUTwZ9uZDJDkmXX k5XEbFNsQQFy/9rBDzTQ8c2cUObTnmokkUG8ZQchCg8Fwu+qChtUnA/xGCznoiVXXOzC xicQ== X-Gm-Message-State: AOAM530SjeWJFCIFHB0opPpvfg9Phi/2F3Nb1i3eNxMIo+6LQ25j8dcH gXLTb71C0kBPFTp18NkiLMWtto2Hr6Sd+M5Ljko= X-Google-Smtp-Source: ABdhPJxuFtxvv53nGdMRUX+IZ44SA8JxdTHYoVj2/HS6mIcfpv9TCOLIqnlrPIOoqgyagekWm0mixQ== X-Received: by 2002:aa7:9059:0:b029:151:d725:e230 with SMTP id n25-20020aa790590000b0290151d725e230mr13012417pfo.77.1602263655511; Fri, 09 Oct 2020 10:14:15 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id fy24sm12299055pjb.35.2020.10.09.10.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 10:14:14 -0700 (PDT) From: Sreekanth Reddy To: martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, sathya.prakash@broadcom.com, suganath-prabu.subramani@broadcom.com, Sreekanth Reddy Subject: [PATCH 01/14] mpt3sas: Define hba_port structure Date: Fri, 9 Oct 2020 22:44:27 +0530 Message-Id: <20201009171440.4949-2-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20201009171440.4949-1-sreekanth.reddy@broadcom.com> References: <20201009171440.4949-1-sreekanth.reddy@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Defined a new hba_port structure with hold below variables, - port_id : Port ID of the narrow/wide port of the HBA - sas_address : SAS Address of the remote device that is attached to the current HBA port - phy_mask : HBA’s phy bits to which above SAS addressed device is attached - flags : this field is used to refresh this port details during HBA reset. Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpt3sas/mpt3sas_base.h | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index bc8beb1..2dde574 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -420,6 +420,7 @@ struct Mpi2ManufacturingPage11_t { * @flags: MPT_TARGET_FLAGS_XXX flags * @deleted: target flaged for deletion * @tm_busy: target is busy with TM request. + * @port: hba port entry containing target's port number info * @sas_dev: The sas_device associated with this target * @pcie_dev: The pcie device associated with this target */ @@ -432,6 +433,7 @@ struct MPT3SAS_TARGET { u32 flags; u8 deleted; u8 tm_busy; + struct hba_port *port; struct _sas_device *sas_dev; struct _pcie_device *pcie_dev; }; @@ -534,6 +536,7 @@ struct _internal_cmd { * addition routine. * @chassis_slot: chassis slot * @is_chassis_slot_valid: chassis slot valid or not + * @port: hba port entry containing device's port number info */ struct _sas_device { struct list_head list; @@ -560,6 +563,7 @@ struct _sas_device { u8 is_chassis_slot_valid; u8 connector_name[5]; struct kref refcount; + struct hba_port *port; }; static inline void sas_device_get(struct _sas_device *s) @@ -730,6 +734,7 @@ struct _boot_device { * @remote_identify: attached device identification * @rphy: sas transport rphy object * @port: sas transport wide/narrow port object + * @hba_port: hba port entry containing port's port number info * @phy_list: _sas_phy list objects belonging to this port */ struct _sas_port { @@ -738,6 +743,7 @@ struct _sas_port { struct sas_identify remote_identify; struct sas_rphy *rphy; struct sas_port *port; + struct hba_port *hba_port; struct list_head phy_list; }; @@ -751,6 +757,7 @@ struct _sas_port { * @handle: device handle for this phy * @attached_handle: device handle for attached device * @phy_belongs_to_port: port has been created for this phy + * @port: hba port entry containing port number info */ struct _sas_phy { struct list_head port_siblings; @@ -761,6 +768,7 @@ struct _sas_phy { u16 handle; u16 attached_handle; u8 phy_belongs_to_port; + struct hba_port *port; }; /** @@ -776,6 +784,7 @@ struct _sas_phy { * @responding: used in _scsih_expander_device_mark_responding * @phy: a list of phys that make up this sas_host/expander * @sas_port_list: list of ports attached to this sas_host/expander + * @port: hba port entry containing node's port number info */ struct _sas_node { struct list_head list; @@ -787,11 +796,11 @@ struct _sas_node { u16 enclosure_handle; u64 enclosure_logical_id; u8 responding; + struct hba_port *port; struct _sas_phy *phy; struct list_head sas_port_list; }; - /** * struct _enclosure_node - enclosure information * @list: list of enclosures @@ -1009,6 +1018,27 @@ struct reply_post_struct { dma_addr_t reply_post_free_dma; }; +/** + * struct hba_port - Saves each HBA's Wide/Narrow port info + * @sas_address: sas address of this wide/narrow port's attached device + * @phy_mask: HBA PHY's belonging to this port + * @port_id: port number + * @flags: hba port flags + */ +struct hba_port { + struct list_head list; + u64 sas_address; + u32 phy_mask; + u8 port_id; + u8 flags; +}; + +/* hba port flags */ +#define HBA_PORT_FLAG_DIRTY_PORT 0x01 +#define HBA_PORT_FLAG_NEW_PORT 0x02 + +#define MULTIPATH_DISABLED_PORT_ID 0xFF + typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc); /** * struct MPT3SAS_ADAPTER - per adapter struct @@ -1191,6 +1221,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc); * which ensures the syncrhonization between cli/sysfs_show path. * @atomic_desc_capable: Atomic Request Descriptor support. * @GET_MSIX_INDEX: Get the msix index of high iops queues. + * @port_table_list: list containing HBA's wide/narrow port's info */ struct MPT3SAS_ADAPTER { struct list_head list; @@ -1483,6 +1514,8 @@ struct MPT3SAS_ADAPTER { PUT_SMID_IO_FP_HIP put_smid_hi_priority; PUT_SMID_DEFAULT put_smid_default; GET_MSIX_INDEX get_msix_index_for_smlio; + + struct list_head port_table_list; }; struct mpt3sas_debugfs_buffer {