-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
portus api: deduplicate programs across flows #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good.
I have a couple code-style comments, and it seems like you haven't cleaned up your commented-out testing code yet.
ccp_generic_cong_avoid/src/lib.rs
Outdated
@@ -347,6 +252,127 @@ impl<T: Ipc, A: GenericCongAvoidAlg> CongAlg<T> for GenericCongAvoid<T, A> { | |||
A::name() | |||
} | |||
|
|||
fn init_programs() -> Option<Vec<(Bin, Scope, String)>> { | |||
// install all the datapath programs that can be used in the lifetime of this program | |||
let mut vec = vec![]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut vec = vec![
(String::from("(def.....)"), String::from("DatapathIntervalProg")),
(String::from("(def.....)"), String::from("DatapathIntervalRTTProg")),
....,
];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cleaner than vec![]
followed by multiple vec.push()
calls.
Also, can we call the variable something other than vec
? Maybe programs
?
ccp_generic_cong_avoid/src/lib.rs
Outdated
let (bin, sc) = portus::compile_program(prog.as_bytes(), None).unwrap(); | ||
ret_vec.push((bin, sc, prog_name.clone())); | ||
} | ||
Some(ret_vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some(
vec.iter()
.map(|prog, prog_name| {
let (bin, sc) = portus::compile_program(prog.as_bytes(), None).unwrap();
(bin, sc, prog_name.clone())
})
.collect::<Vec<(_,_,_)>>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the for loop and the new vec
@@ -1,7 +1,7 @@ | |||
CC = gcc # C compiler | |||
CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags | |||
CFLAGS += -D__USRLIB__ # Only use this makefile for compiling user-space library | |||
ifeq ($(DEBUG), 1) | |||
ifeq ($(DEBUG), y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
different commit for this?
int err = 0; | ||
if ((send_sock = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) { | ||
printf("Could not setup sending socket\n"); | ||
exit(-1); | ||
} | ||
|
||
send_sockaddr.sun_family = AF_UNIX; | ||
/*send_sockaddr.sun_family = AF_UNIX; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
src/lib.rs
Outdated
use ipc::Ipc; | ||
use ipc::{BackendSender, BackendBuilder}; | ||
use serialize::Msg; | ||
use std::sync::{Arc, atomic}; | ||
use std::thread; | ||
|
||
/*pub struct ScopeMap { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is ScopeMap
?
self.sender.send_msg(&buf[..])?; | ||
Ok(sc.clone()) | ||
}, | ||
_ => Err(Error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait what should this look like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I was just thinking:
_ => Err(Error(
format!("Map....", program_name),
)),
src/serialize/changeprog.rs
Outdated
pub struct Msg { | ||
pub sid: u32, | ||
pub program_uid: u32, | ||
pub num_fields: u32, // question: does this get turned into a u32? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
during serialization
Also @deeptir18 since this is a breaking API change, please bump the portus version in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no comments aside from what Akshay already mentioned
965d228
to
4735ee8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version number should be 0.3.0
:)
Cargo.toml
Outdated
@@ -1,7 +1,7 @@ | |||
[package] | |||
name = "portus" | |||
version = "0.2.3" | |||
authors = ["Akshay Narayan <akshayn@csail.mit.edu>", "Frank Cangialosi <frankc@csail.mit.edu", "Deepti Raghavan <deeptir@stanford.edu"] | |||
version = "0.2.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.3.0
: because it's a breaking change, we want to make sure downstream crates which write portus = "0.2"
as their SemVer dependency don't pull in this change and break.
struct sockaddr_un send_sockaddr; | ||
int path_len = 0; | ||
//struct sockaddr_un send_sockaddr; | ||
//int path_len = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this commented?
@@ -277,11 +274,13 @@ int main(__attribute__((unused))int argc, __attribute__((unused))char **argv) { | |||
int recv_sock = setup_listening_thread(); | |||
|
|||
// initialize a fake connection; sends create messages | |||
// sleep to make sure portus has started | |||
sleep(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary, but let's not worry about it now, since my PR #37 will fix it anyway.
self.sender.send_msg(&buf[..])?; | ||
Ok(sc.clone()) | ||
}, | ||
_ => Err(Error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I was just thinking:
_ => Err(Error(
format!("Map....", program_name),
)),
ccp_generic_cong_avoid/src/lib.rs
Outdated
|
||
"), String::from("SSUpdateProg"))]; | ||
Some( | ||
programs.iter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation here
This commit modifies the CCP API to expect users to install all programs in the new init_programs function, when portus starts running. To make a flow use a particular program, there is a new set_program function; when installing, users also specify a name for each program. In the datapath, now, programs need not be duplicated across flows. This also bumps the libccp submodule version to match the corresponding changes in libccp.
4735ee8
to
7260eff
Compare
This commit adds an init_programs function to the CCP API where users
must provide all datapath programs at the beginning, and whenever a flow
should use a particular program, they can use the new "set_program"
function.
I'll split up the commits later, sorry.