@@ -265,9 +265,9 @@ void VirtioNet::msix_xmit_handler()
265265 while (tx_q.new_incoming ())
266266 {
267267 auto res = tx_q.dequeue ();
268- // get packet offset, and call destructor
269- auto * packet = (net::Packet*) (res. data () - sizeof (net:: Packet));
270- delete packet; // call deleter on Packet to release it
268+ assert (res. data () != nullptr );
269+ // get packet offset, and call placement Packet deleter directly
270+ net:: Packet:: operator delete (res. data () - sizeof (net::Packet));
271271 dequeued_tx++;
272272 }
273273 tx_q.enable_interrupts ();
@@ -339,14 +339,13 @@ VirtioNet::create_packet(int link_offset)
339339
340340void VirtioNet::transmit (net::Packet_ptr pckt)
341341{
342- assert (pckt != nullptr );
343- VDBG_TX (" [virtionet] tx: Transmitting %#zu sized packet \n " ,
344- pckt->size ());
345342 while (pckt != nullptr ) {
346343 if (not Nic::sendq_still_available (sendq.size ())) {
347- stat_sendq_limit_dropped_++ ;
348- return ;
344+ stat_sendq_limit_dropped_ += pckt-> chain_length () ;
345+ break ;
349346 }
347+ VDBG_TX (" [virtionet] tx: Transmitting %#zu sized packet \n " ,
348+ pckt->size ());
350349 auto tail = pckt->detach_tail ();
351350 sendq.emplace_back (std::move (pckt));
352351 pckt = std::move (tail);
@@ -363,7 +362,7 @@ void VirtioNet::transmit(net::Packet_ptr pckt)
363362 sendq.size ());
364363
365364 // Transmit all we can directly
366- while (tx_q.num_free () > 1 and sendq.size () > 0 )
365+ while (tx_q.num_free () > 1 and ! sendq.empty () )
367366 {
368367 VDBG_TX (" [virtionet] tx: %u tokens left in TX ring \n " ,
369368 tx_q.num_free ());
0 commit comments