
Type: test This application creates two memif interfaces which connect to an external application i.e. VPP. Usage: 1) Start VPP with following config. create interface memif id 0 master create interface memif id 1 master set int state memif0/0 up set int state memif0/1 up create packet-generator interface pg0 set int state pg0 up create packet-generator interface pg1 set int state pg1 up set int l2 xconn pg0 memif0/0 set int l2 xconn memif0/0 pg0 set int l2 xconn pg1 memif0/1 set int l2 xconn memif0/1 pg1 packet-generator new { \ name memif \ limit -1 \ node ethernet-input \ size 64-64 \ interface pg0 \ worker 0 \ data { \ IP4: 42:01:0a:00:00:0a -> 02:fe:4b:6e:4d:c1 \ UDP: 172.16.2.2 -> 172.16.0.2 \ UDP: 1234 -> 1234 \ length 30 checksum 0 incrementing 1 \ } \ } 2) Compile and Run the test_app in another terminal. mkdir -p extras/libmemif/build cd extras/libmemif/build cmake .. make sudo ./examples/test_app 3) Run in VPP cli vpp# packet enable 4) Run monitor to see the throughput and pps vpp# monitor interface memif0/0 Or vpp# monitor interface memif0/1 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I4b9062fca8ad3020225adb7b1b09e5d66b1a7d48
39 lines
1.3 KiB
CMake
39 lines
1.3 KiB
CMake
# Copyright (c) 2017 Cisco and/or its affiliates.
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at:
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
|
|
|
set(COMMON_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
|
|
|
set(COMMON_SOURCE_FILES
|
|
common/common.c
|
|
common/sender.c
|
|
common/responder.c
|
|
common/packet_handler.c
|
|
common/icmp_proto.c
|
|
)
|
|
|
|
list(APPEND EXAMPLES_LIST
|
|
loopback/main.c
|
|
icmp_responder/main.c
|
|
test_app/main.c
|
|
)
|
|
|
|
foreach (EXAMPLE_SRC ${EXAMPLES_LIST})
|
|
string(FIND ${EXAMPLE_SRC} "/" INDEX)
|
|
string(SUBSTRING ${EXAMPLE_SRC} 0 ${INDEX} EXECUTABLE)
|
|
add_executable(${EXECUTABLE} ${COMMON_SOURCE_FILES} ${EXAMPLE_SRC} )
|
|
target_include_directories(${EXECUTABLE} PRIVATE $<BUILD_INTERFACE:${COMMON_HEADERS}>)
|
|
target_link_libraries(${EXECUTABLE} memif ${CMAKE_THREAD_LIBS_INIT})
|
|
endforeach()
|