Skip to content

Commit 9ae4bdc

Browse files
committed
Merge branch 'rework-the-memory-barrier-for-scrq-entry'
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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 1a2b60f + 2719cb4 commit 9ae4bdc

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,12 +2444,6 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
24442444

24452445
if (!pending_scrq(adapter, rx_scrq))
24462446
break;
2447-
/* The queue entry at the current index is peeked at above
2448-
* to determine that there is a valid descriptor awaiting
2449-
* processing. We want to be sure that the current slot
2450-
* holds a valid descriptor before reading its contents.
2451-
*/
2452-
dma_rmb();
24532447
next = ibmvnic_next_scrq(adapter, rx_scrq);
24542448
rx_buff =
24552449
(struct ibmvnic_rx_buff *)be64_to_cpu(next->
@@ -2516,7 +2510,6 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget)
25162510
if (napi_complete_done(napi, frames_processed)) {
25172511
enable_scrq_irq(adapter, rx_scrq);
25182512
if (pending_scrq(adapter, rx_scrq)) {
2519-
rmb();
25202513
if (napi_reschedule(napi)) {
25212514
disable_scrq_irq(adapter, rx_scrq);
25222515
goto restart_poll;
@@ -3189,13 +3182,6 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
31893182
int total_bytes = 0;
31903183
int num_packets = 0;
31913184

3192-
/* The queue entry at the current index is peeked at above
3193-
* to determine that there is a valid descriptor awaiting
3194-
* processing. We want to be sure that the current slot
3195-
* holds a valid descriptor before reading its contents.
3196-
*/
3197-
dma_rmb();
3198-
31993185
next = ibmvnic_next_scrq(adapter, scrq);
32003186
for (i = 0; i < next->tx_comp.num_comps; i++) {
32013187
if (next->tx_comp.rcs[i])
@@ -3569,11 +3555,16 @@ static int pending_scrq(struct ibmvnic_adapter *adapter,
35693555
struct ibmvnic_sub_crq_queue *scrq)
35703556
{
35713557
union sub_crq *entry = &scrq->msgs[scrq->cur];
3558+
int rc;
35723559

3573-
if (entry->generic.first & IBMVNIC_CRQ_CMD_RSP)
3574-
return 1;
3575-
else
3576-
return 0;
3560+
rc = !!(entry->generic.first & IBMVNIC_CRQ_CMD_RSP);
3561+
3562+
/* Ensure that the SCRQ valid flag is loaded prior to loading the
3563+
* contents of the SCRQ descriptor
3564+
*/
3565+
dma_rmb();
3566+
3567+
return rc;
35773568
}
35783569

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

3595-
/* Ensure that the entire buffer descriptor has been
3596-
* loaded before reading its contents
3586+
/* Ensure that the SCRQ valid flag is loaded prior to loading the
3587+
* contents of the SCRQ descriptor
35973588
*/
35983589
dma_rmb();
35993590

0 commit comments

Comments
 (0)