summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fnic
AgeCommit message (Collapse)AuthorFilesLines
2021-05-02scsi: fnic: Use scsi_host_busy_iter() to traverse commandsHannes Reinecke1-446/+375
Use scsi_host_busy_iter() to traverse commands instead of hand-crafted routines walking the command list. Link: https://lore.kernel.org/r/20210429122517.39659-3-hare@suse.de Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-05-02scsi: fnic: Kill 'exclude_id' argument to fnic_cleanup_io()Hannes Reinecke1-6/+3
'exclude_id' is always SCSI_NO_TAG which will never be reached when traversing the list of tags. Link: https://lore.kernel.org/r/20210429122517.39659-2-hare@suse.de Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-04-05scsi: fnic: Remove unnecessary spin_lock_init() and INIT_LIST_HEAD()Yang Yingliang1-3/+0
The spinlock and list head of fnic_list are initialized statically. It is unnecessary to initialize them. Link: https://lore.kernel.org/r/20210330125911.1050879-1-yangyingliang@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-29scsi: fnic: Remove bogus ratelimit messagesLee Duncan1-6/+8
Commit b43abcbbd5b1 ("scsi: fnic: Ratelimit printks to avoid flooding when vlan is not set by the switch.i") added printk_ratelimit() in front of a couple of debug-mode messages to reduce logging overrun when debugging the driver. The code: > if (printk_ratelimit()) > FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, > "Start VLAN Discovery\n"); ends up calling printk_ratelimit() quite often, triggering many kernel messages about callbacks being supressed. The fix is to decompose FNIC_FCS_DBG(), then change the order of checks so that printk_ratelimit() is only called if driver debugging is enabled. Link: https://lore.kernel.org/r/20210323172756.5743-1-lduncan@suse.com Reviewed-by: Laurence Oberman <loberman@redhat.com> Signed-off-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-24scsi: fnic: Remove unnecessary castWang Qing1-2/+1
Fix the following coccicheck warning: WARNING: casting value returned by memory allocation function is useless. Link: https://lore.kernel.org/r/1615515500-946-1-git-send-email-wangqing@vivo.com Signed-off-by: Wang Qing <wangqing@vivo.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-18scsi: fnic: Kernel-doc headers must contain the function nameLee Jones1-1/+1
Fixes the following W=1 kernel build warning(s): drivers/scsi/fnic/fnic_fcs.c:308: warning: expecting prototype for Check if the Received FIP FLOGI frame is rejected(). Prototype was for is_fnic_fip_flogi_reject() instead Link: https://lore.kernel.org/r/20210317091230.2912389-19-lee.jones@linaro.org Cc: Satish Kharat <satishkh@cisco.com> Cc: Sesidhar Baddela <sebaddel@cisco.com> Cc: Karan Tilak Kumar <kartilak@cisco.com> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-18scsi: fnic: Demote non-conformant kernel-doc headersLee Jones1-3/+3
Fixes the following W=1 kernel build warning(s): drivers/scsi/fnic/fnic_scsi.c:183: warning: Function parameter or member 'fnic' not described in '__fnic_set_state_flags' drivers/scsi/fnic/fnic_scsi.c:183: warning: Function parameter or member 'st_flags' not described in '__fnic_set_state_flags' drivers/scsi/fnic/fnic_scsi.c:183: warning: Function parameter or member 'clearbits' not described in '__fnic_set_state_flags' drivers/scsi/fnic/fnic_scsi.c:2296: warning: Function parameter or member 'fnic' not described in 'fnic_scsi_host_start_tag' drivers/scsi/fnic/fnic_scsi.c:2296: warning: Function parameter or member 'sc' not described in 'fnic_scsi_host_start_tag' drivers/scsi/fnic/fnic_scsi.c:2316: warning: Function parameter or member 'fnic' not described in 'fnic_scsi_host_end_tag' drivers/scsi/fnic/fnic_scsi.c:2316: warning: Function parameter or member 'sc' not described in 'fnic_scsi_host_end_tag' Link: https://lore.kernel.org/r/20210317091230.2912389-18-lee.jones@linaro.org Cc: Satish Kharat <satishkh@cisco.com> Cc: Sesidhar Baddela <sebaddel@cisco.com> Cc: Karan Tilak Kumar <kartilak@cisco.com> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-03-18scsi: fnic: Rudimentary spelling fixesBhaskar Chowdhury1-9/+9
Rudimentary typo fixes throughout the fnic_trace.c file. Link: https://lore.kernel.org/r/20210317092240.927822-1-unixbhaskar@gmail.com Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-01-12scsi: fnic: Fix memleak in vnic_dev_init_devcmd2Dinghao Liu1-3/+5
When ioread32() returns 0xFFFFFFFF, we should execute cleanup functions like other error handling paths before returning. Link: https://lore.kernel.org/r/20201225083520.22015-1-dinghao.liu@zju.edu.cn Acked-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-12-07scsi: fnic: Fix error return code in fnic_probe()Zhang Changzhong1-0/+1
Return a negative error code from the error handling case instead of 0 as done elsewhere in this function. Link: https://lore.kernel.org/r/1607068060-31203-1-git-send-email-zhangchangzhong@huawei.com Fixes: 5df6d737dd4b ("[SCSI] fnic: Add new Cisco PCI-Express FCoE HBA") Reported-by: Hulk Robot <hulkci@huawei.com> Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-11-23scsi: fnic: Validate io_req before othersKaran Tilak Kumar2-6/+5
We need to check for a valid io_req before we check other data. Also, remove redundant checks. Link: https://lore.kernel.org/r/20201121023337.19295-1-kartilak@cisco.com Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-11-23scsi: fnic: Set scsi_set_resid() only for underflowKaran Tilak Kumar2-3/+4
Set scsi_set_resid() only if FCPIO_ICMND_CMPL_RESID_UNDER is set. Link: https://lore.kernel.org/r/20201121015134.18872-1-kartilak@cisco.com Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-11-23scsi: fnic: Change shost_printk() to FNIC_MAIN_DBG()Karan Tilak Kumar2-2/+2
Replace shost_printk() with FNIC_MAIN_DBG() so that these log messages are controlled by fnic_log_level flag in fnic_handle_link. Link: https://lore.kernel.org/r/20201121013739.18701-1-kartilak@cisco.com Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-11-23scsi: fnic: Avoid looping in TRANS ETH on unloadKaran Tilak Kumar4-2/+8
Avoid looping in fnic_scsi_abort_io() before sending fw reset when fnic is in TRANS ETH state and when we have not received any link events. Link: https://lore.kernel.org/r/20201121012145.18522-1-kartilak@cisco.com Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-11-23scsi: fnic: Change shost_printk() to FNIC_FCS_DBG()Karan Tilak Kumar2-4/+4
Replacing shost_printk with FNIC_FCS_DBG() so that these log messages are controlled by fnic_log_level flag in fnic_fip_handler_timer. Bumping up version number from 47 to 49 to maintain same level as internal version. Link: https://lore.kernel.org/r/20201120220712.16708-1-kartilak@cisco.com Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-10-07scsi: fnic: Simplify the return expression of vnic_wq_copy_alloc()Liu Shixin1-7/+1
Simplify the return expression. Link: https://lore.kernel.org/r/20200921082452.2592085-1-liushixin2@huawei.com Signed-off-by: Liu Shixin <liushixin2@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-10-02scsi: fnic: Fix inconsistent format argument type in fnic_debugfs.cYe Bin1-3/+3
Fix the following warnings: [drivers/scsi/fnic/fnic_debugfs.c:123]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'. [drivers/scsi/fnic/fnic_debugfs.c:125]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'. [drivers/scsi/fnic/fnic_debugfs.c:127]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'. Link: https://lore.kernel.org/r/20200930021919.2832860-2-yebin10@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Acked-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Ye Bin <yebin10@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-10-02scsi: fnic: Do not call 'scsi_done()' for unhandled commandsHannes Reinecke1-2/+1
The fnic drivers assigns an ioreq structure to each command and severs this assignment once scsi_done() has been called and the command has been completed. When traversing commands to terminate outstanding I/O we should not call scsi_done() on commands which do not have a corresponding ioreq structure; these commands have either never entered the driver or have already been completed. [mkp: fixed unused label warning] Link: https://lore.kernel.org/r/20200515112647.49260-1-hare@suse.de Reported-by: kbuild test robot <lkp@intel.com> Reviewed-by: Laurence Oberman <loberman@redhat.com> Acked-by: Satish Kharat <satishkh@cisco.com> Acked-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-09-15scsi: fnic: Remove unneeded semicolonJason Yan1-1/+1
This addresses the following coccinelle warning: drivers/scsi/fnic/fnic_main.c:446:2-3: Unneeded semicolon Link: https://lore.kernel.org/r/20200911091057.2938685-1-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-09-02scsi: fnic: Remove set but not used 'eth_hdrs_stripped'Jason Yan1-3/+0
This addresses the following gcc warning with "make W=1": drivers/scsi/fnic/fnic_fcs.c: In function ‘fnic_rq_cmpl_frame_recv’: drivers/scsi/fnic/fnic_fcs.c:840:15: warning: variable ‘eth_hdrs_stripped’ set but not used [-Wunused-but-set-variable] 840 | unsigned int eth_hdrs_stripped; | ^~~~~~~~~~~~~~~~~ Link: https://lore.kernel.org/r/20200831081126.3251288-5-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-09-02scsi: fnic: Remove set but not used 'fr_len'Jason Yan1-2/+0
This addresses the following gcc warning with "make W=1": drivers/scsi/fnic/fnic_fcs.c: In function ‘fnic_fcoe_send_vlan_req’: drivers/scsi/fnic/fnic_fcs.c:379:6: warning: variable ‘fr_len’ set but not used [-Wunused-but-set-variable] 379 | int fr_len; | ^~~~~~ Link: https://lore.kernel.org/r/20200831081126.3251288-4-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-09-02scsi: fnic: Remove set but not used variable in is_fnic_fip_flogi_reject()Jason Yan1-4/+0
This addresses the following gcc warning with "make W=1": drivers/scsi/fnic/fnic_fcs.c: In function ‘is_fnic_fip_flogi_reject’: drivers/scsi/fnic/fnic_fcs.c:317:9: warning: variable ‘els_len’ set but not used [-Wunused-but-set-variable] 317 | size_t els_len = 0; | ^~~~~~~ drivers/scsi/fnic/fnic_fcs.c:312:21: warning: variable ‘els_dtype’ set but not used [-Wunused-but-set-variable] 312 | enum fip_desc_type els_dtype = 0; | ^~~~~~~~~ Link: https://lore.kernel.org/r/20200831081126.3251288-3-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-09-02scsi: fnic: Remove set but not used 'old_vlan'Jason Yan1-2/+1
This addresses the following gcc warning with "make W=1": drivers/scsi/fnic/fnic_main.c: In function ‘fnic_set_vlan’: drivers/scsi/fnic/fnic_main.c:555:6: warning: variable ‘old_vlan’ set but not used [-Wunused-but-set-variable] 555 | u16 old_vlan; | ^~~~~~~~ Link: https://lore.kernel.org/r/20200831081126.3251288-2-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-24scsi: fnic: Use eth_broadcast_addr() to assign broadcast addressMiaohe Lin1-1/+2
Use eth_broadcast_addr() to assign broadcast address insetad of memset(). Link: https://lore.kernel.org/r/1595233498-13628-1-git-send-email-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-05-07scsi: fnic: Use true, false for fnic->internal_reset_inprogressJason Yan1-3/+3
Fix the following coccicheck warning: drivers/scsi/fnic/fnic_scsi.c:2627:5-36: WARNING: Comparison of 0/1 to bool variable Link: https://lore.kernel.org/r/20200430121718.14970-1-yanaijie@huawei.com Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-04-17scsi: fnic: make vnic_wq_get_ctrl and vnic_wq_alloc_ring staticJason Yan1-2/+2
Fix the following sparse warning: drivers/scsi/fnic/vnic_wq.c:28:5: warning: symbol 'vnic_wq_get_ctrl' was not declared. Should it be static? drivers/scsi/fnic/vnic_wq.c:40:5: warning: symbol 'vnic_wq_alloc_ring' was not declared. Should it be static? Link: https://lore.kernel.org/r/20200415093809.9365-3-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-04-17scsi: fnic: make fnic_list and fnic_list_lock staticJason Yan1-2/+2
Fix the following sparse warning: drivers/scsi/fnic/fnic_main.c:52:1: warning: symbol 'fnic_list' was not declared. Should it be static? drivers/scsi/fnic/fnic_main.c:53:1: warning: symbol 'fnic_list_lock' was not declared. Should it be static? Link: https://lore.kernel.org/r/20200415093809.9365-2-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-04-17scsi: fnic: make some symbols staticJason Yan1-6/+6
Fix the following sparse warning: drivers/scsi/fnic/vnic_dev.c:257:5: warning: symbol 'vnic_dev_cmd1' was not declared. Should it be static? drivers/scsi/fnic/vnic_dev.c:319:5: warning: symbol 'vnic_dev_cmd2' was not declared. Should it be static? drivers/scsi/fnic/vnic_dev.c:414:5: warning: symbol 'vnic_dev_init_devcmd1' was not declared. Should it be static? drivers/scsi/fnic/vnic_dev.c:425:5: warning: symbol 'vnic_dev_init_devcmd2' was not declared. Should it be static? drivers/scsi/fnic/vnic_dev.c:495:6: warning: symbol 'vnic_dev_deinit_devcmd2' was not declared. Should it be static? drivers/scsi/fnic/vnic_dev.c:506:5: warning: symbol 'vnic_dev_cmd_no_proxy' was not declared. Should it be static? Link: https://lore.kernel.org/r/20200415093809.9365-1-yanaijie@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-03-17scsi: fnic: Use scnprintf() for avoiding potential buffer overflowTakashi Iwai1-29/+29
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Link: https://lore.kernel.org/r/20200315094241.9086-4-tiwai@suse.de Cc: "James E . J . Bottomley" <jejb@linux.ibm.com> Cc: "Martin K . Petersen" <martin.petersen@oracle.com> Cc: Satish Kharat <satishkh@cisco.com> Cc: Sesidhar Baddela <sebaddel@cisco.com> Cc: Karan Tilak Kumar <kartilak@cisco.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-03-11scsi: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Link: https://lore.kernel.org/r/20200224161406.GA21454@embeddedor Reviewed-by: Lee Duncan <lduncan@suse.com> Reviewed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-01-20scsi: fnic: do not queue commands during fwresetHannes Reinecke1-0/+3
When a link is going down the driver will be calling fnic_cleanup_io(), which will traverse all commands and calling 'done' for each found command. While the traversal is handled under the host_lock, calling 'done' happens after the host_lock is being dropped. As fnic_queuecommand_lck() is being called with the host_lock held, it might well be that it will pick the command being selected for abortion from the above routine and enqueue it for sending, but then 'done' is being called on that very command from the above routine. Which of course confuses the hell out of the scsi midlayer. So fix this by not queueing commands when fnic_cleanup_io is active. Link: https://lore.kernel.org/r/20200116102053.62755-1-hare@suse.de Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-01-15scsi: fnic: fix invalid stack accessArnd Bergmann1-10/+10
gcc -O3 warns that some local variables are not properly initialized: drivers/scsi/fnic/vnic_dev.c: In function 'fnic_dev_hang_notify': drivers/scsi/fnic/vnic_dev.c:511:16: error: 'a0' is used uninitialized in this function [-Werror=uninitialized] vdev->args[0] = *a0; ~~~~~~~~~~~~~~^~~~~ drivers/scsi/fnic/vnic_dev.c:691:6: note: 'a0' was declared here u64 a0, a1; ^~ drivers/scsi/fnic/vnic_dev.c:512:16: error: 'a1' is used uninitialized in this function [-Werror=uninitialized] vdev->args[1] = *a1; ~~~~~~~~~~~~~~^~~~~ drivers/scsi/fnic/vnic_dev.c:691:10: note: 'a1' was declared here u64 a0, a1; ^~ drivers/scsi/fnic/vnic_dev.c: In function 'fnic_dev_mac_addr': drivers/scsi/fnic/vnic_dev.c:512:16: error: 'a1' is used uninitialized in this function [-Werror=uninitialized] vdev->args[1] = *a1; ~~~~~~~~~~~~~~^~~~~ drivers/scsi/fnic/vnic_dev.c:698:10: note: 'a1' was declared here u64 a0, a1; ^~ Apparently the code relies on the local variables occupying adjacent memory locations in the same order, but this is of course not guaranteed. Use an array of two u64 variables where needed to make it work correctly. I suspect there is also an endianness bug here, but have not digged in deep enough to be sure. Fixes: 5df6d737dd4b ("[SCSI] fnic: Add new Cisco PCI-Express FCoE HBA") Fixes: mmtom ("init/Kconfig: enable -O3 for all arches") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200107201602.4096790-1-arnd@arndb.de Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-11-06scsi: fnic: fix use after freePan Bian1-1/+2
The memory chunk io_req is released by mempool_free. Accessing io_req->start_time will result in a use after free bug. The variable start_time is a backup of the timestamp. So, use start_time here to avoid use after free. Link: https://lore.kernel.org/r/1572881182-37664-1-git-send-email-bianpan2016@163.com Signed-off-by: Pan Bian <bianpan2016@163.com> Reviewed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-09-30scsi: fnic: make array dev_cmd_err static const, makes object smallerColin Ian King1-1/+1
Don't populate the array dev_cmd_err on the stack but instead make it static const. Makes the object code smaller by 80 bytes. Before: text data bss dec hex filename 21461 1564 0 23025 59f1 drivers/scsi/fnic/vnic_dev.o After: text data bss dec hex filename 21318 1628 0 22946 59a2 drivers/scsi/fnic/vnic_dev.o (gcc version 9.2.1, amd64) Link: https://lore.kernel.org/r/20190906163945.3889-1-colin.king@canonical.com Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-09-07scsi: fnic: fix msix interrupt allocationGovindarajulu Varadarajan1-2/+2
pci_alloc_irq_vectors() returns number of vectors allocated. Fix the check for error condition. Fixes: cca678dfbad49 ("scsi: fnic: switch to pci_alloc_irq_vectors") Link: https://lore.kernel.org/r/20190827211340.1095-1-gvaradar@cisco.com Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com> Acked-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-08-30scsi: fnic: print port speed only at driver init or speed changeJohn Pittman2-5/+11
Port speed printing was added by commit d948e6383ec3 ("scsi: fnic: Add port speed stat to fnic debug stats"). As currently configured, this will cause the port speed to be printed to syslog every 2 seconds. To prevent log spamming, only print the vnic port speed at driver initialization and if the speed changes. Also clean up a small typo in fnic_trace.c. Fixes: d948e6383ec3 ("scsi: fnic: Add port speed stat to fnic debug stats") Signed-off-by: John Pittman <jpittman@redhat.com> Reviewed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-08-19scsi: fnic: remove redundant assignment of variable rcColin Ian King1-3/+1
Variable ret is initialized to a value that is never read and it is re-assigned later and immediately returns. Clean up the code by removing rc and just returning 0. [mkp: typo] Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-29scsi: fnic: Remove set but not used variable 'vdev'YueHaibing2-6/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/fnic/vnic_wq.c: In function 'vnic_wq_alloc_bufs': drivers/scsi/fnic/vnic_wq.c:50:19: warning: variable 'vdev' set but not used [-Wunused-but-set-variable] drivers/scsi/fnic/vnic_rq.c: In function 'vnic_rq_alloc_bufs': drivers/scsi/fnic/vnic_rq.c:30:19: warning: variable 'vdev' set but not used [-Wunused-but-set-variable] Never used since introduction. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-29scsi: fnic: no need to check return value of debugfs_create functionsGreg Kroah-Hartman5-108/+10
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Satish Kharat <satishkh@cisco.com> Cc: Sesidhar Baddela <sebaddel@cisco.com> Cc: Karan Tilak Kumar <kartilak@cisco.com> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: Update fnic driver version to 1.6.0.47Satish Kharat1-1/+1
Update fnic driver to version 1.6.0.47. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: Enable fnic devcmd2 interfaceSatish Kharat3-1/+29
This patch adds changes to check if fnic devcmd2 interface is exported by the firmware. If devcmd2 interfaces is exported, driver starts using it else falls back to fnic devcmd1 interface. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: Adding devcmd2 init and posting interfacesSatish Kharat1-4/+219
This patch adds fnic devcmd2 interfaces for initialization and posting commands to fw. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: Add devcmd2 initialization helpersSatish Kharat2-0/+74
This patch adds the devcmd2 wq initalization and devcmd2 ring allocation helper interfaces used by devcmd2 init. [mkp: typos] Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: fnic devcmd2 controller definitionsSatish Kharat1-2/+28
This patch adds the fnic devcmd2 controller definitions. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: fnic devcmd2 interface definitionsSatish Kharat2-2/+163
This patch adds the fnic devcmd2 command structre and the command result structure definitions. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: Impose upper limit on max. # of CQs processed per intrSatish Kharat3-4/+11
Impose an upper limit on the max number of CQ entries (corresponding to the copy wq) processed in an interrupt. Use module parameter to set the limit. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: RQ enable and then post descriptorsSatish Kharat2-3/+4
Do RQ enable before posting descriptor. This is needed for later hw revisions. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: delaying vnic dev enable till after req intrSatish Kharat1-2/+2
Doing vnic_device_enable before this could cause interrupts to happen before they are setup. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: Warn when calling done for IO not issued to fwSatish Kharat1-2/+8
The change is to print warning when scsi done is called for an IO that has not yet been issued to the fw. Also adding sc and tag to debug print when IO is cleaned up. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22scsi: fnic: fnic stats for max CQs processed and ISR timeSatish Kharat3-0/+28
This change is to add fnic stats for the max number of CQs (corresponding to copy WQ) processed in a given interrupt, max time taken by the ISR. Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>