Permalink
Browse files

logging fixup

  • Loading branch information...
toanju committed Mar 8, 2017
1 parent 4a19c99 commit 24ad2b86fe95fbae274f34dfa20eb3936f78c326
View
@@ -12,6 +12,7 @@
*.swo
*.out
*.kdev4
*.trs
config/libtool.m4
config/ltoptions.m4
View
@@ -10,7 +10,7 @@ AC_MSG_CHECKING(and adding support for ROFL libraries...)
ROFL_INCLUDES="-I$XDPD_SRCDIR/libs/rofl-common/src/ -I$XDPD_SRCDIR/libs/rofl-datapath/src/ -I$XDPD_BUILDDIR/libs/rofl-common/build/src/ -I$XDPD_BUILDDIR/libs/rofl-datapath/build/src -I$XDPD_SRCDIR/src/xdpd/common"
#Library path
ROFL_LDFLAGS="-L$XDPD_BUILDDIR/libs/rofl-common/build/src/rofl/ -L$XDPD_BUILDDIR/libs/rofl-datapath/build/src/rofl/"
ROFL_LDFLAGS="-L$XDPD_BUILDDIR/libs/rofl-common/build/src/rofl/ -L$XDPD_BUILDDIR/libs/rofl-datapath/build/src/rofl/ -L$XDPD_BUILDDIR/src/xdpd/common"
CPPFLAGS="$ROFL_INCLUDES $CPPFLAGS "
LDFLAGS="$ROFL_LDFLAGS $LDFLAGS "
@@ -104,7 +104,7 @@ class mmap_rx{
if( likely( ( hdr->tp_status&(TP_STATUS_COPY|TP_STATUS_CSUMNOTREADY) ) == 0 ) ){
#ifdef DEBUG
//if( ( hdr->tp_status&(TP_STATUS_LOSING) ) > 0){
// ROFL_DEBUG_VERBOSE(DRIVER_NAME"[mmap_rx:%s] Congestion in RX of the port\n", devname.c_str());
// XDPD_DEBUG_VERBOSE(DRIVER_NAME"[mmap_rx:%s] Congestion in RX of the port\n", devname.c_str());
//}
#endif
@@ -99,7 +99,7 @@ class mmap_tx{
inline rofl_result_t send(void){
int rv;
ROFL_DEBUG_VERBOSE(DRIVER_NAME" %s() on socket descriptor %d\n", __FUNCTION__, sd);
XDPD_DEBUG_VERBOSE(DRIVER_NAME" %s() on socket descriptor %d\n", __FUNCTION__, sd);
MMAP_SEND_RETRY:
rv = ::sendto(sd, NULL, 0, MSG_DONTWAIT, NULL, 0);
@@ -33,14 +33,14 @@ SHARED_SRC=\
$(top_srcdir)/src/bg_taskmanager.cc \
$(top_srcdir)/src/bg_taskmanager.h \
platform_hooks_of1x_mockup.cc \
$(top_srcdir)/src/c_logger.c \
$(CLASSIFIER_SRC)
SHARED_LIBS=\
-lrofl_common \
-lrofl_datapath \
-lcppunit \
-lpthread
-lpthread \
$(top_srcdir)/../../common/utils/libxdpd_common_utils.la
#Simple portmockup with mockup matches
@@ -12,11 +12,9 @@ test_datapacket_storage_LDADD= -lcppunit -lpthread
test_bufferpool_SOURCES=$(top_srcdir)/src/io/bufferpool.cc\
$(top_srcdir)/src/io/datapacketx86.cc\
$(top_srcdir)/src/pipeline-imp/memory.c\
$(top_srcdir)/src/c_logger.c\
test_bufferpool.cc
test_bufferpool_LDADD= -lrofl_common -lcppunit -lpthread
test_bufferpool_CXXFLAGS= -std=c++0x -std=gnu++0x
test_bufferpool_LDADD= -lrofl_common -lcppunit -lpthread $(top_srcdir)/../../common/utils/libxdpd_common_utils.la
check_PROGRAMS = test_datapacket_storage test_bufferpool
TESTS = test_datapacket_storage test_bufferpool
@@ -2,13 +2,12 @@ MAINTAINERCLEANFILES = Makefile.in
ringbuffertest_SOURCES= \
ringbuffertest.cc
# ../../../src/c_logger.h \
# ../../../src/c_logger.c
ringbuffertest_LDADD= \
-lrofl_common \
-lcppunit \
-lpthread
-lpthread \
$(top_srcdir)/../../common/utils/libxdpd_common_utils.la
check_PROGRAMS=ringbuffertest
@@ -117,7 +117,7 @@ int process_timeouts()
#ifdef DEBUG
dummy++;
//ROFL_DEBUG_VERBOSE("<%s:%d> Checking flow entries expirations %lu:%lu\n",__func__,__LINE__,now.tv_sec,now.tv_usec);
//XDPD_DEBUG_VERBOSE("<%s:%d> Checking flow entries expirations %lu:%lu\n",__func__,__LINE__,now.tv_sec,now.tv_usec);
#endif
last_time_entries_checked = now;
}
@@ -134,11 +134,11 @@ int process_timeouts()
//TODO process buffers in the storage
while(dps->oldest_packet_needs_expiration(&buffer_id)){
ROFL_DEBUG_VERBOSE("<%s:%d> trying to erase a datapacket from storage\n",__func__,__LINE__);
XDPD_DEBUG_VERBOSE("<%s:%d> trying to erase a datapacket from storage\n",__func__,__LINE__);
if( (pkt = dps->get_packet(buffer_id) ) == NULL ){
ROFL_DEBUG_VERBOSE("Error in get_packet_wrapper %u\n", buffer_id);
XDPD_DEBUG_VERBOSE("Error in get_packet_wrapper %u\n", buffer_id);
}else{
ROFL_DEBUG_VERBOSE("Datapacket expired correctly %u\n", buffer_id);
XDPD_DEBUG_VERBOSE("Datapacket expired correctly %u\n", buffer_id);
//Return buffer to bufferpool
bufferpool::release_buffer(pkt);
}
@@ -199,7 +199,7 @@ void* x86_background_tasks_routine(void* param)
snprintf(iface_name, NETFPGA_INTERFACE_NAME_LEN, NETFPGA_INTERFACE_BASE_NAME"%d", i);
//ROFL_DEBUG("interface name %s ", iface_name );
//XDPD_DEBUG("interface name %s ", iface_name );
//Recover port from pipeline
port = physical_switch_get_port_by_name(iface_name);
@@ -248,7 +248,7 @@ void* x86_background_tasks_routine(void* param)
of1x_flow_entry_t* of1x_entry=new of1x_flow_entry_t;
memset(of1x_entry,0,sizeof(of1x_flow_entry_t));
of1x_entry->platform_state=(of1x_flow_entry_platform_state_t*)hw_entry;
ROFL_DEBUG("\n entry number %d", i);
XDPD_DEBUG("\n entry number %d", i);
netfpga_update_entry_stats(of1x_entry);
netfpga_destroy_flow_entry(hw_entry);
@@ -266,21 +266,21 @@ void* x86_background_tasks_routine(void* param)
//update_misc_stats();
nfds = epoll_wait(efd, event_list, MAX_EPOLL_EVENTS, LSW_TIMER_SLOT_MS /*temporaly changet to infinite*/ /*timeout needs TBD somewhere else*/);
//ROFL_DEBUG(" After epoll_wait \n\n\n\n");
//XDPD_DEBUG(" After epoll_wait \n\n\n\n");
if(nfds==-1){ //ERROR in select
ROFL_DEBUG("<%s:%d> Epoll Failed\n",__func__,__LINE__);
XDPD_DEBUG("<%s:%d> Epoll Failed\n",__func__,__LINE__);
continue;
}
if(nfds==0){
//TIMEOUT PASSED
//ROFL_DEBUG("bg_taskmanager epoll gave 0 - TIMEOUT PASSED");
//XDPD_DEBUG("bg_taskmanager epoll gave 0 - TIMEOUT PASSED");
process_timeouts();
}
//ROFL_DEBUG("bg_taskmanager epoll gave %d \n \n", nfds );
//XDPD_DEBUG("bg_taskmanager epoll gave %d \n \n", nfds );
for(i=0;i<nfds;i++){
@@ -294,7 +294,7 @@ void* x86_background_tasks_routine(void* param)
continue;
}else{
//ROFL_DEBUG("event_list[i].data.ptr %p \n",event_list[i].data.ptr);
//XDPD_DEBUG("event_list[i].data.ptr %p \n",event_list[i].data.ptr);
netpfga_io_read_from_port(((switch_port_t*)event_list[i].data.ptr));
}
//check if there is a need of manage timers!
@@ -97,7 +97,7 @@ hal_result_t hal_driver_destroy(){
//Gently destroy (release) 10G NetFPGA
if(netfpga_destroy() != ROFL_SUCCESS){
ROFL_DEBUG("["DRIVER_NAME"] calling netfpga_destroy() failed!\n");
XDPD_DEBUG("["DRIVER_NAME"] calling netfpga_destroy() failed!\n");
}
//If using the pipeline you should call
@@ -260,7 +260,7 @@ hal_result_t hal_driver_of1x_process_packet_out(uint64_t dpid, uint32_t buffer_i
classify_packet(&pktx86->clas_state, pktx86->get_buffer(), pktx86->get_buffer_length(), pktx86->clas_state.port_in, 0);
ROFL_DEBUG_VERBOSE("Getting packet out [%p]\n",pkt);
XDPD_DEBUG_VERBOSE("Getting packet out [%p]\n",pkt);
//Instruct pipeline to process actions. This may reinject the packet
of1x_process_packet_out_pipeline(ROFL_PIPELINE_LOCKED_TID, (of1x_switch_t*)lsw, pkt, action_group);
@@ -24,15 +24,15 @@ void netpfga_io_read_from_port(switch_port_t* port){
packet = pcap_next(state->pcap_fd, &header);
if (header.len < 0)
ROFL_DEBUG(" packet_io.cc Reading to a socket unsuccessful: %d",errno);
XDPD_DEBUG(" packet_io.cc Reading to a socket unsuccessful: %d",errno);
//ROFL_DEBUG(" in the buff %d \n",*buff);
//ROFL_DEBUG(" read size %d \n",header.len);
//XDPD_DEBUG(" in the buff %d \n",*buff);
//XDPD_DEBUG(" read size %d \n",header.len);
pack->init((uint8_t*)packet, header.len, port->attached_sw, port->of_port_num, 0, true, false);
//ROFL_DEBUG(" packet_io.cc buffer %p \n",pack->get_buffer());
//XDPD_DEBUG(" packet_io.cc buffer %p \n",pack->get_buffer());
of1x_switch_t* sw=(of1x_switch_t*)port->attached_sw;
@@ -44,7 +44,7 @@ void netpfga_io_read_from_port(switch_port_t* port){
storage=((logical_switch_internals*)lsw->platform_state)->storage;
storeid storage_id=storage->store_packet(pkt);
//ROFL_DEBUG(" PACKET_IN storage ID %d for datapacket pkt %d dpid %d \n", storage_id, pkt,sw->dpid);
//XDPD_DEBUG(" PACKET_IN storage ID %d for datapacket pkt %d dpid %d \n", storage_id, pkt,sw->dpid);
//Fill matches
fill_packet_matches(pkt, &matches);
@@ -62,10 +62,10 @@ void netpfga_io_read_from_port(switch_port_t* port){
&matches );
if ( HAL_FAILURE == r ) ROFL_DEBUG(" packet_io.cc cmm packet_in unsuccessful");
if ( HAL_SUCCESS == r ) ROFL_DEBUG(" \n packet_io.cc cmm packet_in successful \n");
if ( HAL_FAILURE == r ) XDPD_DEBUG(" packet_io.cc cmm packet_in unsuccessful");
if ( HAL_SUCCESS == r ) XDPD_DEBUG(" \n packet_io.cc cmm packet_in successful \n");
//ROFL_DEBUG(" packet_io.cc ENDS \n \n \n \n");
//XDPD_DEBUG(" packet_io.cc ENDS \n \n \n \n");
}
@@ -9,9 +9,9 @@
bool check_mac_mask(netfpga_align_mac_addr_t* mac){
int i=0 ;
ROFL_DEBUG("MAC ADDRESS MASK: ");
XDPD_DEBUG("MAC ADDRESS MASK: ");
for (i=0; i<6;i++ ){
ROFL_DEBUG("%x:",mac->addr[i]);
XDPD_DEBUG("%x:",mac->addr[i]);
}
for (i=0; i<6;i++ ){
if (mac->addr[i]!=0xFF) return false;
@@ -22,9 +22,9 @@ bool check_mac_mask(netfpga_align_mac_addr_t* mac){
void fill_up_mac(netfpga_align_mac_addr_t* mac){
int i=0 ;
ROFL_DEBUG("MAC ADDRESS before filling up: ");
XDPD_DEBUG("MAC ADDRESS before filling up: ");
for (i=0; i<6;i++ ){
ROFL_DEBUG("%x:",mac->addr[i]);
XDPD_DEBUG("%x:",mac->addr[i]);
}
uint32_t sum=0;
@@ -35,7 +35,7 @@ void fill_up_mac(netfpga_align_mac_addr_t* mac){
for (i=0; i<6;i++ ){
mac->addr[i]=0xFF;
}
ROFL_DEBUG("MAC ADDRESS filled up ");
XDPD_DEBUG("MAC ADDRESS filled up ");
}
}
@@ -82,7 +82,7 @@ netfpga_flow_entry_t* netfpga_init_flow_entry(){
memset(entry->masks, 0, sizeof(*(entry->masks)));
memset(entry->actions, 0, sizeof(*(entry->actions)));
ROFL_DEBUG("size of entry: %d",sizeof(entry));
XDPD_DEBUG("size of entry: %d",sizeof(entry));
return entry;
}
@@ -122,11 +122,11 @@ static rofl_result_t netfpga_flow_entry_map_matches(netfpga_flow_entry_t* entry,
memset(masks, 0xFF, sizeof(*(masks)));
ROFL_DEBUG("%s %d num_of_matches: %x",__FILE__, __LINE__,of1x_entry->matches.num_elements);
XDPD_DEBUG("%s %d num_of_matches: %x",__FILE__, __LINE__,of1x_entry->matches.num_elements);
//Go through all the matches and set entry matches
for(match = of1x_entry->matches.head; match;match = match->next){
ROFL_DEBUG("%s %d of1x_entry->type : %x, ",__FILE__, __LINE__, match->type);
XDPD_DEBUG("%s %d of1x_entry->type : %x, ",__FILE__, __LINE__, match->type);
switch(match->type){
case OF1X_MATCH_IN_PORT:
@@ -175,7 +175,7 @@ static rofl_result_t netfpga_flow_entry_map_matches(netfpga_flow_entry_t* entry,
num_of_matches++;
break;
case OF1X_MATCH_NW_SRC:
ROFL_DEBUG("of1x_entry src_ip: %d ", of1x_get_match_value32(match));
XDPD_DEBUG("of1x_entry src_ip: %d ", of1x_get_match_value32(match));
matches->ip_src = of1x_get_match_value32(match);
tmp_ipv4_mask = of1x_get_match_mask32(match);
@@ -190,7 +190,7 @@ static rofl_result_t netfpga_flow_entry_map_matches(netfpga_flow_entry_t* entry,
break;
case OF1X_MATCH_NW_DST:
ROFL_DEBUG("of1x_entry dst_ip: %d ", of1x_get_match_value32(match));
XDPD_DEBUG("of1x_entry dst_ip: %d ", of1x_get_match_value32(match));
matches->ip_dst = of1x_get_match_value32(match);
tmp_ipv4_mask = of1x_get_match_mask32(match);
@@ -294,7 +294,7 @@ static rofl_result_t netfpga_flow_entry_map_actions(netfpga_flow_entry_t* entry,
case OF1X_AT_OUTPUT:
port = of1x_get_packet_action_field32(action);
entry->actions->action_flags=0;//added
ROFL_DEBUG(" netfpga_flow_entry_map_actions ENTRY port %d ",port);
XDPD_DEBUG(" netfpga_flow_entry_map_actions ENTRY port %d ",port);
memset(&(actions->forward_bitmask),0x00,sizeof(actions->forward_bitmask));// clearing
if ((port >= NETFPGA_FIRST_PORT) && (port <= NETFPGA_LAST_PORT)) {
@@ -303,11 +303,11 @@ static rofl_result_t netfpga_flow_entry_map_actions(netfpga_flow_entry_t* entry,
}else if (port == NETFPGA_IN_PORT) {
//Send back to in-port
ROFL_DEBUG(" \n SEND BACK TO PORT %x ",entry->matches->src_port);
XDPD_DEBUG(" \n SEND BACK TO PORT %x ",entry->matches->src_port);
actions->forward_bitmask |= (entry->matches->src_port);
}else if(port == NETFPGA_ALL_PORTS || port == NETFPGA_FLOOD_PORT) {
ROFL_DEBUG(" \n FLOOD PORT %x ",entry->matches->src_port);
XDPD_DEBUG(" \n FLOOD PORT %x ",entry->matches->src_port);
//Send to all ports except in-port
for(i = NETFPGA_FIRST_PORT; i <= NETFPGA_LAST_PORT; ++i) {
if(entry->matches->src_port != (0x1 << ((i-1) * 2))) {
@@ -362,7 +362,7 @@ static void netfpga_set_hw_position_exact(netfpga_device_t* nfpga, netfpga_flow_
hw_entry->hw_pos = pos;
nfpga->hw_exact_table[pos] = hw_entry;
//ROFL_DEBUG("HW position is %d \n", pos);
//XDPD_DEBUG("HW position is %d \n", pos);
}
//Determine wildcard position
@@ -380,7 +380,7 @@ static void netfpga_set_hw_position_wildcard(netfpga_device_t* nfpga, netfpga_fl
for(i=0; i<NETFPGA_OPENFLOW_WILDCARD_TABLE_SIZE; ++i){
if( nfpga->hw_wildcard_table[i] == NULL){
hw_entry->hw_pos = i;
ROFL_DEBUG(" \n Given hw_position %x ",i);
XDPD_DEBUG(" \n Given hw_position %x ",i);
nfpga->hw_wildcard_table[i] = hw_entry;
return;
}
Oops, something went wrong.

0 comments on commit 24ad2b8

Please sign in to comment.