From: Ian Stokes <ian.stokes@intel.com>
The driver allocates a cmd_buf array in addition to the desc_buf array. This
array stores an ice_sq_cd command details structure for each entry in the
control queue ring.
The contents of the structure are copied from the value passed in via
ice_sq_send_cmd, and include only a pointer to storage for the write back
descriptor contents.
Originally this array was intended to support asynchronous completion including
features such as a callback function. This support was never implemented. All
that exists today is needless copying and resetting of a cmd_buf array that is
otherwise functionally unused.
Since we do not plan to implement asynchronous completions, drop this
unnecessary memory and logic. This saves memory for each control queue, and
avoids the pointless copying and memset.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
drivers/net/ice/base/ice_controlq.c | 27 +++------------------------
drivers/net/ice/base/ice_controlq.h | 2 --
2 files changed, 3 insertions(+), 26 deletions(-)
@@ -101,13 +101,6 @@ ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
if (!cq->sq.desc_buf.va)
return ICE_ERR_NO_MEMORY;
- cq->sq.cmd_buf = ice_calloc(hw, cq->num_sq_entries,
- sizeof(struct ice_sq_cd));
- if (!cq->sq.cmd_buf) {
- ice_free_dma_mem(hw, &cq->sq.desc_buf);
- return ICE_ERR_NO_MEMORY;
- }
-
return 0;
}
@@ -309,9 +302,6 @@ do { \
ice_free_dma_mem((hw), \
&(qi)->ring.r.ring##_bi[i]); \
} \
- /* free the buffer info list */ \
- if ((qi)->ring.cmd_buf) \
- ice_free(hw, (qi)->ring.cmd_buf); \
/* free DMA head */ \
ice_free(hw, (qi)->ring.dma_head); \
} while (0)
@@ -844,21 +834,17 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
struct ice_ctl_q_ring *sq = &cq->sq;
u16 ntc = sq->next_to_clean;
- struct ice_sq_cd *details;
struct ice_aq_desc *desc;
desc = ICE_CTL_Q_DESC(*sq, ntc);
- details = ICE_CTL_Q_DETAILS(*sq, ntc);
while (rd32(hw, cq->sq.head) != ntc) {
ice_debug(hw, ICE_DBG_AQ_MSG, "ntc %d head %d.\n", ntc, rd32(hw, cq->sq.head));
ice_memset(desc, 0, sizeof(*desc), ICE_DMA_MEM);
- ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM);
ntc++;
if (ntc == sq->count)
ntc = 0;
desc = ICE_CTL_Q_DESC(*sq, ntc);
- details = ICE_CTL_Q_DETAILS(*sq, ntc);
}
sq->next_to_clean = ntc;
@@ -977,7 +963,6 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
struct ice_dma_mem *dma_buf = NULL;
struct ice_aq_desc *desc_on_ring;
bool cmd_completed = false;
- struct ice_sq_cd *details;
u32 total_delay = 0;
int status = 0;
u16 retval = 0;
@@ -1021,12 +1006,6 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
goto sq_send_command_error;
}
- details = ICE_CTL_Q_DETAILS(cq->sq, cq->sq.next_to_use);
- if (cd)
- *details = *cd;
- else
- ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM);
-
/* Call clean and check queue available function to reclaim the
* descriptors that were processed by FW/MBX; the function returns the
* number of desc available. The clean function called here could be
@@ -1114,9 +1093,9 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
ice_debug_cq(hw, cq, (void *)desc, buf, buf_size, true);
/* save writeback AQ if requested */
- if (details->wb_desc)
- ice_memcpy(details->wb_desc, desc_on_ring,
- sizeof(*details->wb_desc), ICE_DMA_TO_NONDMA);
+ if (cd && cd->wb_desc)
+ ice_memcpy(cd->wb_desc, desc_on_ring,
+ sizeof(*cd->wb_desc), ICE_DMA_TO_NONDMA);
/* update the error if time out occurred */
if (!cmd_completed) {
@@ -43,7 +43,6 @@ enum ice_ctl_q {
struct ice_ctl_q_ring {
void *dma_head; /* Virtual address to DMA head */
struct ice_dma_mem desc_buf; /* descriptor ring memory */
- void *cmd_buf; /* command buffer memory */
union {
struct ice_dma_mem *sq_bi;
@@ -73,7 +72,6 @@ struct ice_sq_cd {
struct ice_aq_desc *wb_desc;
};
-#define ICE_CTL_Q_DETAILS(R, i) (&(((struct ice_sq_cd *)((R).cmd_buf))[i]))
/* rq event information */
struct ice_rq_event_info {