Skip to content

Commit 69b33f9

Browse files
author
rstade
committed
some minor cleanup, new command line option --interactive
1 parent eb2af41 commit 69b33f9

18 files changed

Lines changed: 35 additions & 54 deletions

File tree

framework/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "e2d2"
3-
version = "1.0.7"
3+
version = "1.0.8"
44
authors = ["Aurojit Panda <apanda@cs.berkeley.edu>", "Rainer Stademann"]
55
build = "build.rs"
66

@@ -21,12 +21,12 @@ lazy_static = "*"
2121
net2 = "*"
2222
# NIX restricts us to just unix for now, we can fix this if someone cares at a later point.
2323
nix = ">=0.10.0"
24-
toml = "~0.4"
24+
toml = "0.6"
2525
# Hack for SHM
2626
uuid= { version = ">=0.7", features=["v4"] }
2727
tokio-core=">=0.1.8"
2828
futures=">=0.1.14"
29-
eui48 = { version= ">=0.4" }
29+
eui48 = { git= "https://github.com/readysettech/eui48.git", version= ">=1.1", features=["serde"] , default-features= false}
3030
separator = ">= 0.3"
3131
serde_derive = "1.0"
3232
serde = "1.0"

framework/src/config/config_reader.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use eui48::MacAddress;
66
use ipnet::Ipv4Net;
77
use native::zcsi::{RteEthIpv4Flow, RteFdirConf, RteFdirMode, RteFdirPballocType};
88
use std::clone::Clone;
9-
use std::collections::BTreeMap;
109
use std::fs::File;
1110
use std::io::Read;
1211
use std::net::{AddrParseError, Ipv4Addr};
@@ -160,28 +159,28 @@ fn read_port(value: &Value) -> errors::Result<PortConfiguration> {
160159
}
161160
}
162161

163-
fn read_ipv4(mask_def: &BTreeMap<String, Value>, key: String) -> Result<u32, AddrParseError> {
162+
fn read_ipv4(mask_def: &toml::map::Map<String, Value>, key: String) -> Result<u32, AddrParseError> {
164163
match mask_def.get(&key) {
165164
Some(&Value::String(ref ipv4_string)) => Ok(u32::from(Ipv4Addr::from_str(ipv4_string)?)),
166165
_ => Ok(0u32),
167166
}
168167
}
169168

170-
fn read_hex_u32(mask_def: &BTreeMap<String, Value>, key: String) -> u32 {
169+
fn read_hex_u32(mask_def: &toml::map::Map<String, Value>, key: String) -> u32 {
171170
match mask_def.get(&key) {
172171
Some(&Value::String(ref hex_string)) => u32::from_str_radix(hex_string, 16).unwrap_or(0u32),
173172
_ => 0u32,
174173
}
175174
}
176175

177-
fn read_hex_u16(mask_def: &BTreeMap<String, Value>, key: String) -> u16 {
176+
fn read_hex_u16(mask_def: &toml::map::Map<String, Value>, key: String) -> u16 {
178177
match mask_def.get(&key) {
179178
Some(&Value::String(ref hex_string)) => u16::from_str_radix(hex_string, 16).unwrap_or(0u16),
180179
_ => 0u16,
181180
}
182181
}
183182

184-
fn read_hex_u8(mask_def: &BTreeMap<String, Value>, key: String) -> u8 {
183+
fn read_hex_u8(mask_def: &toml::map::Map<String, Value>, key: String) -> u8 {
185184
match mask_def.get(&key) {
186185
Some(&Value::String(ref hex_string)) => u8::from_str_radix(hex_string, 16).unwrap_or(0u8),
187186
_ => 0u8,

framework/src/config/flag_reader.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn basic_opts() -> Options {
2121
opts.optopt("m", "master", "Master core", "master");
2222
opts.optopt("f", "configuration", "Configuration file", "path");
2323
opts.optmulti("", "vdev", "Virtual device to create", "vdev_name");
24+
opts.optflag("i", "interactive", "run interactively");
2425
opts
2526
}
2627

framework/src/config/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pub use self::config_reader::*;
22
pub use self::flag_reader::*;
3+
use interface::{FlowSteeringMode, NetSpec};
34
use native::zcsi::RteFdirConf;
45
use std::fmt;
5-
use interface::{FlowSteeringMode, NetSpec};
66

77
mod config_reader;
88
mod flag_reader;
@@ -87,11 +87,11 @@ impl fmt::Display for NetbricksConfiguration {
8787
for port in &self.ports {
8888
write!(f, "\t{}\n", port)?
8989
}
90-
write!(f, "Cores:\n")?;
90+
write!(f, "Cores:")?;
9191
for core in &self.cores {
92-
write!(f, "\t{}\n", core)?
92+
write!(f, "\t{}", core)?
9393
}
94-
write!(f, "")
94+
write!(f, "\n")
9595
}
9696
}
9797

framework/src/interface/port/phy_port.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ impl Default for PmdPort {
136136
}
137137
}
138138
}
139-
139+
pub type PciQueueType = CacheAligned<PortQueueTxBuffered>;
140+
pub type KniQueueType = CacheAligned<PortQueue>;
140141
/// A port queue represents a single queue for a physical port, and should be used to send and receive data.
141142
#[derive(Clone)]
142143
pub struct PortQueue {

framework/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
#![recursion_limit = "1024"]
2-
#![feature(log_syntax)]
3-
#![feature(box_syntax)]
4-
#![feature(min_specialization)]
5-
#![feature(slice_concat_ext)]
62
#![feature(ptr_internals)]
7-
// Used for cache alignment.
8-
#![feature(allocator_api)]
9-
#![allow(unused_features)]
10-
#![feature(integer_atomics)]
113
#![allow(unused_doc_comments)]
124
#![cfg_attr(feature = "dev", allow(unstable_features))]
135
// Need this since PMD port construction triggers too many arguments.

framework/src/operators/composition_batch.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ pub struct CompositionBatch {
1111

1212
impl CompositionBatch {
1313
pub fn new<V: 'static + Batch>(parent: V) -> CompositionBatch {
14-
CompositionBatch { parent: box parent }
14+
CompositionBatch {
15+
parent: Box::new(parent),
16+
}
1517
}
1618
}
1719

framework/src/operators/group_by.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ where
4040
{
4141
let iter = PayloadEnumerator::new(&mut self.parent);
4242
while let Some(ParsedDescriptor { mut pdu, .. }) = iter.next(&mut self.parent) {
43-
//let group = (self.group_fn)(&mut packet);
4443
let group = (self.group_fn)(&mut pdu);
4544
if !self.producers[group].enqueue_one(pdu) {
4645
warn!("queue overflow in GroupByProducer for group {}", group);

framework/src/scheduler/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,6 @@ pub fn initialize_system(configuration: &NetbricksConfiguration) -> errors::Resu
324324
cores.extend(ctx.rx_queues.keys());
325325
};
326326
ctx.active_cores = cores.into_iter().collect();
327+
ctx.active_cores.sort_by(|a, b| a.cmp(b));
327328
Ok(ctx)
328329
}

framework/src/scheduler/standalone_scheduler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct Runnable {
2525
impl Runnable {
2626
pub fn from_task<T: Executable + 'static>(uuid: Uuid, name: String, task: T) -> Runnable {
2727
Runnable {
28-
task: box task,
28+
task: Box::new(task),
2929
uuid,
3030
name,
3131
cycles: 0,

0 commit comments

Comments
 (0)