* idpf_send_msg_to_cp * @hw: pointer to the hardware structure * @v_opcode: opcodes for VF-PF communication * @v_retval: return error code * @msg: pointer to the msg buffer * @msglen: msg length * @cmd_details: pointer to command details * * Send message to CP. By default, this message * is sent asynchronously, i.e. idpf_asq_send_command() does not wait for * completion before returning.
| 149 | * completion before returning. |
| 150 | */ |
| 151 | int idpf_send_msg_to_cp(struct idpf_hw *hw, int v_opcode, |
| 152 | int v_retval, u8 *msg, u16 msglen) |
| 153 | { |
| 154 | struct idpf_ctlq_msg ctlq_msg = { 0 }; |
| 155 | struct idpf_dma_mem dma_mem = { 0 }; |
| 156 | int status; |
| 157 | |
| 158 | ctlq_msg.opcode = idpf_mbq_opc_send_msg_to_pf; |
| 159 | ctlq_msg.func_id = 0; |
| 160 | ctlq_msg.data_len = msglen; |
| 161 | ctlq_msg.cookie.mbx.chnl_retval = v_retval; |
| 162 | ctlq_msg.cookie.mbx.chnl_opcode = v_opcode; |
| 163 | |
| 164 | if (msglen > 0) { |
| 165 | dma_mem.va = (struct idpf_dma_mem *) |
| 166 | idpf_alloc_dma_mem(hw, &dma_mem, msglen); |
| 167 | if (!dma_mem.va) |
| 168 | return -ENOMEM; |
| 169 | |
| 170 | idpf_memcpy(dma_mem.va, msg, msglen, IDPF_NONDMA_TO_DMA); |
| 171 | ctlq_msg.ctx.indirect.payload = &dma_mem; |
| 172 | } |
| 173 | status = idpf_ctlq_send(hw, hw->asq, 1, &ctlq_msg); |
| 174 | |
| 175 | if (dma_mem.va) |
| 176 | idpf_free_dma_mem(hw, &dma_mem); |
| 177 | |
| 178 | return status; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * idpf_asq_done - check if FW has processed the Admin Send Queue |
no test coverage detected