]> git.kernelconcepts.de Git - mv-sheeva.git/commitdiff
[SCSI] libsas: fix definition of wideport, include local sas address
authorDan Williams <dan.j.williams@intel.com>
Fri, 1 Oct 2010 20:55:52 +0000 (13:55 -0700)
committerJames Bottomley <James.Bottomley@suse.de>
Tue, 21 Dec 2010 18:23:53 +0000 (12:23 -0600)
To date libsas has only looked at the attached sas address when
determining the formation of wide ports.  The specification and some
hardware expects that phys with different addresses will not form a wide
port unless the local peer phys also match each other.  Introduce a flag
to select stricter behavior at sas_register_ha() time.  The flag can be
dropped once it is known that all libsas users expect the same behavior.

Current drivers just initialize this field to zero and get the
traditional behavior.

Reported-by: Patrick Thomson <patrick.s.thomson@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/libsas/sas_port.c
include/scsi/libsas.h

index fe8b74c706d21d4449887070133db3294d1b50ac..5257fdfe699ae6d1c853d0de0a68f2f51986e054 100644 (file)
 #include <scsi/scsi_transport_sas.h>
 #include "../scsi_sas_internal.h"
 
+static bool phy_is_wideport_member(struct asd_sas_port *port, struct asd_sas_phy *phy)
+{
+       struct sas_ha_struct *sas_ha = phy->ha;
+
+       if (memcmp(port->attached_sas_addr, phy->attached_sas_addr,
+                  SAS_ADDR_SIZE) != 0 || (sas_ha->strict_wide_ports &&
+            memcmp(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE) != 0))
+               return false;
+       return true;
+}
+
 /**
  * sas_form_port -- add this phy to a port
  * @phy: the phy of interest
@@ -45,8 +56,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
        unsigned long flags;
 
        if (port) {
-               if (memcmp(port->attached_sas_addr, phy->attached_sas_addr,
-                          SAS_ADDR_SIZE) != 0)
+               if (!phy_is_wideport_member(port, phy))
                        sas_deform_port(phy);
                else {
                        SAS_DPRINTK("%s: phy%d belongs to port%d already(%d)!\n",
@@ -62,9 +72,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
                port = sas_ha->sas_port[i];
                spin_lock(&port->phy_list_lock);
                if (*(u64 *) port->sas_addr &&
-                   memcmp(port->attached_sas_addr,
-                          phy->attached_sas_addr, SAS_ADDR_SIZE) == 0 &&
-                   port->num_phys > 0) {
+                   phy_is_wideport_member(port, phy) && port->num_phys > 0) {
                        /* wide port */
                        SAS_DPRINTK("phy%d matched wide port%d\n", phy->id,
                                    port->id);
index 90ce527ecf3d02c5c214308dc30098301d9892d5..8f6bb9c7f3eb1b038a784e4d706098f3442937ba 100644 (file)
@@ -361,6 +361,8 @@ struct sas_ha_struct {
        /* The class calls this to send a task for execution. */
        int lldd_max_execute_num;
        int lldd_queue_size;
+       int strict_wide_ports; /* both sas_addr and attached_sas_addr must match
+                               * their siblings when forming wide ports */
 
        /* LLDD calls these to notify the class of an event. */
        void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);