Skip to content
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

[dpapp] Initial dpapp implementation being a vpp plugin #609

Merged
merged 11 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/dash-bmv2-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,24 @@ jobs:
run: make docker-bmv2-bldr
- name: Generate SAI API
run: DOCKER_FLAGS=$docker_fg_flags make sai
- name: Pull/Build docker dpapp image
run: make docker-dash-dpapp
- name: Build bmv2 dpapp
run: DOCKER_FLAGS=$docker_fg_flags make dpapp
- name: Check if SAI spec is updated
run: DOCKER_FLAGS=$docker_fg_flags make check-sai-spec
- name: Build libsai c++ tests
run: DOCKER_FLAGS=$docker_fg_flags make test
- name: Prepare network
run: DOCKER_FLAGS=$docker_fg_flags make network
run: DOCKER_FLAGS=$docker_fg_flags make network HAVE_DPAPP=y
- name: Run P4 software switch (bmv2) with P4Runtime
run: DOCKER_FLAGS=$docker_bg_flags make run-switch
run: DOCKER_FLAGS=$docker_bg_flags make run-switch HAVE_DPAPP=y
- name: Force bmv2 to load forwarding pipeline config via dummy libsai call
run: DOCKER_FLAGS=$docker_fg_flags make init-switch
- name: Test SAI library over P4RT to switch
run: DOCKER_FLAGS=$docker_fg_flags make run-libsai-test
- name: Run dpapp
run: DOCKER_FLAGS=$docker_bg_flags make run-dpapp HAVE_DPAPP=y
- name: Generate saithrift-server
run: DOCKER_FLAGS=$docker_fg_flags make saithrift-server
- name: Generate saithrift-client local docker
Expand Down
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ sai
saic
SAIC
saichallenger
saidashdpapp
saigen
sairedis
SAIRPC
Expand Down
11 changes: 11 additions & 0 deletions dash-pipeline/dpapp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.5)
r12f marked this conversation as resolved.
Show resolved Hide resolved

project(dash-plugin)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I /SAI/SAI/inc -I /SAI/SAI/experimental")

find_package(VPP)

add_subdirectory(dash)
24 changes: 24 additions & 0 deletions dash-pipeline/dpapp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SHELL=/bin/bash
BUILD_DIR=build
CMAKE_ARGS=

ifeq ($(V),1)
CMAKE_ARGS += --verbose
endif

all: dpapp

.PHONY:configure install clean

configure:
@cmake $(CMAKE_ARGS) -G Ninja -S . -B $(BUILD_DIR)

dpapp: configure
@cmake --build $(BUILD_DIR) $(CMAKE_ARGS)

clean:
@cmake --build $(BUILD_DIR) $(CMAKE_ARGS) -- clean

install:
@sudo cmake --build $(BUILD_DIR) $(CMAKE_ARGS) -- install

84 changes: 84 additions & 0 deletions dash-pipeline/dpapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# DPAPP - Data Plane Application
## Overview
DPAPP fulfills [VPP](https://fd.io/) plugin mechanism to implement the slow (exception) path of
packet processing. It works with [DASH pipeline BMv2](https://github.com/sonic-net/DASH/tree/main/dash-pipeline/bmv2),
serving fast path, to consist of a complete DASH data plane. Refer to the doc
[bmv2 data plane app](https://github.com/sonic-net/DASH/blob/main/documentation/dataplane/dash-bmv2-data-plane-app.md)
for design details.

## Usage
1. build dpapp
```
DASH/dash-pipeline$ make dpapp
```
2. Run dpapp
```
DASH/dash-pipeline$ make run-dpapp
```

## Debug
VPP CLI `vppctl` provides lots of commands for debugging. Use the command `docker exec -it dash-dpapp-${USER} vppctl`
to launch it.

- Check dpapp interfaces and the counters
```
vpp# show interface
Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count
host-veth5 1 up 9000/0/0/0 rx packets 39
rx bytes 10764
tx packets 39
tx bytes 7628
local0 0 down 0/0/0/0

vpp# show hardware-interfaces
Name Idx Link Hardware
host-veth5 1 up host-veth5
Link speed: unknown
RX Queues:
queue thread mode
0 vpp_wk_0 (1) interrupt
TX Queues:
TX Hash: [name: hash-eth-l34 priority: 50 description: Hash ethernet L34 headers]
queue shared thread(s)
0 yes 0-1
Ethernet address 02:fe:23:f0:88:99
Linux PACKET socket interface v3
FEATURES:
qdisc-bpass-enabled
cksum-gso-enabled
RX Queue 0:
block size:65536 nr:160 frame size:2048 nr:5120 next block:39
TX Queue 0:
block size:69206016 nr:1 frame size:67584 nr:1024 next frame:39
available:1024 request:0 sending:0 wrong:0 total:1024
local0 0 down local0
Link speed: unknown
local

```

- Check flow table in dpapp
```
vpp# show dash flow
1: eni 00:cc:cc:cc:cc:cc, vnet_id 343, proto 17, 10.1.1.10 1234 -> 10.1.2.50 80
common data - version 0, direction 1, actions 0x9, timeout 28

vpp# clear dash flow 1
```

- Check packet processing trace in dpapp
```
vpp# trace add af-packet-input 100
vpp# show trace
```

On behalf of BMv2 switch, script `tools/send_p2a_pkt.py` can send packet with dash header to verify basic flow
functionality of dpapp.

## Test
By default, flow lookup is not enabled in DASH pipeline. The decorator `@use_flow` will enable it and then involve dpapp
for slow path. If test cases are verified to support flow, aka stateful packet processing, use the decorator to mark
the test class.

PTF test script [saidashdpapp_sanity.py](https://github.com/sonic-net/DASH/blob/main/test/test-cases/functional/ptf/saidashdpapp_sanity.py)
provides sanity check for dpapp. Refer to it as a sample for new flow tests.
36 changes: 36 additions & 0 deletions dash-pipeline/dpapp/dash/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2018 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.

include_directories(${CMAKE_SOURCE_DIR})

# for generated API headers:
include_directories(${CMAKE_BINARY_DIR})

add_vpp_plugin(dash
SOURCES
dash.c
dash_node.c
flow.c
saiapi.c

MULTIARCH_SOURCES
dash_node.c

API_FILES
dash.api

API_TEST_SOURCES
dash_test.c

COMPONENT vpp-plugin-dash
)
18 changes: 18 additions & 0 deletions dash-pipeline/dpapp/dash/dash.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Define a simple binary API to control the feature */

option version = "0.1.0";
import "vnet/interface_types.api";

autoreply define dash_enable_disable {
/* Client identifier, set from api_main.my_client_index */
u32 client_index;

/* Arbitrary context, so client can match reply to request */
u32 context;

/* Enable / disable the feature */
bool enable_disable;

/* Interface handle */
vl_api_interface_index_t sw_if_index;
};
Loading