qla2xxx SAN Congestion Management (SCM) support
Subsystems (2)
Nilesh Javali
maintainercover qla2xxx SAN Congestion Management (SCM) support
Martin,
Please apply the qla2xxx patch series implementing SAN Congestion Management (SCM) support to the scsi tree at your earliest convenience.
Thanks,
Nilesh
Shyam Sundar (3):
qla2xxx: Change in PUREX to handle FPIN ELS requests.
qla2xxx: SAN congestion management(SCM) implementation.
qla2xxx: Pass SCM counters to the application.
drivers/scsi/qla2xxx/qla_bsg.c | 114 ++++++ drivers/scsi/qla2xxx/qla_bsg.h | 118 ++++++ drivers/scsi/qla2xxx/qla_dbg.c | 13 +- drivers/scsi/qla2xxx/qla_def.h | 106 +++++- drivers/scsi/qla2xxx/qla_fw.h | 7 +- drivers/scsi/qla2xxx/qla_gbl.h | 4 +- drivers/scsi/qla2xxx/qla_init.c | 9 +- drivers/scsi/qla2xxx/qla_isr.c | 632 ++++++++++++++++++++++++++++++-- drivers/scsi/qla2xxx/qla_mbx.c | 65 +++- drivers/scsi/qla2xxx/qla_os.c | 37 +- 10 files changed, 1039 insertions(+), 66 deletions(-)
base-commit: 47742bde281b2920aae8bb82ed2d61d890aa4f56
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 1/3 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 | 17 ++++- 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 ++++-- 5 files changed, 136 insertions(+), 41 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +16 -1
@@ -1270,6 +1270,11 @@ static inline bool qla2xxx_is_valid_mbs(unsigned int mbs)#define ELS_CMD_MAP_SIZE 32#define ELS_COMMAND_RDP 0x18 +/* Fabric Perf Impact Notification */ +#define ELS_COMMAND_FPIN 0x16 +/* Read Diagnostic Functions */ +#define ELS_COMMAND_RDF 0x19 +#define ELS_COMMAND_PUN 0x31/* * Firmware state codes from get firmware state mailbox command
@@ -4487,10 +4492,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 +4704,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 3int 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_PUN ; + +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); } }
Signature · 1 line
2.19.0.rc0
Re: [PATCH 1/3] qla2xxx: Change in PUREX to handle FPIN ELS requests.
Quoted 3 lines · Nilesh Javali
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.
Signature · 2 lines
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH 1/3] qla2xxx: Change in PUREX to handle FPIN ELS requests.
In reply to Nilesh JavaliQuoted 22 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.
Signed-off-by Shyam Sundar <[email protected]>Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_def.h | 17 ++++- 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 ++++-- 5 files changed, 136 insertions(+), 41 deletions(-)drivers/scsi/qla2xxx/qla_def.h +0
-0
drivers/scsi/qla2xxx/qla_def.h static inline bool qla2xxx_is_valid_mbs(unsigned int mbs) · line 1277
Quoted 8 lines
drivers/scsi/qla2xxx/qla_def.h +5
-0@@ -1270,6 +1270,11 @@ static inline bool qla2xxx_is_valid_mbs(unsigned int mbs)#define ELS_CMD_MAP_SIZE 32#define ELS_COMMAND_RDP 0x18 +/* Fabric Perf Impact Notification */ +#define ELS_COMMAND_FPIN 0x16 +/* Read Diagnostic Functions */ +#define ELS_COMMAND_RDF 0x19 +#define ELS_COMMAND_PUN 0x31
You should use the definitions for FPIN, RDF from include/uapi/scsi/fc/fc_els.h. And add PUN to the file.
Note datastructures for FPIN and RDF are there as well.
-- james
Nilesh Javali
maintainerPATCH 2/3 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.
* Support for the following FPIN descriptors:
1. Link Integrity Notification.
2. Delivery Notification.
3. Peer Congestion Notification.
4. Congestion Notification.
* Mark a device as slow when a Peer Congestion Notification is received.
* Allocate a default purex item for each vha, to handle memory allocation failures in ISR.
--- drivers/scsi/qla2xxx/qla_bsg.h | 115 +++++++ drivers/scsi/qla2xxx/qla_dbg.c | 13 +- drivers/scsi/qla2xxx/qla_def.h | 89 ++++++ drivers/scsi/qla2xxx/qla_fw.h | 7 +- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 9 +- drivers/scsi/qla2xxx/qla_isr.c | 532 ++++++++++++++++++++++++++++++-- drivers/scsi/qla2xxx/qla_mbx.c | 45 ++- drivers/scsi/qla2xxx/qla_os.c | 18 ++ 9 files changed, 795 insertions(+), 34 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.h +115 -0
@@ -290,4 +290,119 @@ struct qla_active_regions {uint8_t reserved[32 ]; } __packed; +#define SCM_LINK_EVENT_UNKNOWN 0x0 +#define SCM_LINK_EVENT_LINK_FAILURE 0x1 +#define SCM_LINK_EVENT_LOSS_OF_SYNC 0x2 +#define SCM_LINK_EVENT_LOSS_OF_SIGNAL 0x3 +#define SCM_LINK_EVENT_PRIMITIVE_SEQ_PROTOCOL_ERROR 0x4 +#define SCM_LINK_EVENT_INVALID_TX_WORD 0x5 +#define SCM_LINK_EVENT_INVALID_CRC 0x6 +#define SCM_LINK_EVENT_DEVICE_SPECIFIC 0xF +#define SCM_LINK_EVENT_V1_SIZE 20 +struct qla_scm_link_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_threshold; +uint32_t event_count; +uint8_t reserved[12 ]; +} __packed; + +#define SCM_DELIVERY_REASON_UNKNOWN 0x0 +#define SCM_DELIVERY_REASON_TIMEOUT 0x1 +#define SCM_DELIVERY_REASON_UNABLE_TO_ROUTE 0x2 +#define SCM_DELIVERY_REASON_DEVICE_SPECIFIC 0xF +struct qla_scm_delivery_event { +uint64_t timestamp; +uint32_t delivery_reason; +uint8_t deliver_frame_hdr[24 ]; +uint8_t reserved[28 ]; + +} __packed; + +#define SCM_CONGESTION_EVENT_CLEAR 0x0 +#define SCM_CONGESTION_EVENT_LOST_CREDIT 0x1 +#define SCM_CONGESTION_EVENT_CREDIT_STALL 0x2 +#define SCM_CONGESTION_EVENT_OVERSUBSCRIPTION 0x3 +#define SCM_CONGESTION_EVENT_DEVICE_SPECIFIC 0xF +struct qla_scm_peer_congestion_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_period; +uint8_t reserved[16 ]; +} __packed; + +#define SCM_CONGESTION_SEVERITY_WARNING 0xF1 +#define SCM_CONGESTION_SEVERITY_ERROR 0xF7 +struct qla_scm_congestion_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_period; +uint8_t severity; +uint8_t reserved[15 ]; +} __packed; + +#define SCM_FLAG_RDF_REJECT 0x00 +#define SCM_FLAG_RDF_COMPLETED 0x01 +#define SCM_FLAG_BROCADE_CONNECTED 0x02 +#define SCM_FLAG_CISCO_CONNECTED 0x04 + +#define SCM_STATE_CONGESTION 0x1 +#define SCM_STATE_DELIVERY 0x2 +#define SCM_STATE_LINK_INTEGRITY 0x4 +#define SCM_STATE_PEER_CONGESTION 0x8 + +#define QLA_CON_PRIMITIVE_RECEIVED 0x1 +#define QLA_CONGESTION_ARB_WARNING 0x1 +#define QLA_CONGESTION_ARB_ALARM 0X2 +struct qla_scm_port { +uint32_t current_events; + +struct qla_scm_link_event link_integrity; +struct qla_scm_delivery_event delivery; +struct qla_scm_congestion_event congestion; +uint64_t scm_congestion_alarm; +uint64_t scm_congestion_warning; +uint8_t scm_fabric_connection_flags; +uint8_t reserved[43 ]; +} __packed; + +struct qla_scm_target { +uint8_t wwpn[8 ]; +uint32_t current_events; + +struct qla_scm_link_event link_integrity; +struct qla_scm_delivery_event delivery; +struct qla_scm_peer_congestion_event peer_congestion; + +uint32_t link_failure_count; +uint32_t loss_of_sync_count; +uint32_t loss_of_signals_count; +uint32_t primitive_seq_protocol_err_count; +uint32_t invalid_transmission_word_count; +uint32_t invalid_crc_count; + +uint32_t delivery_failure_unknown; +uint32_t delivery_timeout; +uint32_t delivery_unable_to_route; +uint32_t delivery_failure_device_specific; + +uint32_t peer_congestion_clear; +uint32_t peer_congestion_lost_credit; +uint32_t peer_congestion_credit_stall; +uint32_t peer_congestion_oversubscription; +uint32_t peer_congestion_device_specific; +uint32_t link_unknown_event; +uint32_t link_device_specific_event; +uint8_t reserved[48 ]; +} __packed; + +#define QLA_DRV_ATTR_SCM_SUPPORTED 0x00800000 +struct qla_drv_attr { +uint32_t attributes; +uint8_t reserved[28 ]; +} __packed; +#endif
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 +89 -0
143 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_fw.h +6 -1
@@ -723,6 +723,9 @@ struct ct_entry_24xx {struct dsd64 dsd[2 ]; }; +#define PURX_ELS_HEADER_SIZE 0x18 +#define FPIN_ELS_DESCRIPTOR_LIST_OFFSET 8 +/* * ISP queue - PUREX IOCB entry structure definition */
@@ -2020,7 +2023,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 ((le16_to_cpu (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 +514 -18
574 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_mbx.c +42 -3
77 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 2/3] qla2xxx: SAN congestion management(SCM) implementation.
Nilesh,
Quoted 4 lines · Nilesh Javali
* 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.
Quoted 8 lines
* Support for the following FPIN descriptors:
1. Link Integrity Notification.
2. Delivery Notification.
3. Peer Congestion Notification.
4. Congestion Notification.
* Mark a device as slow when a Peer Congestion Notification is received.
* Allocate a default purex item for each vha, to handle memory allocation failures in ISR.
When you repost this series, fix comments for function header and places where its using windows style comments in this patch.
Signature · 2 lines
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
In reply to Nilesh JavaliQuoted 14 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.
* Support for the following FPIN descriptors:
1. Link Integrity Notification.
2. Delivery Notification.
3. Peer Congestion Notification.
4. Congestion Notification.
* Mark a device as slow when a Peer Congestion Notification is received.
* Allocate a default purex item for each vha, to handle memory allocation failures in ISR.
In general, there's a lot of generic things here that are done in driver-specific manners.
All the FPIN statistics should be added to the scsi fc transport objects and transport routines created to parse the fpin payloads and set statistics. Also, statistics can be reported via sysfs on the transport object rather than creating vendor-specific bsg requests to obtain them.
In line with this - FPIN definitions should use the existing the existing common headers in include/uapi/fc/fc_els.h. The file doesn't have the congestion fpin definitions, so rather than putting in a driver header - put the structure definitions in the common header.
Quoted 23 lines
Signed-off-by Shyam Sundar <[email protected]>Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_bsg.h | 115 +++++++ drivers/scsi/qla2xxx/qla_dbg.c | 13 +- drivers/scsi/qla2xxx/qla_def.h | 89 ++++++ drivers/scsi/qla2xxx/qla_fw.h | 7 +- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 9 +- drivers/scsi/qla2xxx/qla_isr.c | 532 ++++++++++++++++++++++++++++++-- drivers/scsi/qla2xxx/qla_mbx.c | 45 ++- drivers/scsi/qla2xxx/qla_os.c | 18 ++ 9 files changed, 795 insertions(+), 34 deletions(-)drivers/scsi/qla2xxx/qla_bsg.h +0
-0@@ -290,4 +290,119 @@ struct qla_active_regions {uint8_t reserved[32 ]; } __packed;
drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions { · line 301
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +9
-0+#define SCM_LINK_EVENT_UNKNOWN 0x0 +#define SCM_LINK_EVENT_LINK_FAILURE 0x1 +#define SCM_LINK_EVENT_LOSS_OF_SYNC 0x2 +#define SCM_LINK_EVENT_LOSS_OF_SIGNAL 0x3 +#define SCM_LINK_EVENT_PRIMITIVE_SEQ_PROTOCOL_ERROR 0x4 +#define SCM_LINK_EVENT_INVALID_TX_WORD 0x5 +#define SCM_LINK_EVENT_INVALID_CRC 0x6 +#define SCM_LINK_EVENT_DEVICE_SPECIFIC 0xF +#define SCM_LINK_EVENT_V1_SIZE 20
These should be the existing defines in the common fc_els.h header. Also make sure SCM_LINK_EVENT_V1_SIZE is actually used.
Quoted 34 lines
drivers/scsi/qla2xxx/qla_bsg.h +34
-0+struct qla_scm_link_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_threshold; +uint32_t event_count; +uint8_t reserved[12 ]; +} __packed; + +#define SCM_DELIVERY_REASON_UNKNOWN 0x0 +#define SCM_DELIVERY_REASON_TIMEOUT 0x1 +#define SCM_DELIVERY_REASON_UNABLE_TO_ROUTE 0x2 +#define SCM_DELIVERY_REASON_DEVICE_SPECIFIC 0xF +struct qla_scm_delivery_event { +uint64_t timestamp; +uint32_t delivery_reason; +uint8_t deliver_frame_hdr[24 ]; +uint8_t reserved[28 ]; + +} __packed; + +#define SCM_CONGESTION_EVENT_CLEAR 0x0 +#define SCM_CONGESTION_EVENT_LOST_CREDIT 0x1 +#define SCM_CONGESTION_EVENT_CREDIT_STALL 0x2 +#define SCM_CONGESTION_EVENT_OVERSUBSCRIPTION 0x3 +#define SCM_CONGESTION_EVENT_DEVICE_SPECIFIC 0xF +struct qla_scm_peer_congestion_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_period; +uint8_t reserved[16 ]; +} __packed; +
drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions { · line 345
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+#define SCM_CONGESTION_SEVERITY_WARNING 0xF1 +#define SCM_CONGESTION_SEVERITY_ERROR 0xF7 +struct qla_scm_congestion_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_period; +uint8_t severity; +uint8_t reserved[15 ]; +} __packed;
I expect many of these defines also should map to std-defined defines, thus should be added to fc_els.h
Quoted 46 lines
drivers/scsi/qla2xxx/qla_bsg.h +46
-0+ +#define SCM_FLAG_RDF_REJECT 0x00 +#define SCM_FLAG_RDF_COMPLETED 0x01 +#define SCM_FLAG_BROCADE_CONNECTED 0x02 +#define SCM_FLAG_CISCO_CONNECTED 0x04 + +#define SCM_STATE_CONGESTION 0x1 +#define SCM_STATE_DELIVERY 0x2 +#define SCM_STATE_LINK_INTEGRITY 0x4 +#define SCM_STATE_PEER_CONGESTION 0x8 + +#define QLA_CON_PRIMITIVE_RECEIVED 0x1 +#define QLA_CONGESTION_ARB_WARNING 0x1 +#define QLA_CONGESTION_ARB_ALARM 0X2 +struct qla_scm_port { +uint32_t current_events; + +struct qla_scm_link_event link_integrity; +struct qla_scm_delivery_event delivery; +struct qla_scm_congestion_event congestion; +uint64_t scm_congestion_alarm; +uint64_t scm_congestion_warning; +uint8_t scm_fabric_connection_flags; +uint8_t reserved[43 ]; +} __packed; + +struct qla_scm_target { +uint8_t wwpn[8 ]; +uint32_t current_events; + +struct qla_scm_link_event link_integrity; +struct qla_scm_delivery_event delivery; +struct qla_scm_peer_congestion_event peer_congestion; + +uint32_t link_failure_count; +uint32_t loss_of_sync_count; +uint32_t loss_of_signals_count; +uint32_t primitive_seq_protocol_err_count; +uint32_t invalid_transmission_word_count; +uint32_t invalid_crc_count; + +uint32_t delivery_failure_unknown; +uint32_t delivery_timeout; +uint32_t delivery_unable_to_route; +uint32_t delivery_failure_device_specific; +
drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions { · line 401
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+uint32_t peer_congestion_clear; +uint32_t peer_congestion_lost_credit; +uint32_t peer_congestion_credit_stall; +uint32_t peer_congestion_oversubscription; +uint32_t peer_congestion_device_specific; +uint32_t link_unknown_event; +uint32_t link_device_specific_event; +uint8_t reserved[48 ]; +} __packed; +
Q: what purpose are these shorter "meta" event structures serving ? Why hold onto (what I assume is) the last event. Wouldn't something monitoring netlink and use of the existing fc_host_fpin_rcv() interface be enough ? it should see all events.
Quoted 37 lines
drivers/scsi/qla2xxx/qla_bsg.h +36
-0+#define SCM_EDC_ACC_RECEIVED BIT_6 +#define SCM_RDF_ACC_RECEIVED BIT_7 +#define SCM_NOTIFICATION_TYPE_LINK_INTEGRITY 0x00020001 +#define SCM_NOTIFICATION_TYPE_DELIVERY 0x00020002 +#define SCM_NOTIFICATION_TYPE_PEER_CONGESTION 0x00020003 +#define SCM_NOTIFICATION_TYPE_CONGESTION 0x00020004 +#define FPIN_DESCRIPTOR_HEADER_SIZE 4 +#define FPIN_ELS_DESCRIPTOR_LIST_OFFSET 8 +struct fpin_descriptor { + __be32 descriptor_tag; + __be32 descriptor_length; + union { + uint8_t common_detecting_port_name[WWN_SIZE]; + struct { + uint8_t detecting_port_name[WWN_SIZE]; + uint8_t attached_port_name[WWN_SIZE]; + __be16 event_type; + __be16 event_modifier; + __be32 event_threshold; + __be32 event_count; + __be32 port_name_count; + uint8_t port_name_list[1][WWN_SIZE]; + } link_integrity; + struct { + uint8_t detecting_port_name[WWN_SIZE]; + uint8_t attached_port_name[WWN_SIZE]; + __be32 delivery_reason_code; + } delivery; + struct { + uint8_t detecting_port_name[WWN_SIZE]; + uint8_t attached_port_name[WWN_SIZE]; + __be16 event_type; + __be16 event_modifier; + __be32 event_period; + __be32 port_name_count; + uint8_t port_name_list[1][WWN_SIZE];
drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions {
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+ } peer_congestion; +struct { +__be16 event_type; +__be16 event_modifier; +__be32 event_period; +uint8_t severity; +uint8_t reserved[3 ]; + } congestion; + }; +};
The fpin descriptor is already in the common fc_els.h header. Use it. And feel free to extend the common header definitions for the congestion/delivery events.
Quoted 47 lines
drivers/scsi/qla2xxx/qla_bsg.h +46
-0+void +qla_link_integrity_tgt_stats_update (struct fpin_descriptor *fpin_desc, +fc_port_t *fcport) +{ +ql_log (ql_log_info, fcport->vha,0x502d , +"Link Integrity Event Type %d for Port %8phN\n" , +be16_to_cpu (fpin_desc->link_integrity.event_type), + fcport->port_name); + + fcport->scm_stats.link_integrity.event_type = +be16_to_cpu (fpin_desc->link_integrity.event_type); + fcport->scm_stats.link_integrity.event_modifier = +be16_to_cpu (fpin_desc->link_integrity.event_modifier); + fcport->scm_stats.link_integrity.event_threshold = +be32_to_cpu (fpin_desc->link_integrity.event_threshold); + fcport->scm_stats.link_integrity.event_count = +be32_to_cpu (fpin_desc->link_integrity.event_count); + fcport->scm_stats.link_integrity.timestamp =ktime_get_real_seconds (); + + fcport->scm_stats.current_events |=SCM_STATE_LINK_INTEGRITY ; +switch (be16_to_cpu (fpin_desc->link_integrity.event_type)) { +case SCM_LINK_EVENT_UNKNOWN : + fcport->scm_stats.link_unknown_event += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_LINK_FAILURE : + fcport->scm_stats.link_failure_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_LOSS_OF_SYNC : + fcport->scm_stats.loss_of_sync_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_LOSS_OF_SIGNAL : + fcport->scm_stats.loss_of_signals_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_PRIMITIVE_SEQ_PROTOCOL_ERROR : + fcport->scm_stats.primitive_seq_protocol_err_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_INVALID_TX_WORD : + fcport->scm_stats.invalid_transmission_word_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_INVALID_CRC :
drivers/scsi/qla2xxx/qla_bsg.h
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+ fcport->scm_stats.invalid_crc_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_DEVICE_SPECIFIC : + fcport->scm_stats.link_device_specific_event += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; + } +} +
A prime example of a routine that should be put into the fc transport and a list of statistics that should be visible via sysfs on the transport host (aka port) object.
Quoted 44 lines
drivers/scsi/qla2xxx/qla_bsg.h +38
-0+void +qla_scm_process_link_integrity_d (struct scsi_qla_host *vha, +struct fpin_descriptor *fpin_desc) +{ +} + +void +qla_delivery_tgt_stats_update (struct fpin_descriptor *fpin_desc, +fc_port_t *fcport) +{ +} + +/* +* Process Delivery Notification Descriptor +*/ +void +qla_scm_process_delivery_notification_d (struct scsi_qla_host *vha, +struct fpin_descriptor *fpin_desc) +{ +} + + +void +qla_peer_congestion_tgt_stats_update (struct fpin_descriptor *fpin_desc, +fc_port_t *fcport) +{ +} + +/* +* Process Peer-Congestion Notification Descriptor +*/ +void +qla_scm_process_peer_congestion_notification_d (struct scsi_qla_host *vha, +struct fpin_descriptor *fpin_desc) +{ +} + +/*
drivers/scsi/qla2xxx/qla_bsg.h
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +9
-0+* qla_scm_process_congestion_notification_d() - Process +* Process Congestion Notification Descriptor +* @rsp: response queue +* @pkt: Entry pointer +*/ +void +qla_scm_process_congestion_notification_d (struct scsi_qla_host *vha, + struct fpin_descriptor *fpin_desc) +}
Same comment as prior - should be in scsi fc transport routines and stats set on appropriate transport object
-- james
A message that is not in the archive (sent off-list or not yet received): CA+ihqdiA7AN05k5MjPG=o8_pf=L-La6UigY4t0emKgJMXm=hnQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): BYAPR18MB2805AEA357302FCFA20D2B57B48F0@BYAPR18MB2805.namprd18.prod.outlook.com
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
Seems like this (and a previous email) never made it to the reflector, resending.
The suggestions make sense to me, and I have made most of the recommended changes. I was looking for some guidance on placements of the sim stats structures.
Quoted 394 lines · Shyam Sundar
James,
I was thinking of adding a structures for tracking the target FPIN stats.struct
fc_rport_statistics{uint32_tlink_failure_count;uint32_tloss_of_sync_count;
....
}under
fc_rport:struct
fc_rport{/* Private (Transport-managed) Attributes */
structfc_rport_statistics;For host FPIN stats (essentially the alarm & warning), was not sure if I should add them to the
fc_host_statisticsor
define a new structure under the Private Attributes section within the fc_host_attrs/fc_vport.In theory, given that the host stats could be updated both via signals and FPIN, one could argue that it would make sense
to maintain it with the current host statistics, but keeping it confined to transport will ensure we have a uniform way of handling congestion and peer congestion events.Would appreciate your thoughts there.
Thanks
Shyam---------- Forwarded message ---------
From: James Smart <[email protected]>
Date: Fri, May 15, 2020 at 3:51 PM
Subject: Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
To: Nilesh Javali <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>Quoted 14 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.
* Support for the following FPIN descriptors:
1. Link Integrity Notification.
2. Delivery Notification.
3. Peer Congestion Notification.
4. Congestion Notification.
* Mark a device as slow when a Peer Congestion Notification is received.
* Allocate a default purex item for each vha, to handle memory allocation failures in ISR.In general, there's a lot of generic things here that are done in driver-specific manners.
All the FPIN statistics should be added to the scsi fc transport objects and transport routines created to parse the fpin payloads and set statistics. Also, statistics can be reported via sysfs on the transport object rather than creating vendor-specific bsg requests to obtain them.
In line with this - FPIN definitions should use the existing the existing common headers in
include/uapi/fc/fc_els.h. The file doesn't have the congestion fpin definitions, so rather than putting in a driver header - put the structure definitions in the common header.Quoted 23 lines
Signed-off-by Shyam Sundar <[email protected]>Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_bsg.h | 115 +++++++ drivers/scsi/qla2xxx/qla_dbg.c | 13 +- drivers/scsi/qla2xxx/qla_def.h | 89 ++++++ drivers/scsi/qla2xxx/qla_fw.h | 7 +- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 9 +- drivers/scsi/qla2xxx/qla_isr.c | 532 ++++++++++++++++++++++++++++++-- drivers/scsi/qla2xxx/qla_mbx.c | 45 ++- drivers/scsi/qla2xxx/qla_os.c | 18 ++ 9 files changed, 795 insertions(+), 34 deletions(-)drivers/scsi/qla2xxx/qla_bsg.h +0
-0@@ -290,4 +290,119 @@ struct qla_active_regions {uint8_t reserved[32 ]; } __packed;drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions { · line 301
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +9
-0+#define SCM_LINK_EVENT_UNKNOWN 0x0 +#define SCM_LINK_EVENT_LINK_FAILURE 0x1 +#define SCM_LINK_EVENT_LOSS_OF_SYNC 0x2 +#define SCM_LINK_EVENT_LOSS_OF_SIGNAL 0x3 +#define SCM_LINK_EVENT_PRIMITIVE_SEQ_PROTOCOL_ERROR 0x4 +#define SCM_LINK_EVENT_INVALID_TX_WORD 0x5 +#define SCM_LINK_EVENT_INVALID_CRC 0x6 +#define SCM_LINK_EVENT_DEVICE_SPECIFIC 0xF +#define SCM_LINK_EVENT_V1_SIZE 20These should be the existing defines in the common
fc_els.hheader. Also make sureSCM_LINK_EVENT_V1_SIZEis actually used.Quoted 34 lines
drivers/scsi/qla2xxx/qla_bsg.h +34
-0+struct qla_scm_link_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_threshold; +uint32_t event_count; +uint8_t reserved[12 ]; +} __packed; + +#define SCM_DELIVERY_REASON_UNKNOWN 0x0 +#define SCM_DELIVERY_REASON_TIMEOUT 0x1 +#define SCM_DELIVERY_REASON_UNABLE_TO_ROUTE 0x2 +#define SCM_DELIVERY_REASON_DEVICE_SPECIFIC 0xF +struct qla_scm_delivery_event { +uint64_t timestamp; +uint32_t delivery_reason; +uint8_t deliver_frame_hdr[24 ]; +uint8_t reserved[28 ]; + +} __packed; + +#define SCM_CONGESTION_EVENT_CLEAR 0x0 +#define SCM_CONGESTION_EVENT_LOST_CREDIT 0x1 +#define SCM_CONGESTION_EVENT_CREDIT_STALL 0x2 +#define SCM_CONGESTION_EVENT_OVERSUBSCRIPTION 0x3 +#define SCM_CONGESTION_EVENT_DEVICE_SPECIFIC 0xF +struct qla_scm_peer_congestion_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_period; +uint8_t reserved[16 ]; +} __packed; +drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions { · line 345
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+#define SCM_CONGESTION_SEVERITY_WARNING 0xF1 +#define SCM_CONGESTION_SEVERITY_ERROR 0xF7 +struct qla_scm_congestion_event { +uint64_t timestamp; +uint16_t event_type; +uint16_t event_modifier; +uint32_t event_period; +uint8_t severity; +uint8_t reserved[15 ]; +} __packed;I expect many of these defines also should map to std-defined defines, thus should be added to
fc_els.hQuoted 46 lines
drivers/scsi/qla2xxx/qla_bsg.h +46
-0+ +#define SCM_FLAG_RDF_REJECT 0x00 +#define SCM_FLAG_RDF_COMPLETED 0x01 +#define SCM_FLAG_BROCADE_CONNECTED 0x02 +#define SCM_FLAG_CISCO_CONNECTED 0x04 + +#define SCM_STATE_CONGESTION 0x1 +#define SCM_STATE_DELIVERY 0x2 +#define SCM_STATE_LINK_INTEGRITY 0x4 +#define SCM_STATE_PEER_CONGESTION 0x8 + +#define QLA_CON_PRIMITIVE_RECEIVED 0x1 +#define QLA_CONGESTION_ARB_WARNING 0x1 +#define QLA_CONGESTION_ARB_ALARM 0X2 +struct qla_scm_port { +uint32_t current_events; + +struct qla_scm_link_event link_integrity; +struct qla_scm_delivery_event delivery; +struct qla_scm_congestion_event congestion; +uint64_t scm_congestion_alarm; +uint64_t scm_congestion_warning; +uint8_t scm_fabric_connection_flags; +uint8_t reserved[43 ]; +} __packed; + +struct qla_scm_target { +uint8_t wwpn[8 ]; +uint32_t current_events; + +struct qla_scm_link_event link_integrity; +struct qla_scm_delivery_event delivery; +struct qla_scm_peer_congestion_event peer_congestion; + +uint32_t link_failure_count; +uint32_t loss_of_sync_count; +uint32_t loss_of_signals_count; +uint32_t primitive_seq_protocol_err_count; +uint32_t invalid_transmission_word_count; +uint32_t invalid_crc_count; + +uint32_t delivery_failure_unknown; +uint32_t delivery_timeout; +uint32_t delivery_unable_to_route; +uint32_t delivery_failure_device_specific; +drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions { · line 401
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+uint32_t peer_congestion_clear; +uint32_t peer_congestion_lost_credit; +uint32_t peer_congestion_credit_stall; +uint32_t peer_congestion_oversubscription; +uint32_t peer_congestion_device_specific; +uint32_t link_unknown_event; +uint32_t link_device_specific_event; +uint8_t reserved[48 ]; +} __packed; +Q: what purpose are these shorter "meta" event structures serving ? Why hold onto (what I assume is) the last event. Wouldn't something monitoring netlink and use of the existing
fc_host_fpin_rcv()interface be enough ? it should see all events.Quoted 37 lines
drivers/scsi/qla2xxx/qla_bsg.h +36
-0+#define SCM_EDC_ACC_RECEIVED BIT_6 +#define SCM_RDF_ACC_RECEIVED BIT_7 +#define SCM_NOTIFICATION_TYPE_LINK_INTEGRITY 0x00020001 +#define SCM_NOTIFICATION_TYPE_DELIVERY 0x00020002 +#define SCM_NOTIFICATION_TYPE_PEER_CONGESTION 0x00020003 +#define SCM_NOTIFICATION_TYPE_CONGESTION 0x00020004 +#define FPIN_DESCRIPTOR_HEADER_SIZE 4 +#define FPIN_ELS_DESCRIPTOR_LIST_OFFSET 8 +struct fpin_descriptor { + __be32 descriptor_tag; + __be32 descriptor_length; + union { + uint8_t common_detecting_port_name[WWN_SIZE]; + struct { + uint8_t detecting_port_name[WWN_SIZE]; + uint8_t attached_port_name[WWN_SIZE]; + __be16 event_type; + __be16 event_modifier; + __be32 event_threshold; + __be32 event_count; + __be32 port_name_count; + uint8_t port_name_list[1][WWN_SIZE]; + } link_integrity; + struct { + uint8_t detecting_port_name[WWN_SIZE]; + uint8_t attached_port_name[WWN_SIZE]; + __be32 delivery_reason_code; + } delivery; + struct { + uint8_t detecting_port_name[WWN_SIZE]; + uint8_t attached_port_name[WWN_SIZE]; + __be16 event_type; + __be16 event_modifier; + __be32 event_period; + __be32 port_name_count; + uint8_t port_name_list[1][WWN_SIZE];drivers/scsi/qla2xxx/qla_bsg.h struct qla_active_regions {
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+ } peer_congestion; +struct { +__be16 event_type; +__be16 event_modifier; +__be32 event_period; +uint8_t severity; +uint8_t reserved[3 ]; + } congestion; + }; +};The fpin descriptor is already in the common
fc_els.hheader. Use it. And feel free to extend the common header definitions for the congestion/delivery events.Quoted 47 lines
drivers/scsi/qla2xxx/qla_bsg.h +46
-0+void +qla_link_integrity_tgt_stats_update (struct fpin_descriptor *fpin_desc, +fc_port_t *fcport) +{ +ql_log (ql_log_info, fcport->vha,0x502d , +"Link Integrity Event Type %d for Port %8phN\n" , +be16_to_cpu (fpin_desc->link_integrity.event_type), + fcport->port_name); + + fcport->scm_stats.link_integrity.event_type = +be16_to_cpu (fpin_desc->link_integrity.event_type); + fcport->scm_stats.link_integrity.event_modifier = +be16_to_cpu (fpin_desc->link_integrity.event_modifier); + fcport->scm_stats.link_integrity.event_threshold = +be32_to_cpu (fpin_desc->link_integrity.event_threshold); + fcport->scm_stats.link_integrity.event_count = +be32_to_cpu (fpin_desc->link_integrity.event_count); + fcport->scm_stats.link_integrity.timestamp =ktime_get_real_seconds (); + + fcport->scm_stats.current_events |=SCM_STATE_LINK_INTEGRITY ; +switch (be16_to_cpu (fpin_desc->link_integrity.event_type)) { +case SCM_LINK_EVENT_UNKNOWN : + fcport->scm_stats.link_unknown_event += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_LINK_FAILURE : + fcport->scm_stats.link_failure_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_LOSS_OF_SYNC : + fcport->scm_stats.loss_of_sync_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_LOSS_OF_SIGNAL : + fcport->scm_stats.loss_of_signals_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_PRIMITIVE_SEQ_PROTOCOL_ERROR : + fcport->scm_stats.primitive_seq_protocol_err_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_INVALID_TX_WORD : + fcport->scm_stats.invalid_transmission_word_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_INVALID_CRC :drivers/scsi/qla2xxx/qla_bsg.h
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +10
-0+ fcport->scm_stats.invalid_crc_count += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; +case SCM_LINK_EVENT_DEVICE_SPECIFIC : + fcport->scm_stats.link_device_specific_event += +be32_to_cpu (fpin_desc->link_integrity.event_count); +break ; + } +} +A prime example of a routine that should be put into the fc transport and a list of statistics that should be visible via sysfs on the transport host (aka port) object.
Quoted 44 lines
drivers/scsi/qla2xxx/qla_bsg.h +38
-0+void +qla_scm_process_link_integrity_d (struct scsi_qla_host *vha, +struct fpin_descriptor *fpin_desc) +{ +} + +void +qla_delivery_tgt_stats_update (struct fpin_descriptor *fpin_desc, +fc_port_t *fcport) +{ +} + +/* +* Process Delivery Notification Descriptor +*/ +void +qla_scm_process_delivery_notification_d (struct scsi_qla_host *vha, +struct fpin_descriptor *fpin_desc) +{ +} + + +void +qla_peer_congestion_tgt_stats_update (struct fpin_descriptor *fpin_desc, +fc_port_t *fcport) +{ +} + +/* +* Process Peer-Congestion Notification Descriptor +*/ +void +qla_scm_process_peer_congestion_notification_d (struct scsi_qla_host *vha, +struct fpin_descriptor *fpin_desc) +{ +} + +/* drivers/scsi/qla2xxx/qla_bsg.h
Quoted 10 lines
drivers/scsi/qla2xxx/qla_bsg.h +9
-0+* qla_scm_process_congestion_notification_d() - Process +* Process Congestion Notification Descriptor +* @rsp: response queue +* @pkt: Entry pointer +*/ +void +qla_scm_process_congestion_notification_d (struct scsi_qla_host *vha, + struct fpin_descriptor *fpin_desc) +}Same comment as prior - should be in scsi fc transport routines and stats set on appropriate transport object
-- james
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
Quoted 25 lines · Shyam Sundar
Seems like this (and a previous email) never made it to the reflector, resending.
The suggestions make sense to me, and I have made most of the recommended changes. I was looking for some guidance on placements of the sim stats structures.
Quoted 20 lines · Shyam Sundar
James,
I was thinking of adding a structures for tracking the target FPIN stats.struct
fc_rport_statistics{uint32_tlink_failure_count;uint32_tloss_of_sync_count;
....
}under
fc_rport:struct
fc_rport{/* Private (Transport-managed) Attributes */
structfc_rport_statistics;For host FPIN stats (essentially the alarm & warning), was not sure if I should add them to the
fc_host_statisticsor
define a new structure under the Private Attributes section within the fc_host_attrs/fc_vport.
my initial thought was the same
Quoted 4 lines
Quoted 4 lines
In theory, given that the host stats could be updated both via signals and FPIN, one could argue that it would make sense
to maintain it with the current host statistics, but keeping it confined to transport will ensure we have a uniform way of handling congestion and peer congestion events.
but then I have the same thoughts as well. And the commonization of the parsing and incrementing makes a lot more sense.
Quoted 7 lines
Quoted 7 lines
Would appreciate your thoughts there.
Thanks
Shyam
I would put them under the Dynamic attributes area in fc_host_attrs and fc_rport. fc_host_attrs:
fpin_cn incremented for each Congestion Notify FPIN
cn_sig_warn incremented for each congestion warning signal
cn_sig_alarm incremented for each congestion alarm signal
fpin_dn incremented for each Delivery Notification FPIN where attached wwpn is local port fpin_li incremented for each Link Integrity FPIN where attached wwpn is local port
fc_rport:
fpin_dn incremented for each Delivery Notification FPIN where attached wwpn is the rport fpin_li incremented for each Link Integrity FPIN where attached wwpn is the rport fpin_pcn incremented for each Peer Congestion Notify FPIN where attached wwpn is the rport
For the cn_sig_xxx values, the driver would just increment them.
For the fpin_xxx values - we'll augment the fc_host_fpin_rcv routine to parse the fpin and increment the fc_host or fc_rport counter.
-- james
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
Quoted 58 lines · James Smart
Quoted 25 lines · Shyam Sundar
Seems like this (and a previous email) never made it to the reflector, resending.
The suggestions make sense to me, and I have made most of the recommended changes. I was looking for some guidance on placements of the sim stats structures.
Quoted 20 lines · Shyam Sundar
James,
I was thinking of adding a structures for tracking the target FPIN stats.struct
fc_rport_statistics{uint32_tlink_failure_count;uint32_tloss_of_sync_count;
....
}under
fc_rport:struct
fc_rport{/* Private (Transport-managed) Attributes */
structfc_rport_statistics;For host FPIN stats (essentially the alarm & warning), was not sure if I should add them to the
fc_host_statisticsor
define a new structure under the Private Attributes section within the fc_host_attrs/fc_vport.my initial thought was the same
Quoted 4 lines
Quoted 4 lines
In theory, given that the host stats could be updated both via signals and FPIN, one could argue that it would make sense
to maintain it with the current host statistics, but keeping it confined to transport will ensure we have a uniform way of handling congestion and peer congestion events.but then I have the same thoughts as well. And the commonization of the parsing and incrementing makes a lot more sense.
Quoted 6 lines
Quoted 6 lines
Would appreciate your thoughts there.
Thanks
ShyamI would put them under the Dynamic attributes area in
fc_host_attrsandfc_rport.fc_host_attrs:fpin_cnincremented for each Congestion Notify FPINcn_sig_warnincremented for each congestion warning signalcn_sig_alarmincremented for each congestion alarm signalfpin_dnincremented for each Delivery Notification FPIN where attached wwpn is local portfpin_liincremented for each Link Integrity FPIN where attached wwpn is local port
Quoted 7 lines
fc_rport:fpin_dnincremented for each Delivery Notification FPIN where attached wwpn is the rportfpin_liincremented for each Link Integrity FPIN where attached wwpn is the rportfpin_pcnincremented for each Peer Congestion Notify FPIN where attached wwpn is the rportFor the
cn_sig_xxxvalues, the driver would just increment them.
For thefpin_xxxvalues - we'll augment thefc_host_fpin_rcvroutine to parse the fpin and increment thefc_hostorfc_rportcounter.
Sounds good. Will do.
Thanks
Shyam
Quoted 2 lines
-- james
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
In reply to James SmartJames,
Please review the updated patchset to see if the changes make sense to you. There are a few deviations from what we discussed here.
I have used a single structure definition to maintain all fpin statistics and we are maintain them at the granularity provided by the fabric instead of Using a single counter per category. The same
structure is used across the fc_host_attr and the fc_rport structures.
Given that the congestion signals will have to be maintained by the LLDs, as we do not have the plumbing to push those notifications to the transport, I have added them to the fc_host_statistics maintained and filled in by the LLD. All of the stats are displayed under the "statistics" folder under the sysfs.
Under the host stats, a subset of stats (the Link Integrity FPINs) are redundunt, and are already maintained, read via the traditional mechanism. I have rolled them in nonetheless because during testing, they did not update to the same values (using the FPIN error injection commands). If we determine that these values will be in sync consistently, we can remove one of the subset at a later point.
Regards
Shyam
Quoted 65 lines · James Smart
Quoted 25 lines · Shyam Sundar
Seems like this (and a previous email) never made it to the reflector, resending.
The suggestions make sense to me, and I have made most of the recommended changes. I was looking for some guidance on placements of the sim stats structures.
Quoted 20 lines · Shyam Sundar
James,
I was thinking of adding a structures for tracking the target FPIN stats.struct
fc_rport_statistics{uint32_tlink_failure_count;uint32_tloss_of_sync_count;
....
}under
fc_rport:struct
fc_rport{/* Private (Transport-managed) Attributes */
structfc_rport_statistics;For host FPIN stats (essentially the alarm & warning), was not sure if I should add them to the
fc_host_statisticsor
define a new structure under the Private Attributes section within the fc_host_attrs/fc_vport.my initial thought was the same
Quoted 4 lines
Quoted 4 lines
In theory, given that the host stats could be updated both via signals and FPIN, one could argue that it would make sense
to maintain it with the current host statistics, but keeping it confined to transport will ensure we have a uniform way of handling congestion and peer congestion events.but then I have the same thoughts as well. And the commonization of the parsing and incrementing makes a lot more sense.
Quoted 6 lines
Quoted 6 lines
Would appreciate your thoughts there.
Thanks
ShyamI would put them under the Dynamic attributes area in
fc_host_attrsandfc_rport.fc_host_attrs:fpin_cnincremented for each Congestion Notify FPINcn_sig_warnincremented for each congestion warning signalcn_sig_alarmincremented for each congestion alarm signalfpin_dnincremented for each Delivery Notification FPIN where attached wwpn is local portfpin_liincremented for each Link Integrity FPIN where attached wwpn is local port
fc_rport:fpin_dnincremented for each Delivery Notification FPIN where attached wwpn is the rportfpin_liincremented for each Link Integrity FPIN where attached wwpn is the rportfpin_pcnincremented for each Peer Congestion Notify FPIN where attached wwpn is the rportFor the
cn_sig_xxxvalues, the driver would just increment them.
For thefpin_xxxvalues - we'll augment thefc_host_fpin_rcvroutine to parse the fpin and increment thefc_hostorfc_rportcounter.-- james
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
Shyam,
comments will be posted shortly
-- james
Quoted 86 lines · Shyam Sundar
James,
Please review the updated patchset to see if the changes make sense to you. There are a few deviations from what we discussed here.
I have used a single structure definition to maintain all fpin statistics and we are maintain them at the granularity provided by the fabric instead of Using a single counter per category. The same
structure is used across thefc_host_attrand thefc_rportstructures.Given that the congestion signals will have to be maintained by the LLDs, as we do not have the plumbing to push those notifications to the transport, I have added them to the
fc_host_statisticsmaintained and filled in by the LLD. All of the stats are displayed under the "statistics" folder under the sysfs.Under the host stats, a subset of stats (the Link Integrity FPINs) are redundunt, and are already maintained, read via the traditional mechanism. I have rolled them in nonetheless because during testing, they did not update to the same values (using the FPIN error injection commands). If we determine that these values will be in sync consistently, we can remove one of the subset at a later point.
Regards
ShyamQuoted 60 lines · James Smart
Quoted 25 lines · Shyam Sundar
Seems like this (and a previous email) never made it to the reflector, resending.
The suggestions make sense to me, and I have made most of the recommended changes. I was looking for some guidance on placements of the sim stats structures.
Quoted 20 lines · Shyam Sundar
James,
I was thinking of adding a structures for tracking the target FPIN stats.struct
fc_rport_statistics{uint32_tlink_failure_count;uint32_tloss_of_sync_count;
....
}under
fc_rport:struct
fc_rport{/* Private (Transport-managed) Attributes */
structfc_rport_statistics;For host FPIN stats (essentially the alarm & warning), was not sure if I should add them to the
fc_host_statisticsor
define a new structure under the Private Attributes section within the fc_host_attrs/fc_vport.my initial thought was the same
Quoted 3 lines
Quoted 3 lines
In theory, given that the host stats could be updated both via signals and FPIN, one could argue that it would make sense
to maintain it with the current host statistics, but keeping it confined to transport will ensure we have a uniform way of handling congestion and peer congestion events.but then I have the same thoughts as well. And the commonization of the parsing and incrementing makes a lot more sense.
Quoted 5 lines
Quoted 5 lines
Would appreciate your thoughts there.
Thanks
ShyamI would put them under the Dynamic attributes area in
fc_host_attrsandfc_rport.fc_host_attrs:fpin_cnincremented for each Congestion Notify FPINcn_sig_warnincremented for each congestion warning signalcn_sig_alarmincremented for each congestion alarm signalfpin_dnincremented for each Delivery Notification FPIN where attached wwpn is local portfpin_liincremented for each Link Integrity FPIN where attached wwpn is local port
fc_rport:fpin_dnincremented for each Delivery Notification FPIN where attached wwpn is the rportfpin_liincremented for each Link Integrity FPIN where attached wwpn is the rportfpin_pcnincremented for each Peer Congestion Notify FPIN where attached wwpn is the rportFor the
cn_sig_xxxvalues, the driver would just increment them.
For thefpin_xxxvalues - we'll augment thefc_host_fpin_rcvroutine to parse the fpin and increment thefc_hostorfc_rportcounter.-- james
A message that is not in the archive (sent off-list or not yet received): CA+ihqdjtoA=1q7N0pg1TQDAMGo1XtNN8+XnO1qXORyqGYfpq=A@mail.gmail.com
Re: [PATCH 2/3] qla2xxx: SAN congestion management(SCM) implementation.
Resending to the reflector.
Quoted 17 lines · Shyam S
Quoted 8 lines
Quoted 8 lines
Q: what purpose are these shorter "meta" event structures serving ? Why hold onto (what I assume is) the last event. Wouldn't something monitoring netlink and use of the existing
fc_host_fpin_rcv()interface be enough ? it should see all events.The Idea was to be able to have a longer term view within the driver so that while debugging issues, correlations can be made between symptoms exhibited by the driver with these statistics.
All your other comments make complete sense to me. I'll re-work the changes to move them up the stack.
Regards
Shyam
Nilesh Javali
maintainerPATCH 3/3 qla2xxx: Pass SCM counters to the application.
In reply to Nilesh JavaliFrom: Shyam Sundar <[email protected]>
Implement 3 functions to pass on SAN congestion management related counters tracked by the driver, up to the Marvell application using the BSG interface.
--- drivers/scsi/qla2xxx/qla_bsg.c | 114 +++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_bsg.h | 3 + 2 files changed, 117 insertions(+)
drivers/scsi/qla2xxx/qla_bsg.c +114 -0
@@ -2446,6 +2446,111 @@ qla2x00_get_flash_image_status(struct bsg_job *bsg_job)return 0 ; } +static int +qla2x00_get_drv_attr (struct bsg_job *bsg_job) +{ +struct qla_drv_attr drv_attr; +struct fc_bsg_reply *bsg_reply = bsg_job->reply; + +memset (&drv_attr,0 ,sizeof (struct qla_drv_attr )); +/* Additional check should be added if SCM is not enabled +* by default for a given driver version. +*/ + drv_attr.attributes |=QLA_DRV_ATTR_SCM_SUPPORTED ; + +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &drv_attr, +sizeof (struct qla_drv_attr )); + + bsg_reply->reply_payload_rcv_len =sizeof (struct qla_drv_attr ); + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] =EXT_STATUS_OK ; + + bsg_job->reply_len =sizeof (*bsg_job->reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +return 0 ; +} + +static int +qla2x00_get_port_scm (struct bsg_job *bsg_job) +{ +struct Scsi_Host *shost =fc_bsg_to_shost (bsg_job); +scsi_qla_host_t *vha =shost_priv (shost); +struct qla_hw_data *ha = vha->hw; +struct fc_bsg_reply *bsg_reply = bsg_job->reply; + +if (!IS_QLA27XX (ha) && !IS_QLA28XX (ha)) +return -EPERM ; + +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &vha->scm_stats, +sizeof (struct qla_scm_port )); + + bsg_reply->reply_payload_rcv_len =sizeof (struct qla_scm_port ); + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] =EXT_STATUS_OK ; + + bsg_job->reply_len =sizeof (*bsg_job->reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +return 0 ; +} + +static int +qla2x00_get_target_scm (struct bsg_job *bsg_job) +{ +struct Scsi_Host *shost =fc_bsg_to_shost (bsg_job); +scsi_qla_host_t *vha =shost_priv (shost); +struct fc_bsg_reply *bsg_reply = bsg_job->reply; +struct qla_hw_data *ha = vha->hw; +fc_port_t *fcport =NULL ; +int rval; +struct qla_scm_target *scm_stats =NULL ; + +if (!IS_QLA27XX (ha) && !IS_QLA28XX (ha)) +return -EPERM ; + + scm_stats =kzalloc (sizeof (*scm_stats),GFP_KERNEL ); +if (!scm_stats) { +ql_log (ql_log_warn, vha,0x7024 , +"Failed to allocate memory for target scm stats.\n" ); +return -ENOMEM ; + } + +sg_copy_to_buffer (bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, scm_stats, +sizeof (struct qla_scm_target )); + + fcport =qla2x00_find_fcport_by_wwpn (vha, scm_stats->wwpn,0 ); +if (fcport) { +/* Copy SCM Target data to local struct, keep WWPN from user */ +memcpy (&scm_stats->current_events, + &fcport->scm_stats.current_events, + (sizeof (struct qla_scm_target ) - +sizeof (scm_stats->wwpn))); +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, scm_stats, +sizeof (struct qla_scm_target )); + rval =EXT_STATUS_OK ; + }else { + rval =EXT_STATUS_ERR ; + } + + bsg_reply->reply_payload_rcv_len =sizeof (struct qla_scm_target ); + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = rval; + + bsg_job->reply_len =sizeof (*bsg_job->reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +kfree (scm_stats); +return 0 ; +} +static int qla2x00_process_vendor_specific (struct bsg_job *bsg_job) {
@@ -2522,6 +2627,15 @@ qla2x00_process_vendor_specific(struct bsg_job *bsg_job)case QL_VND_SS_GET_FLASH_IMAGE_STATUS :return qla2x00_get_flash_image_status (bsg_job); +case QL_VND_GET_PORT_SCM : +return qla2x00_get_port_scm (bsg_job); + +case QL_VND_GET_TARGET_SCM : +return qla2x00_get_target_scm (bsg_job); + +case QL_VND_GET_DRV_ATTR : +return qla2x00_get_drv_attr (bsg_job); +default :return -ENOSYS ; }
drivers/scsi/qla2xxx/qla_bsg.h +3 -0
@@ -32,6 +32,9 @@#define QL_VND_DPORT_DIAGNOSTICS 0x19#define QL_VND_GET_PRIV_STATS_EX 0x1A#define QL_VND_SS_GET_FLASH_IMAGE_STATUS 0x1E +#define QL_VND_GET_PORT_SCM 0x20 +#define QL_VND_GET_TARGET_SCM 0x21 +#define QL_VND_GET_DRV_ATTR 0x22/* BSG Vendor specific subcode returns */ #define EXT_STATUS_OK 0
Signature · 1 line
2.19.0.rc0
Re: [PATCH 3/3] qla2xxx: Pass SCM counters to the application.
Quoted 152 lines · Nilesh Javali
From: Shyam Sundar <[email protected]>
Implement 3 functions to pass on SAN congestion management related counters tracked by the driver, up to the Marvell application using the BSG interface.
Signed-off-by Shyam Sundar <[email protected]>Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_bsg.c | 114 +++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_bsg.h | 3 + 2 files changed, 117 insertions(+)drivers/scsi/qla2xxx/qla_bsg.c +114
-0@@ -2446,6 +2446,111 @@ qla2x00_get_flash_image_status(struct bsg_job *bsg_job)return 0 ; } +static int +qla2x00_get_drv_attr (struct bsg_job *bsg_job) +{ +struct qla_drv_attr drv_attr; +struct fc_bsg_reply *bsg_reply = bsg_job->reply; + +memset (&drv_attr,0 ,sizeof (struct qla_drv_attr )); +/* Additional check should be added if SCM is not enabled +* by default for a given driver version. +*/ + drv_attr.attributes |=QLA_DRV_ATTR_SCM_SUPPORTED ; + +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &drv_attr, +sizeof (struct qla_drv_attr )); + + bsg_reply->reply_payload_rcv_len =sizeof (struct qla_drv_attr ); + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] =EXT_STATUS_OK ; + + bsg_job->reply_len =sizeof (*bsg_job->reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +return 0 ; +} + +static int +qla2x00_get_port_scm (struct bsg_job *bsg_job) +{ +struct Scsi_Host *shost =fc_bsg_to_shost (bsg_job); +scsi_qla_host_t *vha =shost_priv (shost); +struct qla_hw_data *ha = vha->hw; +struct fc_bsg_reply *bsg_reply = bsg_job->reply; + +if (!IS_QLA27XX (ha) && !IS_QLA28XX (ha)) +return -EPERM ; + +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, &vha->scm_stats, +sizeof (struct qla_scm_port )); + + bsg_reply->reply_payload_rcv_len =sizeof (struct qla_scm_port ); + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] =EXT_STATUS_OK ; + + bsg_job->reply_len =sizeof (*bsg_job->reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +return 0 ; +} + +static int +qla2x00_get_target_scm (struct bsg_job *bsg_job) +{ +struct Scsi_Host *shost =fc_bsg_to_shost (bsg_job); +scsi_qla_host_t *vha =shost_priv (shost); +struct fc_bsg_reply *bsg_reply = bsg_job->reply; +struct qla_hw_data *ha = vha->hw; +fc_port_t *fcport =NULL ; +int rval; +struct qla_scm_target *scm_stats =NULL ; + +if (!IS_QLA27XX (ha) && !IS_QLA28XX (ha)) +return -EPERM ; + + scm_stats =kzalloc (sizeof (*scm_stats),GFP_KERNEL ); +if (!scm_stats) { +ql_log (ql_log_warn, vha,0x7024 , +"Failed to allocate memory for target scm stats.\n" ); +return -ENOMEM ; + } + +sg_copy_to_buffer (bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, scm_stats, +sizeof (struct qla_scm_target )); + + fcport =qla2x00_find_fcport_by_wwpn (vha, scm_stats->wwpn,0 ); +if (fcport) { +/* Copy SCM Target data to local struct, keep WWPN from user */ +memcpy (&scm_stats->current_events, + &fcport->scm_stats.current_events, + (sizeof (struct qla_scm_target ) - +sizeof (scm_stats->wwpn))); +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, scm_stats, +sizeof (struct qla_scm_target )); + rval =EXT_STATUS_OK ; + }else { + rval =EXT_STATUS_ERR ; + } + + bsg_reply->reply_payload_rcv_len =sizeof (struct qla_scm_target ); + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = rval; + + bsg_job->reply_len =sizeof (*bsg_job->reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +kfree (scm_stats); +return 0 ; +} +static int qla2x00_process_vendor_specific (struct bsg_job *bsg_job) {@@ -2522,6 +2627,15 @@ qla2x00_process_vendor_specific(struct bsg_job *bsg_job)case QL_VND_SS_GET_FLASH_IMAGE_STATUS :return qla2x00_get_flash_image_status (bsg_job); +case QL_VND_GET_PORT_SCM : +return qla2x00_get_port_scm (bsg_job); + +case QL_VND_GET_TARGET_SCM : +return qla2x00_get_target_scm (bsg_job); + +case QL_VND_GET_DRV_ATTR : +return qla2x00_get_drv_attr (bsg_job); +default :return -ENOSYS ; }drivers/scsi/qla2xxx/qla_bsg.h +0
-0
drivers/scsi/qla2xxx/qla_bsg.h line 40
Quoted 9 lines
drivers/scsi/qla2xxx/qla_bsg.h +3
-0@@ -32,6 +32,9 @@#define QL_VND_DPORT_DIAGNOSTICS 0x19#define QL_VND_GET_PRIV_STATS_EX 0x1A#define QL_VND_SS_GET_FLASH_IMAGE_STATUS 0x1E +#define QL_VND_GET_PORT_SCM 0x20 +#define QL_VND_GET_TARGET_SCM 0x21 +#define QL_VND_GET_DRV_ATTR 0x22/* BSG Vendor specific subcode returns */ #define EXT_STATUS_OK 0
Signature · 2 lines
Himanshu Madhani Oracle Linux Engineering
Quoted 2 lines · Nilesh Javali
Please apply the qla2xxx patch series implementing SAN Congestion Management (SCM) support to the scsi tree at your earliest convenience.
Hi Nilesh,
This patch series introduces the following compiler warnings (W=1):
drivers/scsi/qla2xxx/qla_isr.c:27:1: warning: no previous prototype for ‘qla_link_integrity_tgt_stats_update’ [-Wmissing-prototypes]
27 | qla_link_integrity_tgt_stats_update(struct fpin_descriptor*fpin_desc,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:83:1: warning: no previous prototype for
‘qla_scm_process_link_integrity_d’ [-Wmissing-prototypes]
83 | qla_scm_process_link_integrity_d(struct scsi_qla_host *vha,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:143:1: warning: no previous prototype for
‘qla_delivery_tgt_stats_update’ [-Wmissing-prototypes]
143 | qla_delivery_tgt_stats_update(struct fpin_descriptor *fpin_desc,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:173:1: warning: no previous prototype for
‘qla_scm_process_delivery_notification_d’ [-Wmissing-prototypes]
173 | qla_scm_process_delivery_notification_d(struct scsi_qla_host *vha,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:204:1: warning: no previous prototype for
‘qla_scm_set_target_device_state’ [-Wmissing-prototypes]
204 | qla_scm_set_target_device_state(fc_port_t *fcport,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/scsi/qla2xxx/qla_isr.c:227:1: warning: no previous prototype for ‘qla_peer_congestion_tgt_stats_update’ [-Wmissing-prototypes]
227 | qla_peer_congestion_tgt_stats_update(struct fpin_descriptor*fpin_desc,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:270:1: warning: no previous prototype for ‘qla_scm_process_peer_congestion_notification_d’ [-Wmissing-prototypes]
270 | qla_scm_process_peer_congestion_notification_d(structscsi_qla_host *vha,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:313:1: warning: no previous prototype for
‘qla_scm_process_congestion_notification_d’ [-Wmissing-prototypes]
313 | qla_scm_process_congestion_notification_d(struct scsi_qla_host *vha,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/scsi/qla2xxx/qla_isr.c:343:1: warning: no previous prototype for ‘qla27xx_process_purex_fpin’ [-Wmissing-prototypes]
343 | qla27xx_process_purex_fpin(struct scsi_qla_host *vha, structpurex_item *item)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:1136:1: warning: no previous prototype
for ‘qla24xx_alloc_purex_item’ [-Wmissing-prototypes]
1136 | qla24xx_alloc_purex_item(scsi_qla_host_t *vha, uint16_t size)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:1192:2: warning: no previous prototype
for ‘qla24xx_copy_std_pkt’ [-Wmissing-prototypes]
1192 | *qla24xx_copy_std_pkt(struct scsi_qla_host *vha, void *pkt)
| ^~~~~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_isr.c:1213:1: warning: no previous prototype
for ‘qla27xx_copy_fpin_pkt’ [-Wmissing-prototypes]
1213 | qla27xx_copy_fpin_pkt(struct scsi_qla_host *vha, void **pkt,
| ^~~~~~~~~~~~~~~~~~~~~
CC [M] drivers/scsi/qla2xxx/qla_gs.o
CC [M] drivers/scsi/qla2xxx/qla_dbg.o
CC [M] drivers/scsi/qla2xxx/qla_sup.o
CC [M] drivers/scsi/qla2xxx/qla_attr.o
CC [M] drivers/scsi/qla2xxx/qla_mid.o
CC [M] drivers/scsi/qla2xxx/qla_dfs.odrivers/scsi/qla2xxx/qla_dfs.c: In function ‘qla2x00_dfs_tgt_port_database_show’:drivers/scsi/qla2xxx/qla_dfs.c:107:1: warning: the frame size of 1280 bytes is larger than 1024 bytes [-Wframe-larger-than=]
107 | }
| ^
and also the following sparse complaints:
$ make M=drivers/scsi/qla2xxx C=2
CHECK drivers/scsi/qla2xxx/qla_os.c
CC [M] drivers/scsi/qla2xxx/qla_os.o
CHECK drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_init.c:8520:22: warning: cast to restricted __le16
CC [M] drivers/scsi/qla2xxx/qla_init.o
CHECK drivers/scsi/qla2xxx/qla_mbx.c
CC [M] drivers/scsi/qla2xxx/qla_mbx.o
CHECK drivers/scsi/qla2xxx/qla_iocb.c
CC [M] drivers/scsi/qla2xxx/qla_iocb.o
CHECK drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_isr.c:27:1: warning: symbol
'qla_link_integrity_tgt_stats_update' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:106:38: warning: restricted __be32
degrades to integer
drivers/scsi/qla2xxx/qla_isr.c:83:1: warning: symbol
'qla_scm_process_link_integrity_d' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:143:1: warning: symbol
'qla_delivery_tgt_stats_update' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:173:1: warning: symbol
'qla_scm_process_delivery_notification_d' was not declared. Should it be
static?
drivers/scsi/qla2xxx/qla_isr.c:204:1: warning: symbol
'qla_scm_set_target_device_state' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:240:56: warning: incorrect type in
assignment (different base types)
drivers/scsi/qla2xxx/qla_isr.c:240:56: expected unsigned int
[usertype] event_period
drivers/scsi/qla2xxx/qla_isr.c:240:56: got restricted __be32
[usertype] event_period
drivers/scsi/qla2xxx/qla_isr.c:227:1: warning: symbol
'qla_peer_congestion_tgt_stats_update' was not declared. Should it be
static?
drivers/scsi/qla2xxx/qla_isr.c:270:1: warning: symbol
'qla_scm_process_peer_congestion_notification_d' was not declared.
Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:313:1: warning: symbol
'qla_scm_process_congestion_notification_d' was not declared. Should it
be static?
drivers/scsi/qla2xxx/qla_isr.c:343:1: warning: symbol
'qla27xx_process_purex_fpin' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:1135:19: warning: symbol
'qla24xx_alloc_purex_item' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:1192:1: warning: symbol
'qla24xx_copy_std_pkt' was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_isr.c:1225:23: warning: restricted __le16
degrades to integer
drivers/scsi/qla2xxx/qla_isr.c:1225:23: warning: cast to restricted __le16
drivers/scsi/qla2xxx/qla_isr.c:1212:19: warning: symbol
'qla27xx_copy_fpin_pkt' was not declared. Should it be static?
CC [M] drivers/scsi/qla2xxx/qla_isr.o
CHECK drivers/scsi/qla2xxx/qla_gs.c
CC [M] drivers/scsi/qla2xxx/qla_gs.o
CHECK drivers/scsi/qla2xxx/qla_dbg.c
CC [M] drivers/scsi/qla2xxx/qla_dbg.o
CHECK drivers/scsi/qla2xxx/qla_sup.c
CC [M] drivers/scsi/qla2xxx/qla_sup.o
CHECK drivers/scsi/qla2xxx/qla_attr.c
CC [M] drivers/scsi/qla2xxx/qla_attr.o
CHECK drivers/scsi/qla2xxx/qla_mid.c
CC [M] drivers/scsi/qla2xxx/qla_mid.o
CHECK drivers/scsi/qla2xxx/qla_dfs.c
CC [M] drivers/scsi/qla2xxx/qla_dfs.o
drivers/scsi/qla2xxx/qla_dfs.c: In function
‘qla2x00_dfs_tgt_port_database_show’:
drivers/scsi/qla2xxx/qla_dfs.c:107:1: warning: the frame size of 1280
bytes is larger than 1024 bytes [-Wframe-larger-than=]
107 | }
| ^Please fix these issues.
Thanks,
Bart.