diff mbox series

[01/14] scsi: mpt3sas: Define hba_port structure

Message ID 20201125221548.24127-2-michael.reed@canonical.com
State New
Headers show
Series [01/14] scsi: mpt3sas: Define hba_port structure | expand

Commit Message

Michael Reed Nov. 25, 2020, 10:15 p.m. UTC
From: Sreekanth Reddy <sreekanth.reddy@broadcom.com>

Define a new hba_port structure which holds the following 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 port details during HBA reset

Link: https://lore.kernel.org/r/20201027130847.9962-2-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit b22a0fac8c056e88fc72f7241fa9077b804634a6)
Signed-off-by: Michael Reed <Michael.Reed@canonical.com>
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1899802
---
 drivers/scsi/mpt3sas/mpt3sas_base.h | 35 ++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

Comments

Stefan Bader Nov. 26, 2020, 8:41 a.m. UTC | #1
On 25.11.20 23:15, Michael Reed wrote:
> From: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
> 
> Define a new hba_port structure which holds the following 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 port details during HBA reset
> 
> Link: https://lore.kernel.org/r/20201027130847.9962-2-sreekanth.reddy@broadcom.com
> Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> (cherry picked from commit b22a0fac8c056e88fc72f7241fa9077b804634a6)
> Signed-off-by: Michael Reed <Michael.Reed@canonical.com>
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1899802
> ---

This set does not give any indication for which series it is intended for. I
would expect at least some cover-email explaining things and anything above 5
patches should also consider providing a pull request in the cover-email.

The way it is now is highly confusing, and requires everybody to go on a wild
hunt for info.

-Stefan

>  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 e7197150721f..a369d9674681 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.h
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
> @@ -419,6 +419,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
>   */
> @@ -431,6 +432,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;
>  };
> @@ -533,6 +535,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;
> @@ -559,6 +562,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)
> @@ -729,6 +733,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 {
> @@ -737,6 +742,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;
>  };
>  
> @@ -750,6 +756,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;
> @@ -760,6 +767,7 @@ struct _sas_phy {
>  	u16	handle;
>  	u16	attached_handle;
>  	u8	phy_belongs_to_port;
> +	struct hba_port *port;
>  };
>  
>  /**
> @@ -775,6 +783,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;
> @@ -786,11 +795,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
> @@ -1008,6 +1017,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
> @@ -1188,6 +1218,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;
> @@ -1476,6 +1507,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;
>  };
>  
>  #define MPT_DRV_SUPPORT_BITMAP_MEMMOVE 0x00000001
>
diff mbox series

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index e7197150721f..a369d9674681 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -419,6 +419,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
  */
@@ -431,6 +432,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;
 };
@@ -533,6 +535,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;
@@ -559,6 +562,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)
@@ -729,6 +733,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 {
@@ -737,6 +742,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;
 };
 
@@ -750,6 +756,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;
@@ -760,6 +767,7 @@  struct _sas_phy {
 	u16	handle;
 	u16	attached_handle;
 	u8	phy_belongs_to_port;
+	struct hba_port *port;
 };
 
 /**
@@ -775,6 +783,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;
@@ -786,11 +795,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
@@ -1008,6 +1017,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
@@ -1188,6 +1218,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;
@@ -1476,6 +1507,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;
 };
 
 #define MPT_DRV_SUPPORT_BITMAP_MEMMOVE 0x00000001