Skip to content

Commit c702e0e

Browse files
committed
Few fixes to packet batching
1 parent 84d3ff7 commit c702e0e

File tree

2 files changed

+23
-4
lines changed
  • sys

2 files changed

+23
-4
lines changed

sys/interfaces/device/ixgbe/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,10 @@ impl IxgbeDevice {
10241024
}
10251025

10261026
//if reap_queue.push_back(RRef::new(buf.take().unwrap())).is_some() {
1027-
if reap_queue.push_back(buf).is_some() {
1027+
if let Some(buf) = reap_queue.push_back(buf) {
10281028
println!("tx_sub_and_poll1: Pushing to a full reap queue");
1029+
self.transmit_rrefs[tx_index] = Some(buf);
1030+
break;
10291031
}
10301032

10311033
tx_clean_index = wrap_ring(tx_clean_index, self.transmit_ring.len());

sys/lib/libbenchnet/src/lib.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,19 @@ pub fn run_rx_udptest_rref_with_delay(net: &dyn Net, pkt_len: usize, debug: bool
351351
let mut collect = Some(collect);
352352
let mut poll = Some(poll);
353353

354-
println!("======== Starting udp rx test (rrefs) loop_delay: {} ==========", delay);
354+
355+
// pkgten.hz 2590000000 wire_size 704 lk 10000000000 pps 14204545 cpp 182 tx_cycles 11648 tx_rate 100.000000
356+
// compute the number of bits on wire for this pkt_len
357+
358+
let wire_size = (req_pkt_len + 24) * 8;
359+
let link_speed = 10_000_000_000_u64;
360+
let pps = link_speed as f64 / wire_size as f64;
361+
let cpp = CPU_MHZ as f64 / pps;
362+
let rx_cycles = (cpp as u64 * batch_sz as u64);
363+
364+
println!("CPU_MHZ {} wire_size {} link_speed {} pps {} cpp {} rx_cycles {}",
365+
CPU_MHZ, wire_size, link_speed, pps, cpp, rx_cycles);
366+
println!("======== Starting udp rx test {}B (rrefs) loop_delay: {} ==========", pkt_len, delay);
355367

356368
let mut sum: usize = 0;
357369
let mut alloc_count = 0;
@@ -834,7 +846,7 @@ pub fn run_fwd_udptest_rref_with_delay(net: &dyn Net, pkt_len: usize, delay: u64
834846
#[cfg(feature = "noop")]
835847
return Ok(());
836848

837-
let batch_sz = BATCH_SIZE / 2;
849+
let batch_sz = BATCH_SIZE;
838850
let mut rx_submit = RRefDeque::<[u8; 1514], 32>::default();
839851
let mut rx_collect = RRefDeque::<[u8; 1514], 32>::default();
840852
let mut tx_poll = RRefDeque::<[u8; 1514], 512>::default();
@@ -895,8 +907,13 @@ pub fn run_fwd_udptest_rref_with_delay(net: &dyn Net, pkt_len: usize, delay: u64
895907

896908
let ms_start = rdtsc();
897909
for pkt in rx_collect_.iter_mut() {
898-
for i in 0..6 {
910+
/*for i in 0..6 {
899911
(pkt).swap(i, 6 + i);
912+
}*/
913+
//let mut pkt = pkt as *mut [u8; 1514] as *mut u8;
914+
unsafe {
915+
ptr::copy(our_mac.as_ptr(), pkt.as_mut_ptr().offset(6), our_mac.capacity());
916+
ptr::copy(sender_mac.as_ptr(), pkt.as_mut_ptr().offset(0), sender_mac.capacity());
900917
}
901918
}
902919
mswap_elapsed += rdtsc() - ms_start;

0 commit comments

Comments
 (0)