ena: Make first_interrupt a uint8_t

We do not have atomic(9) routines for bools, and it is not guaranteed
that sizeof(bool) is 1.

This fixes the KASAN and KMSAN kernel builds, which fail because the
compiler refuses to silently cast a _Bool * to a uint8_t * when calling
the atomic(9) sanitizer interceptors.

Reviewed by:	Dawid Górecki <dgr@semihalf.com>
MFC after:	2 weeks
Fixes:	0ac122c388 ("ena: Use atomic_load/store functions for first_interrupt variable")
Differential Revision:	https://reviews.freebsd.org/D35683
This commit is contained in:
Mark Johnston 2022-06-30 14:49:46 -04:00
parent 17732dd8f0
commit b72f1f4516
3 changed files with 4 additions and 4 deletions

View File

@ -376,7 +376,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;
atomic_store_8(&ring->first_interrupt, false);
atomic_store_8(&ring->first_interrupt, 0);
ring->no_interrupt_event_cnt = 0;
}

View File

@ -329,7 +329,7 @@ struct ena_ring {
};
bool first_interrupt;
uint8_t first_interrupt;
uint16_t no_interrupt_event_cnt;
struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];

View File

@ -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];
atomic_store_8(&tx_ring->first_interrupt, true);
atomic_store_8(&rx_ring->first_interrupt, true);
atomic_store_8(&tx_ring->first_interrupt, 1);
atomic_store_8(&rx_ring->first_interrupt, 1);
for (i = 0; i < ENA_CLEAN_BUDGET; ++i) {
rxc = ena_rx_cleanup(rx_ring);