qla2xxx, qla4xxx: re-use %p[hmM] specifiers to print variables
Subsystems (3)
v2 cover qla2xxx, qla4xxx: re-use %p[hmM] specifiers to print variables
We have nice specifiers in the kernel that helps us to simplify printing of the small buffers (as hexstring) and MAC addresses.
Since v1:
- rewritten commit messages to reflect changes better
- append patch 2/3
- apply ACK to patch 3/3
Andy Shevchenko (1):
scsi: qla2xxx: print MAC via %pMR
Oleksandr Khoshaba (2):
scsi: qla2xxx: print some variables via %*phC or %*phN format
scsi: qla4xxx: print MAC and SID via %p[mM][R]
drivers/scsi/qla2xxx/qla_attr.c | 5 +- drivers/scsi/qla2xxx/qla_bsg.c | 8 +--- drivers/scsi/qla2xxx/qla_gs.c | 96 ++++++-------------------------------- drivers/scsi/qla2xxx/qla_init.c | 24 ++-------- drivers/scsi/qla2xxx/qla_isr.c | 9 +--- drivers/scsi/qla2xxx/qla_mr.c | 10 +--- drivers/scsi/qla2xxx/qla_os.c | 10 +--- drivers/scsi/qla2xxx/qla_target.c | 71 +++++++--------------------- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 18 +++---- drivers/scsi/qla4xxx/ql4_mbx.c | 5 +- drivers/scsi/qla4xxx/ql4_nx.c | 8 +--- drivers/scsi/qla4xxx/ql4_os.c | 15 ++---- 12 files changed, 60 insertions(+), 219 deletions(-)
Signature · 1 line
1.8.3.2
PATCH v2 1/3 scsi: qla2xxx: print some variables via %*phC or %*phN format
From: Oleksandr Khoshaba <[email protected]>
The patch changes a specifier used to output some variables. Instead of using stack for each byte the '%*ph[CN]' allows to take a one pointer and prints entire buffer as a hexadecimal string with the separator ':' or ''.
--- drivers/scsi/qla2xxx/qla_bsg.c | 8 +--- drivers/scsi/qla2xxx/qla_gs.c | 96 ++++++-------------------------------- drivers/scsi/qla2xxx/qla_init.c | 24 ++-------- drivers/scsi/qla2xxx/qla_isr.c | 9 +--- drivers/scsi/qla2xxx/qla_mr.c | 10 +--- drivers/scsi/qla2xxx/qla_os.c | 10 +--- drivers/scsi/qla2xxx/qla_target.c | 71 +++++++--------------------- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 18 +++---- 8 files changed, 52 insertions(+), 194 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +2 -6
@@ -1318,12 +1318,8 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)if (rval) {ql_log (ql_log_warn, vha,0x704c , -"iIDMA cmd failed for %02x%02x%02x%02x%02x%02x%02x%02x -- " -"%04x %x %04x %04x.\n" , fcport->port_name[0 ], - fcport->port_name[1 ], fcport->port_name[2 ], - fcport->port_name[3 ], fcport->port_name[4 ], - fcport->port_name[5 ], fcport->port_name[6 ], - fcport->port_name[7 ], rval, fcport->fp_speed, mb[0 ], mb[1 ]); +"iIDMA cmd failed for %8phN -- %04x %x %04x %04x.\n" , + fcport->port_name, rval, fcport->fp_speed, mb[0 ], mb[1 ]); rval = (DID_ERROR <<16 ); }else {if (!port_param->mode) {
drivers/scsi/qla2xxx/qla_gs.c +15 -81
150 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_init.c +5 -19
@@ -564,12 +564,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)if (ha->flags.disable_serdes) {/* Mask HBA via NVRAM settings? */ ql_log (ql_log_info, vha,0x0077 , -"Masking HBA WWPN " -"%02x%02x%02x%02x%02x%02x%02x%02x (via NVRAM).\n" , - vha->port_name[0 ], vha->port_name[1 ], - vha->port_name[2 ], vha->port_name[3 ], - vha->port_name[4 ], vha->port_name[5 ], - vha->port_name[6 ], vha->port_name[7 ]); +"Masking HBA WWPN %8phN (via NVRAM).\n" , vha->port_name);return QLA_FUNCTION_FAILED ; }
@@ -3061,22 +3056,13 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) mb);if (rval !=QLA_SUCCESS ) {ql_dbg (ql_dbg_disc, vha,0x2004 , -"Unable to adjust iIDMA " -"%02x%02x%02x%02x%02x%02x%02x%02x -- %04x %x %04x " -"%04x.\n" , fcport->port_name[0 ], fcport->port_name[1 ], - fcport->port_name[2 ], fcport->port_name[3 ], - fcport->port_name[4 ], fcport->port_name[5 ], - fcport->port_name[6 ], fcport->port_name[7 ], rval, - fcport->fp_speed, mb[0 ], mb[1 ]); +"Unable to adjust iIDMA %8phN -- %04x %x %04x %04x.\n" , + fcport->port_name, rval, fcport->fp_speed, mb[0 ], mb[1 ]); }else {ql_dbg (ql_dbg_disc, vha,0x2005 , -"iIDMA adjusted to %s GB/s " -"on %02x%02x%02x%02x%02x%02x%02x%02x.\n" , +"iIDMA adjusted to %s GB/s on %8phN.\n" ,qla2x00_get_link_speed_str (ha, fcport->fp_speed), - fcport->port_name[0 ], fcport->port_name[1 ], - fcport->port_name[2 ], fcport->port_name[3 ], - fcport->port_name[4 ], fcport->port_name[5 ], - fcport->port_name[6 ], fcport->port_name[7 ]); + fcport->port_name); } }
drivers/scsi/qla2xxx/qla_isr.c +2 -7
@@ -2212,16 +2212,11 @@ check_scsi_status: out:if (logit)ql_dbg (ql_dbg_io, fcport->vha,0x3022 , -"FCP command status: 0x%x-0x%x (0x%x) " -"nexus=%ld:%d:%d portid=%02x%02x%02x oxid=0x%x " -"cdb=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x len=0x%x " -"rsp_info=0x%x resid=0x%x fw_resid=0x%x.\n" , +"FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%d portid=%02x%02x%02x oxid=0x%x cdb=%10phN len=0x%x rsp_info=0x%x resid=0x%x fw_resid=0x%x.\n" , comp_status, scsi_status, res, vha->host_no, cp->device->id, cp->device->lun, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa, ox_id, - cp->cmnd[0 ], cp->cmnd[1 ], cp->cmnd[2 ], cp->cmnd[3 ], - cp->cmnd[4 ], cp->cmnd[5 ], cp->cmnd[6 ], cp->cmnd[7 ], - cp->cmnd[8 ], cp->cmnd[9 ],scsi_bufflen (cp), rsp_info_len, + cp->cmnd,scsi_bufflen (cp), rsp_info_len, resid_len, fw_resid_len);if (!res)
drivers/scsi/qla2xxx/qla_mr.c +2 -8
@@ -2526,16 +2526,10 @@ check_scsi_status:if (logit)ql_dbg (ql_dbg_io, fcport->vha,0x3058 , -"FCP command status: 0x%x-0x%x (0x%x) " -"nexus=%ld:%d:%d tgt_id: 0x%x lscsi_status: 0x%x" -"cdb=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x len=0x%x " -"rsp_info=0x%x resid=0x%x fw_resid=0x%x " -"sense_len=0x%x, par_sense_len=0x%x, rsp_info_len=0x%x\n" , +"FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%d tgt_id: 0x%x lscsi_status: 0x%xcdb=%10phN len=0x%x rsp_info=0x%x resid=0x%x fw_resid=0x%x sense_len=0x%x, par_sense_len=0x%x, rsp_info_len=0x%x\n" , comp_status, scsi_status, res, vha->host_no, cp->device->id, cp->device->lun, fcport->tgt_id, - lscsi_status, cp->cmnd[0 ], cp->cmnd[1 ], cp->cmnd[2 ], - cp->cmnd[3 ], cp->cmnd[4 ], cp->cmnd[5 ], cp->cmnd[6 ], - cp->cmnd[7 ], cp->cmnd[8 ], cp->cmnd[9 ],scsi_bufflen (cp), + lscsi_status, cp->cmnd,scsi_bufflen (cp), rsp_info_len, resid_len, fw_resid_len, sense_len, par_sense_len, rsp_info_len);
drivers/scsi/qla2xxx/qla_os.c +2 -8
@@ -3210,14 +3210,8 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport,set_bit (RELOGIN_NEEDED , &vha->dpc_flags);ql_dbg (ql_dbg_disc, vha,0x2067 , -"Port login retry " -"%02x%02x%02x%02x%02x%02x%02x%02x, " -"id = 0x%04x retry cnt=%d.\n" , - fcport->port_name[0 ], fcport->port_name[1 ], - fcport->port_name[2 ], fcport->port_name[3 ], - fcport->port_name[4 ], fcport->port_name[5 ], - fcport->port_name[6 ], fcport->port_name[7 ], - fcport->loop_id, fcport->login_retry); +"Port login retry %8phN, id = 0x%04x retry cnt=%d.\n" , + fcport->port_name, fcport->loop_id, fcport->login_retry); } }
drivers/scsi/qla2xxx/qla_target.c +18 -53
113 lines not on this page · raw message
drivers/scsi/qla2xxx/tcm_qla2xxx.c +6 -12
@@ -1428,9 +1428,7 @@ static int tcm_qla2xxx_check_initiator_node_acl(* match the format by tcm_qla2xxx explict ConfigFS NodeACLs. */ memset (&port_name,0 ,36 ); -snprintf (port_name,36 ,"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" , - fc_wwpn[0 ], fc_wwpn[1 ], fc_wwpn[2 ], fc_wwpn[3 ], fc_wwpn[4 ], - fc_wwpn[5 ], fc_wwpn[6 ], fc_wwpn[7 ]); +snprintf (port_name,36 ,"%8phC" , fc_wwpn);/* * Locate our struct se_node_acl either from an explict NodeACL created * via ConfigFS, or via running in TPG demo mode.
@@ -1474,15 +1472,11 @@ static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24) -pr_info ("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n" , - sess, - sess->port_name[0 ], sess->port_name[1 ], - sess->port_name[2 ], sess->port_name[3 ], - sess->port_name[4 ], sess->port_name[5 ], - sess->port_name[6 ], sess->port_name[7 ], - sess->loop_id, loop_id, - sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, - s_id.b.domain, s_id.b.area, s_id.b.al_pa); +pr_info ("Updating session %p from port %8phC loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n" , + sess, sess->port_name, sess->loop_id, loop_id, + sess->s_id.b.domain, sess->s_id.b.area, + sess->s_id.b.al_pa, s_id.b.domain, s_id.b.area, + s_id.b.al_pa);if (sess->loop_id != loop_id) {/*
Signature · 1 line
1.8.3.2
PATCH v2 2/3 scsi: qla2xxx: print MAC via %pMR
In reply to Andy Shevchenko--- drivers/scsi/qla2xxx/qla_attr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -4
@@ -1265,10 +1265,7 @@ qla2x00_vn_port_mac_address_show(struct device *dev,if (!IS_CNA_CAPABLE (vha->hw))return snprintf (buf,PAGE_SIZE ,"\n" ); -return snprintf (buf,PAGE_SIZE ,"%02x:%02x:%02x:%02x:%02x:%02x\n" , - vha->fcoe_vn_port_mac[5 ], vha->fcoe_vn_port_mac[4 ], - vha->fcoe_vn_port_mac[3 ], vha->fcoe_vn_port_mac[2 ], - vha->fcoe_vn_port_mac[1 ], vha->fcoe_vn_port_mac[0 ]); +return snprintf (buf,PAGE_SIZE ,"%pMR\n" , vha->fcoe_vn_port_mac); } static ssize_t
Signature · 1 line
1.8.3.2
PATCH v2 3/3 scsi: qla4xxx: print MAC and SID via %p[mM][R]
In reply to Andy ShevchenkoFrom: Oleksandr Khoshaba <[email protected]>
In the kernel we have nice specifier to print MAC by given pointer to the address in binary form.
--- drivers/scsi/qla4xxx/ql4_mbx.c | 5 +---- drivers/scsi/qla4xxx/ql4_nx.c | 8 ++------ drivers/scsi/qla4xxx/ql4_os.c | 15 ++++----------- 3 files changed, 7 insertions(+), 21 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -4
@@ -1837,10 +1837,7 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha, ptid = (uint16_t *)&fw_ddb_entry->isid[1 ]; *ptid =cpu_to_le16 ((uint16_t )ddb_entry->sess->target_id); -DEBUG2 (ql4_printk (KERN_INFO , ha,"ISID [%02x%02x%02x%02x%02x%02x]\n" , - fw_ddb_entry->isid[5 ], fw_ddb_entry->isid[4 ], - fw_ddb_entry->isid[3 ], fw_ddb_entry->isid[2 ], - fw_ddb_entry->isid[1 ], fw_ddb_entry->isid[0 ])); +DEBUG2 (ql4_printk (KERN_INFO , ha,"ISID [%pmR]\n" , fw_ddb_entry->isid)); iscsi_opts =le16_to_cpu (fw_ddb_entry->iscsi_options);memset (fw_ddb_entry->iscsi_alias,0 ,sizeof (fw_ddb_entry->iscsi_alias));
drivers/scsi/qla4xxx/ql4_nx.c +2 -6
@@ -3455,12 +3455,8 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha) ha->phy_port_num = sys_info->port_num; ha->iscsi_pci_func_cnt = sys_info->iscsi_pci_func_cnt; -DEBUG2 (printk ("scsi%ld: %s: " -"mac %02x:%02x:%02x:%02x:%02x:%02x " -"serial %s\n" , ha->host_no, __func__, - ha->my_mac[0 ], ha->my_mac[1 ], ha->my_mac[2 ], - ha->my_mac[3 ], ha->my_mac[4 ], ha->my_mac[5 ], - ha->serial_number)); +DEBUG2 (printk ("scsi%ld: %s: mac %pM serial %s\n" , ha->host_no, + __func__, ha->my_mac, ha->serial_number)); status =QLA_SUCCESS ;
drivers/scsi/qla4xxx/ql4_os.c +4 -11
@@ -4786,13 +4786,9 @@ static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha,* ISID would not match firmware generated ISID. */ if (is_isid_compare) { -DEBUG2 (ql4_printk (KERN_INFO , ha,"%s: old ISID [%02x%02x%02x" -"%02x%02x%02x] New ISID [%02x%02x%02x%02x%02x%02x]\n" , - __func__, old_tddb->isid[5 ], old_tddb->isid[4 ], - old_tddb->isid[3 ], old_tddb->isid[2 ], old_tddb->isid[1 ], - old_tddb->isid[0 ], new_tddb->isid[5 ], new_tddb->isid[4 ], - new_tddb->isid[3 ], new_tddb->isid[2 ], new_tddb->isid[1 ], - new_tddb->isid[0 ])); +DEBUG2 (ql4_printk (KERN_INFO , ha, +"%s: old ISID [%pmR] New ISID [%pmR]\n" , + __func__, old_tddb->isid, new_tddb->isid));if (memcmp (&old_tddb->isid[0 ], &new_tddb->isid[0 ],sizeof (old_tddb->isid)))
@@ -6211,10 +6207,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess, rc =sprintf (buf,"%u\n" , fnode_conn->keepalive_timeout);break ;case ISCSI_FLASHNODE_ISID : - rc =sprintf (buf,"%02x%02x%02x%02x%02x%02x\n" , - fnode_sess->isid[0 ], fnode_sess->isid[1 ], - fnode_sess->isid[2 ], fnode_sess->isid[3 ], - fnode_sess->isid[4 ], fnode_sess->isid[5 ]); + rc =sprintf (buf,"%pm\n" , fnode_sess->isid);break ;case ISCSI_FLASHNODE_TSID : rc =sprintf (buf,"%u\n" , fnode_sess->tsid);
Signature · 1 line
1.8.3.2
Re: [PATCHv2 3/3] scsi: qla4xxx: print MAC and SID via %p[mM][R]
Quoted 7 lines · Andy Shevchenko
From: Oleksandr Khoshaba <[email protected]>
In the kernel we have nice specifier to print MAC by given pointer to the address in binary form.
Signed-off-by Oleksandr Khoshaba <[email protected]>Acked-by Vikas Chaudhary <[email protected]>
Could anyone take this patch?
Quoted 81 lines
--- drivers/scsi/qla4xxx/ql4_mbx.c | 5 +---- drivers/scsi/qla4xxx/ql4_nx.c | 8 ++------ drivers/scsi/qla4xxx/ql4_os.c | 15 ++++----------- 3 files changed, 7 insertions(+), 21 deletions(-)drivers/scsi/qla4xxx/ql4_mbx.c +1
-4@@ -1837,10 +1837,7 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha, ptid = (uint16_t *)&fw_ddb_entry->isid[1 ]; *ptid =cpu_to_le16 ((uint16_t )ddb_entry->sess->target_id); -DEBUG2 (ql4_printk (KERN_INFO , ha,"ISID [%02x%02x%02x%02x%02x%02x]\n" , - fw_ddb_entry->isid[5 ], fw_ddb_entry->isid[4 ], - fw_ddb_entry->isid[3 ], fw_ddb_entry->isid[2 ], - fw_ddb_entry->isid[1 ], fw_ddb_entry->isid[0 ])); +DEBUG2 (ql4_printk (KERN_INFO , ha,"ISID [%pmR]\n" , fw_ddb_entry->isid)); iscsi_opts =le16_to_cpu (fw_ddb_entry->iscsi_options);memset (fw_ddb_entry->iscsi_alias,0 ,sizeof (fw_ddb_entry->iscsi_alias));drivers/scsi/qla4xxx/ql4_nx.c +2
-6@@ -3455,12 +3455,8 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha) ha->phy_port_num = sys_info->port_num; ha->iscsi_pci_func_cnt = sys_info->iscsi_pci_func_cnt; -DEBUG2 (printk ("scsi%ld: %s: " -"mac %02x:%02x:%02x:%02x:%02x:%02x " -"serial %s\n" , ha->host_no, __func__, - ha->my_mac[0 ], ha->my_mac[1 ], ha->my_mac[2 ], - ha->my_mac[3 ], ha->my_mac[4 ], ha->my_mac[5 ], - ha->serial_number)); +DEBUG2 (printk ("scsi%ld: %s: mac %pM serial %s\n" , ha->host_no, + __func__, ha->my_mac, ha->serial_number)); status =QLA_SUCCESS ;drivers/scsi/qla4xxx/ql4_os.c +4
-12@@ -4786,13 +4786,9 @@ static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha,* ISID would not match firmware generated ISID. */ if (is_isid_compare) { -DEBUG2 (ql4_printk (KERN_INFO , ha,"%s: old ISID [%02x%02x%02x" -"%02x%02x%02x] New ISID [%02x%02x%02x%02x%02x%02x]\n" , - __func__, old_tddb->isid[5 ], old_tddb->isid[4 ], - old_tddb->isid[3 ], old_tddb->isid[2 ], old_tddb->isid[1 ], - old_tddb->isid[0 ], new_tddb->isid[5 ], new_tddb->isid[4 ], - new_tddb->isid[3 ], new_tddb->isid[2 ], new_tddb->isid[1 ], - new_tddb->isid[0 ])); +DEBUG2 (ql4_printk (KERN_INFO , ha, +"%s: old ISID [%pmR] New ISID [%pmR]\n" , + __func__, old_tddb->isid, new_tddb->isid));if (memcmp (&old_tddb->isid[0 ], &new_tddb->isid[0 ],sizeof (old_tddb->isid)))@@ -6211,10 +6207,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess, rc =sprintf (buf,"%u\n" , fnode_conn->keepalive_timeout);break ;case ISCSI_FLASHNODE_ISID : - rc =sprintf (buf,"%02x%02x%02x%02x%02x%02x\n" , - fnode_sess->isid[0 ], fnode_sess->isid[1 ], - fnode_sess->isid[2 ], fnode_sess->isid[3 ], - fnode_sess->isid[4 ], fnode_sess->isid[5 ]); + rc =sprintf (buf,"%pm\n" , fnode_sess->isid);break ;case ISCSI_FLASHNODE_TSID : rc =sprintf (buf,"%u\n" , fnode_sess->tsid); --1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
With Best Regards, Andy Shevchenko