Skip to content

Commit 4f5126a

Browse files
atbrady-intelanguy11
authored andcommitted
idpf: fix minor controlq issues
While we're here improving virtchnl we can include two minor fixes for the lower level ctrlq flow. This adds a memory barrier to idpf_post_rx_buffs before we update tail on the controlq. We should make sure our writes have had a chance to finish before we tell HW it can touch them. This also removes some defensive programming in idpf_ctrlq_recv. The caller should not be using a num_q_msg value of zero or more than the ring size and it's their responsibility to call functions sanely. Tested-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: Alan Brady <alan.brady@intel.com> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 14696ed commit 4f5126a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/net/ethernet/intel/idpf/idpf_controlq.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq,
516516
/* Wrap to end of end ring since current ntp is 0 */
517517
cq->next_to_post = cq->ring_size - 1;
518518

519+
dma_wmb();
520+
519521
wr32(hw, cq->reg.tail, cq->next_to_post);
520522
}
521523

@@ -546,11 +548,6 @@ int idpf_ctlq_recv(struct idpf_ctlq_info *cq, u16 *num_q_msg,
546548
int err = 0;
547549
u16 i;
548550

549-
if (*num_q_msg == 0)
550-
return 0;
551-
else if (*num_q_msg > cq->ring_size)
552-
return -EBADR;
553-
554551
/* take the lock before we start messing with the ring */
555552
mutex_lock(&cq->cq_lock);
556553

0 commit comments

Comments
 (0)