/// Processes the completion queue of the NIC
/// updates tail pointer accordingly.
///
/// # Arguments
/// - exact: If true, advances completion queue as much as possible,
///  if false, only checks if at least one IOBufChain can be returned.
///
/// # Returns
/// How many packets have been sent.
Processes the completion queue of the NIC
updates tail pointer accordingly.

Arguments
exact: If true, advances completion queue as much as possible,
if false, only checks if at least one IOBufChain can be returned.

Returns
How many packets have been sent.
Processes the completion queue of the NIC updates tail pointer accordingly . Arguments exact : If true advances completion queue as much as possible if false only checks if at least one IOBufChain can be returned . Returns How many packets have been sent .
fn can_dequeue(&mut self, exact: bool) -> usize {
        let txc = &mut self.vxtxq_comp_ring;
        let txr = &mut self.vxtxq_cmd_ring;
        // If exact is true, we need to report the number of TX command ring
        // descriptors that have been processed by the device.  If exact is
        // false, we just need to report whether or not at least one TX
        // command ring descriptor has been processed by the device.
        let mut processed = 0;
        loop {
            let txcd = txc.vxcr[txc.vxcr_next as usize];
            if txcd.gen() != txc.vxcr_gen {
                break;
            }
            VMXNet3::barrier(Barrier::Read);
            txc.vxcr_next += 1;
            if txc.vxcr_next == txc.vxcr_ndesc() {
                txc.vxcr_next = 0;
                txc.vxcr_gen ^= 1;
            }
            // TODO: Update chain-holder element here
            let (chain_eop_idx, buf_chain) =
                self.inflight_chains.pop_front().expect("Expected an entry");
            assert_eq!(chain_eop_idx, txcd.eop_idx() as usize);
            self.processed_chains.push_back(buf_chain);
            processed += 1;
            // replaced with pidx_tail:
            // txr.vxtxr_next = (txcd.eop_idx() + 1) % txr.vxtxr_ndesc() as u32;
            self.pidx_tail = (txcd.eop_idx() as usize + 1) % txr.vxtxr_ndesc();
            if !exact {
                // Stop after one packet
                break;
            }
        }
        processed
    }
fn can_dequeue ( & mut self , exact : bool ) -> usize { let txc = & mut self . vxtxq_comp_ring ; let txr = & mut self . vxtxq_cmd_ring ; // If exact is true, we need to report the number of TX command ring // descriptors that have been processed by the device.  If exact is // false, we just need to report whether or not at least one TX // command ring descriptor has been processed by the device. let mut processed = 0 ; loop { let txcd = txc . vxcr [ txc . vxcr_next as usize ] ; if txcd . gen ( ) != txc . vxcr_gen { break ; } VMXNet3 :: barrier ( Barrier :: Read ) ; txc . vxcr_next += 1 ; if txc . vxcr_next == txc . vxcr_ndesc ( ) { txc . vxcr_next = 0 ; txc . vxcr_gen ^= 1 ; } // TODO: Update chain-holder element here let ( chain_eop_idx , buf_chain ) = self . inflight_chains . pop_front ( ) . expect ( " " ) ; assert_eq ! ( chain_eop_idx txcd eop_idx ( ) as usize ) ; self . processed_chains . push_back ( buf_chain ) ; processed += 1 ; // replaced with pidx_tail: // txr.vxtxr_next = (txcd.eop_idx() + 1) % txr.vxtxr_ndesc() as u32; self . pidx_tail = ( txcd . eop_idx ( ) as usize + 1 ) % txr . vxtxr_ndesc ( ) ; if ! exact { // Stop after one packet break ; } } processed }
Processes the completion queue of the NIC
updates tail pointer accordingly.
Processes the completion queue of the NIC updates tail pointer accordingly .
&mut self
exact
bool