/* We'll be allocating the buffer info memory first, then we can *allocatethemappedbuffersfortheeventprocessing
*/
cq->rq.dma_head = devm_kcalloc(ice_hw_to_dev(hw), cq->num_rq_entries, sizeof(cq->rq.desc_buf), GFP_KERNEL); if (!cq->rq.dma_head) return -ENOMEM;
cq->rq.r.rq_bi = (struct ice_dma_mem *)cq->rq.dma_head;
/* allocate the mapped buffers */ for (i = 0; i < cq->num_rq_entries; i++) { struct libie_aq_desc *desc; struct ice_dma_mem *bi;
bi = &cq->rq.r.rq_bi[i];
bi->va = dmam_alloc_coherent(ice_hw_to_dev(hw),
cq->rq_buf_size, &bi->pa,
GFP_KERNEL | __GFP_ZERO); if (!bi->va) goto unwind_alloc_rq_bufs;
bi->size = cq->rq_buf_size;
/* now configure the descriptors for use */
desc = ICE_CTL_Q_DESC(cq->rq, i);
desc->flags = cpu_to_le16(LIBIE_AQ_FLAG_BUF); if (cq->rq_buf_size > LIBIE_AQ_LG_BUF)
desc->flags |= cpu_to_le16(LIBIE_AQ_FLAG_LB);
desc->opcode = 0; /* This is in accordance with control queue design, there is no *registerforbuffersizeconfiguration
*/
desc->datalen = cpu_to_le16(bi->size);
desc->retval = 0;
desc->cookie_high = 0;
desc->cookie_low = 0;
desc->params.generic.addr_high =
cpu_to_le32(upper_32_bits(bi->pa));
desc->params.generic.addr_low =
cpu_to_le32(lower_32_bits(bi->pa));
desc->params.generic.param0 = 0;
desc->params.generic.param1 = 0;
} return0;
unwind_alloc_rq_bufs: /* don't try to free the one that failed... */
i--; for (; i >= 0; i--) {
dmam_free_coherent(ice_hw_to_dev(hw), cq->rq.r.rq_bi[i].size,
cq->rq.r.rq_bi[i].va, cq->rq.r.rq_bi[i].pa);
cq->rq.r.rq_bi[i].va = NULL;
cq->rq.r.rq_bi[i].pa = 0;
cq->rq.r.rq_bi[i].size = 0;
}
cq->rq.r.rq_bi = NULL;
devm_kfree(ice_hw_to_dev(hw), cq->rq.dma_head);
cq->rq.dma_head = NULL;
if (hw->api_maj_ver > exp_fw_api_ver_major) { /* Major API version is newer than expected, don't load */
dev_warn(ice_hw_to_dev(hw), "The driver for the device stopped because the NVM image is newer than expected. You must install the most recent version of the network driver.\n"); returnfalse;
} elseif (hw->api_maj_ver == exp_fw_api_ver_major) { if (hw->api_min_ver > (exp_fw_api_ver_minor + 2))
dev_info(ice_hw_to_dev(hw), "The driver for the device detected a newer version (%u.%u) of the NVM image than expected (%u.%u). Please install the most recent version of the network driver.\n",
hw->api_maj_ver, hw->api_min_ver,
exp_fw_api_ver_major, exp_fw_api_ver_minor); elseif ((hw->api_min_ver + 2) < exp_fw_api_ver_minor)
dev_info(ice_hw_to_dev(hw), "The driver for the device detected an older version (%u.%u) of the NVM image than expected (%u.%u). Please update the NVM image.\n",
hw->api_maj_ver, hw->api_min_ver,
exp_fw_api_ver_major, exp_fw_api_ver_minor);
} else { /* Major API version is older than expected, log a warning */
dev_info(ice_hw_to_dev(hw), "The driver for the device detected an older version (%u.%u) of the NVM image than expected (%u.%u). Please update the NVM image.\n",
hw->api_maj_ver, hw->api_min_ver,
exp_fw_api_ver_major, exp_fw_api_ver_minor);
} returntrue;
}
/** *ice_is_sbq_supported-isthesidebandqueuesupported *@hw:pointertothehardwarestructure * *Returnstrueifthesidebandcontrolqueueinterfaceis *supportedforthedevice,falseotherwise
*/ bool ice_is_sbq_supported(struct ice_hw *hw)
{ /* The device sideband queue is only supported on devices with the *genericMACtype.
*/ return ice_is_generic_mac(hw);
}
/* Init FW admin queue */ do {
status = ice_init_ctrlq(hw, ICE_CTL_Q_ADMIN); if (status) return status;
status = ice_init_check_adminq(hw); if (status != -EIO) break;
ice_debug(hw, ICE_DBG_AQ_MSG, "Retry Admin Queue init due to FW critical error\n");
ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN, true);
msleep(ICE_CTL_Q_ADMIN_INIT_MSEC);
} while (retry++ < ICE_CTL_Q_ADMIN_INIT_TIMEOUT);
if (status) return status; /* sideband control queue (SBQ) interface is not supported on some *devices.Initializeifsupported,elsefallbacktotheadminqueue *interface
*/ if (ice_is_sbq_supported(hw)) {
status = ice_init_ctrlq(hw, ICE_CTL_Q_SB); if (status) return status;
} /* Init Mailbox queue */ return ice_init_ctrlq(hw, ICE_CTL_Q_MAILBOX);
}
/** *ice_destroy_all_ctrlq-exitroutineforallcontrolqueues *@hw:pointertothehardwarestructure * *Thisfunctionshutsdownallthecontrolqueuesandthendestroysthe *controlqueuelocks.Itshouldbecalledonceduringdriverunload.The *drivershouldcallice_shutdown_all_ctrlqifitneedstoshutdownand *reinitializecontrolqueues,suchasinresponsetoaresetevent.
*/ void ice_destroy_all_ctrlq(struct ice_hw *hw)
{ /* shut down all the control queues first */
ice_shutdown_all_ctrlq(hw, true);
ice_destroy_ctrlq_locks(&hw->adminq); if (ice_is_sbq_supported(hw))
ice_destroy_ctrlq_locks(&hw->sbq);
ice_destroy_ctrlq_locks(&hw->mailboxq);
}
/* if reset is in progress return a soft error */ if (hw->reset_ongoing) return -EBUSY;
mutex_lock(&cq->sq_lock);
cq->sq_last_status = LIBIE_AQ_RC_OK;
if (!cq->sq.count) {
ice_debug(hw, ICE_DBG_AQ_MSG, "Control Send queue not initialized.\n");
status = -EIO; goto sq_send_command_error;
}
if ((buf && !buf_size) || (!buf && buf_size)) {
status = -EINVAL; goto sq_send_command_error;
}
if (buf) { if (buf_size > cq->sq_buf_size) {
ice_debug(hw, ICE_DBG_AQ_MSG, "Invalid buffer size for Control Send queue: %d.\n",
buf_size);
status = -EINVAL; goto sq_send_command_error;
}
val = rd32(hw, cq->sq.head); if (val >= cq->num_sq_entries) {
ice_debug(hw, ICE_DBG_AQ_MSG, "head overrun at %d in the Control Send Queue ring\n",
val);
status = -EIO; goto sq_send_command_error;
}
/* Call clean and check queue available function to reclaim the *descriptorsthatwereprocessedbyFW/MBX;thefunctionreturnsthe *numberofdescavailable.Thecleanfunctioncalledherecouldbe *calledinaseparatethreadincaseofasynchronouscompletions.
*/ if (ice_clean_sq(hw, cq) == 0) {
ice_debug(hw, ICE_DBG_AQ_MSG, "Error: Control Send Queue is full.\n");
status = -ENOSPC; goto sq_send_command_error;
}
/* initialize the temp desc pointer with the right desc */
desc_on_ring = ICE_CTL_Q_DESC(cq->sq, cq->sq.next_to_use);
/* if the desc is available copy the temp desc to the right place */
memcpy(desc_on_ring, desc, sizeof(*desc_on_ring));
/* if buf is not NULL assume indirect command */ if (buf) {
dma_buf = &cq->sq.r.sq_bi[cq->sq.next_to_use]; /* copy the user buf into the respective DMA buf */
memcpy(dma_buf->va, buf, buf_size);
desc_on_ring->datalen = cpu_to_le16(buf_size);
/* Update the address values in the desc with the pa value *forrespectivebuffer
*/
desc_on_ring->params.generic.addr_high =
cpu_to_le32(upper_32_bits(dma_buf->pa));
desc_on_ring->params.generic.addr_low =
cpu_to_le32(lower_32_bits(dma_buf->pa));
}
/* Debug desc and buffer */
ice_debug(hw, ICE_DBG_AQ_DESC, "ATQ: Control Send queue desc and buffer:\n");
/* Wait for the command to complete. If it finishes within the *timeout,copythedescriptorbacktotemp.
*/ if (ice_sq_done(hw, cq)) {
memcpy(desc, desc_on_ring, sizeof(*desc)); if (buf) { /* get returned length to copy */
u16 copy_size = le16_to_cpu(desc->datalen);
if (copy_size > buf_size) {
ice_debug(hw, ICE_DBG_AQ_MSG, "Return len %d > than buf len %d\n",
copy_size, buf_size);
status = -EIO;
} else {
memcpy(buf, dma_buf->va, copy_size);
}
}
retval = le16_to_cpu(desc->retval); if (retval) {
ice_debug(hw, ICE_DBG_AQ_MSG, "Control Send Queue command 0x%04X completed with error 0x%X\n",
le16_to_cpu(desc->opcode),
retval);
/* strip off FW internal code */
retval &= 0xff;
}
cmd_completed = true; if (!status && retval != LIBIE_AQ_RC_OK)
status = -EIO;
cq->sq_last_status = (enum libie_aq_err)retval;
}
ice_debug(hw, ICE_DBG_AQ_MSG, "ATQ: desc and buffer writeback:\n");
/* Restore the original datalen and buffer address in the desc, *FWupdatesdatalentoindicatetheeventmessagesize
*/
bi = &cq->rq.r.rq_bi[ntc];
memset(desc, 0, sizeof(*desc));
/* set tail = the last cleaned desc index. */
wr32(hw, cq->rq.tail, ntc); /* ntc is updated to tail + 1 */
ntc++; if (ntc == cq->num_rq_entries)
ntc = 0;
cq->rq.next_to_clean = ntc;
cq->rq.next_to_use = ntu;
clean_rq_elem_out: /* Set pending if needed, unlock and return */ if (pending) { /* re-read HW head to calculate actual pending messages */
ntu = (u16)(rd32(hw, cq->rq.head) & cq->rq.head_mask);
*pending = (u16)((ntc > ntu ? cq->rq.count : 0) + (ntu - ntc));
}
clean_rq_elem_err:
mutex_unlock(&cq->rq_lock);
return ret_code;
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.78Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.