Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2012 06:38:38 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r235462 - projects/zfsd/head/sys/cam/scsi
Message-ID:  <201205150638.q4F6ccPa071624@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue May 15 06:38:38 2012
New Revision: 235462
URL: http://svn.freebsd.org/changeset/base/235462

Log:
  Add workaround for broken Supermicro backplanes, reporting wrong value in
  ELEMENT INDEX field. If index of element for which additional status is
  not supported is detected, ignore this and further indexes, trying to
  assign elements sequentially.

Modified:
  projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c

Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c	Tue May 15 04:55:15 2012	(r235461)
+++ projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c	Tue May 15 06:38:38 2012	(r235462)
@@ -1670,9 +1670,10 @@ static int
 ses_process_elm_addlstatus(enc_softc_t *enc, struct enc_fsm_state *state,
     union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 {
-	struct ses_iterator iter;
+	struct ses_iterator iter, titer;
 	int eip;
 	int err;
+	int ignore_index = 0;
 	int length;
 	int offset;
 	enc_cache_t *enc_cache;
@@ -1680,7 +1681,7 @@ ses_process_elm_addlstatus(enc_softc_t *
 	uint8_t *buf;
 	ses_element_t *elmpriv;
 	const struct ses_page_hdr *hdr;
-	enc_element_t *element;
+	enc_element_t *element, *telement;
 
 	enc_cache = &enc->enc_daemon_cache;
 	ses_cache = enc_cache->private;
@@ -1743,15 +1744,24 @@ ses_process_elm_addlstatus(enc_softc_t *
 
 		elm_hdr = (struct ses_elm_addlstatus_base_hdr *)&buf[offset];
 		eip = ses_elm_addlstatus_eip(elm_hdr);
-		if (eip) {
+		if (eip && !ignore_index) {
 			struct ses_elm_addlstatus_eip_hdr *eip_hdr;
 			int expected_index;
 
 			eip_hdr = (struct ses_elm_addlstatus_eip_hdr *)elm_hdr;
 			expected_index = iter.individual_element_index;
-			element = ses_iter_seek_to(&iter,
+			titer = iter;
+			telement = ses_iter_seek_to(&titer,
 						   eip_hdr->element_index,
 						   SES_ELEM_INDEX_INDIVIDUAL);
+			if (telement != NULL &&
+			    (ses_typehasaddlstatus(enc, titer.type_index) !=
+			     TYPE_ADDLSTATUS_NONE ||
+			     titer.type_index > ELMTYP_SAS_CONN)) {
+				iter = titer;
+				element = telement;
+			} else
+				ignore_index = 1;
 
 			if (iter.individual_element_index > expected_index
 			 && status_type == TYPE_ADDLSTATUS_MANDATORY) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205150638.q4F6ccPa071624>