/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2009-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * * www.broadcom.com * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of version 2 of the GNU General * * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful. * * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * * TO BE LEGALLY INVALID. See the GNU General Public License for * * more details, a copy of which can be found in the file COPYING * * included with this package. * *******************************************************************/ #include <linux/interrupt.h> #include <linux/mempool.h> #include <linux/pci.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/list.h> #include <linux/bsg-lib.h> #include <linux/vmalloc.h> #include <scsi/scsi.h> #include <scsi/scsi_host.h> #include <scsi/scsi_transport_fc.h> #include <scsi/scsi_bsg_fc.h> #include <scsi/fc/fc_fs.h> #include "lpfc_hw4.h" #include "lpfc_hw.h" #include "lpfc_sli.h" #include "lpfc_sli4.h" #include "lpfc_nl.h" #include "lpfc_bsg.h" #include "lpfc_disc.h" #include "lpfc_scsi.h" #include "lpfc.h" #include "lpfc_logmsg.h" #include "lpfc_crtn.h" #include "lpfc_debugfs.h" #include "lpfc_vport.h" #include "lpfc_version.h" struct lpfc_bsg_event { … }; struct lpfc_bsg_iocb { … }; struct lpfc_bsg_mbox { … }; #define TYPE_EVT … #define TYPE_IOCB … #define TYPE_MBOX … struct bsg_job_data { … }; struct event_data { … }; #define BUF_SZ_4K … #define SLI_CT_ELX_LOOPBACK … enum ELX_LOOPBACK_CMD { … }; #define ELX_LOOPBACK_HEADER_SZ … struct lpfc_dmabufext { … }; static void lpfc_free_bsg_buffers(struct lpfc_hba *phba, struct lpfc_dmabuf *mlist) { … } static struct lpfc_dmabuf * lpfc_alloc_bsg_buffers(struct lpfc_hba *phba, unsigned int size, int outbound_buffers, struct ulp_bde64 *bpl, int *bpl_entries) { … } static unsigned int lpfc_bsg_copy_data(struct lpfc_dmabuf *dma_buffers, struct bsg_buffer *bsg_buffers, unsigned int bytes_to_transfer, int to_buffers) { … } /** * lpfc_bsg_send_mgmt_cmd_cmp - lpfc_bsg_send_mgmt_cmd's completion handler * @phba: Pointer to HBA context object. * @cmdiocbq: Pointer to command iocb. * @rspiocbq: Pointer to response iocb. * * This function is the completion handler for iocbs issued using * lpfc_bsg_send_mgmt_cmd function. This function is called by the * ring event handler function without any lock held. This function * can be called from both worker thread context and interrupt * context. This function also can be called from another thread which * cleans up the SLI layer objects. * This function copies the contents of the response iocb to the * response iocb memory object provided by the caller of * lpfc_sli_issue_iocb_wait and then wakes up the thread which * sleeps for the iocb completion. **/ static void lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocbq, struct lpfc_iocbq *rspiocbq) { … } /** * lpfc_bsg_send_mgmt_cmd - send a CT command from a bsg request * @job: fc_bsg_job to handle **/ static int lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) { … } /** * lpfc_bsg_rport_els_cmp - lpfc_bsg_rport_els's completion handler * @phba: Pointer to HBA context object. * @cmdiocbq: Pointer to command iocb. * @rspiocbq: Pointer to response iocb. * * This function is the completion handler for iocbs issued using * lpfc_bsg_rport_els_cmp function. This function is called by the * ring event handler function without any lock held. This function * can be called from both worker thread context and interrupt * context. This function also can be called from other thread which * cleans up the SLI layer objects. * This function copies the contents of the response iocb to the * response iocb memory object provided by the caller of * lpfc_sli_issue_iocb_wait and then wakes up the thread which * sleeps for the iocb completion. **/ static void lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocbq, struct lpfc_iocbq *rspiocbq) { … } /** * lpfc_bsg_rport_els - send an ELS command from a bsg request * @job: fc_bsg_job to handle **/ static int lpfc_bsg_rport_els(struct bsg_job *job) { … } /** * lpfc_bsg_event_free - frees an allocated event structure * @kref: Pointer to a kref. * * Called from kref_put. Back cast the kref into an event structure address. * Free any events to get, delete associated nodes, free any events to see, * free any data then free the event itself. **/ static void lpfc_bsg_event_free(struct kref *kref) { … } /** * lpfc_bsg_event_ref - increments the kref for an event * @evt: Pointer to an event structure. **/ static inline void lpfc_bsg_event_ref(struct lpfc_bsg_event *evt) { … } /** * lpfc_bsg_event_unref - Uses kref_put to free an event structure * @evt: Pointer to an event structure. **/ static inline void lpfc_bsg_event_unref(struct lpfc_bsg_event *evt) { … } /** * lpfc_bsg_event_new - allocate and initialize a event structure * @ev_mask: Mask of events. * @ev_reg_id: Event reg id. * @ev_req_id: Event request id. **/ static struct lpfc_bsg_event * lpfc_bsg_event_new(uint32_t ev_mask, int ev_reg_id, uint32_t ev_req_id) { … } /** * diag_cmd_data_free - Frees an lpfc dma buffer extension * @phba: Pointer to HBA context object. * @mlist: Pointer to an lpfc dma buffer extension. **/ static int diag_cmd_data_free(struct lpfc_hba *phba, struct lpfc_dmabufext *mlist) { … } /* * lpfc_bsg_ct_unsol_event - process an unsolicited CT command * * This function is called when an unsolicited CT command is received. It * forwards the event to any processes registered to receive CT events. **/ int lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocbq) { … } /** * lpfc_bsg_ct_unsol_abort - handler ct abort to management plane * @phba: Pointer to HBA context object. * @dmabuf: pointer to a dmabuf that describes the FC sequence * * This function handles abort to the CT command toward management plane * for SLI4 port. * * If the pending context of a CT command to management plane present, clears * such context and returns 1 for handled; otherwise, it returns 0 indicating * no context exists. **/ int lpfc_bsg_ct_unsol_abort(struct lpfc_hba *phba, struct hbq_dmabuf *dmabuf) { … } /** * lpfc_bsg_hba_set_event - process a SET_EVENT bsg vendor command * @job: SET_EVENT fc_bsg_job **/ static int lpfc_bsg_hba_set_event(struct bsg_job *job) { … } /** * lpfc_bsg_hba_get_event - process a GET_EVENT bsg vendor command * @job: GET_EVENT fc_bsg_job **/ static int lpfc_bsg_hba_get_event(struct bsg_job *job) { … } /** * lpfc_issue_ct_rsp_cmp - lpfc_issue_ct_rsp's completion handler * @phba: Pointer to HBA context object. * @cmdiocbq: Pointer to command iocb. * @rspiocbq: Pointer to response iocb. * * This function is the completion handler for iocbs issued using * lpfc_issue_ct_rsp_cmp function. This function is called by the * ring event handler function without any lock held. This function * can be called from both worker thread context and interrupt * context. This function also can be called from other thread which * cleans up the SLI layer objects. * This function copy the contents of the response iocb to the * response iocb memory object provided by the caller of * lpfc_sli_issue_iocb_wait and then wakes up the thread which * sleeps for the iocb completion. **/ static void lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocbq, struct lpfc_iocbq *rspiocbq) { … } /** * lpfc_issue_ct_rsp - issue a ct response * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @tag: tag index value into the ports context exchange array. * @cmp: Pointer to a cmp dma buffer descriptor. * @bmp: Pointer to a bmp dma buffer descriptor. * @num_entry: Number of enties in the bde. **/ static int lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag, struct lpfc_dmabuf *cmp, struct lpfc_dmabuf *bmp, int num_entry) { … } /** * lpfc_bsg_send_mgmt_rsp - process a SEND_MGMT_RESP bsg vendor command * @job: SEND_MGMT_RESP fc_bsg_job **/ static int lpfc_bsg_send_mgmt_rsp(struct bsg_job *job) { … } /** * lpfc_bsg_diag_mode_enter - process preparing into device diag loopback mode * @phba: Pointer to HBA context object. * * This function is responsible for preparing driver for diag loopback * on device. */ static int lpfc_bsg_diag_mode_enter(struct lpfc_hba *phba) { … } /** * lpfc_bsg_diag_mode_exit - exit process from device diag loopback mode * @phba: Pointer to HBA context object. * * This function is responsible for driver exit processing of setting up * diag loopback mode on device. */ static void lpfc_bsg_diag_mode_exit(struct lpfc_hba *phba) { … } /** * lpfc_sli3_bsg_diag_loopback_mode - process an sli3 bsg vendor command * @phba: Pointer to HBA context object. * @job: LPFC_BSG_VENDOR_DIAG_MODE * * This function is responsible for placing an sli3 port into diagnostic * loopback mode in order to perform a diagnostic loopback test. * All new scsi requests are blocked, a small delay is used to allow the * scsi requests to complete then the link is brought down. If the link is * is placed in loopback mode then scsi requests are again allowed * so the scsi mid-layer doesn't give up on the port. * All of this is done in-line. */ static int lpfc_sli3_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct bsg_job *job) { … } /** * lpfc_sli4_bsg_set_link_diag_state - set sli4 link diag state * @phba: Pointer to HBA context object. * @diag: Flag for set link to diag or nomral operation state. * * This function is responsible for issuing a sli4 mailbox command for setting * link to either diag state or normal operation state. */ static int lpfc_sli4_bsg_set_link_diag_state(struct lpfc_hba *phba, uint32_t diag) { … } /** * lpfc_sli4_bsg_set_loopback_mode - set sli4 internal loopback diagnostic * @phba: Pointer to HBA context object. * @mode: loopback mode to set * @link_no: link number for loopback mode to set * * This function is responsible for issuing a sli4 mailbox command for setting * up loopback diagnostic for a link. */ static int lpfc_sli4_bsg_set_loopback_mode(struct lpfc_hba *phba, int mode, uint32_t link_no) { … } /** * lpfc_sli4_diag_fcport_reg_setup - setup port registrations for diagnostic * @phba: Pointer to HBA context object. * * This function set up SLI4 FC port registrations for diagnostic run, which * includes all the rpis, vfi, and also vpi. */ static int lpfc_sli4_diag_fcport_reg_setup(struct lpfc_hba *phba) { … } /** * lpfc_sli4_bsg_diag_loopback_mode - process an sli4 bsg vendor command * @phba: Pointer to HBA context object. * @job: LPFC_BSG_VENDOR_DIAG_MODE * * This function is responsible for placing an sli4 port into diagnostic * loopback mode in order to perform a diagnostic loopback test. */ static int lpfc_sli4_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct bsg_job *job) { … } /** * lpfc_bsg_diag_loopback_mode - bsg vendor command for diag loopback mode * @job: LPFC_BSG_VENDOR_DIAG_MODE * * This function is responsible for responding to check and dispatch bsg diag * command from the user to proper driver action routines. */ static int lpfc_bsg_diag_loopback_mode(struct bsg_job *job) { … } /** * lpfc_sli4_bsg_diag_mode_end - sli4 bsg vendor command for ending diag mode * @job: LPFC_BSG_VENDOR_DIAG_MODE_END * * This function is responsible for responding to check and dispatch bsg diag * command from the user to proper driver action routines. */ static int lpfc_sli4_bsg_diag_mode_end(struct bsg_job *job) { … } /** * lpfc_sli4_bsg_link_diag_test - sli4 bsg vendor command for diag link test * @job: LPFC_BSG_VENDOR_DIAG_LINK_TEST * * This function is to perform SLI4 diag link test request from the user * applicaiton. */ static int lpfc_sli4_bsg_link_diag_test(struct bsg_job *job) { … } /** * lpfcdiag_loop_self_reg - obtains a remote port login id * @phba: Pointer to HBA context object * @rpi: Pointer to a remote port login id * * This function obtains a remote port login id so the diag loopback test * can send and receive its own unsolicited CT command. **/ static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t *rpi) { … } /** * lpfcdiag_loop_self_unreg - unregs from the rpi * @phba: Pointer to HBA context object * @rpi: Remote port login id * * This function unregisters the rpi obtained in lpfcdiag_loop_self_reg **/ static int lpfcdiag_loop_self_unreg(struct lpfc_hba *phba, uint16_t rpi) { … } /** * lpfcdiag_loop_get_xri - obtains the transmit and receive ids * @phba: Pointer to HBA context object * @rpi: Remote port login id * @txxri: Pointer to transmit exchange id * @rxxri: Pointer to response exchabge id * * This function obtains the transmit and receive ids required to send * an unsolicited ct command with a payload. A special lpfc FsType and CmdRsp * flags are used to the unsolicited response handler is able to process * the ct command sent on the same port. **/ static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, uint16_t rpi, uint16_t *txxri, uint16_t * rxxri) { … } /** * lpfc_bsg_dma_page_alloc - allocate a bsg mbox page sized dma buffers * @phba: Pointer to HBA context object * * This function allocates BSG_MBOX_SIZE (4KB) page size dma buffer and * returns the pointer to the buffer. **/ static struct lpfc_dmabuf * lpfc_bsg_dma_page_alloc(struct lpfc_hba *phba) { … } /** * lpfc_bsg_dma_page_free - free a bsg mbox page sized dma buffer * @phba: Pointer to HBA context object. * @dmabuf: Pointer to the bsg mbox page sized dma buffer descriptor. * * This routine just simply frees a dma buffer and its associated buffer * descriptor referred by @dmabuf. **/ static void lpfc_bsg_dma_page_free(struct lpfc_hba *phba, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_dma_page_list_free - free a list of bsg mbox page sized dma buffers * @phba: Pointer to HBA context object. * @dmabuf_list: Pointer to a list of bsg mbox page sized dma buffer descs. * * This routine just simply frees all dma buffers and their associated buffer * descriptors referred by @dmabuf_list. **/ static void lpfc_bsg_dma_page_list_free(struct lpfc_hba *phba, struct list_head *dmabuf_list) { … } /** * diag_cmd_data_alloc - fills in a bde struct with dma buffers * @phba: Pointer to HBA context object * @bpl: Pointer to 64 bit bde structure * @size: Number of bytes to process * @nocopydata: Flag to copy user data into the allocated buffer * * This function allocates page size buffers and populates an lpfc_dmabufext. * If allowed the user data pointed to with indataptr is copied into the kernel * memory. The chained list of page size buffers is returned. **/ static struct lpfc_dmabufext * diag_cmd_data_alloc(struct lpfc_hba *phba, struct ulp_bde64 *bpl, uint32_t size, int nocopydata) { … } /** * lpfcdiag_sli3_loop_post_rxbufs - post the receive buffers for an unsol CT cmd * @phba: Pointer to HBA context object * @rxxri: Receive exchange id * @len: Number of data bytes * * This function allocates and posts a data buffer of sufficient size to receive * an unsolicited CT command. **/ static int lpfcdiag_sli3_loop_post_rxbufs(struct lpfc_hba *phba, uint16_t rxxri, size_t len) { … } /** * lpfc_bsg_diag_loopback_run - run loopback on a port by issue ct cmd to itself * @job: LPFC_BSG_VENDOR_DIAG_TEST fc_bsg_job * * This function receives a user data buffer to be transmitted and received on * the same port, the link must be up and in loopback mode prior * to being called. * 1. A kernel buffer is allocated to copy the user data into. * 2. The port registers with "itself". * 3. The transmit and receive exchange ids are obtained. * 4. The receive exchange id is posted. * 5. A new els loopback event is created. * 6. The command and response iocbs are allocated. * 7. The cmd iocb FsType is set to elx loopback and the CmdRsp to looppback. * * This function is meant to be called n times while the port is in loopback * so it is the apps responsibility to issue a reset to take the port out * of loopback mode. **/ static int lpfc_bsg_diag_loopback_run(struct bsg_job *job) { … } /** * lpfc_bsg_get_dfc_rev - process a GET_DFC_REV bsg vendor command * @job: GET_DFC_REV fc_bsg_job **/ static int lpfc_bsg_get_dfc_rev(struct bsg_job *job) { … } /** * lpfc_bsg_issue_mbox_cmpl - lpfc_bsg_issue_mbox mbox completion handler * @phba: Pointer to HBA context object. * @pmboxq: Pointer to mailbox command. * * This is completion handler function for mailbox commands issued from * lpfc_bsg_issue_mbox function. This function is called by the * mailbox event handler function with no lock held. This function * will wake up thread waiting on the wait queue pointed by dd_data * of the mailbox. **/ static void lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) { … } /** * lpfc_bsg_check_cmd_access - test for a supported mailbox command * @phba: Pointer to HBA context object. * @mb: Pointer to a mailbox object. * @vport: Pointer to a vport object. * * Some commands require the port to be offline, some may not be called from * the application. **/ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba, MAILBOX_t *mb, struct lpfc_vport *vport) { … } /** * lpfc_bsg_mbox_ext_session_reset - clean up context of multi-buffer mbox session * @phba: Pointer to HBA context object. * * This is routine clean up and reset BSG handling of multi-buffer mbox * command session. **/ static void lpfc_bsg_mbox_ext_session_reset(struct lpfc_hba *phba) { … } /** * lpfc_bsg_issue_mbox_ext_handle_job - job handler for multi-buffer mbox cmpl * @phba: Pointer to HBA context object. * @pmboxq: Pointer to mailbox command. * * This is routine handles BSG job for mailbox commands completions with * multiple external buffers. **/ static struct bsg_job * lpfc_bsg_issue_mbox_ext_handle_job(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) { … } /** * lpfc_bsg_issue_read_mbox_ext_cmpl - compl handler for multi-buffer read mbox * @phba: Pointer to HBA context object. * @pmboxq: Pointer to mailbox command. * * This is completion handler function for mailbox read commands with multiple * external buffers. **/ static void lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) { … } /** * lpfc_bsg_issue_write_mbox_ext_cmpl - cmpl handler for multi-buffer write mbox * @phba: Pointer to HBA context object. * @pmboxq: Pointer to mailbox command. * * This is completion handler function for mailbox write commands with multiple * external buffers. **/ static void lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) { … } static void lpfc_bsg_sli_cfg_dma_desc_setup(struct lpfc_hba *phba, enum nemb_type nemb_tp, uint32_t index, struct lpfc_dmabuf *mbx_dmabuf, struct lpfc_dmabuf *ext_dmabuf) { … } /** * lpfc_bsg_sli_cfg_read_cmd_ext - sli_config non-embedded mailbox cmd read * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @nemb_tp: Enumerate of non-embedded mailbox command type. * @dmabuf: Pointer to a DMA buffer descriptor. * * This routine performs SLI_CONFIG (0x9B) read mailbox command operation with * non-embedded external buffers. **/ static int lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, enum nemb_type nemb_tp, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_sli_cfg_write_cmd_ext - sli_config non-embedded mailbox cmd write * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @nemb_tp: Enumerate of non-embedded mailbox command type. * @dmabuf: Pointer to a DMA buffer descriptor. * * This routine performs SLI_CONFIG (0x9B) write mailbox command operation with * non-embedded external buffers. **/ static int lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, enum nemb_type nemb_tp, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_handle_sli_cfg_mbox - handle sli-cfg mailbox cmd with ext buffer * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @dmabuf: Pointer to a DMA buffer descriptor. * * This routine handles SLI_CONFIG (0x9B) mailbox command with non-embedded * external buffers, including both 0x9B with non-embedded MSEs and 0x9B * with embedded subsystem 0x1 and opcodes with external HBDs. **/ static int lpfc_bsg_handle_sli_cfg_mbox(struct lpfc_hba *phba, struct bsg_job *job, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_mbox_ext_abort - request to abort mbox command with ext buffers * @phba: Pointer to HBA context object. * * This routine is for requesting to abort a pass-through mailbox command with * multiple external buffers due to error condition. **/ static void lpfc_bsg_mbox_ext_abort(struct lpfc_hba *phba) { … } /** * lpfc_bsg_read_ebuf_get - get the next mailbox read external buffer * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * * This routine extracts the next mailbox read external buffer back to * user space through BSG. **/ static int lpfc_bsg_read_ebuf_get(struct lpfc_hba *phba, struct bsg_job *job) { … } /** * lpfc_bsg_write_ebuf_set - set the next mailbox write external buffer * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @dmabuf: Pointer to a DMA buffer descriptor. * * This routine sets up the next mailbox read external buffer obtained * from user space through BSG. **/ static int lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_handle_sli_cfg_ebuf - handle ext buffer with sli-cfg mailbox cmd * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @dmabuf: Pointer to a DMA buffer descriptor. * * This routine handles the external buffer with SLI_CONFIG (0x9B) mailbox * command with multiple non-embedded external buffers. **/ static int lpfc_bsg_handle_sli_cfg_ebuf(struct lpfc_hba *phba, struct bsg_job *job, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_handle_sli_cfg_ext - handle sli-cfg mailbox with external buffer * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @dmabuf: Pointer to a DMA buffer descriptor. * * This routine checks and handles non-embedded multi-buffer SLI_CONFIG * (0x9B) mailbox commands and external buffers. **/ static int lpfc_bsg_handle_sli_cfg_ext(struct lpfc_hba *phba, struct bsg_job *job, struct lpfc_dmabuf *dmabuf) { … } /** * lpfc_bsg_issue_mbox - issues a mailbox command on behalf of an app * @phba: Pointer to HBA context object. * @job: Pointer to the job object. * @vport: Pointer to a vport object. * * Allocate a tracking object, mailbox command memory, get a mailbox * from the mailbox pool, copy the caller mailbox command. * * If offline and the sli is active we need to poll for the command (port is * being reset) and complete the job, otherwise issue the mailbox command and * let our completion handler finish the command. **/ static int lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job, struct lpfc_vport *vport) { … } /** * lpfc_bsg_mbox_cmd - process an fc bsg LPFC_BSG_VENDOR_MBOX command * @job: MBOX fc_bsg_job for LPFC_BSG_VENDOR_MBOX. **/ static int lpfc_bsg_mbox_cmd(struct bsg_job *job) { … } static int lpfc_forced_link_speed(struct bsg_job *job) { … } /** * lpfc_check_fwlog_support: Check FW log support on the adapter * @phba: Pointer to HBA context object. * * Check if FW Logging support by the adapter **/ int lpfc_check_fwlog_support(struct lpfc_hba *phba) { … } /** * lpfc_bsg_get_ras_config: Get RAS configuration settings * @job: fc_bsg_job to handle * * Get RAS configuration values set. **/ static int lpfc_bsg_get_ras_config(struct bsg_job *job) { … } /** * lpfc_bsg_set_ras_config: Set FW logging parameters * @job: fc_bsg_job to handle * * Set log-level parameters for FW-logging in host memory **/ static int lpfc_bsg_set_ras_config(struct bsg_job *job) { … } /** * lpfc_bsg_get_ras_lwpd: Get log write position data * @job: fc_bsg_job to handle * * Get Offset/Wrap count of the log message written * in host memory **/ static int lpfc_bsg_get_ras_lwpd(struct bsg_job *job) { … } /** * lpfc_bsg_get_ras_fwlog: Read FW log * @job: fc_bsg_job to handle * * Copy the FW log into the passed buffer. **/ static int lpfc_bsg_get_ras_fwlog(struct bsg_job *job) { … } static int lpfc_get_trunk_info(struct bsg_job *job) { … } static int lpfc_get_cgnbuf_info(struct bsg_job *job) { … } /** * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job * @job: fc_bsg_job to handle **/ static int lpfc_bsg_hst_vendor(struct bsg_job *job) { … } /** * lpfc_bsg_request - handle a bsg request from the FC transport * @job: bsg_job to handle **/ int lpfc_bsg_request(struct bsg_job *job) { … } /** * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport * @job: bsg_job that has timed out * * This function just aborts the job's IOCB. The aborted IOCB will return to * the waiting function which will handle passing the error back to userspace **/ int lpfc_bsg_timeout(struct bsg_job *job) { … }