Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: lpfc: vmid: Add datastructure for supporting VMID in lpfc

Add the primary datastructures needed to implement VMID in the lpfc
driver. Maintain the capability, current state, and hash table for the
vmid/appid along with other information. This implementation supports the
two versions of vmid implementation (app header and priority tagging).

Link: https://lore.kernel.org/r/20210608043556.274139-5-muneendra.kumar@broadcom.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Gaurav Srivastava <gaurav.srivastava@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Muneendra Kumar <muneendra.kumar@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Gaurav Srivastava and committed by
Martin K. Petersen
02169e84 3dbbca75

+262 -4
+122
drivers/scsi/lpfc/lpfc.h
··· 304 304 struct lpfc_hba; 305 305 306 306 307 + #define LPFC_VMID_TIMER 300 /* timer interval in seconds */ 308 + 309 + #define LPFC_MAX_VMID_SIZE 256 310 + #define LPFC_COMPRESS_VMID_SIZE 16 311 + 312 + union lpfc_vmid_io_tag { 313 + u32 app_id; /* App Id vmid */ 314 + u8 cs_ctl_vmid; /* Priority tag vmid */ 315 + }; 316 + 317 + #define JIFFIES_PER_HR (HZ * 60 * 60) 318 + 319 + struct lpfc_vmid { 320 + u8 flag; 321 + #define LPFC_VMID_SLOT_FREE 0x0 322 + #define LPFC_VMID_SLOT_USED 0x1 323 + #define LPFC_VMID_REQ_REGISTER 0x2 324 + #define LPFC_VMID_REGISTERED 0x4 325 + #define LPFC_VMID_DE_REGISTER 0x8 326 + char host_vmid[LPFC_MAX_VMID_SIZE]; 327 + union lpfc_vmid_io_tag un; 328 + struct hlist_node hnode; 329 + u64 io_rd_cnt; 330 + u64 io_wr_cnt; 331 + u8 vmid_len; 332 + u8 delete_inactive; /* Delete if inactive flag 0 = no, 1 = yes */ 333 + u32 hash_index; 334 + u64 __percpu *last_io_time; 335 + }; 336 + 337 + #define lpfc_vmid_is_type_priority_tag(vport)\ 338 + (vport->vmid_priority_tagging ? 1 : 0) 339 + 340 + #define LPFC_VMID_HASH_SIZE 256 341 + #define LPFC_VMID_HASH_MASK 255 342 + #define LPFC_VMID_HASH_SHIFT 6 343 + 344 + struct lpfc_vmid_context { 345 + struct lpfc_vmid *vmp; 346 + struct lpfc_nodelist *nlp; 347 + bool instantiated; 348 + }; 349 + 350 + struct lpfc_vmid_priority_range { 351 + u8 low; 352 + u8 high; 353 + u8 qos; 354 + }; 355 + 356 + struct lpfc_vmid_priority_info { 357 + u32 num_descriptors; 358 + struct lpfc_vmid_priority_range *vmid_range; 359 + }; 360 + 361 + #define QFPA_EVEN_ONLY 0x01 362 + #define QFPA_ODD_ONLY 0x02 363 + #define QFPA_EVEN_ODD 0x03 364 + 307 365 enum discovery_state { 308 366 LPFC_VPORT_UNKNOWN = 0, /* vport state is unknown */ 309 367 LPFC_VPORT_FAILED = 1, /* vport has failed */ ··· 501 443 #define WORKER_RAMP_DOWN_QUEUE 0x800 /* hba: Decrease Q depth */ 502 444 #define WORKER_RAMP_UP_QUEUE 0x1000 /* hba: Increase Q depth */ 503 445 #define WORKER_SERVICE_TXQ 0x2000 /* hba: IOCBs on the txq */ 446 + #define WORKER_CHECK_INACTIVE_VMID 0x4000 /* hba: check inactive vmids */ 447 + #define WORKER_CHECK_VMID_ISSUE_QFPA 0x8000 /* vport: Check if qfpa needs 448 + * to be issued */ 504 449 505 450 struct timer_list els_tmofunc; 506 451 struct timer_list delayed_disc_tmo; ··· 514 453 #define FC_LOADING 0x1 /* HBA in process of loading drvr */ 515 454 #define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */ 516 455 #define FC_ALLOW_FDMI 0x4 /* port is ready for FDMI requests */ 456 + #define FC_ALLOW_VMID 0x8 /* Allow VMID I/Os */ 457 + #define FC_DEREGISTER_ALL_APP_ID 0x10 /* Deregister all VMIDs */ 517 458 /* Vport Config Parameters */ 518 459 uint32_t cfg_scan_down; 519 460 uint32_t cfg_lun_queue_depth; ··· 534 471 uint32_t cfg_tgt_queue_depth; 535 472 uint32_t cfg_first_burst_size; 536 473 uint32_t dev_loss_tmo_changed; 474 + /* VMID parameters */ 475 + u8 lpfc_vmid_host_uuid[LPFC_COMPRESS_VMID_SIZE]; 476 + u32 max_vmid; /* maximum VMIDs allowed per port */ 477 + u32 cur_vmid_cnt; /* Current VMID count */ 478 + #define LPFC_MIN_VMID 4 479 + #define LPFC_MAX_VMID 255 480 + u32 vmid_inactivity_timeout; /* Time after which the VMID */ 481 + /* deregisters from switch */ 482 + u32 vmid_priority_tagging; 483 + #define LPFC_VMID_PRIO_TAG_DISABLE 0 /* Disable */ 484 + #define LPFC_VMID_PRIO_TAG_SUP_TARGETS 1 /* Allow supported targets only */ 485 + #define LPFC_VMID_PRIO_TAG_ALL_TARGETS 2 /* Allow all targets */ 486 + unsigned long *vmid_priority_range; 487 + #define LPFC_VMID_MAX_PRIORITY_RANGE 256 488 + #define LPFC_VMID_PRIORITY_BITMAP_SIZE 32 489 + u8 vmid_flag; 490 + #define LPFC_VMID_IN_USE 0x1 491 + #define LPFC_VMID_ISSUE_QFPA 0x2 492 + #define LPFC_VMID_QFPA_CMPL 0x4 493 + #define LPFC_VMID_QOS_ENABLED 0x8 494 + #define LPFC_VMID_TIMER_ENBLD 0x10 495 + struct fc_qfpa_res *qfpa_res; 537 496 538 497 struct fc_vport *fc_vport; 498 + 499 + struct lpfc_vmid *vmid; 500 + DECLARE_HASHTABLE(hash_table, 8); 501 + rwlock_t vmid_lock; 502 + struct lpfc_vmid_priority_info vmid_priority; 539 503 540 504 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS 541 505 struct dentry *debug_disc_trc; ··· 1030 940 struct nvmet_fc_target_port *targetport; 1031 941 lpfc_vpd_t vpd; /* vital product data */ 1032 942 943 + u32 cfg_max_vmid; /* maximum VMIDs allowed per port */ 944 + u32 cfg_vmid_app_header; 945 + #define LPFC_VMID_APP_HEADER_DISABLE 0 946 + #define LPFC_VMID_APP_HEADER_ENABLE 1 947 + u32 cfg_vmid_priority_tagging; 948 + u32 cfg_vmid_inactivity_timeout; /* Time after which the VMID */ 949 + /* deregisters from switch */ 1033 950 struct pci_dev *pcidev; 1034 951 struct list_head work_list; 1035 952 uint32_t work_ha; /* Host Attention Bits for WT */ ··· 1277 1180 struct list_head ct_ev_waiters; 1278 1181 struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX]; 1279 1182 uint32_t ctx_idx; 1183 + struct timer_list inactive_vmid_poll; 1280 1184 1281 1185 /* RAS Support */ 1282 1186 struct lpfc_ras_fwlog ras_fwlog; ··· 1518 1420 } \ 1519 1421 } \ 1520 1422 return name; \ 1423 + } 1424 + 1425 + /** 1426 + * lpfc_is_vmid_enabled - returns if VMID is enabled for either switch types 1427 + * @phba: Pointer to HBA context object. 1428 + * 1429 + * Relationship between the enable, target support and if vmid tag is required 1430 + * for the particular combination 1431 + * --------------------------------------------------- 1432 + * Switch Enable Flag Target Support VMID Needed 1433 + * --------------------------------------------------- 1434 + * App Id 0 NA N 1435 + * App Id 1 0 N 1436 + * App Id 1 1 Y 1437 + * Pr Tag 0 NA N 1438 + * Pr Tag 1 0 N 1439 + * Pr Tag 1 1 Y 1440 + * Pr Tag 2 * Y 1441 + --------------------------------------------------- 1442 + * 1443 + **/ 1444 + static inline int lpfc_is_vmid_enabled(struct lpfc_hba *phba) 1445 + { 1446 + return phba->cfg_vmid_app_header || phba->cfg_vmid_priority_tagging; 1521 1447 }
+11
drivers/scsi/lpfc/lpfc_crtn.h
··· 608 608 extern union lpfc_wqe128 lpfc_iread_cmd_template; 609 609 extern union lpfc_wqe128 lpfc_iwrite_cmd_template; 610 610 extern union lpfc_wqe128 lpfc_icmnd_cmd_template; 611 + 612 + /* vmid interface */ 613 + int lpfc_vmid_uvem(struct lpfc_vport *vport, struct lpfc_vmid *vmid, bool ins); 614 + uint32_t lpfc_vmid_get_cs_ctl(struct lpfc_vport *vport); 615 + int lpfc_vmid_cmd(struct lpfc_vport *vport, 616 + int cmdcode, struct lpfc_vmid *vmid); 617 + int lpfc_vmid_hash_fn(const char *vmid, int len); 618 + struct lpfc_vmid *lpfc_get_vmid_from_hashtable(struct lpfc_vport *vport, 619 + uint32_t hash, uint8_t *buf); 620 + void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport); 621 + int lpfc_issue_els_qfpa(struct lpfc_vport *vport);
+1
drivers/scsi/lpfc/lpfc_disc.h
··· 125 125 uint8_t nlp_fcp_info; /* class info, bits 0-3 */ 126 126 #define NLP_FCP_2_DEVICE 0x10 /* FCP-2 device */ 127 127 u8 nlp_nvme_info; /* NVME NSLER Support */ 128 + uint8_t vmid_support; /* destination VMID support */ 128 129 #define NLP_NVME_NSLER 0x1 /* NVME NSLER device */ 129 130 130 131 struct timer_list nlp_delayfunc; /* Used for delayed ELS cmds */
+120 -4
drivers/scsi/lpfc/lpfc_hw.h
··· 275 275 #define SLI_CT_ACCESS_DENIED 0x10 276 276 #define SLI_CT_INVALID_PORT_ID 0x11 277 277 #define SLI_CT_DATABASE_EMPTY 0x12 278 + #define SLI_CT_APP_ID_NOT_AVAILABLE 0x40 278 279 279 280 /* 280 281 * Name Server Command Codes ··· 401 400 uint16_t altBbCredit:1; /* FC Word 1, bit 27 */ 402 401 uint16_t edtovResolution:1; /* FC Word 1, bit 26 */ 403 402 uint16_t multicast:1; /* FC Word 1, bit 25 */ 404 - uint16_t broadcast:1; /* FC Word 1, bit 24 */ 403 + uint16_t app_hdr_support:1; /* FC Word 1, bit 24 */ 405 404 406 - uint16_t huntgroup:1; /* FC Word 1, bit 23 */ 405 + uint16_t priority_tagging:1; /* FC Word 1, bit 23 */ 407 406 uint16_t simplex:1; /* FC Word 1, bit 22 */ 408 407 uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */ 409 408 uint16_t dhd:1; /* FC Word 1, bit 18 */ 410 409 uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */ 411 410 uint16_t payloadlength:1; /* FC Word 1, bit 16 */ 412 411 #else /* __LITTLE_ENDIAN_BITFIELD */ 413 - uint16_t broadcast:1; /* FC Word 1, bit 24 */ 412 + uint16_t app_hdr_support:1; /* FC Word 1, bit 24 */ 414 413 uint16_t multicast:1; /* FC Word 1, bit 25 */ 415 414 uint16_t edtovResolution:1; /* FC Word 1, bit 26 */ 416 415 uint16_t altBbCredit:1; /* FC Word 1, bit 27 */ ··· 424 423 uint16_t dhd:1; /* FC Word 1, bit 18 */ 425 424 uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */ 426 425 uint16_t simplex:1; /* FC Word 1, bit 22 */ 427 - uint16_t huntgroup:1; /* FC Word 1, bit 23 */ 426 + uint16_t priority_tagging:1; /* FC Word 1, bit 23 */ 428 427 #endif 429 428 430 429 uint8_t bbRcvSizeMsb; /* Upper nibble is reserved */ ··· 608 607 #define ELS_CMD_LIRR 0x7A000000 609 608 #define ELS_CMD_LCB 0x81000000 610 609 #define ELS_CMD_FPIN 0x16000000 610 + #define ELS_CMD_QFPA 0xB0000000 611 + #define ELS_CMD_UVEM 0xB1000000 611 612 #else /* __LITTLE_ENDIAN_BITFIELD */ 612 613 #define ELS_CMD_MASK 0xffff 613 614 #define ELS_RSP_MASK 0xff ··· 652 649 #define ELS_CMD_LIRR 0x7A 653 650 #define ELS_CMD_LCB 0x81 654 651 #define ELS_CMD_FPIN ELS_FPIN 652 + #define ELS_CMD_QFPA 0xB0 653 + #define ELS_CMD_UVEM 0xB1 655 654 #endif 656 655 657 656 /* ··· 1321 1316 struct fc_rdp_opd_sfp_desc opd_desc; /* FC word 68-84*/ 1322 1317 }; 1323 1318 1319 + 1320 + /* UVEM */ 1321 + 1322 + #define LPFC_UVEM_SIZE 60 1323 + #define LPFC_UVEM_VEM_ID_DESC_SIZE 16 1324 + #define LPFC_UVEM_VE_MAP_DESC_SIZE 20 1325 + 1326 + #define VEM_ID_DESC_TAG 0x0001000A 1327 + struct lpfc_vem_id_desc { 1328 + uint32_t tag; 1329 + uint32_t length; 1330 + uint8_t vem_id[16]; 1331 + }; 1332 + 1333 + #define LPFC_QFPA_SIZE 4 1334 + 1335 + #define INSTANTIATED_VE_DESC_TAG 0x0001000B 1336 + struct instantiated_ve_desc { 1337 + uint32_t tag; 1338 + uint32_t length; 1339 + uint8_t global_vem_id[16]; 1340 + uint32_t word6; 1341 + #define lpfc_instantiated_local_id_SHIFT 0 1342 + #define lpfc_instantiated_local_id_MASK 0x000000ff 1343 + #define lpfc_instantiated_local_id_WORD word6 1344 + #define lpfc_instantiated_nport_id_SHIFT 8 1345 + #define lpfc_instantiated_nport_id_MASK 0x00ffffff 1346 + #define lpfc_instantiated_nport_id_WORD word6 1347 + }; 1348 + 1349 + #define DEINSTANTIATED_VE_DESC_TAG 0x0001000C 1350 + struct deinstantiated_ve_desc { 1351 + uint32_t tag; 1352 + uint32_t length; 1353 + uint8_t global_vem_id[16]; 1354 + uint32_t word6; 1355 + #define lpfc_deinstantiated_nport_id_SHIFT 0 1356 + #define lpfc_deinstantiated_nport_id_MASK 0x000000ff 1357 + #define lpfc_deinstantiated_nport_id_WORD word6 1358 + #define lpfc_deinstantiated_local_id_SHIFT 24 1359 + #define lpfc_deinstantiated_local_id_MASK 0x00ffffff 1360 + #define lpfc_deinstantiated_local_id_WORD word6 1361 + }; 1362 + 1363 + /* Query Fabric Priority Allocation Response */ 1364 + #define LPFC_PRIORITY_RANGE_DESC_SIZE 12 1365 + 1366 + struct priority_range_desc { 1367 + uint32_t tag; 1368 + uint32_t length; 1369 + uint8_t lo_range; 1370 + uint8_t hi_range; 1371 + uint8_t qos_priority; 1372 + uint8_t local_ve_id; 1373 + }; 1374 + 1375 + struct fc_qfpa_res { 1376 + uint32_t reply_sequence; /* LS_ACC or LS_RJT */ 1377 + uint32_t length; /* FC Word 1 */ 1378 + struct priority_range_desc desc[1]; 1379 + }; 1380 + 1381 + /* Application Server command code */ 1382 + /* VMID */ 1383 + 1384 + #define SLI_CT_APP_SEV_Subtypes 0x20 /* Application Server subtype */ 1385 + 1386 + #define SLI_CTAS_GAPPIA_ENT 0x0100 /* Get Application Identifier */ 1387 + #define SLI_CTAS_GALLAPPIA 0x0101 /* Get All Application Identifier */ 1388 + #define SLI_CTAS_GALLAPPIA_ID 0x0102 /* Get All Application Identifier */ 1389 + /* for Nport */ 1390 + #define SLI_CTAS_GAPPIA_IDAPP 0x0103 /* Get Application Identifier */ 1391 + /* for Nport */ 1392 + #define SLI_CTAS_RAPP_IDENT 0x0200 /* Register Application Identifier */ 1393 + #define SLI_CTAS_DAPP_IDENT 0x0300 /* Deregister Application */ 1394 + /* Identifier */ 1395 + #define SLI_CTAS_DALLAPP_ID 0x0301 /* Deregister All Application */ 1396 + /* Identifier */ 1397 + 1398 + struct entity_id_object { 1399 + uint8_t entity_id_len; 1400 + uint8_t entity_id[255]; /* VM UUID */ 1401 + }; 1402 + 1403 + struct app_id_object { 1404 + uint32_t port_id; 1405 + uint32_t app_id; 1406 + struct entity_id_object obj; 1407 + }; 1408 + 1409 + struct lpfc_vmid_rapp_ident_list { 1410 + uint32_t no_of_objects; 1411 + struct entity_id_object obj[1]; 1412 + }; 1413 + 1414 + struct lpfc_vmid_dapp_ident_list { 1415 + uint32_t no_of_objects; 1416 + struct entity_id_object obj[1]; 1417 + }; 1418 + 1419 + #define GALLAPPIA_ID_LAST 0x80 1420 + struct lpfc_vmid_gallapp_ident_list { 1421 + uint8_t control; 1422 + uint8_t reserved[3]; 1423 + struct app_id_object app_id; 1424 + }; 1425 + 1426 + #define RAPP_IDENT_OFFSET (offsetof(struct lpfc_sli_ct_request, un) + 4) 1427 + #define DAPP_IDENT_OFFSET (offsetof(struct lpfc_sli_ct_request, un) + 4) 1428 + #define GALLAPPIA_ID_SIZE (offsetof(struct lpfc_sli_ct_request, un) + 4) 1429 + #define DALLAPP_ID_SIZE (offsetof(struct lpfc_sli_ct_request, un) + 4) 1324 1430 1325 1431 /******** FDMI ********/ 1326 1432
+8
drivers/scsi/lpfc/lpfc_sli.h
··· 35 35 LPFC_CTX_HOST 36 36 } lpfc_ctx_cmd; 37 37 38 + union lpfc_vmid_iocb_tag { 39 + uint32_t app_id; 40 + uint8_t cs_ctl_vmid; 41 + struct lpfc_vmid_context *vmid_context; /* UVEM context information */ 42 + }; 43 + 38 44 struct lpfc_cq_event { 39 45 struct list_head list; 40 46 uint16_t hdwq; ··· 106 100 #define LPFC_IO_NVME 0x200000 /* NVME FCP command */ 107 101 #define LPFC_IO_NVME_LS 0x400000 /* NVME LS command */ 108 102 #define LPFC_IO_NVMET 0x800000 /* NVMET command */ 103 + #define LPFC_IO_VMID 0x1000000 /* VMID tagged IO */ 109 104 110 105 uint32_t drvrTimeout; /* driver timeout in seconds */ 111 106 struct lpfc_vport *vport;/* virtual port pointer */ ··· 122 115 struct lpfc_node_rrq *rrq; 123 116 } context_un; 124 117 118 + union lpfc_vmid_iocb_tag vmid_tag; 125 119 void (*fabric_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, 126 120 struct lpfc_iocbq *); 127 121 void (*wait_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *,