// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */ #include "iavf_status.h" #include "iavf_type.h" #include "iavf_register.h" #include "iavf_adminq.h" #include "iavf_prototype.h" /** * iavf_alloc_adminq_asq_ring - Allocate Admin Queue send rings * @hw: pointer to the hardware structure **/ static enum iavf_status iavf_alloc_adminq_asq_ring(struct iavf_hw *hw) { … } /** * iavf_alloc_adminq_arq_ring - Allocate Admin Queue receive rings * @hw: pointer to the hardware structure **/ static enum iavf_status iavf_alloc_adminq_arq_ring(struct iavf_hw *hw) { … } /** * iavf_free_adminq_asq - Free Admin Queue send rings * @hw: pointer to the hardware structure * * This assumes the posted send buffers have already been cleaned * and de-allocated **/ static void iavf_free_adminq_asq(struct iavf_hw *hw) { … } /** * iavf_free_adminq_arq - Free Admin Queue receive rings * @hw: pointer to the hardware structure * * This assumes the posted receive buffers have already been cleaned * and de-allocated **/ static void iavf_free_adminq_arq(struct iavf_hw *hw) { … } /** * iavf_alloc_arq_bufs - Allocate pre-posted buffers for the receive queue * @hw: pointer to the hardware structure **/ static enum iavf_status iavf_alloc_arq_bufs(struct iavf_hw *hw) { … } /** * iavf_alloc_asq_bufs - Allocate empty buffer structs for the send queue * @hw: pointer to the hardware structure **/ static enum iavf_status iavf_alloc_asq_bufs(struct iavf_hw *hw) { … } /** * iavf_free_arq_bufs - Free receive queue buffer info elements * @hw: pointer to the hardware structure **/ static void iavf_free_arq_bufs(struct iavf_hw *hw) { … } /** * iavf_free_asq_bufs - Free send queue buffer info elements * @hw: pointer to the hardware structure **/ static void iavf_free_asq_bufs(struct iavf_hw *hw) { … } /** * iavf_config_asq_regs - configure ASQ registers * @hw: pointer to the hardware structure * * Configure base address and length registers for the transmit queue **/ static enum iavf_status iavf_config_asq_regs(struct iavf_hw *hw) { … } /** * iavf_config_arq_regs - ARQ register configuration * @hw: pointer to the hardware structure * * Configure base address and length registers for the receive (event queue) **/ static enum iavf_status iavf_config_arq_regs(struct iavf_hw *hw) { … } /** * iavf_init_asq - main initialization routine for ASQ * @hw: pointer to the hardware structure * * This is the main initialization routine for the Admin Send Queue * Prior to calling this function, drivers *MUST* set the following fields * in the hw->aq structure: * - hw->aq.num_asq_entries * - hw->aq.arq_buf_size * * Do *NOT* hold the lock when calling this as the memory allocation routines * called are not going to be atomic context safe **/ static enum iavf_status iavf_init_asq(struct iavf_hw *hw) { … } /** * iavf_init_arq - initialize ARQ * @hw: pointer to the hardware structure * * The main initialization routine for the Admin Receive (Event) Queue. * Prior to calling this function, drivers *MUST* set the following fields * in the hw->aq structure: * - hw->aq.num_asq_entries * - hw->aq.arq_buf_size * * Do *NOT* hold the lock when calling this as the memory allocation routines * called are not going to be atomic context safe **/ static enum iavf_status iavf_init_arq(struct iavf_hw *hw) { … } /** * iavf_shutdown_asq - shutdown the ASQ * @hw: pointer to the hardware structure * * The main shutdown routine for the Admin Send Queue **/ static enum iavf_status iavf_shutdown_asq(struct iavf_hw *hw) { … } /** * iavf_shutdown_arq - shutdown ARQ * @hw: pointer to the hardware structure * * The main shutdown routine for the Admin Receive Queue **/ static enum iavf_status iavf_shutdown_arq(struct iavf_hw *hw) { … } /** * iavf_init_adminq - main initialization routine for Admin Queue * @hw: pointer to the hardware structure * * Prior to calling this function, drivers *MUST* set the following fields * in the hw->aq structure: * - hw->aq.num_asq_entries * - hw->aq.num_arq_entries * - hw->aq.arq_buf_size * - hw->aq.asq_buf_size **/ enum iavf_status iavf_init_adminq(struct iavf_hw *hw) { … } /** * iavf_shutdown_adminq - shutdown routine for the Admin Queue * @hw: pointer to the hardware structure **/ enum iavf_status iavf_shutdown_adminq(struct iavf_hw *hw) { … } /** * iavf_clean_asq - cleans Admin send queue * @hw: pointer to the hardware structure * * returns the number of free desc **/ static u16 iavf_clean_asq(struct iavf_hw *hw) { … } /** * iavf_asq_done - check if FW has processed the Admin Send Queue * @hw: pointer to the hw struct * * Returns true if the firmware has processed all descriptors on the * admin send queue. Returns false if there are still requests pending. **/ bool iavf_asq_done(struct iavf_hw *hw) { … } /** * iavf_asq_send_command - send command to Admin Queue * @hw: pointer to the hw struct * @desc: prefilled descriptor describing the command (non DMA mem) * @buff: buffer to use for indirect commands * @buff_size: size of buffer for indirect commands * @cmd_details: pointer to command details structure * * This is the main send command driver routine for the Admin Queue send * queue. It runs the queue, cleans the queue, etc **/ enum iavf_status iavf_asq_send_command(struct iavf_hw *hw, struct iavf_aq_desc *desc, void *buff, /* can be NULL */ u16 buff_size, struct iavf_asq_cmd_details *cmd_details) { … } /** * iavf_fill_default_direct_cmd_desc - AQ descriptor helper function * @desc: pointer to the temp descriptor (non DMA mem) * @opcode: the opcode can be used to decide which flags to turn off or on * * Fill the desc with default values **/ void iavf_fill_default_direct_cmd_desc(struct iavf_aq_desc *desc, u16 opcode) { … } /** * iavf_clean_arq_element * @hw: pointer to the hw struct * @e: event info from the receive descriptor, includes any buffers * @pending: number of events that could be left to process * * This function cleans one Admin Receive Queue element and returns * the contents through e. It can also return how many events are * left to process through 'pending' **/ enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw, struct iavf_arq_event_info *e, u16 *pending) { … }