mirror of
https://github.com/opnsense/src.git
synced 2026-02-22 17:32:57 -05:00
ena: Use atomic_load/store functions for first_interrupt variable
Surround cases of possible simultaneous access to the first_interrupt variable with atomic_load/store functions. Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc.
This commit is contained in:
parent
d8aba82b5c
commit
0ac122c388
2 changed files with 6 additions and 5 deletions
|
|
@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
|
|||
#include <sys/time.h>
|
||||
#include <sys/eventhandler.h>
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/in_cksum.h>
|
||||
|
|
@ -381,7 +382,7 @@ ena_init_io_rings_common(struct ena_adapter *adapter, struct ena_ring *ring,
|
|||
ring->qid = qid;
|
||||
ring->adapter = adapter;
|
||||
ring->ena_dev = adapter->ena_dev;
|
||||
ring->first_interrupt = false;
|
||||
atomic_store_8(&ring->first_interrupt, false);
|
||||
ring->no_interrupt_event_cnt = 0;
|
||||
}
|
||||
|
||||
|
|
@ -2983,7 +2984,7 @@ static int
|
|||
check_for_rx_interrupt_queue(struct ena_adapter *adapter,
|
||||
struct ena_ring *rx_ring)
|
||||
{
|
||||
if (likely(rx_ring->first_interrupt))
|
||||
if (likely(atomic_load_8(&rx_ring->first_interrupt)))
|
||||
return (0);
|
||||
|
||||
if (ena_com_cq_empty(rx_ring->ena_com_io_cq))
|
||||
|
|
@ -3026,7 +3027,7 @@ check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
|
|||
bintime_sub(&time, &tx_buf->timestamp);
|
||||
time_offset = bttosbt(time);
|
||||
|
||||
if (unlikely(!tx_ring->first_interrupt &&
|
||||
if (unlikely(!atomic_load_8(&tx_ring->first_interrupt) &&
|
||||
time_offset > 2 * adapter->missing_tx_timeout)) {
|
||||
/*
|
||||
* If after graceful period interrupt is still not
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ ena_cleanup(void *arg, int pending)
|
|||
ena_qid = ENA_IO_TXQ_IDX(qid);
|
||||
io_cq = &adapter->ena_dev->io_cq_queues[ena_qid];
|
||||
|
||||
tx_ring->first_interrupt = true;
|
||||
rx_ring->first_interrupt = true;
|
||||
atomic_store_8(&tx_ring->first_interrupt, true);
|
||||
atomic_store_8(&rx_ring->first_interrupt, true);
|
||||
|
||||
for (i = 0; i < CLEAN_BUDGET; ++i) {
|
||||
rxc = ena_rx_cleanup(rx_ring);
|
||||
|
|
|
|||
Loading…
Reference in a new issue