Add support for EIIOE flag in Additional Element Status.

It was added in SES-3 spec, and its support required to properly link
the Additional Element Status page data to the original elements.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
This commit is contained in:
Alexander Motin 2016-11-07 18:21:53 +00:00
parent 69cab2d1bf
commit bceff6e30a
2 changed files with 21 additions and 9 deletions

View File

@ -1758,14 +1758,20 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct enc_fsm_state *state,
eip = ses_elm_addlstatus_eip(elm_hdr);
if (eip && !ignore_index) {
struct ses_elm_addlstatus_eip_hdr *eip_hdr;
int expected_index;
int expected_index, index;
ses_elem_index_type_t index_type;
eip_hdr = (struct ses_elm_addlstatus_eip_hdr *)elm_hdr;
expected_index = iter.individual_element_index;
if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) {
index_type = SES_ELEM_INDEX_GLOBAL;
expected_index = iter.global_element_index;
} else {
index_type = SES_ELEM_INDEX_INDIVIDUAL;
expected_index = iter.individual_element_index;
}
titer = iter;
telement = ses_iter_seek_to(&titer,
eip_hdr->element_index,
SES_ELEM_INDEX_INDIVIDUAL);
eip_hdr->element_index, index_type);
if (telement != NULL &&
(ses_typehasaddlstatus(enc, titer.type_index) !=
TYPE_ADDLSTATUS_NONE ||
@ -1775,13 +1781,18 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct enc_fsm_state *state,
} else
ignore_index = 1;
if (iter.individual_element_index > expected_index
if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE)
index = iter.global_element_index;
else
index = iter.individual_element_index;
if (index > expected_index
&& status_type == TYPE_ADDLSTATUS_MANDATORY) {
ENC_VLOG(enc, "%s: provided element "
ENC_VLOG(enc, "%s: provided %s element"
"index %d skips mandatory status "
" element at index %d\n",
__func__, eip_hdr->element_index,
expected_index);
__func__, (eip_hdr->byte2 &
SES_ADDL_EIP_EIIOE) ? "global " : "",
index, expected_index);
}
}
elmpriv = element->elm_private;

View File

@ -2413,7 +2413,8 @@ int ses_elm_addlstatus_invalid(struct ses_elm_addlstatus_base_hdr *);
struct ses_elm_addlstatus_eip_hdr {
struct ses_elm_addlstatus_base_hdr base;
uint8_t reserved;
uint8_t byte2;
#define SES_ADDL_EIP_EIIOE 1
uint8_t element_index;
/* NB: This define (currently) applies to all eip=1 headers */
#define SES_EIP_HDR_EXTRA_LEN 2