qla2xxx SAN Congestion Management (SCM) support
Nilesh Javali
maintainerv2 cover qla2xxx SAN Congestion Management (SCM) support
Martin,
Please apply the updated qla2xxx patch series implementing SAN Congestion Management (SCM) support to the scsi tree at your earliest convenience.
We will follow this up with another patchset to add SCM statistics to the scsi transport fc, as recommended by James.
v1->v2:
1. Applied changes to address warnings highlighted by Bart.
2. Removed data structures and functions that should be part of fc transport, to be send out in a follow-up patchset.
3. Changed the existing code to use definitions from fc transport headers.
Thanks,
Nilesh
Shyam Sundar (2):
qla2xxx: Change in PUREX to handle FPIN ELS requests.
qla2xxx: SAN congestion management(SCM) implementation.
drivers/scsi/qla2xxx/qla_dbg.c | 13 +- drivers/scsi/qla2xxx/qla_def.h | 71 +++++++- drivers/scsi/qla2xxx/qla_fw.h | 6 +- drivers/scsi/qla2xxx/qla_gbl.h | 4 +- drivers/scsi/qla2xxx/qla_init.c | 9 +- drivers/scsi/qla2xxx/qla_isr.c | 291 +++++++++++++++++++++++++++----- drivers/scsi/qla2xxx/qla_mbx.c | 64 ++++++- drivers/scsi/qla2xxx/qla_os.c | 37 +++- include/uapi/scsi/fc/fc_els.h | 1 + 9 files changed, 428 insertions(+), 68 deletions(-)
base-commit: 47742bde281b2920aae8bb82ed2d61d890aa4f56
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH v2 1/2 qla2xxx: Change in PUREX to handle FPIN ELS requests.
From: Shyam Sundar <[email protected]>
SAN Congestion Management generates ELS pkts whose size can vary, and be > 64 bytes. Change the purex handling code to support non standard ELS pkt size.
--- drivers/scsi/qla2xxx/qla_def.h | 20 +++++- drivers/scsi/qla2xxx/qla_gbl.h | 3 +- drivers/scsi/qla2xxx/qla_isr.c | 116 ++++++++++++++++++++++++--------- drivers/scsi/qla2xxx/qla_mbx.c | 22 +++++-- drivers/scsi/qla2xxx/qla_os.c | 19 ++++-- include/uapi/scsi/fc/fc_els.h | 1 + 6 files changed, 139 insertions(+), 42 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +18 -2
@@ -34,6 +34,8 @@#include <scsi/scsi_transport_fc.h> #include <scsi/scsi_bsg_fc.h> +#include <uapi/scsi/fc/fc_els.h> +/* Big endian Fibre Channel S_ID (source ID) or D_ID (destination ID). */ typedef struct { uint8_t domain;
@@ -1269,7 +1271,11 @@ static inline bool qla2xxx_is_valid_mbs(unsigned int mbs)#define RNID_TYPE_ASIC_TEMP 0xC#define ELS_CMD_MAP_SIZE 32 -#define ELS_COMMAND_RDP 0x18 +#define ELS_COMMAND_RDP ELS_RDP +/* Fabric Perf Impact Notification */ +#define ELS_COMMAND_FPIN ELS_FPIN +/* Read Diagnostic Functions */ +#define ELS_COMMAND_RDF ELS_RDF/* * Firmware state codes from get firmware state mailbox command
@@ -4487,10 +4493,19 @@ struct active_regions {#define QLA_SET_DATA_RATE_NOLR 1#define QLA_SET_DATA_RATE_LR 2/* Set speed and initiate LR */ +#define QLA_DEFAULT_PAYLOAD_SIZE 64 +/* +* This item might be allocated with a size > sizeof(struct purex_item). +* The "size" variable gives the size of the payload (which +* is variable) starting at "iocb". +*/ struct purex_item {struct list_head list;struct scsi_qla_host *vha; -void (*process_item)(struct scsi_qla_host *vha,void *pkt); +void (*process_item)(struct scsi_qla_host *vha, +struct purex_item *pkt); +atomic_t in_use; +uint16_t size;struct {uint8_t iocb[64 ]; } iocb;
@@ -4690,6 +4705,7 @@ typedef struct scsi_qla_host {struct list_head head;spinlock_t lock; } purex_list; +struct purex_item default_item;struct name_list_extended gnl;/* Count of active session/fcport */
drivers/scsi/qla2xxx/qla_gbl.h +2 -1
@@ -229,7 +229,8 @@ void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *,int qla24xx_post_gnl_work (struct scsi_qla_host *,fc_port_t *);int qla24xx_post_relogin_work (struct scsi_qla_host *vha);void qla2x00_wait_for_sess_deletion (scsi_qla_host_t *); -void qla24xx_process_purex_rdp (struct scsi_qla_host *vha,void *pkt); +void qla24xx_process_purex_rdp (struct scsi_qla_host *vha, +struct purex_item *pkt);/* * Global Functions in qla_mid.c source file.
drivers/scsi/qla2xxx/qla_isr.c +86 -30
148 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_mbx.c +17 -5
@@ -59,6 +59,7 @@ static struct rom_cmd { { MBC_IOCB_COMMAND_A64 }, { MBC_GET_ADAPTER_LOOP_ID }, { MBC_READ_SFP }, + { MBC_SET_RNID_PARAMS }, { MBC_GET_RNID_PARAMS }, { MBC_GET_SET_ZIO_THRESHOLD }, };
@@ -4867,6 +4868,7 @@ qla24xx_get_port_login_templ(scsi_qla_host_t *vha, dma_addr_t buf_dma,return rval; } +#define PUREX_CMD_COUNT 2int qla25xx_set_els_cmds_supported (scsi_qla_host_t *vha) {
@@ -4875,12 +4877,12 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha)mbx_cmd_t *mcp = &mc;uint8_t *els_cmd_map;dma_addr_t els_cmd_map_dma; -uint cmd_opcode =ELS_COMMAND_RDP ; -uint index = cmd_opcode /8 ; -uint bit = cmd_opcode %8 ; +uint cmd_opcode[PUREX_CMD_COUNT ]; +uint i, index, purex_bit;struct qla_hw_data *ha = vha->hw; -if (!IS_QLA25XX (ha) && !IS_QLA2031 (ha) && !IS_QLA27XX (ha)) +if (!IS_QLA25XX (ha) && !IS_QLA2031 (ha) && + !IS_QLA27XX (ha) && !IS_QLA28XX (ha))return QLA_SUCCESS ; ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1197,
@@ -4896,7 +4898,17 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha)memset (els_cmd_map,0 ,ELS_CMD_MAP_SIZE ); - els_cmd_map[index] |=1 << bit; +memset (els_cmd_map,0 ,ELS_CMD_MAP_SIZE ); + +/* List of Purex ELS */ + cmd_opcode[0 ] =ELS_COMMAND_FPIN ; + cmd_opcode[1 ] =ELS_COMMAND_RDP ; + +for (i =0 ; i <PUREX_CMD_COUNT ; i++) { + index = cmd_opcode[i] /8 ; + purex_bit = cmd_opcode[i] %8 ; + els_cmd_map[index] |=1 << purex_bit; + } mcp->mb[0 ] =MBC_SET_RNID_PARAMS ; mcp->mb[1 ] =RNID_TYPE_ELS_CMD <<8 ;
drivers/scsi/qla2xxx/qla_os.c +15 -4
@@ -5891,10 +5891,12 @@ qla25xx_rdp_port_speed_currently(struct qla_hw_data *ha)* vha: SCSI qla host * purex: RDP request received by HBA */ -void qla24xx_process_purex_rdp (struct scsi_qla_host *vha,void *pkt) +void qla24xx_process_purex_rdp (struct scsi_qla_host *vha, +struct purex_item *item) {struct qla_hw_data *ha = vha->hw; -struct purex_entry_24xx *purex = pkt; +struct purex_entry_24xx *purex = + (struct purex_entry_24xx *)&item->iocb;dma_addr_t rsp_els_dma;dma_addr_t rsp_payload_dma;dma_addr_t stat_dma;
@@ -6304,6 +6306,15 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha, void *pkt) rsp_els, rsp_els_dma); } +void +qla24xx_free_purex_item (struct purex_item *item) +{ +if (item == &item->vha->default_item) +memset (&item->vha->default_item,0 ,sizeof (struct purex_item )); +else +kfree (item); +} +void qla24xx_process_purex_list (struct purex_list *list) {struct list_head head =LIST_HEAD_INIT (head);
@@ -6316,8 +6327,8 @@ void qla24xx_process_purex_list(struct purex_list *list)list_for_each_entry_safe (item, next, &head, list) {list_del (&item->list); - item->process_item (item->vha, &item->iocb); -kfree (item); + item->process_item (item->vha, item); +qla24xx_free_purex_item (item); } }
include/uapi/scsi/fc/fc_els.h +1 -0
@@ -41,6 +41,7 @@ enum fc_els_cmd {ELS_REC =0x13 ,/* read exchange concise */ ELS_SRR =0x14 ,/* sequence retransmission request */ ELS_FPIN =0x16 ,/* Fabric Performance Impact Notification */ +ELS_RDP =0x18 ,/* Read Diagnostic Parameters */ ELS_RDF =0x19 ,/* Register Diagnostic Functions */ ELS_PRLI =0x20 ,/* process login */ ELS_PRLO = 0x21, /* process logout */
base-commit: 47742bde281b2920aae8bb82ed2d61d890aa4f56
Signature · 1 line
2.19.0.rc0
Re: [PATCH v2 1/2] qla2xxx: Change in PUREX to handle FPIN ELS requests.
Quoted 6 lines · Nilesh Javali
From: Shyam Sundar <[email protected]>
SAN Congestion Management generates ELS pkts whose size can vary, and be > 64 bytes. Change the purex handling code to support non standard ELS pkt size.
Quoted 6 lines
Signed-off-by Shyam Sundar <[email protected]>Reviewed-by Arun Easi <[email protected]>Reviewed-by Bart Van Assche <[email protected]>Reviewed-by Himanshu Madhani <[email protected]>Reviewed-by James Smart <[email protected]>Signed-off-by Nilesh Javali <[email protected]>
Has anyone other than Himanshu ever posted a positive review for this patch? I can't find the other review tags here:
https://lore.kernel.org/linux-scsi/[email protected]/
Bart.
Nilesh Javali
maintainerRE: [EXT] Re: [PATCH v2 1/2] qla2xxx: Change in PUREX to handle FPIN ELS requests.
Bart,
Sure, I would remove the tags and re-post the patch set.
Thanks,
Nilesh
Quoted 36 lines
-----Original Message-----
From: Bart Van Assche <[email protected]>
Sent: Tuesday, June 9, 2020 1:07 AM
To: Nilesh Javali <[email protected]>; [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: [EXT] Re: [PATCH v2 1/2] qla2xxx: Change in PUREX to handle FPIN ELS requests.External Email
----------------------------------------------------------------------
Quoted 6 lines · Nilesh Javali
From: Shyam Sundar <[email protected]>
SAN Congestion Management generates ELS pkts whose size can vary, and be > 64 bytes. Change the purex handling code to support non standard ELS pkt size.
Quoted 6 lines
Signed-off-by Shyam Sundar <[email protected]>Reviewed-by Arun Easi <[email protected]>Reviewed-by Bart Van Assche <[email protected]>Reviewed-by Himanshu Madhani <[email protected]>Reviewed-by James Smart <[email protected]>Signed-off-by Nilesh Javali <[email protected]>Has anyone other than Himanshu ever posted a positive review for this patch? I can't find the other review tags here:
https://urldefense.proofpoint.com/v2/url?u=https-
3A__lore.kernel.org_linux-2Dscsi_20200514101026.10040-2D1-2Dnjavali- 40marvell.com_&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FAW9wuzbtH IZL7SV63sr8rG59Hctu-eGu0G9pxwOXgQ&m=WrKsjn8ilzVn32q- 9eMHbnUUvl1cpj06n4fKq8KfBhc&s=gm2J0Gh3hotgenLae9uFvfCiD9MK7iYGn aYhYrnSwzs&e=Bart.
Nilesh Javali
maintainerRE: [EXT] Re: [PATCH v2 1/2] qla2xxx: Change in PUREX to handle FPIN ELS requests.
Bart,
We have these patches internally reviewed, so is it alright to keep the reviewed-by tag for internal reviewer, Arun Easi.
Thanks,
Nilesh
Quoted 54 lines
-----Original Message-----
From: Nilesh Javali <[email protected]>
Sent: Tuesday, June 9, 2020 11:31 AM
To: Bart Van Assche <[email protected]>; [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: RE: [EXT] Re: [PATCH v2 1/2] qla2xxx: Change in PUREX to handle FPIN ELS requests.Bart,
Sure, I would remove the tags and re-post the patch set.
Thanks,
NileshQuoted 26 lines
-----Original Message-----
From: Bart Van Assche <[email protected]>
Sent: Tuesday, June 9, 2020 1:07 AM
To: Nilesh Javali <[email protected]>; [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: [EXT] Re: [PATCH v2 1/2] qla2xxx: Change in PUREX to handle FPIN ELS requests.External Email
----------------------------------------------------------------------
Quoted 6 lines · Nilesh Javali
From: Shyam Sundar <[email protected]>
SAN Congestion Management generates ELS pkts whose size can vary, and be > 64 bytes. Change the purex handling code to support non standard ELS pkt size.
Quoted 6 lines
Signed-off-by Shyam Sundar <[email protected]>Reviewed-by Arun Easi <[email protected]>Reviewed-by Bart Van Assche <[email protected]>Reviewed-by Himanshu Madhani <[email protected]>Reviewed-by James Smart <[email protected]>Signed-off-by Nilesh Javali <[email protected]>Quoted 5 lines
Has anyone other than Himanshu ever posted a positive review for this patch? I can't find the other review tags here:
https://urldefense.proofpoint.com/v2/url?u=https-
3A__lore.kernel.org_linux-2Dscsi_20200514101026.10040-2D1-2Dnjavali-40marvell.com_&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FAW9wuzbtH
Quoted 2 lines
IZL7SV63sr8rG59Hctu-eGu0G9pxwOXgQ&m=WrKsjn8ilzVn32q-
9eMHbnUUvl1cpj06n4fKq8KfBhc&s=gm2J0Gh3hotgenLae9uFvfCiD9MK7iYGn
Quoted 3 lines
aYhYrnSwzs&e=
Bart.
Nilesh Javali
maintainerPATCH v2 2/2 qla2xxx: SAN congestion management(SCM) implementation.
In reply to Nilesh JavaliFrom: Shyam Sundar <[email protected]>
* Firmware Initialization with SCM enabled based on NVRAM setting and firmware support (About Firmware).
* Enable PUREX and add support for fabric performance impact notification(FPIN) handling.
* Allocate a default purex item for each vha, to handle memory allocation failures in ISR.
--- drivers/scsi/qla2xxx/qla_dbg.c | 13 +-- drivers/scsi/qla2xxx/qla_def.h | 51 +++++++++ drivers/scsi/qla2xxx/qla_fw.h | 6 +- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 9 +- drivers/scsi/qla2xxx/qla_isr.c | 191 ++++++++++++++++++++++++++++---- drivers/scsi/qla2xxx/qla_mbx.c | 42 ++++++- drivers/scsi/qla2xxx/qla_os.c | 18 +++ 8 files changed, 297 insertions(+), 34 deletions(-)
drivers/scsi/qla2xxx/qla_dbg.c +3 -10
@@ -11,10 +11,8 @@* ---------------------------------------------------------------------- * | Level | Last Value Used | Holes | * ---------------------------------------------------------------------- -* | Module Init and Probe | 0x0193 | 0x0146 | -* | | | 0x015b-0x0160 | -* | | | 0x016e | -* | Mailbox commands | 0x1206 | 0x11a2-0x11ff | +* | Module Init and Probe | 0x0199 | | +* | Mailbox commands | 0x1206 | 0x11a5-0x11ff | * | Device Discovery | 0x2134 | 0x210e-0x2116 | * | | | 0x211a | * | | | 0x211c-0x2128 |
@@ -26,11 +24,7 @@* | | | 0x3036,0x3038 | * | | | 0x303a | * | DPC Thread | 0x4023 | 0x4002,0x4013 | -* | Async Events | 0x5090 | 0x502b-0x502f | -* | | | 0x5047 | -* | | | 0x5084,0x5075 | -* | | | 0x503d,0x5044 | -* | | | 0x505f | +* | Async Events | 0x509c | | * | Timer Routines | 0x6012 | | * | User Space Interactions | 0x70e3 | 0x7018,0x702e | * | | | 0x7020,0x7024 |
@@ -2752,7 +2746,6 @@ ql_dump_regs(uint level, scsi_qla_host_t *vha, uint id) "mbox[%d] %#04x\n", i, RD_REG_WORD(mbx_reg)); } -void ql_dump_buffer (uint level,scsi_qla_host_t *vha,uint id,const void *buf,uint size)
drivers/scsi/qla2xxx/qla_def.h +51 -0
99 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_fw.h +5 -1
@@ -723,6 +723,8 @@ struct ct_entry_24xx {struct dsd64 dsd[2 ]; }; +#define PURX_ELS_HEADER_SIZE 0x18 +/* * ISP queue - PUREX IOCB entry structure definition */
@@ -2020,7 +2022,9 @@ struct nvram_81xx {* BIT 0 = Extended BB credits for LR * BIT 1 = Virtual Fabric Enable * BIT 2-5 = Distance Support if BIT 0 is on -* BIT 6-15 = Unused +* BIT 6 = Prefer FCP +* BIT 7 = SCM Disabled if BIT is set (1) +* BIT 8-15 = Unused */ uint16_t enhanced_features;
drivers/scsi/qla2xxx/qla_gbl.h +1 -0
@@ -127,6 +127,7 @@ int qla_post_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport);void qla_do_iidma_work (struct scsi_qla_host *vha,fc_port_t *fcport);int qla2x00_reserve_mgmt_server_loop_id (scsi_qla_host_t *);void qla_rscn_replay (fc_port_t *fcport); +void qla24xx_free_purex_item (struct purex_item *item);extern bool qla24xx_risc_firmware_invalid (uint32_t *);/*
drivers/scsi/qla2xxx/qla_init.c +7 -2
@@ -3752,7 +3752,7 @@ qla2x00_setup_chip(scsi_qla_host_t *vha) }/* Enable PUREX PASSTHRU */ -if (ql2xrdpenable) +if (ql2xrdpenable || ha->flags.scm_supported_f)qla25xx_set_els_cmds_supported (vha); }else goto failed;
@@ -3965,7 +3965,7 @@ qla24xx_update_fw_options(scsi_qla_host_t *vha) ha->fw_options[2 ] &= ~BIT_8 ; } -if (ql2xrdpenable) +if (ql2xrdpenable || ha->flags.scm_supported_f) ha->fw_options[1 ] |=ADD_FO1_ENABLE_PUREX_IOCB ;/* Enable Async 8130/8131 events -- transceiver insertion/removal */
@@ -8514,6 +8514,11 @@ qla81xx_nvram_config(scsi_qla_host_t *vha) icb->node_name[0 ] &=0xF0 ; } +if (IS_QLA28XX (ha) ||IS_QLA27XX (ha)) { +if ((nv->enhanced_features &BIT_7 ) ==0 ) + ha->flags.scm_supported_a =1 ; + } +/* Set host adapter parameters. */ ha->flags.disable_risc_code_load =0 ; ha->flags.enable_lip_reset =0 ;
drivers/scsi/qla2xxx/qla_isr.c +172 -19
239 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_mbx.c +40 -2
68 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_os.c +18 -0
@@ -4220,6 +4220,16 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, "ex_init_cb=%p.\n", ha->ex_init_cb); } +/* Get consistent memory allocated for Special Features-CB. */ +if (IS_QLA27XX (ha) ||IS_QLA28XX (ha)) { + ha->sf_init_cb =dma_pool_alloc (ha->s_dma_pool,GFP_KERNEL , + &ha->sf_init_cb_dma); +if (!ha->sf_init_cb) + goto fail_sf_init_cb; +ql_dbg_pci (ql_dbg_init, ha->pdev,0x0199 , +"sf_init_cb=%p.\n" , ha->sf_init_cb); + } +INIT_LIST_HEAD (&ha->gbl_dsd_list);/* Get consistent memory allocated for Async Port-Database. */
@@ -4273,6 +4283,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, fail_loop_id_map:dma_pool_free (ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); fail_async_pd: +dma_pool_free (ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); +fail_sf_init_cb:dma_pool_free (ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); fail_ex_init_cb:kfree (ha->npiv_info);
@@ -4695,6 +4707,10 @@ qla2x00_mem_free(struct qla_hw_data *ha) ha->ms_iocb =NULL ; ha->ms_iocb_dma =0 ; +if (ha->sf_init_cb) +dma_pool_free (ha->s_dma_pool, + ha->sf_init_cb, ha->sf_init_cb_dma); +if (ha->ex_init_cb)dma_pool_free (ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);
@@ -4782,6 +4798,8 @@ qla2x00_mem_free(struct qla_hw_data *ha)kfree (ha->swl); ha->swl =NULL ;kfree (ha->loop_id_map); + ha->sf_init_cb =NULL ; + ha->sf_init_cb_dma =0 ; ha->loop_id_map =NULL ; }
Signature · 1 line
2.19.0.rc0
Re: [PATCH v2 2/2] qla2xxx: SAN congestion management(SCM) implementation.
Quoted 9 lines · Nilesh Javali
From: Shyam Sundar <[email protected]>
* Firmware Initialization with SCM enabled based on NVRAM setting and firmware support (About Firmware).
* Enable PUREX and add support for fabric performance impact notification(FPIN) handling.
* Allocate a default purex item for each vha, to handle memory allocation failures in ISR.
Quoted 6 lines
Signed-off-by Shyam Sundar <[email protected]>Reviewed-by Arun Easi <[email protected]>Reviewed-by Bart Van Assche <[email protected]>Reviewed-by Himanshu Madhani <[email protected]>Reviewed-by James Smart <[email protected]>Signed-off-by Nilesh Javali <[email protected]>
Same question for this patch: has anyone ever posted a positive review for this patch?
Bart.