3 ms·
Are their uses of unsafe necessary? After briefly looking over the implementation it seems like they could just be using references in a bunch of places. Take f
by leshow 7y ago
Are their uses of unsafe necessary? After briefly looking over the implementation it seems like they could just be using references in a bunch of places. Take for example:
let queue = &mut self.rx_queues[queue_id as usize];
rx_index = queue.rx_index;
last_rx_index = queue.rx_index;
for i in 0..num_packets {
let desc = unsafe { queue.descriptors.add(rx_index) as *mut ixgbe_adv_rx_desc };
let status =
unsafe { ptr::read_volatile(&mut (*desc).wb.upper.status_error as *mut u32) };
- dbaupp 7y agoI've got no idea. One would have to understand the code fairly deeply to tell that. For instance, are the volatile reads/writes meant to be atomic ones (which could be done safely) or are they truly volatile?