Skip to content

Commit 19d7102

Browse files
andy-shevmartinkpetersen
authored andcommitted
scsi: lpfc: Do not abuse UUID APIs and LPFC_COMPRESS_VMID_SIZE
The lpfc_vmid_host_uuid is not defined as uuid_t and its usage is not the same as for uuid_t operations (like exporting or importing). Hence replace call to uuid_is_null() by respective memchr_inv() without abusing casting. With that, replace LPFC_COMPRESS_VMID_SIZE with plain number and respective sizeof() to make code robust to changes in the future, if any. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Justin Tee <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 04aff45 commit 19d7102

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/scsi/lpfc/lpfc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ struct lpfc_hba;
309309
#define LPFC_VMID_TIMER 300 /* timer interval in seconds */
310310

311311
#define LPFC_MAX_VMID_SIZE 256
312-
#define LPFC_COMPRESS_VMID_SIZE 16
313312

314313
union lpfc_vmid_io_tag {
315314
u32 app_id; /* App Id vmid */
@@ -667,7 +666,7 @@ struct lpfc_vport {
667666
uint32_t cfg_first_burst_size;
668667
uint32_t dev_loss_tmo_changed;
669668
/* VMID parameters */
670-
u8 lpfc_vmid_host_uuid[LPFC_COMPRESS_VMID_SIZE];
669+
u8 lpfc_vmid_host_uuid[16];
671670
u32 max_vmid; /* maximum VMIDs allowed per port */
672671
u32 cur_vmid_cnt; /* Current VMID count */
673672
#define LPFC_MIN_VMID 4

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,8 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
13311331
if (phba->cfg_vmid_priority_tagging) {
13321332
sp->cmn.priority_tagging = 1;
13331333
/* lpfc_vmid_host_uuid is combination of wwpn and wwnn */
1334-
if (uuid_is_null((uuid_t *)vport->lpfc_vmid_host_uuid)) {
1334+
if (!memchr_inv(vport->lpfc_vmid_host_uuid, 0,
1335+
sizeof(vport->lpfc_vmid_host_uuid))) {
13351336
memcpy(vport->lpfc_vmid_host_uuid, phba->wwpn,
13361337
sizeof(phba->wwpn));
13371338
memcpy(&vport->lpfc_vmid_host_uuid[8], phba->wwnn,
@@ -12357,9 +12358,10 @@ lpfc_vmid_uvem(struct lpfc_vport *vport,
1235712358
elsiocb->vmid_tag.vmid_context = vmid_context;
1235812359
pcmd = (u8 *)elsiocb->cmd_dmabuf->virt;
1235912360

12360-
if (uuid_is_null((uuid_t *)vport->lpfc_vmid_host_uuid))
12361+
if (!memchr_inv(vport->lpfc_vmid_host_uuid, 0,
12362+
sizeof(vport->lpfc_vmid_host_uuid)))
1236112363
memcpy(vport->lpfc_vmid_host_uuid, vmid->host_vmid,
12362-
LPFC_COMPRESS_VMID_SIZE);
12364+
sizeof(vport->lpfc_vmid_host_uuid));
1236312365

1236412366
*((u32 *)(pcmd)) = ELS_CMD_UVEM;
1236512367
len = (u32 *)(pcmd + 4);
@@ -12369,13 +12371,13 @@ lpfc_vmid_uvem(struct lpfc_vport *vport,
1236912371
vem_id_desc->tag = be32_to_cpu(VEM_ID_DESC_TAG);
1237012372
vem_id_desc->length = be32_to_cpu(LPFC_UVEM_VEM_ID_DESC_SIZE);
1237112373
memcpy(vem_id_desc->vem_id, vport->lpfc_vmid_host_uuid,
12372-
LPFC_COMPRESS_VMID_SIZE);
12374+
sizeof(vem_id_desc->vem_id));
1237312375

1237412376
inst_desc = (struct instantiated_ve_desc *)(pcmd + 32);
1237512377
inst_desc->tag = be32_to_cpu(INSTANTIATED_VE_DESC_TAG);
1237612378
inst_desc->length = be32_to_cpu(LPFC_UVEM_VE_MAP_DESC_SIZE);
1237712379
memcpy(inst_desc->global_vem_id, vmid->host_vmid,
12378-
LPFC_COMPRESS_VMID_SIZE);
12380+
sizeof(inst_desc->global_vem_id));
1237912381

1238012382
bf_set(lpfc_instantiated_nport_id, inst_desc, vport->fc_myDID);
1238112383
bf_set(lpfc_instantiated_local_id, inst_desc,

0 commit comments

Comments
 (0)