Skip to content

Commit

Permalink
Merge branch 'rework-the-memory-barrier-for-scrq-entry'
Browse files Browse the repository at this point in the history
Lijun Pan says:

====================
rework the memory barrier for SCRQ entry

This series rework the memory barrier for SCRQ (Sub-Command-Response
Queue) entry.
====================

Link: https://lore.kernel.org/r/20210130011905.1485-1-ljp@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
kuba-moo committed Feb 2, 2021
2 parents 1a2b60f + 2719cb4 commit 9ae4bdc
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions drivers/net/ethernet/ibm/ibmvnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,12 +2444,6 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)

if (!pending_scrq(adapter, rx_scrq))
break;
/* The queue entry at the current index is peeked at above
* to determine that there is a valid descriptor awaiting
* processing. We want to be sure that the current slot
* holds a valid descriptor before reading its contents.
*/
dma_rmb();
next = ibmvnic_next_scrq(adapter, rx_scrq);
rx_buff =
(struct ibmvnic_rx_buff *)be64_to_cpu(next->
Expand Down Expand Up @@ -2516,7 +2510,6 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
if (napi_complete_done(napi, frames_processed)) {
enable_scrq_irq(adapter, rx_scrq);
if (pending_scrq(adapter, rx_scrq)) {
rmb();
if (napi_reschedule(napi)) {
disable_scrq_irq(adapter, rx_scrq);
goto restart_poll;
Expand Down Expand Up @@ -3189,13 +3182,6 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
int total_bytes = 0;
int num_packets = 0;

/* The queue entry at the current index is peeked at above
* to determine that there is a valid descriptor awaiting
* processing. We want to be sure that the current slot
* holds a valid descriptor before reading its contents.
*/
dma_rmb();

next = ibmvnic_next_scrq(adapter, scrq);
for (i = 0; i < next->tx_comp.num_comps; i++) {
if (next->tx_comp.rcs[i])
Expand Down Expand Up @@ -3569,11 +3555,16 @@ static int pending_scrq(struct ibmvnic_adapter *adapter,
struct ibmvnic_sub_crq_queue *scrq)
{
union sub_crq *entry = &scrq->msgs[scrq->cur];
int rc;

if (entry->generic.first & IBMVNIC_CRQ_CMD_RSP)
return 1;
else
return 0;
rc = !!(entry->generic.first & IBMVNIC_CRQ_CMD_RSP);

/* Ensure that the SCRQ valid flag is loaded prior to loading the
* contents of the SCRQ descriptor
*/
dma_rmb();

return rc;
}

static union sub_crq *ibmvnic_next_scrq(struct ibmvnic_adapter *adapter,
Expand All @@ -3592,8 +3583,8 @@ static union sub_crq *ibmvnic_next_scrq(struct ibmvnic_adapter *adapter,
}
spin_unlock_irqrestore(&scrq->lock, flags);

/* Ensure that the entire buffer descriptor has been
* loaded before reading its contents
/* Ensure that the SCRQ valid flag is loaded prior to loading the
* contents of the SCRQ descriptor
*/
dma_rmb();

Expand Down

0 comments on commit 9ae4bdc

Please sign in to comment.