Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c3afc42 authored by Moger, Babu's avatar Moger, Babu Committed by James Bottomley
Browse files

[SCSI] scsi_dh_rdac : Detect the different RDAC operating modes



This patch detects different operating RDAC modes during the
discovery. It also collects the information about the preferred path.

Signed-off-by: default avatarBabu Moger <babu.moger@lsi.com>
Reviewed-by: default avatarYanling Qi <yanling.qi@lsi.com>
Reviewed-by: default avatarSudhir Dachepalli <Sudhir.Dachepalli@lis.com>
Reviewed-by: default avatarSomasundaram Krishnasamy <Somasundaram.Krishnasamy@lsi.com>
Reviewed-by: default avatarBob Stankey <Robert.Stankey@lsi.com>
Reviewed-by: default avatarVijay Chauhan <Vijay.Chauhan@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent eebe9b96
Loading
Loading
Loading
Loading
+20 −13
Original line number Original line Diff line number Diff line
@@ -194,7 +194,6 @@ struct rdac_dh_data {


#define RDAC_LUN_UNOWNED	0
#define RDAC_LUN_UNOWNED	0
#define RDAC_LUN_OWNED		1
#define RDAC_LUN_OWNED		1
#define RDAC_LUN_AVT		2
	char			lun_state;
	char			lun_state;


#define RDAC_PREFERRED		0
#define RDAC_PREFERRED		0
@@ -473,25 +472,33 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
	int err;
	int err;
	struct c9_inquiry *inqp;
	struct c9_inquiry *inqp;


	h->lun_state = RDAC_LUN_UNOWNED;
	h->state = RDAC_STATE_ACTIVE;
	h->state = RDAC_STATE_ACTIVE;
	err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h);
	err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h);
	if (err == SCSI_DH_OK) {
	if (err == SCSI_DH_OK) {
		inqp = &h->inq.c9;
		inqp = &h->inq.c9;
		if ((inqp->avte_cvp >> 7) == 0x1) {
		/* detect the operating mode */
			/* LUN in AVT mode */
		if ((inqp->avte_cvp >> 5) & 0x1)
			sdev_printk(KERN_NOTICE, sdev,
			h->mode = RDAC_MODE_IOSHIP; /* LUN in IOSHIP mode */
				    "%s: AVT mode detected\n",
		else if (inqp->avte_cvp >> 7)
				    RDAC_NAME);
			h->mode = RDAC_MODE_AVT; /* LUN in AVT mode */
			h->lun_state = RDAC_LUN_AVT;
		else
		} else if ((inqp->avte_cvp & 0x1) != 0) {
			h->mode = RDAC_MODE; /* LUN in RDAC mode */
			/* LUN was owned by the controller */

		/* Update ownership */
		if (inqp->avte_cvp & 0x1)
			h->lun_state = RDAC_LUN_OWNED;
			h->lun_state = RDAC_LUN_OWNED;
		}
		else {
			h->lun_state = RDAC_LUN_UNOWNED;
			if (h->mode == RDAC_MODE)
				h->state = RDAC_STATE_PASSIVE;
		}
		}


	if (h->lun_state == RDAC_LUN_UNOWNED)
		/* Update path prio*/
		h->state = RDAC_STATE_PASSIVE;
		if (inqp->path_prio & 0x1)
			h->preferred = RDAC_PREFERRED;
		else
			h->preferred = RDAC_NON_PREFERRED;
	}


	return err;
	return err;
}
}