qla2xxx SAN Congestion Management (SCM) support
Nilesh Javali
maintainerv4 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.
v3->v4:
1. Removed unused structure highlighted by Himanshu.
2. Addressed issues highlighted by James.
3. Changed the use of GFP_ATOMIC allocations to be the exception than the norm during FPIN events.
v2->v3:
1. Updated Reviewed-by tags
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 v4 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 | 15 ++++- 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 | 2 + 6 files changed, 134 insertions(+), 43 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +13 -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,6 @@ 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/* * Firmware state codes from get firmware state mailbox command
@@ -4487,10 +4488,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 +4700,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 +85 -31
153 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 ; +uint8_t cmd_opcode[PUREX_CMD_COUNT ]; +uint8_t 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_FPIN ; + cmd_opcode[1 ] =ELS_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 +2 -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 */
@@ -110,6 +111,7 @@ enum fc_els_cmd { [ELS_REC] = "REC", \ [ELS_SRR] = "SRR", \ [ELS_FPIN] = "FPIN", \ + [ELS_RDP] = "RDP", \ [ELS_RDF] = "RDF", \ [ELS_PRLI] = "PRLI", \ [ELS_PRLO] = "PRLO", \
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH v4 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 | 49 ++++++++ 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 | 190 +++++++++++++++++++++++++++++--- drivers/scsi/qla2xxx/qla_mbx.c | 42 ++++++- drivers/scsi/qla2xxx/qla_os.c | 18 +++ 8 files changed, 295 insertions(+), 33 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 +49 -0
97 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 -18
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 v4 2/2] qla2xxx: SAN congestion management(SCM) implementation.
drivers/scsi/qla2xxx/qla_isr.c struct purex_item · line 883
Quoted 2 lines · Nilesh Javali
drivers/scsi/qla2xxx/qla_isr.c +2
-0+ total_bytes =le16_to_cpu (purex->frame_size &0x0FFF ) + -PURX_ELS_HEADER_SIZE ;
This assignment triggers two new sparse warnings:
drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: restricted __le16 degrades to integer drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: cast to restricted __le16
Please fix these.
Thanks,
Bart.
Re: [PATCH v4 2/2] qla2xxx: SAN congestion management(SCM) implementation.
Bart,
Thanks. Will send out a patch to address this issue shortly.
Quoted 16 lines · Bart Van Assche
drivers/scsi/qla2xxx/qla_isr.c struct purex_item · line 883
Quoted 2 lines · Nilesh Javali
drivers/scsi/qla2xxx/qla_isr.c +2
-0+ total_bytes =le16_to_cpu (purex->frame_size &0x0FFF ) + -PURX_ELS_HEADER_SIZE ;This assignment triggers two new sparse warnings:
drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: restricted__le16degrades to integerdrivers/scsi/qla2xxx/qla_isr.c:881:23: warning: cast to restricted__le16Please fix these.
Thanks,
Bart.
Martin K. Petersen
AppliedQuoted 10 lines · Nilesh Javali
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.
[...]
Applied to 5.9/scsi-queue, thanks!
[1/2] scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests
https://git.kernel.org/mkp/scsi/c/62e9dd177732 [2/2] scsi: qla2xxx: SAN congestion management implementation https://git.kernel.org/mkp/scsi/c/9f2475fe7406
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering