pub fn process_tx(&mut self) -> bool {
        debug!("vsock::process_tx()");
        // This is safe since we checked in the event handler that the device is activated.
        let mem = self.device_state.mem().unwrap();

        let mut have_used = false;

        while let Some(head) = self.queues[TXQ_INDEX].pop(mem) {
            let pkt = match VsockPacket::from_tx_virtq_head(&head) {
                Ok(pkt) => pkt,
                Err(e) => {
                    error!("vsock: error reading TX packet: {:?}", e);
                    have_used = true;
                    self.queues[TXQ_INDEX]
                        .add_used(mem, head.index, 0)
                        .unwrap_or_else(|e| {
                            error!("Failed to add available descriptor {}: {}", head.index, e);
                        });
                    continue;
                }
            };

            if self.backend.send_pkt(&pkt, mem).is_err() {
                self.queues[TXQ_INDEX].undo_pop();
                break;
            }

            have_used = true;
            self.queues[TXQ_INDEX]
                .add_used(mem, head.index, 0)
                .unwrap_or_else(|e| {
                    error!("Failed to add available descriptor {}: {}", head.index, e);
                });
        }

        have_used
    }
/// Walk the driver-provided TX queue buffers, package them up as vsock packets, and send them
/// to the backend for processing. Return `true` if descriptors have been added to the used
/// ring, and `false` otherwise.
Walk the driver-provided TX queue buffers, package them up as vsock packets, and send them
to the backend for processing. Return `true` if descriptors have been added to the used
ring, and `false` otherwise.
Walk the driver - provided TX queue buffers package them up as vsock packets and send them to the backend for processing . Return ` true ` if descriptors have been added to the used ring and ` false ` otherwise .
pub fn process_tx(&mut self) -> bool {
        debug!("vsock::process_tx()");
        // This is safe since we checked in the event handler that the device is activated.
        let mem = self.device_state.mem().unwrap();
        let mut have_used = false;
        while let Some(head) = self.queues[TXQ_INDEX].pop(mem) {
            let pkt = match VsockPacket::from_tx_virtq_head(&head) {
                Ok(pkt) => pkt,
                Err(e) => {
                    error!("vsock: error reading TX packet: {:?}", e);
                    have_used = true;
                    self.queues[TXQ_INDEX]
                        .add_used(mem, head.index, 0)
                        .unwrap_or_else(|e| {
                            error!("Failed to add available descriptor {}: {}", head.index, e);
                        });
                    continue;
                }
            };
            if self.backend.send_pkt(&pkt, mem).is_err() {
                self.queues[TXQ_INDEX].undo_pop();
                break;
            }
            have_used = true;
            self.queues[TXQ_INDEX]
                .add_used(mem, head.index, 0)
                .unwrap_or_else(|e| {
                    error!("Failed to add available descriptor {}: {}", head.index, e);
                });
        }
        have_used
    }
pub fn process_tx ( & mut self ) -> bool { debug ! ( " " ) ; // This is safe since we checked in the event handler that the device is activated. let mem = self . device_state . mem ( ) . unwrap ( ) ; let mut have_used = false ; while let Some ( head ) = self . queues [ TXQ_INDEX ] . pop ( mem ) { let pkt = match VsockPacket :: from_tx_virtq_head ( & head ) { Ok ( pkt ) => pkt , Err ( e ) => { error ! ( " " e ) ; have_used = true ; self . queues [ TXQ_INDEX ] . add_used ( mem , head . index , 0 ) . unwrap_or_else ( | e | { error ! ( " " head index e ) ; } ) ; continue ; } } ; if self . backend . send_pkt ( & pkt , mem ) . is_err ( ) { self . queues [ TXQ_INDEX ] . undo_pop ( ) ; break ; } have_used = true ; self . queues [ TXQ_INDEX ] . add_used ( mem , head . index , 0 ) . unwrap_or_else ( | e | { error ! ( " " head index e ) ; } ) ; } have_used }
Walk the driver-provided TX queue buffers, package them up as vsock packets, and send them
to the backend for processing.
Walk the driver - provided TX queue buffers package them up as vsock packets and send them to the backend for processing .
&mut self
&mut self