Commit 045c58c8 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Rework FDMI attribute registration for unintential padding

Removed the lpfc_fdmi_attr_entry and lpfc_fdmi_attr_def structures that had
a union causing unintentional zero padding, which required the usage of
__packed.  They are replaced with explicit lpfc_fdmi_attr_u32,
lpfc_fdmi_attr_wwn, lpfc_fdmi_attr_fc4types, and lpfc_fdmi_attr_string
structure defines instead of living in a union.  This rids of ambiguous
compiler zero padding, and entailed cleaning up bitwise endian
declarations.

As such, all FDMI attribute registration routines are replaced with generic
void *arg and handlers for each of the newly defined attribute structure
types.

Link: https://lore.kernel.org/r/20220911221505.117655-11-jsmart2021@gmail.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2649809c
This diff is collapsed.
......@@ -1442,30 +1442,56 @@ struct lpfc_vmid_gallapp_ident_list {
/* Definitions for HBA / Port attribute entries */
/* Attribute Entry */
struct lpfc_fdmi_attr_entry {
union {
uint32_t AttrInt;
uint8_t AttrTypes[32];
uint8_t AttrString[256];
struct lpfc_name AttrWWN;
} un;
/* Attribute Entry Structures */
struct lpfc_fdmi_attr_u32 {
__be16 type;
__be16 len;
__be32 value_u32;
};
struct lpfc_fdmi_attr_def { /* Defined in TLV format */
/* Structure is in Big Endian format */
uint32_t AttrType:16;
uint32_t AttrLen:16;
/* Marks start of Value (ATTRIBUTE_ENTRY) */
struct lpfc_fdmi_attr_entry AttrValue;
} __packed;
struct lpfc_fdmi_attr_wwn {
__be16 type;
__be16 len;
/* Keep as u8[8] instead of __be64 to avoid accidental zero padding
* by compiler
*/
u8 name[8];
};
struct lpfc_fdmi_attr_fullwwn {
__be16 type;
__be16 len;
/* Keep as u8[8] instead of __be64 to avoid accidental zero padding
* by compiler
*/
u8 nname[8];
u8 pname[8];
};
struct lpfc_fdmi_attr_fc4types {
__be16 type;
__be16 len;
u8 value_types[32];
};
struct lpfc_fdmi_attr_string {
__be16 type;
__be16 len;
char value_string[256];
};
/* Maximum FDMI attribute length is Type+Len (4 bytes) + 256 byte string */
#define FDMI_MAX_ATTRLEN sizeof(struct lpfc_fdmi_attr_string)
/*
* HBA Attribute Block
*/
struct lpfc_fdmi_attr_block {
uint32_t EntryCnt; /* Number of HBA attribute entries */
struct lpfc_fdmi_attr_entry Entry; /* Variable-length array */
/* Variable Length Attribute Entry TLV's follow */
};
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment