Skip to content

Commit

Permalink
Reduce IPv4 logging level, fix static library dependencies (#76)
Browse files Browse the repository at this point in the history
* Fix dependencies on static targets

* Check processor return status in ofed/ena devices

* Reduce logging level on unknown IP destination
  • Loading branch information
xguerin authored Oct 18, 2023
1 parent 1661fed commit f461b12
Show file tree
Hide file tree
Showing 20 changed files with 85 additions and 22 deletions.
4 changes: 2 additions & 2 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ if (LibIBVerbs_FOUND AND TULIPS_ENABLE_RAW)
target_link_libraries(raw_ofed
PRIVATE
tulips_api_static
tulips_stack_static
tulips_system_static
tulips_transport_ofed_static
tulips_transport_pcap_static
tulips_transport_stubs_static
tulips_stack_static
tulips_system_static
PUBLIC
${LibIBVerbs_LINK_LIBRARIES}
${LibPCAP_LINK_LIBRARIES})
Expand Down
1 change: 1 addition & 0 deletions src/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ add_library(tulips_api SHARED ${SOURCES})
target_link_libraries(tulips_api PRIVATE tulips_stack)

add_library(tulips_api_static STATIC ${SOURCES})
target_link_libraries(tulips_api_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_api
Expand Down
11 changes: 10 additions & 1 deletion src/ssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
include_directories(${OpenSSL_INCLUDE_DIRS})

add_library(tulips_ssl SHARED ${SOURCES})
target_link_libraries(tulips_ssl PRIVATE tulips_api tulips_stack PUBLIC ${OpenSSL_LINK_LIBRARIES})
target_link_libraries(tulips_ssl
PRIVATE
tulips_api
tulips_stack
PUBLIC ${OpenSSL_LINK_LIBRARIES})

add_library(tulips_ssl_static STATIC ${SOURCES})
target_link_libraries(tulips_ssl_static
PRIVATE
tulips_api_static
tulips_stack_static
PUBLIC ${OpenSSL_LINK_LIBRARIES})

install(TARGETS
tulips_ssl
Expand Down
2 changes: 0 additions & 2 deletions src/stack/ethernet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(CMAKE_POSITION_INDEPENDENT_CODE 1)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
add_library(tulips_stack_ethernet OBJECT ${SOURCES})


7 changes: 4 additions & 3 deletions src/stack/ipv4/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ Processor::process(UNUSED const uint16_t len, const uint8_t* const data,
++m_stats.drop;
++m_stats.frgerr;
m_log.error("IP4", "IP fragment are not supported");
return Status::ProtocolError;
return Status::UnsupportedProtocol;
}
/*
* Check if the packet is for us.
*/
if (INIP->destipaddr != m_hostAddress) {
++m_stats.drop;
m_log.error("IP4", INIP->destipaddr.toString(), " <> ",
m_log.debug("IP4", INIP->destipaddr.toString(), " <> ",
m_hostAddress.toString(), " (proto: ", int(INIP->proto), ")");
return Status::ProtocolError;
return Status::Ok;
}
/*
* Compute and check the IP header checksum.
Expand Down Expand Up @@ -147,6 +147,7 @@ Processor::process(UNUSED const uint16_t len, const uint8_t* const data,
}
#endif
default: {
++m_stats.drop;
ret = Status::UnsupportedProtocol;
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ add_library(tulips_system SHARED ${SOURCES})
target_link_libraries(tulips_system PUBLIC ${CMAKE_THREAD_LIBS_INIT})

add_library(tulips_system_static STATIC ${SOURCES})
target_link_libraries(tulips_system_static PUBLIC ${CMAKE_THREAD_LIBS_INIT})

install(TARGETS
tulips_system
Expand Down
3 changes: 2 additions & 1 deletion src/transport/bond/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE 1)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)

add_library(tulips_transport_bond SHARED ${SOURCES})
target_link_libraries(tulips_transport_bond PUBLIC tulips_stack)
target_link_libraries(tulips_transport_bond PRIVATE tulips_stack)

add_library(tulips_transport_bond_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_bond_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_transport_bond
Expand Down
3 changes: 2 additions & 1 deletion src/transport/check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE 1)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)

add_library(tulips_transport_check SHARED ${SOURCES})
target_link_libraries(tulips_transport_check PUBLIC tulips_stack)
target_link_libraries(tulips_transport_check PRIVATE tulips_stack)

add_library(tulips_transport_check_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_check_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_transport_check
Expand Down
9 changes: 9 additions & 0 deletions src/transport/ena/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
add_library(tulips_transport_ena SHARED ${SOURCES})
target_link_libraries(tulips_transport_ena
PRIVATE
tulips_api
tulips_stack
tulips_system
PUBLIC
${LibDPDK_LINK_LIBRARIES})

add_library(tulips_transport_ena_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_ena_static
PRIVATE
tulips_api_static
tulips_stack_static
tulips_system_static
PUBLIC
${LibDPDK_LINK_LIBRARIES})

install(TARGETS
tulips_transport_ena
Expand Down
11 changes: 9 additions & 2 deletions src/transport/ena/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,22 @@ Device::poll(Processor& proc)
* Process the packet.
*/
m_log.trace("ENA", "processing addr=", (void*)dat, " len=", len);
proc.process(len, dat, system::Clock::read());
ret = proc.process(len, dat, system::Clock::read());
/*
* Check the processor's status.
*/
if (ret != Status::Ok && ret != Status::UnsupportedProtocol) {
m_log.error("OFED", "error processing buffer: ", toString(ret));
return ret;
}
/*
* Free the packet.
*/
rte_pktmbuf_free(buf);
/*
* Clear buffers sent in-band.
*/
auto ret = clearSentBuffers(proc);
ret = clearSentBuffers(proc);
if (ret != Status::Ok) {
return ret;
}
Expand Down
3 changes: 2 additions & 1 deletion src/transport/erase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE 1)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)

add_library(tulips_transport_erase SHARED ${SOURCES})
target_link_libraries(tulips_transport_erase PUBLIC tulips_stack)
target_link_libraries(tulips_transport_erase PRIVATE tulips_stack)

add_library(tulips_transport_erase_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_erase_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_transport_erase
Expand Down
3 changes: 2 additions & 1 deletion src/transport/list/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE 1)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)

add_library(tulips_transport_list SHARED ${SOURCES})
target_link_libraries(tulips_transport_list PUBLIC tulips_stack)
target_link_libraries(tulips_transport_list PRIVATE tulips_stack)

add_library(tulips_transport_list_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_list_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_transport_list
Expand Down
3 changes: 2 additions & 1 deletion src/transport/npipe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE 1)
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)

add_library(tulips_transport_npipe SHARED ${SOURCES})
target_link_libraries(tulips_transport_npipe PUBLIC tulips_stack)
target_link_libraries(tulips_transport_npipe PRIVATE tulips_stack)

add_library(tulips_transport_npipe_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_npipe_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_transport_npipe
Expand Down
10 changes: 10 additions & 0 deletions src/transport/ofed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
add_library(tulips_transport_ofed SHARED ${SOURCES} Utils.cpp Utils.h)
target_link_libraries(tulips_transport_ofed
PRIVATE
tulips_api
tulips_stack
tulips_transport_stubs
tulips_system
PUBLIC
${LibIBVerbs_LINK_LIBRARIES})

add_library(tulips_transport_ofed_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_ofed_static
PRIVATE
tulips_api_static
tulips_stack_static
tulips_transport_stubs_static
tulips_system_static
PUBLIC
${LibIBVerbs_LINK_LIBRARIES})

install(TARGETS
tulips_transport_ofed
Expand Down
10 changes: 9 additions & 1 deletion src/transport/ofed/Device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Utils.h"
#include <tulips/api/Status.h>
#include <tulips/stack/Ethernet.h>
#include <tulips/stack/IPv4.h>
#include <tulips/stack/Utils.h>
Expand Down Expand Up @@ -545,7 +546,14 @@ Device::poll(Processor& proc)
/*
* Process the packet.
*/
proc.process(len, addr, system::Clock::read());
auto res = proc.process(len, addr, system::Clock::read());
/*
* Check the processor's status.
*/
if (res != Status::Ok && res != Status::UnsupportedProtocol) {
m_log.error("OFED", "error processing buffer: ", toString(res));
return res;
}
/*
* Re-post the buffers every 10 WCs.
*/
Expand Down
9 changes: 8 additions & 1 deletion src/transport/pcap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ include_directories(${LibPCAP_INCLUDE_DIRS})
file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)

add_library(tulips_transport_pcap SHARED ${SOURCES})
target_link_libraries(tulips_transport_pcap PUBLIC tulips_stack ${LibPCAP_LINK_LIBRARIES})
target_link_libraries(tulips_transport_pcap
PRIVATE
tulips_stack
PUBLIC ${LibPCAP_LINK_LIBRARIES})

add_library(tulips_transport_pcap_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_pcap_static
PRIVATE
tulips_stack_static
PUBLIC ${LibPCAP_LINK_LIBRARIES})

install(TARGETS
tulips_transport_pcap
Expand Down
1 change: 1 addition & 0 deletions src/transport/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ add_library(tulips_transport_stubs SHARED ${SOURCES})
target_link_libraries(tulips_transport_stubs PRIVATE tulips_stack)

add_library(tulips_transport_stubs_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_stubs_static PRIVATE tulips_stack_static)

install(TARGETS
tulips_transport_stubs
Expand Down
4 changes: 4 additions & 0 deletions src/transport/tap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ target_link_libraries(tulips_transport_tap
tulips_transport_stubs)

add_library(tulips_transport_tap_static STATIC ${SOURCES})
target_link_libraries(tulips_transport_tap_static
PRIVATE
tulips_stack_static
tulips_transport_stubs_static)

install(TARGETS
tulips_transport_tap
Expand Down
7 changes: 4 additions & 3 deletions tools/uspace/ena/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ add_executable(ena-uspace ${SOURCES}

target_link_libraries(ena-uspace
PRIVATE
tulips_transport_ena
tulips_transport_pcap
tulips_api
tulips_ssl)
tulips_ssl
tulips_stack
tulips_transport_ena
tulips_transport_pcap)
5 changes: 3 additions & 2 deletions tools/uspace/ofed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ add_executable(ofed-uspace ${SOURCES}

target_link_libraries(ofed-uspace
PUBLIC
tulips_api
tulips_stack
tulips_transport_ofed
tulips_transport_pcap
tulips_api)
tulips_transport_pcap)

0 comments on commit f461b12

Please sign in to comment.