From 807d16a7c25433309a293171222fd8105840f8cc Mon Sep 17 00:00:00 2001 From: Maryam Tahhan Date: Thu, 20 Jun 2024 08:47:29 -0400 Subject: [PATCH] pre-commit: integrate with cndp Install pre-commit for CNDP + its configuration. Remove old githook. Signed-off-by: Maryam Tahhan --- .cndpstyle.rb | 17 ++ .githooks/pre-commit | 19 -- .github/workflows/cache-build.yml | 10 +- .github/workflows/clang-format.yml | 18 +- .github/workflows/docker.yml | 12 +- .github/workflows/rust-build.yml | 38 ++- .github/workflows/smoke.yml | 62 ++--- .github/workflows/super-linter.yml | 6 +- .mdlrc | 2 + .pre-commit-config.yaml | 40 +++ .yamllint.yaml | 10 + CONTRIBUTING.md | 75 +++--- INSTALL.md | 100 ++++---- Makefile | 10 +- README.md | 151 ++++++----- ansible/README.md | 104 ++++---- .../cndp-ansible/localhost-kernel-install.yml | 1 - .../localhost-post-kernel-install.yml | 1 - .../roles/check_hugepages/tasks/main.yml | 6 +- .../roles/check_os/tasks/main.yml | 5 +- .../roles/check_updated_kernel/tasks/main.yml | 18 +- .../cndp-ansible/roles/common/tasks/main.yml | 9 +- .../roles/install_kernel/tasks/main.yml | 6 +- .../roles/install_libbpf/tasks/main.yml | 3 +- .../roles/install_libxdp/tasks/main.yml | 42 ++-- .../roles/setup_hugepages/tasks/main.yml | 8 +- ansible/cndp-config/README.md | 17 +- .../roles/gen_config/tasks/main.yml | 2 +- cndp-codespell.precommit-toml | 3 + containerization/docker/README.md | 43 ++-- containerization/k8s/README.md | 235 +++++++++--------- containerization/k8s/cndp-pods/cndp-0-0.yaml | 13 +- containerization/k8s/crio-README.md | 49 ++-- containerization/k8s/logging-README.md | 72 +++--- .../k8s/networks/map-pinning-nad.yaml | 2 +- containerization/k8s/networks/uds-nad.yaml | 5 +- doc/guides/pmds/memif.rst | 1 - doc/guides/prog_guide/cnet.rst | 2 +- doc/guides/prog_guide/img/cnet_overview.svg | 2 +- doc/guides/prog_guide/img/cnet_stack_view.svg | 2 +- doc/guides/prog_guide/pktmbuf_lib.rst | 2 +- doc/guides/prog_guide/ring_lib.rst | 2 +- doc/guides/prog_guide/xskdev_buffer_mgmt.rst | 2 - .../sample_app_ug/k8s_dp_integration.rst | 5 +- examples/cndp-frr/README.md | 24 +- .../docker/frr-cfgs/90-routing-sysctl.conf | 1 - examples/cndpfwd/l3-fwd.c | 2 +- examples/cndpfwd/main.h | 4 +- examples/cnet-graph/cnet-graph.c | 2 +- examples/cnet-quic/README.md | 65 ++--- examples/cnet-quic/cnet-quic.c | 2 +- examples/dlb_test/README.md | 23 +- examples/dlb_test/meson.build | 1 - examples/ibroker/meson.build | 1 - examples/l3fwd-graph/fwd.c | 2 +- examples/phil/phil.c | 2 +- examples/vpp-plugin/README.md | 66 ++--- examples/vpp-plugin/cndp/setup.txt | 1 - lang/go/bindings/cne/packet.go | 7 +- .../bindings/examples/distributor/README.md | 28 ++- lang/go/bindings/examples/sampling/doc.go | 2 +- lang/go/stats/prometheus/README.md | 15 +- lang/go/tools/pkgs/etimers/etimers.go | 2 +- lang/rs/Cargo.toml | 1 - lang/rs/README.md | 111 ++++++--- lang/rs/apis/cne/README.md | 63 +++-- lang/rs/apis/cne/src/instance.rs | 2 +- lang/rs/bindings/cne-sys/README.md | 44 ++-- lang/rs/examples/echo_server/Cargo.toml | 1 - lang/rs/examples/echo_server/src/main.rs | 2 +- lib/cnet/chnl/chnl_priv.h | 2 +- lib/cnet/chnl/cnet_chnl.c | 2 +- lib/cnet/icmp6/icmp6.h | 10 +- lib/cnet/ipv4/cnet_ipv4.h | 2 +- lib/cnet/sbin/cnet_ifshow.c | 2 +- lib/cnet/tcp/cnet_tcp.c | 2 +- lib/cnet/tcp/tcp_output.c | 2 +- lib/common/uds/meson.build | 1 - lib/core/hash/cne_hash_crc.h | 2 +- lib/core/mempool/mempool.c | 2 +- lib/core/pktmbuf/pktmbuf_offload.h | 2 +- lib/core/pktmbuf/pktmbuf_ptype.h | 4 +- lib/core/pmds/net/tap/pmd_tap.c | 2 +- lib/include/net/cne_ip.h | 7 +- lib/usr/app/cli/cli_cmap.c | 2 +- lib/usr/app/cli/cli_cmds.c | 2 +- lib/usr/app/cli/cli_file.h | 2 +- lib/usr/app/cli/cli_lib.rst | 2 +- lib/usr/app/cli/cli_map.h | 2 +- lib/usr/clib/acl/acl_run_avx512.c | 2 +- lib/usr/clib/acl/acl_run_avx512x16.h | 2 +- lib/usr/clib/acl/cne_acl.h | 2 +- lib/usr/clib/cthread/cthread_api.h | 2 +- lib/usr/clib/cthread/cthread_int.h | 2 +- lib/usr/clib/cthread/cthread_tls.h | 2 +- lib/usr/clib/fib/cne_fib6.h | 4 +- lib/usr/clib/fib/trie_avx512.c | 2 +- lib/usr/clib/hmap/meson.build | 1 - lib/usr/slib/ibroker/meson.build | 1 - meson_options.txt | 1 - test/common/test.h | 5 +- test/fuzz/README.md | 20 +- test/testcne/fib_perf_test.c | 2 +- test/testcne/hash_test.c | 2 +- test/testcne/ring_profile.c | 2 +- tools/cne-build.sh | 4 +- tools/jsonc_gen.sh | 2 +- usrtools/txgen/INSTALL.md | 63 +++-- usrtools/txgen/README.md | 25 +- usrtools/txgen/app/capture.c | 2 +- usrtools/txgen/app/cli-functions.c | 2 +- usrtools/txgen/app/txgen.c | 2 +- usrtools/txgen/docs/source/commands.rst | 4 +- usrtools/xskmap_load_send/README.md | 18 +- 114 files changed, 1074 insertions(+), 858 deletions(-) create mode 100644 .cndpstyle.rb delete mode 100755 .githooks/pre-commit create mode 100644 .mdlrc create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint.yaml create mode 100644 cndp-codespell.precommit-toml diff --git a/.cndpstyle.rb b/.cndpstyle.rb new file mode 100644 index 00000000..628053e9 --- /dev/null +++ b/.cndpstyle.rb @@ -0,0 +1,17 @@ +# Style configuration for CNDP documentation files. +# +# For details on how to configure, see [markdownlint docs][1]. +# +# For explanation of the rules themselves, see [markdownlint's RULES.md][2] +# +# [1]: https://github.com/markdownlint/markdownlint/blob/master/docs/creating_styles.md +# [2]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md + +all +rule "ul-indent", indent: 4 + +rule "ul-style", style: :dash +rule "no-duplicate-header", allow_different_nesting: true +rule "line-length", :line_length => 165 +rule 'MD010', :indent => 3 +# exclude_rule 'MD010' # Hard tabs diff --git a/.githooks/pre-commit b/.githooks/pre-commit deleted file mode 100755 index d8438491..00000000 --- a/.githooks/pre-commit +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/bash - -for filename in $(git diff --cached --name-only | grep '.*\.[c|h]$'); do - if [ -f "$filename" ]; then - clang-format -style=file -i "$filename"; git add "$filename"; - fi -done - -for filename in $(git diff --cached --name-only | grep '.*\.go$'); do - if [ -f "$filename" ]; then - gofmt -s -w "$filename"; git add "$filename"; - fi -done - -for filename in $(git diff --cached --name-only | grep '.*\.jsonc$'); do - if [ -f "$filename" ]; then - ./tools/check_json.py --schema ./tools/cndp.schema "$filename" - fi -done diff --git a/.github/workflows/cache-build.yml b/.github/workflows/cache-build.yml index c15ac037..03b1c640 100644 --- a/.github/workflows/cache-build.yml +++ b/.github/workflows/cache-build.yml @@ -1,11 +1,11 @@ name: Docker Image Build with cache -on: +on: # yamllint disable-line rule:truthy push: branches: - main pull_request: - branches: [ main ] + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -50,9 +50,9 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 - name: Move cache run: | rm -rf /tmp/.buildx-cache && \ diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index ee305495..bb513eee 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -1,18 +1,18 @@ name: clang-format -on: +on: # yamllint disable-line rule:truthy pull_request: - branches: [ main ] + branches: [main] jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: DoozyX/clang-format-lint-action@v0.15 - with: - source: '.' - exclude: './examples/vpp-plugin' - extensions: 'c,h,cc,cpp' - clangFormatVersion: 15.0.2 + - uses: actions/checkout@v2 + - uses: DoozyX/clang-format-lint-action@v0.17 + with: + source: '.' + exclude: 'examples/vpp-plugin' + extensions: 'h,cpp,c,cc' + clangFormatVersion: 17 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 43f1221d..3fc82296 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,8 +1,8 @@ name: Docker Image Build -on: +on: # yamllint disable-line rule:truthy pull_request: - branches: [ main ] + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -13,8 +13,8 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check out repository code - uses: actions/checkout@v4 + - name: Check out repository code + uses: actions/checkout@v4 - - name: Build Docker Image - run: make oci-image + - name: Build Docker Image + run: make oci-image diff --git a/.github/workflows/rust-build.yml b/.github/workflows/rust-build.yml index b6f50bdb..db2e2017 100644 --- a/.github/workflows/rust-build.yml +++ b/.github/workflows/rust-build.yml @@ -1,10 +1,10 @@ name: Rust -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main" ] + branches: [main] pull_request: - branches: [ "main" ] + branches: [main] env: CARGO_TERM_COLOR: always @@ -17,24 +17,22 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check out repository code - uses: actions/checkout@v4 + - name: Check out repository code + uses: actions/checkout@v4 - - name: Install packages - run: | - sudo apt-get update && sudo apt-get install -y\ - build-essential libbsd-dev libelf-dev libjson-c-dev\ - libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\ - pkg-config wget libbpf-dev llvm-dev libclang-dev clang + - name: Install packages + run: | + sudo apt-get update && sudo apt-get install -y\ + build-essential libbsd-dev libelf-dev libjson-c-dev\ + libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\ + pkg-config wget libbpf-dev llvm-dev libclang-dev clang + - name: Build and Install CNDP + run: make; sudo CNE_DEST_DIR=/ make install + - name: update rust + run: rustup update stable - - name: Build and Install CNDP - run: make; sudo CNE_DEST_DIR=/ make install - - - name: update rust - run: rustup update stable - - - name: Build - working-directory: lang/rs - run: CLANG_PATH=/usr/bin/clang-15 cargo build + - name: Build + working-directory: lang/rs + run: CLANG_PATH=/usr/bin/clang-15 cargo build diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index a4c08ef3..d023e623 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -1,8 +1,8 @@ name: Smoke Test -on: +on: # yamllint disable-line rule:truthy pull_request: - branches: [ main ] + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -13,32 +13,32 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check out repository code - uses: actions/checkout@v4 - - - name: Install packages - run: | - sudo apt-get update && sudo apt-get install -y\ - build-essential libbsd-dev libelf-dev libjson-c-dev\ - libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\ - pkg-config wget - - - name: Install libbpf - run: | - wget -q -O - https://github.com/libbpf/libbpf/archive/refs/tags/v0.5.0.tar.gz \ - | tar -xzC "${GITHUB_WORKSPACE}" \ - && sudo make -j -C "${GITHUB_WORKSPACE}"/libbpf-0.5.0/src install \ - && sudo rm -rf "${GITHUB_WORKSPACE}"/libbpf-0.5.0 - - - name: Build - run: make - - - name: Short test - run: meson test -C builddir --suite short - - - name: Upload testlog - uses: actions/upload-artifact@v3 - if: success() || failure() - with: - name: testlog.txt - path: ${{ github.workspace }}/builddir/meson-logs/testlog.txt + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Install packages + run: | + sudo apt-get update && sudo apt-get install -y\ + build-essential libbsd-dev libelf-dev libjson-c-dev\ + libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\ + pkg-config wget + + - name: Install libbpf + run: | + wget -q -O - https://github.com/libbpf/libbpf/archive/refs/tags/v0.5.0.tar.gz \ + | tar -xzC "${GITHUB_WORKSPACE}" \ + && sudo make -j -C "${GITHUB_WORKSPACE}"/libbpf-0.5.0/src install \ + && sudo rm -rf "${GITHUB_WORKSPACE}"/libbpf-0.5.0 + + - name: Build + run: make + + - name: Short test + run: meson test -C builddir --suite short + + - name: Upload testlog + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: testlog.txt + path: ${{ github.workspace }}/builddir/meson-logs/testlog.txt diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 64b37c8c..5c020bda 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -6,11 +6,11 @@ # https://github.com/github/super-linter name: Lint Code Base -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main" ] + branches: [main] pull_request: - branches: [ "main" ] + branches: [main] jobs: run-lint: runs-on: ubuntu-latest diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 00000000..a0cb947d --- /dev/null +++ b/.mdlrc @@ -0,0 +1,2 @@ +style ".cndpstyle.rb" +ignore_front_matter true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..229cc971 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,40 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v17.0.6 + hooks: + - id: clang-format + types_or: [c++, c] + args: [-i, --style=file] + - repo: https://github.com/golangci/golangci-lint + rev: v1.59.1 + hooks: + - id: golangci-lint + - repo: https://github.com/markdownlint/markdownlint.git + rev: v0.13.0 + hooks: + - id: markdownlint_docker + name: Markdownlint Docker + description: Run markdown lint on your Markdown files using the project docker image + language: docker_image + files: \.(md|mdown|markdown)$ + entry: markdownlint/markdownlint -c .mdlrc + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: [--toml, cndp-codespell.precommit-toml] + additional_dependencies: + - tomli +exclude: doc/api/doxy-api-index.md|lang/rs/wireguard/patch/* diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..3b347224 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,10 @@ +--- +extends: default +rules: + line-length: disable + document-start: disable + comments: + min-spaces-from-content: 1 +ignore: + - builddir/* + - .clang-format diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4385f4df..f02edb88 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ This document outlines how to contribute code to the CNDP project. The CNDP code can be cloned from the repository on GitHub: -``` bash +```bash git clone https://github.com/CloudNativeDataPlane/cndp.git ``` @@ -20,42 +20,55 @@ C code should follow the CNDP coding standards. A .clang-format file is available in the CNDP repo and can be run with ninja: -``` bash +```bash ninja -C builddir clang-format ``` Or with git-clang-format if it is installed: -``` bash +```bash git clang-format --diff ``` -Or a pre-commit hook is available and can be used to apply the clang format to -modified files in a commit by doing the following before committing changes: +Or a [Pre-commit](https://pre-commit.com/#install) hook is available and can be used +to apply the linters to modified files in a commit. You can install pre-commit +by running the following command: -``` bash -cp .githooks/pre-commit .git/hooks/ -chmod +x .git/hooks/pre-commit +```bash +pip install pre-commit +``` + +After installing pre-commit, you need to install the pre-commit hooks by +running the following command: + +```bash +pre-commit install +``` + +To run pre-commit manually + +```bash +pre-commit run --all-files ``` Guidelines for public or private APIs is to hide as much of the internal API from the developer. Which means we need to label function prototypes as public using the CNDP_API macro. The macro is defined as -``` c +```c #define CNDP_API __attribute__((visibility("default"))) ``` And used in this way: -``` c +```c CNDP_API int cne_init(); ``` -We also use function versioning macros to allow for build time function -linking using the following APIs: +We also use function versioning macros to allow for build time function linking +using the following APIs: -``` c +```c #ifdef CNE_BUILD_SHARED_LIBS #define FUNCTION_VERSION(internal, api, ver) __asm__(".symver " #internal ", " #api "@" #ver) #define DEFAULT_VERSION(internal, api, ver) __asm__(".symver " #internal ", " #api "@@" #ver) @@ -65,18 +78,18 @@ linking using the following APIs: #endif ``` -To hide internal APIs we have public and private headers. The public headers are installed -in the system, but the private headers are not. The public headers should use typedefs -to hide the internal structures by: +To hide internal APIs we have public and private headers. The public headers are +installed in the system, but the private headers are not. The public headers +should use typedefs to hide the internal structures by: -``` c +```c typedef void foo_t; foo_t *foo; ``` where the structure may be -``` c +```c struct foo { int bar; }; @@ -84,10 +97,11 @@ struct foo { Do not hide the '\*' type inside the typedef. -This requires the public APIs to only return void pointers and the public functions are passed -these void types and must cast the void pointer into the private structure pointer i.e. +This requires the public APIs to only return void pointers and the public +functions are passed these void types and must cast the void pointer into the +private structure pointer i.e. -``` c +```c int foobar(foo_t *foo) { struct foo *f = foo; // Cast of foo is not required as *foo is a void * @@ -95,13 +109,14 @@ int foobar(foo_t *foo) { } ``` -Naming header files as xyz\_private.h and cne\_xyz.h is preferred. The .c files should be named -xyz.c or cne\_xyz.c. +Naming header files as xyz_private.h and cne_xyz.h is preferred. The .c files +should be named xyz.c or cne_xyz.c. ### Braces for single line statements + Do not use braces where a single statement (if, while, for, ...) will do: -``` c +```c if (foo) do_this(); else @@ -109,8 +124,11 @@ else ``` ### Error message -Avoid using "Unable to xxxx", use "Failed to xxx" instead for logging failed function calls: -``` c + +Avoid using "Unable to xxxx", use "Failed to xxx" instead for logging failed +function calls: + +```c CNE_ERR_GOTO(out, "Unable to init CNE\n"); // Do NOT use 'unable to' phase here CNE_ERR_GOTO(out, "Failed to init CNE\n"); // Use 'failed to' instead. @@ -119,5 +137,6 @@ CNE_ERR_GOTO(out, "Failed to init CNE\n"); // Use 'failed to' instead. ## Maintainers The CNDP maintainers are as follows: -* Jeff Shaw -* Keith Wiles + +- Jeff Shaw +- Keith Wiles diff --git a/INSTALL.md b/INSTALL.md index ab7a6aa6..09029183 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,14 +2,16 @@ ## Ubuntu Installation Instructions -This section assumes you are building on an Ubuntu 21.04 host. It provides minimal -instructions to run CNDP applications. For more information, refer to the CNDP documentation. +This section assumes you are building on an Ubuntu 21.04 host. It provides +minimal instructions to run CNDP applications. For more information, refer to +the CNDP documentation. ### Ubuntu Prerequisites -If behind a proxy server you may need to setup a number of configurations to allow access via the server. -Some commands i.e. apt-get, git, ssh, curl, wget and others will need configuration to work correctly. -Please refer to apt-get, git and other documentations to enable access through a proxy server. +If behind a proxy server you may need to setup a number of configurations to +allow access via the server. Some commands i.e. apt-get, git, ssh, curl, wget +and others will need configuration to work correctly. Please refer to apt-get, +git and other documentations to enable access through a proxy server. ### Ubuntu Dependencies @@ -23,11 +25,12 @@ sudo apt-get update && sudo apt-get install -y \ ### Hyperscan support -The cndpfwd example application supports a simple hyperscan forwarding type mode. The Hyperscan -forwarding mode uses expressions in Hyperscan style in the jsonc file in options.hs_patterns array. -The example can be expanded to be a DDOS or DPI or a load balancer using Hyperscan. If wanting to -try Hyperscan you must install Hyperscan. Ubuntu has a package which can be installed to enable the -build process to detect and use Hyperscan. +The cndpfwd example application supports a simple hyperscan forwarding type +mode. The Hyperscan forwarding mode uses expressions in Hyperscan style in the +jsonc file in options.hs_patterns array. The example can be expanded to be a +DDOS or DPI or a load balancer using Hyperscan. If wanting to try Hyperscan you +must install Hyperscan. Ubuntu has a package which can be installed to enable +the build process to detect and use Hyperscan. ```bash sudo apt-get install -y libhyperscan-dev # In Ubuntu 22.10 the Hyperscan version is 5.4.0 @@ -41,18 +44,19 @@ sudo apt-get install -y doxygen python3-sphinx ### libbpf -The [libbpf](https://github.com/libbpf/libbpf) is a dependency of CNDP. Starting with Ubuntu 20.10 -it can be installed using apt. For earlier Ubuntu versions, or for users who want the latest code, -it can be installed from source. +The [libbpf](https://github.com/libbpf/libbpf) is a dependency of CNDP. Starting +with Ubuntu 20.10 it can be installed using apt. For earlier Ubuntu versions, or +for users who want the latest code, it can be installed from source. -> **_NOTE:_** -Newer versions of libbpf greater than or equal to v0.7.0 require _libxdp_ to be installed. For now we -can checkout a previous version v0.5.0 or v0.6.1 instead of installing _libxdp_. +> **_NOTE:_** Newer versions of libbpf greater than or equal to v0.7.0 require +> _libxdp_ to be installed. For now we can checkout a previous version v0.5.0 or +> v0.6.1 instead of installing _libxdp_. ### Install libbpf-dev from package manager -Use the following command on Ubuntu 20.10 and later to install the headers and libraries to build -and run CNDP applications. If using an earlier Ubuntu version, you need to build libbpf from source. +Use the following command on Ubuntu 20.10 and later to install the headers and +libraries to build and run CNDP applications. If using an earlier Ubuntu +version, you need to build libbpf from source. ```bash sudo apt-get install -y libbpf-dev @@ -63,12 +67,13 @@ sudo apt-get install -y libbpf-dev ```bash git clone https://github.com/libbpf/libbpf.git cd libbpf -git checkout v0.5.0 # or v0.6.1 if needing a newer version +git checkout v0.5.0 # or v0.6.1 if needing a newer version make -C src && sudo make -C src install ``` -The library and pkgconfig file is installed to /usr/lib64, which is not where the loader or -pkg-config looks. Fix this by editing the ldconfig file as suggested below. +The library and pkgconfig file is installed to /usr/lib64, which is not where +the loader or pkg-config looks. Fix this by editing the ldconfig file as +suggested below. ```bash sudo vim /etc/ld.so.conf.d/x86_64-linux-gnu.conf @@ -76,7 +81,8 @@ sudo vim /etc/ld.so.conf.d/x86_64-linux-gnu.conf sudo ldconfig ``` -The following statement may be necessary if libbpf is installed from source instead of the package manager. +The following statement may be necessary if libbpf is installed from source +instead of the package manager. ```cmd export PKG_CONFIG_PATH=/usr/lib64/pkgconfig @@ -154,8 +160,9 @@ export PKG_CONFIG_PATH=/usr/lib/pkgconfig ## Fedora Installation Instructions -This section assumes you are building on a Fedora 35 host with a 5.17.5 Kernel version. It provides -minimal instructions to run CNDP applications. For more information, refer to the CNDP documentation. +This section assumes you are building on a Fedora 35 host with a 5.17.5 Kernel +version. It provides minimal instructions to run CNDP applications. For more +information, refer to the CNDP documentation. ### Fedora dependencies @@ -170,7 +177,9 @@ sudo dnf update && sudo dnf -y install \ ## Hugepage Configuration -Hugepage support is optional, but preferred as it provides a performance boost. Details of Hugepage Configuration can be found [here](https://github.com/CloudNativeDataPlane/cndp/blob/9fa83c17c75930eee2355476e23cf786a533756c/doc/guides/linux_gsg/linux_gsg.rst) +Hugepage support is optional, but preferred as it provides a performance boost. +Details of Hugepage Configuration can be found +[here](https://github.com/CloudNativeDataPlane/cndp/blob/9fa83c17c75930eee2355476e23cf786a533756c/doc/guides/linux_gsg/linux_gsg.rst) ## Build CNDP @@ -210,12 +219,12 @@ Ctrl-C to exit ### cndpfwd -An example that uses networking is `cndpfwd`. It requires the underlying network interface -uses, e.g. AF_XDP sockets. Make sure the kernel on which you intend to run the application -supports AF_XDP sockets, i.e. CONFIG_XDP_SOCKETS=y. +An example that uses networking is `cndpfwd`. It requires the underlying network +interface uses, e.g. AF_XDP sockets. Make sure the kernel on which you intend to +run the application supports AF_XDP sockets, i.e. CONFIG_XDP_SOCKETS=y. ```bash -grep XDP_SOCKETS= /boot/config-`uname -r` +grep XDP_SOCKETS= /boot/config-$(uname -r) ``` Configure an ethtool filter to steer packets to a specific queue. @@ -225,11 +234,12 @@ sudo ethtool -N flow-type udp4 dst-port action sudo ip link set dev up ``` -Instruct `cndpfwd` to receive, count, and drop all packets on the previously configured -queue. To configure `cndpfwd`, edit the examples/cndpfwd/fwd.jsonc configuration file. Make -sure the "lports" section has the same netdev name and queue id for which the ethtool filter -is configured. Make sure the "threads" section has the correct "lports" configured. Then -launch the application, specifying the updated configuration file. +Instruct `cndpfwd` to receive, count, and drop all packets on the previously +configured queue. To configure `cndpfwd`, edit the examples/cndpfwd/fwd.jsonc +configuration file. Make sure the "lports" section has the same netdev name and +queue id for which the ethtool filter is configured. Make sure the "threads" +section has the correct "lports" configured. Then launch the application, +specifying the updated configuration file. ```bash sudo ./builddir/examples/cndpfwd/cndpfwd -c examples/cndpfwd/fwd.jsonc drop @@ -237,10 +247,12 @@ sudo ./builddir/examples/cndpfwd/cndpfwd -c examples/cndpfwd/fwd.jsonc drop ### XDP Packet Capture -Packets processed at the XDP hook can't be captured using tcpdump. Instead, -it's recommended to use [xdpdump](https://github.com/xdp-project/xdp-tools/tree/master/xdp-dump). +Packets processed at the XDP hook can't be captured using tcpdump. Instead, it's +recommended to use +[xdpdump](https://github.com/xdp-project/xdp-tools/tree/master/xdp-dump). -The following example shows how to redirect a capture file from xdpdump to tcpdump for real-time packet decoding: +The following example shows how to redirect a capture file from xdpdump to +tcpdump for real-time packet decoding: ```bash xdpdump -i eno1 -w - | tcpdump -r - -n @@ -255,7 +267,8 @@ Silent packet drops for AF_XDP can be debugged using: #### bpftrace -The following `bpftrace` command can be used to capture and count all XDP tracepoints: +The following `bpftrace` command can be used to capture and count all XDP +tracepoints: ```bash sudo bpftrace -e 'tracepoint:xdp:* { @cnt[probe] = count(); }' @@ -267,18 +280,19 @@ Attaching 12 probes... @cnt[tracepoint:xdp:xdp_exception]: 19605 @cnt[tracepoint:xdp:xdp_devmap_xmit]: 1393604 @cnt[tracepoint:xdp:xdp_redirect]: 22292200 - ``` -> **_NOTE:_** The various xdp tracepoints can be found in [xdp.h](https://github.com/torvalds/linux/blob/master/include/trace/events/xdp.h) in the kernel source tree. +> **_NOTE:_** The various xdp tracepoints can be found in +> [xdp.h](https://github.com/torvalds/linux/blob/master/include/trace/events/xdp.h) +> in the kernel source tree. -The following `bpftrace` command can be used to extract the ERRNO being returned as part of the err parameter: +The following `bpftrace` command can be used to extract the ERRNO being returned +as part of the err parameter: ```bash sudo bpftrace -e \ -'tracepoint:xdp:xdp_redirect*_err {@redir_errno[-args->err] = count();} + 'tracepoint:xdp:xdp_redirect*_err {@redir_errno[-args->err] = count();} tracepoint:xdp:xdp_devmap_xmit {@devmap_errno[-args->err] = count();}' - ``` #### perf record diff --git a/Makefile b/Makefile index 400eeffd..e318f623 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,7 @@ ifeq ($(OCI-Builder), docker) else ifeq ($(OCI-Builder), buildah) @echo "buildah selected" else - @echo "UNKOWN OCI IMAGE builder $(OCI-Builder)" + @echo "UNKNOWN OCI IMAGE builder $(OCI-Builder)" exit 1 endif ${OCI-Builder} build -t cndp --build-arg http_proxy=${http_proxy} \ @@ -117,7 +117,7 @@ ifeq ($(OCI-Builder), docker) else ifeq ($(OCI-Builder), buildah) @echo "buildah selected" else - @echo "UNKOWN OCI IMAGE builder $(OCI-Builder)" + @echo "UNKNOWN OCI IMAGE builder $(OCI-Builder)" exit 1 endif $(OCI-Builder) build -t cndp-fedora --build-arg http_proxy=${http_proxy} \ @@ -129,7 +129,7 @@ ifeq ($(OCI-Builder), docker) else ifeq ($(OCI-Builder), buildah) @echo "buildah selected" else - @echo "UNKOWN OCI IMAGE builder $(OCI-Builder)" + @echo "UNKNOWN OCI IMAGE builder $(OCI-Builder)" exit 1 endif $(OCI-Builder) build -t cndp-frr --build-arg http_proxy=${http_proxy} \ @@ -147,7 +147,7 @@ ifeq ($(ContainerEngine), docker) else ifeq ($(ContainerEngine), podman) @echo "podman selected" else - @echo "UNKOWN Container Engine $(ContainerEngine)" + @echo "UNKNOWN Container Engine $(ContainerEngine)" exit 1 endif $(ContainerEngine) run --privileged --network=host -it cndp bash @@ -158,7 +158,7 @@ ifeq ($(ContainerEngine), docker) else ifeq ($(ContainerEngine), podman) @echo "podman selected" else - @echo "UNKOWN Container Engine $(ContainerEngine)" + @echo "UNKNOWN Container Engine $(ContainerEngine)" exit 1 endif $(ContainerEngine) run --privileged --network=host -it cndp-fedora bash diff --git a/README.md b/README.md index 0485a9cc..299f0c00 100644 --- a/README.md +++ b/README.md @@ -2,62 +2,97 @@ ## Overview -Cloud Native Data Plane (CNDP) is a collection of userspace libraries for accelerating packet -processing for cloud applications. It aims to provide better performance than that of standard -network socket interfaces by taking advantage of platform technologies such as Intel(R) AVX-512, -Intel(R) DSA, CLDEMOTE, etc. The I/O layer is primarily built on AF_XDP, an interface that -delivers packets straight to userspace, bypassing the kernel networking stack. CNDP provides ways -to expose metrics and telemetry with examples to deploy network services on Kubernetes. +Cloud Native Data Plane (CNDP) is a collection of userspace libraries for +accelerating packet processing for cloud applications. It aims to provide better +performance than that of standard network socket interfaces by taking advantage +of platform technologies such as Intel(R) AVX-512, Intel(R) DSA, CLDEMOTE, etc. +The I/O layer is primarily built on AF_XDP, an interface that delivers packets +straight to userspace, bypassing the kernel networking stack. CNDP provides ways +to expose metrics and telemetry with examples to deploy network services on +Kubernetes. ## CNDP Consumers -* **Cloud Network Function (CNF) and Cloud Application developers**: Those who create applications - based on CNDP. CNDP hides the low-level I/O, allowing the developer to focus on their - application. +- **Cloud Network Function (CNF) and Cloud Application developers**: Those who + create applications based on CNDP. CNDP hides the low-level I/O, allowing the + developer to focus on their application. -* **CNF and Cloud Application consumers**: Those who consume the applications developed by the CNF - developer. CNDP showcases deployment models for their applications using Kubernetes. +- **CNF and Cloud Application consumers**: Those who consume the applications + developed by the CNF developer. CNDP showcases deployment models for their + applications using Kubernetes. ## CNDP Characteristics CNDP follows a set of principles: -* **Functionality**: Provide a framework for cloud native developers that offers full control of - their application. +- **Functionality**: Provide a framework for cloud native developers that offers + full control of their application. -* **Usability**: Simplify cloud native application development to enable the developer to create - applications by providing APIs that abstract the complexities of the underlying system while - still taking advantage of acceleration features when available. +- **Usability**: Simplify cloud native application development to enable the + developer to create applications by providing APIs that abstract the + complexities of the underlying system while still taking advantage of + acceleration features when available. -* **Interoperability**: The CNDP framework is built primarily on top of AF_XDP. Other interfaces, - such as memif, are also supported, however building on AF_XDP ensures it is possible to move - an application across environments wherever AF_XDP is supported. +- **Interoperability**: The CNDP framework is built primarily on top of AF_XDP. + Other interfaces, such as memif, are also supported, however building on + AF_XDP ensures it is possible to move an application across environments + wherever AF_XDP is supported. -* **Portability/stability**: CNDP provides ABI stability and a common API to access network - interfaces. +- **Portability/stability**: CNDP provides ABI stability and a common API to + access network interfaces. -* **Performance**: Take advantage of platform technologies to accelerate packet processing or - fall-back to software when acceleration is unavailable. +- **Performance**: Take advantage of platform technologies to accelerate packet + processing or fall-back to software when acceleration is unavailable. -* **Observability**: Provide observability into the performance and operation of the application. +- **Observability**: Provide observability into the performance and operation of + the application. -* **Security**: Security for deployment in a cloud environment is critical. +- **Security**: Security for deployment in a cloud environment is critical. ## CNDP background -CNDP was created to enable cloud native developers to use AF_XDP and other interfaces in a simple -way while providing better performance as compared to standard Linux networking interfaces. +CNDP was created to enable cloud native developers to use AF_XDP and other +interfaces in a simple way while providing better performance as compared to +standard Linux networking interfaces. -CNDP does not replace DPDK (Data Plane Development Kit), which provides the highest performance for -packet processing. DPDK implements user space drivers, bypassing the kernel drivers. This approach -of rewriting drivers is one reason DPDK achieves the highest performance for packet processing. DPDK -also implements a framework to initialize and setup platform resources i.e. scanning PCI bus for -devices, allocating memory via hugepages, setting up Primary/Secondary process support, etc. +CNDP does not replace DPDK (Data Plane Development Kit), which provides the +highest performance for packet processing. DPDK implements user space drivers, +bypassing the kernel drivers. This approach of rewriting drivers is one reason +DPDK achieves the highest performance for packet processing. DPDK also +implements a framework to initialize and setup platform resources i.e. scanning +PCI bus for devices, allocating memory via hugepages, setting up +Primary/Secondary process support, etc. -In contrast to DPDK, CNDP does not have custom drivers. Instead it expects the kernel drivers to -implement AF_XDP, preferably in zero-copy mode. Since there are no PCIe drivers, there's no PCI bus -scanning, and does not require physically contiguous and pinned memory. This simplifies deployment -for cloud native applications while gaining the performance benefits provided by AF_XDP. +In contrast to DPDK, CNDP does not have custom drivers. Instead it expects the +kernel drivers to implement AF_XDP, preferably in zero-copy mode. Since there +are no PCIe drivers, there's no PCI bus scanning, and does not require +physically contiguous and pinned memory. This simplifies deployment for cloud +native applications while gaining the performance benefits provided by AF_XDP. + +## Development + +In order to make contributions to CNDP, you need to have the following installed: + +- [Pre-commit](https://pre-commit.com/#install) + +You can install pre-commit by running the following command: + +```bash +pip install pre-commit +``` + +After installing pre-commit, you need to install the pre-commit hooks by +running the following command: + +```bash +pre-commit install +``` + +To run pre-commit manually + +```bash +pre-commit run --all-files +``` ## CNDP notable directories @@ -65,26 +100,26 @@ The following shows a subset of the directory structure. ```bash . -├── ansible # Ansible playbook to install in a system(s) -├── containerization # Container configuration and setup scripts for Docker/K8s -├── doc # Documentation APIs, guides, getting started, ... -├── examples # Example applications to understand how to use CNDP features -├── lang # Language bindings and examples -│   ├── go # Go Language bindings to CNDP and tools (WIP) -│   └── rs # Rust Language bindings for CNDP/Wireguard (WIP) -├── lib # Set of libraries for building CNDP applications -│   ├── cnet # Userspace network stack -│   ├── common # Libraries used by core and applications libraries -│   ├── core # Core libraries for CNDP -│   ├── include # Common headers for CNDP and applications -│   └── usr # User set of libraries that are optional for developer -├── test # Unit test framework -│   ├── common # Common test code -│   ├── fuzz # Fuzzing (WIP) -│   └── testcne # Functional unit testing application -├── tools # Tools for building CNDP -│   └── vscode # Configuration files for vscode -└── usrtools # Tools for users -    ├── cnectl # Remote CLI for CNDP applications -    └── txgen # Traffic Generator using AF_XDP and CNDP +├── ansible # Ansible playbook to install in a system(s) +├── containerization # Container configuration and setup scripts for Docker/K8s +├── doc # Documentation APIs, guides, getting started, ... +├── examples # Example applications to understand how to use CNDP features +├── lang # Language bindings and examples +│   ├── go # Go Language bindings to CNDP and tools (WIP) +│   └── rs # Rust Language bindings for CNDP/Wireguard (WIP) +├── lib # Set of libraries for building CNDP applications +│   ├── cnet # Userspace network stack +│   ├── common # Libraries used by core and applications libraries +│   ├── core # Core libraries for CNDP +│   ├── include # Common headers for CNDP and applications +│   └── usr # User set of libraries that are optional for developer +├── test # Unit test framework +│   ├── common # Common test code +│   ├── fuzz # Fuzzing (WIP) +│   └── testcne # Functional unit testing application +├── tools # Tools for building CNDP +│   └── vscode # Configuration files for vscode +└── usrtools # Tools for users +   ├── cnectl # Remote CLI for CNDP applications +   └── txgen # Traffic Generator using AF_XDP and CNDP ``` diff --git a/ansible/README.md b/ansible/README.md index 5b81c90e..0b49c9ad 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -2,11 +2,13 @@ ## Overview -CNDP provides an Ansible playbook to install all CNDP dependencies and setup the CNDP env. +CNDP provides an Ansible playbook to install all CNDP dependencies and setup the +CNDP env. -Though CNDP can run on many distributions and kernels, the preferred environment is for an Ubuntu -20.04 installation. This is chosen as its the most recent LTS version, and the kernel can be -updated from the package manager to one which natively supports many AF_XDP features. +Though CNDP can run on many distributions and kernels, the preferred environment +is for an Ubuntu 20.04 installation. This is chosen as its the most recent LTS +version, and the kernel can be updated from the package manager to one which +natively supports many AF_XDP features. ## Prerequisites @@ -15,7 +17,7 @@ updated from the package manager to one which natively supports many AF_XDP feat If required, create a proxy.conf and configure the apt proxy settings. ```bash -cat << EOF | sudo tee -a /etc/apt/apt.conf.d/proxy.conf +cat < Note: if ansible isn't available in the package tree, it can be installed by -following these -[instructions](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-ubuntu). +> following these +> [instructions](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-ubuntu). ### SSH Key Setup -Ansible uses ssh to load and run it's modules on the target host. As such, it's important to setup a -SSH key and copy it to the target node (note: the target node maybe the localhost). +Ansible uses ssh to load and run it's modules on the target host. As such, it's +important to setup a SSH key and copy it to the target node (note: the target +node maybe the localhost). As root on both nodes run: @@ -52,71 +58,75 @@ As root on both nodes run: ssh-keygen ssh-copy-id ``` -where is an IP address or localhost. +where `target` is an IP address or localhost. Three playbooks are provided: + 1. multi-host.yml: Requires a control node and a managed node. -2. localhost-kernel-install.yml: Installs all the required packages and updates kernel to 5.13 (for ubuntu 20.04) - with XDP enabled (on the localhost). A user is expected to reboot the system after this script - runs. -3. localhost-post-kernel-install.yml: Installs any additional libraries needed for - CNDP after the Kernel is updated and rebooted. +1. localhost-kernel-install.yml: Installs all the required packages and updates + kernel to 5.13 (for ubuntu 20.04) with XDP enabled (on the localhost). A user + is expected to reboot the system after this script runs. +1. localhost-post-kernel-install.yml: Installs any additional libraries needed + for CNDP after the Kernel is updated and rebooted. Before running the playbooks it's important to modify the following files: + 1. hosts.ini: to add the hosts that you wish the multi-node playbook to setup. -2. group_vars/all: to edit proxy and distribution variables. +1. group_vars/all: to edit proxy and distribution variables. ### CNDP Ansible tree + Below is the full directory tree of Ansible playbooks and roles. ```bash . ├── group_vars -│   └── all // contains global variable for ansible -├── hosts.ini // contains the host ip addresses that you which to configure -├── localhost-kernel-install.yml // playbook -├── localhost-post-kernel-install.yml // playbook -├── multi-host.yml // playbook +│   └── all // contains global variable for ansible +├── hosts.ini // contains the host ip addresses that you which to configure +├── localhost-kernel-install.yml // playbook +├── localhost-post-kernel-install.yml // playbook +├── multi-host.yml // playbook └── roles - ├── check_hugepages - │   └── tasks - │   └── main.yml - ├── check_os - │   └── tasks - │   └── main.yml - ├── check_updated_kernel - │   └── tasks - │   └── main.yml - ├── common - │   └── tasks - │   └── main.yml - ├── install_kernel - │   └── tasks - │   └── main.yml - ├── install_libbpf - │   └── tasks - │   └── main.yml - └── setup_hugepages - └── tasks - └── main.yml +├── check_hugepages +│   └── tasks +│   └── main.yml +├── check_os +│   └── tasks +│   └── main.yml +├── check_updated_kernel +│   └── tasks +│   └── main.yml +├── common +│   └── tasks +│   └── main.yml +├── install_kernel +│   └── tasks +│   └── main.yml +├── install_libbpf +│   └── tasks +│   └── main.yml +└── setup_hugepages +└── tasks +└── main.yml ``` ## Running the Ansible playbook -> Note: it's important to edit group_vars/all and hosts.ini before running any playbooks. +> Note: it's important to edit group_vars/all and hosts.ini before running any +> playbooks. ```bash sudo ansible-playbook -i hosts.ini ``` -> Note: you will need to manually reboot the host after using the localhost-kernel-install.yml -playbook +> Note: you will need to manually reboot the host after using the +> localhost-kernel-install.yml playbook ### Building CNDP -After running Ansible to install all the dependencies, please set `PKG_CONFIG_PATH`, then CNDP can be built by typing `make` in the -top level dir: +After running Ansible to install all the dependencies, please set +`PKG_CONFIG_PATH`, then CNDP can be built by typing `make` in the top level dir: ```bash export PKG_CONFIG_PATH=/usr/lib/pkgconfig diff --git a/ansible/cndp-ansible/localhost-kernel-install.yml b/ansible/cndp-ansible/localhost-kernel-install.yml index 5658469b..4aadbf82 100644 --- a/ansible/cndp-ansible/localhost-kernel-install.yml +++ b/ansible/cndp-ansible/localhost-kernel-install.yml @@ -34,4 +34,3 @@ apply: delegate_to: localhost tags: 03_install_kernel - diff --git a/ansible/cndp-ansible/localhost-post-kernel-install.yml b/ansible/cndp-ansible/localhost-post-kernel-install.yml index bdd51c98..a31a2a30 100644 --- a/ansible/cndp-ansible/localhost-post-kernel-install.yml +++ b/ansible/cndp-ansible/localhost-post-kernel-install.yml @@ -29,4 +29,3 @@ apply: delegate_to: localhost tags: 03_install_libxdp - diff --git a/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml b/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml index 93f503c1..6f47b30e 100644 --- a/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml +++ b/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml @@ -1,6 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2020-2023 Intel Corporation - --- # This role checks how much memory is available on the system for # hugepage allocation @@ -11,11 +10,10 @@ - memory only {{ ansible_memtotal_mb }} MiB available when: ansible_memtotal_mb < ((hugepages_2MB|int * 2) + (hugepages_1GB|int * 1024)) tags: - - check_mem + - check_mem - name: Memory Check Success debug: msg: Memory Check is good tags: - - check_mem - + - check_mem diff --git a/ansible/cndp-ansible/roles/check_os/tasks/main.yml b/ansible/cndp-ansible/roles/check_os/tasks/main.yml index 1ef776b8..6a698b60 100644 --- a/ansible/cndp-ansible/roles/check_os/tasks/main.yml +++ b/ansible/cndp-ansible/roles/check_os/tasks/main.yml @@ -10,11 +10,10 @@ when: (ansible_distribution != required_dist) or (ansible_distribution_version is version (dist_ver, '<')) tags: - - check_os + - check_os - name: Distribution Check debug: msg: Distribution is good tags: - - check_os - + - check_os diff --git a/ansible/cndp-ansible/roles/check_updated_kernel/tasks/main.yml b/ansible/cndp-ansible/roles/check_updated_kernel/tasks/main.yml index 1ff24744..86ba7316 100644 --- a/ansible/cndp-ansible/roles/check_updated_kernel/tasks/main.yml +++ b/ansible/cndp-ansible/roles/check_updated_kernel/tasks/main.yml @@ -10,14 +10,14 @@ - name: Kernel Version OK Check debug: - msg: Kernel Version is OK {{ ansible_kernel }} + msg: Kernel Version is OK {{ ansible_kernel }} when: ansible_kernel is version (installed_kernel, '>=') tags: - check_updated_kernel - name: Kernel Version Not OK Check fail: - msg: Kernel Version is Not OK {{ ansible_kernel }} + msg: Kernel Version is Not OK {{ ansible_kernel }} when: ansible_kernel is version (installed_kernel, '<') tags: - check_updated_kernel @@ -26,19 +26,19 @@ shell: nm /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/intel/i40e/i40e.ko | grep -q i40e_xsk_wakeup && echo "FOUND" || echo "NOT FOUND" register: i40e_check_output tags: - - check_updated_kernel + - check_updated_kernel - name: Print i40e_xsk_wakeup result - debug: #TODO Change to fail - msg: i40e_xsk_wakeup check result {{ i40e_check_output.stdout }} + debug: # TODO Change to fail + msg: i40e_xsk_wakeup check result {{ i40e_check_output.stdout }} when: i40e_check_output.stdout != "FOUND" tags: - check_updated_kernel - name: Checks summary debug: - msg: - - Kernel Version {{ ansible_kernel }} required is {{ installed_kernel }} - - i40e_xsk_wakeup check result {{ i40e_check_output.stdout }} + msg: + - Kernel Version {{ ansible_kernel }} required is {{ installed_kernel }} + - i40e_xsk_wakeup check result {{ i40e_check_output.stdout }} tags: - - check_updated_kernel + - check_updated_kernel diff --git a/ansible/cndp-ansible/roles/common/tasks/main.yml b/ansible/cndp-ansible/roles/common/tasks/main.yml index 26d704fb..a1243cbc 100644 --- a/ansible/cndp-ansible/roles/common/tasks/main.yml +++ b/ansible/cndp-ansible/roles/common/tasks/main.yml @@ -4,7 +4,7 @@ --- # This role installs all the packages needed for CNDP # Template for installing packages -#- name: install +# - name: install # package: # name: # state: present @@ -15,14 +15,13 @@ tags: - cache_update package: - update_cache: yes + update_cache: yes # yamllint disable-line rule:truthy environment: "{{ proxy_env }}" - name: install packages package: - name: "{{ item }}" - state: present + name: "{{ item }}" + state: present environment: "{{ proxy_env }}" tags: install_pkgs with_items: "{{ common_pkgs[required_dist | lower] }}" - diff --git a/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml b/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml index 4fbd6316..94f3fd3a 100644 --- a/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml +++ b/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml @@ -11,7 +11,7 @@ when: - ansible_kernel is version ( installed_kernel, '>=') tags: - - check_kernel + - check_kernel - name: Kernel Version Needs update debug: @@ -19,7 +19,7 @@ when: - ansible_kernel is version ( installed_kernel, '<') tags: - - check_kernel + - check_kernel - name: install kernel for ubuntu package: @@ -46,7 +46,7 @@ - name: Reboot the host after kernel installation reboot: reboot_timeout: 3600 -# pre_reboot_delay: 60 + # pre_reboot_delay: 60 when: - ansible_kernel is version ( installed_kernel, '<') and localhost_install != true tags: diff --git a/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml b/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml index e68745eb..24d03430 100644 --- a/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml +++ b/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml @@ -29,7 +29,7 @@ unarchive: src: https://github.com/libbpf/libbpf/archive/refs/tags/v1.0.0.tar.gz dest: /tmp - remote_src: yes + remote_src: yes # yamllint disable-line rule:truthy when: bpf_static_installed.stat.exists == False or bpf_shared_installed.stat.exists == False environment: "{{ proxy_env }}" tags: @@ -45,4 +45,3 @@ when: bpf_static_installed.stat.exists == False or bpf_shared_installed.stat.exists == False tags: - install_libbpf - diff --git a/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml b/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml index 7c0f13e8..53dd2438 100644 --- a/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml +++ b/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml @@ -9,68 +9,68 @@ tags: - cache_update package: - update_cache: yes + update_cache: yes # yamllint disable-line rule:truthy environment: "{{ proxy_env }}" - name: install packages package: - name: "{{ item }}" - state: present + name: "{{ item }}" + state: present environment: "{{ proxy_env }}" tags: install_pkgs with_items: "{{ clang_pkgs[required_dist | lower] }}" - name: check if libxdp shared lib is already installed stat: - path: /usr/lib/libxdp.so + path: /usr/lib/libxdp.so register: xdp_shared_installed tags: - - check_libxdp + - check_libxdp - name: check if libxdp static lib is already installed stat: - path: /usr/lib/libxdp.a + path: /usr/lib/libxdp.a register: xdp_static_installed tags: - - check_libxdp + - check_libxdp - name: libxdp installed check result debug: - msg: libxdp already installed + msg: libxdp already installed when: xdp_static_installed.stat.exists == True or xdp_shared_installed.stat.exists == True tags: - - check_libxdp + - check_libxdp - name: Unarchive libxdp unarchive: - src: https://github.com/xdp-project/xdp-tools/releases/download/v1.3.1/xdp-tools-1.3.1.tar.gz - dest: /tmp - remote_src: yes + src: https://github.com/xdp-project/xdp-tools/releases/download/v1.3.1/xdp-tools-1.3.1.tar.gz + dest: /tmp + remote_src: yes # yamllint disable-line rule:truthy when: xdp_static_installed.stat.exists == False or xdp_shared_installed.stat.exists == False environment: "{{ proxy_env }}" tags: - - unarchive_libxdp + - unarchive_libxdp - name: Install libxdp make: - chdir: /tmp/xdp-tools-1.3.1 - target: install - params: - NUM_THREADS: "{{ num_threads }}" - LIBDIR: /usr/lib + chdir: /tmp/xdp-tools-1.3.1 + target: install + params: + NUM_THREADS: "{{ num_threads }}" + LIBDIR: /usr/lib when: xdp_static_installed.stat.exists == False or xdp_shared_installed.stat.exists == False tags: - - install_libxdp + - install_libxdp - name: check xsk_socket__create_shared shell: nm /usr/lib/libxdp.so.1 | grep -q xsk_socket__create_shared && echo "FOUND" || echo "NOT FOUND" register: xsk_shared_check_output tags: - - check_xsk_shared + - check_xsk_shared - name: Print xsk_socket__create_shared result debug: - msg: xsk_socket__create_shared check result {{ xsk_shared_check_output.stdout }} + msg: xsk_socket__create_shared check result {{ xsk_shared_check_output.stdout }} when: xsk_shared_check_output.stdout != "FOUND" tags: - check_xsk_shared diff --git a/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml b/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml index ef809518..c2ffbb60 100644 --- a/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml +++ b/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml @@ -22,7 +22,7 @@ - name: Configure Persistent 2MB Hugepages if missing in /etc/sysctl.conf lineinfile: path: /etc/sysctl.conf - backup: yes + backup: yes # yamllint disable-line rule:truthy regexp: 'vm.nr_hugepages = [0-9]+' state: absent insertafter: 'EOF' @@ -30,19 +30,19 @@ when: - hugepages_2MB_check.stdout == "FOUND" and hugepages_2MB|int > 0 tags: - - hugepages_2MB_config + - hugepages_2MB_config - name: Edit Persistent 2MB Hugepages if it already exists lineinfile: path: /etc/sysctl.conf - backup: yes + backup: yes # yamllint disable-line rule:truthy regexp: 'vm.nr_hugepages = [0-9]+' state: present line: 'vm.nr_hugepages = {{ hugepages_2MB }}' when: - hugepages_2MB_check.stdout == "FOUND" and hugepages_2MB|int > 0 tags: - - hugepages_2MB_config + - hugepages_2MB_config ################################################################ diff --git a/ansible/cndp-config/README.md b/ansible/cndp-config/README.md index c7bf06d7..c683aed2 100644 --- a/ansible/cndp-config/README.md +++ b/ansible/cndp-config/README.md @@ -1,14 +1,13 @@ - -### Run Playbook +# Run Playbook 1. Modify the global vars in the all file under group_vars -2. Run the playbook: +1. Run the playbook: -``` -$ ansible-playbook -i hosts.ini generate_jsonc.yml +```sh +ansible-playbook -i hosts.ini generate_jsonc.yml ``` -note: there are quite a few improvements that could be made to the playbook. This -is just a rough and ready way to generate a configuration. For example, right now -the playbook doesn't take the available amount of CPUs into consideration when -setting queues and threads... +> _Note_: there are quite a few improvements that could be made to the playbook. +> This is just a rough and ready way to generate a configuration. For example, +> right now the playbook doesn't take the available amount of CPUs into +> consideration when setting queues and threads... diff --git a/ansible/cndp-config/roles/gen_config/tasks/main.yml b/ansible/cndp-config/roles/gen_config/tasks/main.yml index 03aec56d..6821313f 100644 --- a/ansible/cndp-config/roles/gen_config/tasks/main.yml +++ b/ansible/cndp-config/roles/gen_config/tasks/main.yml @@ -5,4 +5,4 @@ - name: create json configuration for CNDP template: src: templates/fwd.jsonc.j2 - dest: "{{ config_dst }}/fwd.jsonc" + dest: "{{ config_dst }}/fwd.jsonc" diff --git a/cndp-codespell.precommit-toml b/cndp-codespell.precommit-toml new file mode 100644 index 00000000..a055dd43 --- /dev/null +++ b/cndp-codespell.precommit-toml @@ -0,0 +1,3 @@ +[tool.codespell] +skip = "./.*,lang/rs/wireguard/patch/*,doc/guides/prog_guide/img/cnet_overview.svg" +ignore-words-list = "quicly,thirdparty,te,parms,CRATE,crate,systm,keep-alives,ans,tolen,nd,ND,fo" diff --git a/containerization/docker/README.md b/containerization/docker/README.md index f5c339c6..e9fba2a7 100644 --- a/containerization/docker/README.md +++ b/containerization/docker/README.md @@ -5,9 +5,11 @@ Add the docker repo: ```bash -sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common gnupg2 +sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl \ + software-properties-common gnupg2 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ +sudo add-apt-repository "deb [arch=amd64] \ + https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" ``` @@ -18,8 +20,8 @@ Install docker-ce: sudo apt-get install -y docker-ce docker-ce-cli ``` -Ensure that the overlay driver is what's used for docker-ce and memlock limit -is removed: +Ensure that the overlay driver is what's used for docker-ce and memlock limit is +removed: ```bash cat < **Note:** Only Ubuntu 21.04 is tested with the included Dockerfile. @@ -60,8 +62,8 @@ configuration in the Docker systemd service file. sudo mkdir -p /etc/systemd/system/docker.service.d ``` -- Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf - that adds the HTTP_PROXY environment variable: +- Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that + adds the HTTP_PROXY environment variable: ```bash [Service] @@ -114,8 +116,8 @@ sudo usermod -aG docker $USER newgrp docker ``` -The `newgrp` command activates the group changes immediately. Without it you must logout -and login again for new groups to take effect. +The `newgrp` command activates the group changes immediately. Without it you +must logout and login again for new groups to take effect. ## Step 4: Testing Docker Installation @@ -144,39 +146,46 @@ to your terminal. ## Step 5: Build the cndp container -> **Note:** Follow INSTALL.md in the CNDP top level directory if CNDP dependencies are not installed +> **Note:** Follow INSTALL.md in the CNDP top level directory if CNDP +> dependencies are not installed -To build the container image using `docker` from the top level CNDP directory call: +To build the container image using `docker` from the top level CNDP directory +call: ```cmd make oci-image ``` -To build the container image using `buildah` from the top level CNDP directory call: +To build the container image using `buildah` from the top level CNDP directory +call: ```cmd make Builder=buildah oci-image ``` -To run the container Ubuntu image using `docker` from the top level CNDP directory call: +To run the container Ubuntu image using `docker` from the top level CNDP +directory call: ```cmd make ce-run ``` -To run the container Ubuntu image using `podman` from the top level CNDP directory call: +To run the container Ubuntu image using `podman` from the top level CNDP +directory call: ```cmd make CE=podman ce-run ``` -To run the container Fedora image using `docker` from the top level CNDP directory call: +To run the container Fedora image using `docker` from the top level CNDP +directory call: ```cmd make ce-fed-run ``` -To run the container Fedora image using `podman` from the top level CNDP directory call: +To run the container Fedora image using `podman` from the top level CNDP +directory call: ```cmd make CE=podman ce-fed-run diff --git a/containerization/k8s/README.md b/containerization/k8s/README.md index 46422e22..3412a509 100644 --- a/containerization/k8s/README.md +++ b/containerization/k8s/README.md @@ -1,17 +1,18 @@ # CNDP Pod The provided configuration creates a CNDP pod with two containers. One that runs -the CNDP cndpfwd example and another which runs the prometheus go agent to collect -metrics from the CNDP cndpfwd container. The CNDP containers are interconnected via -a unix domain socket. +the CNDP cndpfwd example and another which runs the prometheus go agent to +collect metrics from the CNDP cndpfwd container. The CNDP containers are +interconnected via a unix domain socket. -This guide will walk you through the setup of the CNDP pods and the AF_XDP Device -Plugin (DP). +This guide will walk you through the setup of the CNDP pods and the AF_XDP +Device Plugin (DP). ## 1. Setup a Kubernetes Cluster This section will walk you through how to setup a single node cluster where you -can launch a CNDP container. The example uses `kubeadm` to bootstrap the cluster. +can launch a CNDP container. The example uses `kubeadm` to bootstrap the +cluster. Start by setting the hostname for your platform and ensuring that there's a corresponding entry in /etc/hosts @@ -36,32 +37,33 @@ no_proxy=HOST_IP,YOURHOSTNAME.com,localhost,127.0.0.1,10.96.0.0/12 ### Prepare system to install containerd #### Ubuntu 21.04 - - + + + ```bash -$ cat < /proc/sys/net/ipv4/ip_forward +echo 1 >/proc/sys/net/ipv4/ip_forward ``` ### Install containerd @@ -69,23 +71,23 @@ $ echo 1 > /proc/sys/net/ipv4/ip_forward #### Ubuntu 21.04 ```bash -$ sudo apt-get update +sudo apt-get update -$ sudo apt-get install -y software-properties-common apt-transport-https ca-certificates curl gnupg -$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" +sudo apt-get install -y software-properties-common apt-transport-https ca-certificates curl gnupg +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -$ sudo apt-get update -$ sudo apt-get install apparmor-utils containerd.io +sudo apt-get update +sudo apt-get install apparmor-utils containerd.io ``` #### Fedora 38 ```bash -$ sudo setenforce 0 -$ sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config +sudo setenforce 0 +sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config -$ cat < **NOTE**: This step is required on both Ubuntu and Fedora -> On `Fedora 38` you also need to disable zram: +> **NOTE**: This step is required on both Ubuntu and Fedora On `Fedora 38` you +> also need to disable zram: > ->```bash -> $ sudo touch /etc/systemd/zram-generator.conf ->``` +> ```bash +> sudo touch /etc/systemd/zram-generator.conf +> ``` And setup hugepages (used later by CNDP pod): @@ -232,7 +234,7 @@ EOF Launch a cluster: ```bash -sudo kubeadm init --v 99 --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=all +sudo kubeadm init --v 99 --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=all ``` If the cluster launches successfully you should see a message that looks like: @@ -268,22 +270,22 @@ Install flannel and all the default networking plugins ```bash kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/v0.15.1/Documentation/kube-flannel.yml -$ git clone https://github.com/containernetworking/plugins.git -$ cd plugins +git clone https://github.com/containernetworking/plugins.git +cd plugins $./build_linux.sh -$ ls bin/ -bandwidth bridge dhcp dummy firewall host-device host-local ipvlan loopback macvlan portmap ptp sbr static tap tuning vlan vrf -$ cp bin/* /opt/cni/bin/ +ls bin/ +bandwidth bridge dhcp dummy firewall host-device host-local ipvlan loopback macvlan portmap ptp sbr static tap tuning vlan vrf +cp bin/* /opt/cni/bin/ ``` > **NOTE**: Compiling the network plugins requires golang to be installed. -Un-taint the controller node so you can schedule pods there and add a label to it: -Remember to change HOSTNAME to your actual hostname in the commands below: +Un-taint the controller node so you can schedule pods there and add a label to +it: Remember to change HOSTNAME to your actual hostname in the commands below: ```bash -$ kubectl taint nodes --all node-role.kubernetes.io/master- -$ kubectl label node HOSTNAME cndp="true" +kubectl taint nodes --all node-role.kubernetes.io/master- +kubectl label node HOSTNAME cndp="true" ``` ### Setup Multus @@ -291,7 +293,7 @@ $ kubectl label node HOSTNAME cndp="true" Setup Multus: ```bash -$ kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/v3.8/images/multus-daemonset.yml +kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/v3.8/images/multus-daemonset.yml ``` ## 2. Build the CNDP container image @@ -299,43 +301,45 @@ $ kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus In the top level CNDP directory run: ```bash -$ make oci-image +make oci-image ``` Push this image to a registry. ### 3. Build and deploy AF_XDP plugin and CNI for K8s -The source code is available [here](https://github.com/intel/afxdp-plugins-for-kubernetes). +The source code is available +[here](https://github.com/intel/afxdp-plugins-for-kubernetes). -For detailed install instructions please refer to README.md in the device plugin repo. -This section will provide a quick start for deploying the device plugin and CNI. +For detailed install instructions please refer to README.md in the device plugin +repo. This section will provide a quick start for deploying the device plugin +and CNI. Please ensure you have the runtime dependencies installed. 1. Clone the repo -```bash -$ git clone https://github.com/intel/afxdp-plugins-for-kubernetes -``` + ```bash + git clone https://github.com/intel/afxdp-plugins-for-kubernetes + ``` -2. Move to the top level directory of the repo +1. Move to the top level directory of the repo -```bash -$ cd afxdp-plugins-for-kubernetes -``` + ```bash + cd afxdp-plugins-for-kubernetes + ``` #### AF_XDP DP UDS based deployment Edit the `deployments/daemonset.yml` file ```bash -$ vim deployments/daemonset.yml +vim deployments/daemonset.yml ``` -Modify the ConfigMap to include the relevant drivers, also -modify the af_xdp dp image to reference the registry used to -store the image built in the previous step. +Modify the ConfigMap to include the relevant drivers, also modify the af_xdp dp +image to reference the registry used to store the image built in the previous +step. ```yaml apiVersion: v1 @@ -373,10 +377,9 @@ Edit the `deployments/daemonset-pinning.yml` file vim deployments/daemonset-pinning.yml ``` - -Modify the ConfigMap to include the relevant drivers, also -modify the af_xdp dp image to reference the registry used to -store the image built in the previous step. +Modify the ConfigMap to include the relevant drivers, also modify the af_xdp dp +image to reference the registry used to store the image built in the previous +step. ```yaml apiVersion: v1 @@ -416,10 +419,12 @@ sudo make image ### 4. Import docker images -Before importing docker images, the container images are built using docker. For more information on building the CNDP image using docker, please follow the instructions at containerization/docker/README.md. +Before importing docker images, the container images are built using docker. For +more information on building the CNDP image using docker, please follow the +instructions at containerization/docker/README.md. -If using containerd as the container run-time interface with K8s, the images built using docker need to be -imported so that the K8s run-time can use it: +If using containerd as the container run-time interface with K8s, the images +built using docker need to be imported so that the K8s run-time can use it: Import the CNDP docker image @@ -435,12 +440,12 @@ Import the AF_XDP device plugin docker image. docker save afxdp-device-plugin -o afxdp-device-plugin.tar ctr -n=k8s.io images import afxdp-device-plugin.tar - ``` #### Verify that the image is now available to the container run-time -More information on how to install crictl can be found [here](https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/). +More information on how to install crictl can be found +[here](https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/). ```bash sudo crictl images @@ -462,18 +467,22 @@ kubectl create -f ./deployments/daemonset-pinning.yml ### 6. Modify the Network attachment definition for AF_XDP interface -> **_NOTE:_** make sure any interfaces you wish to add to the Pod are in an UP state and do not have IP addresses configured. +> **_NOTE:_** make sure any interfaces you wish to add to the Pod are in an UP +> state and do not have IP addresses configured. -Ethtool filters are programmed on the interface by the CNI through the NAD. Currently, the ethtool filter will be programmed on queue 4 and on. +Ethtool filters are programmed on the interface by the CNI through the NAD. +Currently, the ethtool filter will be programmed on queue 4 and on. -The "queues" field in the network attachment definition decides how many queues are used for the ethtool filter setup. +The "queues" field in the network attachment definition decides how many queues +are used for the ethtool filter setup. -If `"queues":"1"` is set in the network attachment definition, the ethtool filter programmed by the CNI, will be of the form +If `"queues":"1"` is set in the network attachment definition, the ethtool +filter programmed by the CNI, will be of the form ```bash -"ethtoolCmds" : ["-X -device- equal 1 start 4", # CNI ethtool filters (optional) - "--config-ntuple -device- flow-type udp4 dst-ip -ip- action" - ], +"ethtoolCmds" : ["-X -device- equal 1 start 4", # CNI ethtool filters (optional) +"--config-ntuple -device- flow-type udp4 dst-ip -ip- action" +], ``` In order to create the network attachment definition: @@ -484,9 +493,9 @@ kubectl create -f containerization/k8s/networks/uds-nad.yaml > Note: To deploy the map pinning based configuration run: - ```bash - kubectl create -f containerization/k8s/networks/map-pinning-nad.yaml - ``` +```bash +kubectl create -f containerization/k8s/networks/map-pinning-nad.yaml +``` Check the definition was added: @@ -498,12 +507,12 @@ kubectl get network-attachment-definitions First make optional changes to the containerization/k8s/cndp-pods/cndp-0-0.yaml file to define LIST_OF_QIDS or CNDP_COPY_MODE environment variables. These -variables are read by `tools/jsonc_gen.sh` when the container starts to -generate the configuration for the CNDP application. +variables are read by `tools/jsonc_gen.sh` when the container starts to generate +the configuration for the CNDP application. > **_NOTE:_** the `tools/jsonc_gen.sh` supports BPF map pinning configuration by -running it with the `-p` flag. If you wish to use it in a kind cluster then run -the script with a `-k` flag in the pod YAML. +> running it with the `-p` flag. If you wish to use it in a kind cluster then +> run the script with a `-k` flag in the pod YAML. An example to force copy-mode for all AF_XDP sockets: @@ -531,8 +540,8 @@ kubectl describe pods ### Connecting to the cndp containers container ```bash -kubectl exec -i -t cndp-0-0 --container control-0 -- /bin/bash -kubectl exec -i -t cndp-0-0 --container cndp-0 -- /bin/bash +kubectl exec -i -t cndp-0-0 --container control-0 -- /bin/bash +kubectl exec -i -t cndp-0-0 --container cndp-0 -- /bin/bash ``` ### Checking the container logs @@ -545,29 +554,31 @@ kubectl logs cndp-0-0 cndp-0 ### Port forwarding to export metrics to the local host ```bash -kubectl port-forward cndp-0-0 2112:2112& +kubectl port-forward cndp-0-0 2112:2112 & ``` ### Prometheus installation -To install Prometheus locally on the host, please follow the sets [here](https://computingforgeeks.com/install-prometheus-server-on-debian-ubuntu-linux/) +To install Prometheus locally on the host, please follow the sets +[here](https://computingforgeeks.com/install-prometheus-server-on-debian-ubuntu-linux/) -> **_NOTE:_** There's no need to enable Prometheus as a service that runs all the time. +> **_NOTE:_** There's no need to enable Prometheus as a service that runs all +> the time. Modify the /etc/prometheus/prometheus.yml file to pull stats from the CNDP pod ```yaml # my global config global: - scrape_interval: 1s # UPDATE THIS INTERVAL AS PREFERRED. Default is every 1 minute. + scrape_interval: 1s # UPDATE THIS INTERVAL AS PREFERRED. Default is every 1 minute. evaluation_interval: 1s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - - static_configs: - - targets: + - static_configs: + - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. @@ -579,19 +590,20 @@ rule_files: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=` to any timeseries scraped from this config. - - job_name: 'prometheus' + - job_name: prometheus # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - - targets: ['localhost:9090'] - - targets: ['localhost:2112'] # THIS IS THE CNDP PODs exposed metrics port + - targets: [localhost:9090] + - targets: [localhost:2112] # THIS IS THE CNDP PODs exposed metrics port ``` -After restarting the prometheus service to pick up these changes you should be able to see -the CNDP pod metrics in the prometheus frontend through a web browser, or through curl: +After restarting the prometheus service to pick up these changes you should be +able to see the CNDP pod metrics in the prometheus frontend through a web +browser, or through curl: ```bash curl http://localhost:2112/metrics @@ -599,8 +611,8 @@ curl http://localhost:2112/metrics ### Logging -To install a reference logging stack based on Fluent Bit, Elasticsearch, and Kibana follow the -instructions in [logging-README.md](logging-README.md). +To install a reference logging stack based on Fluent Bit, Elasticsearch, and +Kibana follow the instructions in [logging-README.md](logging-README.md). ### Deleting the CNDP pod @@ -632,4 +644,5 @@ kubeadm init --pod-network-cidr=10.244.0.0/16 - [Multus Quickstart](https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/docs/quickstart.md) + diff --git a/containerization/k8s/cndp-pods/cndp-0-0.yaml b/containerization/k8s/cndp-pods/cndp-0-0.yaml index 2ec11afd..a57808fa 100644 --- a/containerization/k8s/cndp-pods/cndp-0-0.yaml +++ b/containerization/k8s/cndp-pods/cndp-0-0.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Pod metadata: @@ -10,8 +11,8 @@ spec: nodeSelector: cndp: "true" volumes: - - name: shared-data - emptyDir: {} + - name: shared-data + emptyDir: {} containers: - name: cndp-0 command: ["/bin/bash"] @@ -27,8 +28,8 @@ spec: - IPC_LOCK # - BPF # Enable if running in a kind cluster as the default kernel used is 5.15, BPF map support without privilege is only supported from 5.19. ports: - - containerPort: 8094 - hostPort: 8094 + - containerPort: 8094 + hostPort: 8094 resources: requests: afxdp/myPool: '1' @@ -44,8 +45,8 @@ spec: image: cndp imagePullPolicy: Never ports: - - containerPort: 2112 - hostPort: 2112 + - containerPort: 2112 + hostPort: 2112 volumeMounts: - name: shared-data mountPath: /var/run/cndp/ diff --git a/containerization/k8s/crio-README.md b/containerization/k8s/crio-README.md index c35d5f40..bd79abb7 100644 --- a/containerization/k8s/crio-README.md +++ b/containerization/k8s/crio-README.md @@ -1,21 +1,23 @@ # CNDP with CRI-O Container Runtime -Kubernetes expects a Container Runtime to implement its Container Runtime Interface (CRI). The -CRI-O runtime is built specifically for this purpose. It is a lightweight alternative to containerd. -For more information, refer to the [CRI-O website](https://cri-o.io/). To build containers, this -document uses [podman](https://podman.io/). +Kubernetes expects a Container Runtime to implement its Container Runtime +Interface (CRI). The CRI-O runtime is built specifically for this purpose. It is +a lightweight alternative to containerd. For more information, refer to the +[CRI-O website](https://cri-o.io/). To build containers, this document uses +[podman](https://podman.io/). ## References The information in this document is sourced from the Kubernetes documentation. -* [Container-runtimes](https://kubernetes.io/docs/setup/production-environment/container-runtimes/) -* [Install kubeadm](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) +- [Container-runtimes](https://kubernetes.io/docs/setup/production-environment/container-runtimes/) +- [Install kubeadm](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) ## Install CRI and Kubernetes -This document assumes a fresh install of Ubuntu 21.04 as the base OS where Kubernetes runs. It -describes one way to setup a single node cluster to test and develop applications. +This document assumes a fresh install of Ubuntu 21.04 as the base OS where +Kubernetes runs. It describes one way to setup a single node cluster to test and +develop applications. ### Install packages @@ -28,7 +30,7 @@ sudo apt-get install -y apt-transport-https ca-certificates curl ### Configure CRI-O pre-requisites -Create the .conf file to load the modules at bootup. +Create the .conf file to load the modules at boot up. ```bash cat </dev/null @@ -80,8 +83,8 @@ EOF ### Install CRI-O -Set environment variables for the host OS and the CRI-O version. The CRI-O version must match the -version of Kubernetes that is installed. +Set environment variables for the host OS and the CRI-O version. The CRI-O +version must match the version of Kubernetes that is installed. ```bash export OS=xUbuntu_21.04 @@ -89,12 +92,13 @@ export VERSION=1.22 ``` Setup repos and keys. + ```bash -curl -fsSL https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key |\ +curl -fsSL https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo tee /usr/share/keyrings/libcontainers.asc >/dev/null -curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key |\ +curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo tee /usr/share/keyrings/libcontainers-cri-o.asc >/dev/null cat < + Install CRI-O. ```bash @@ -134,7 +140,7 @@ sudo systemctl enable crio --now Setup repos and keys. ```bash -curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg |\ +curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo tee /usr/share/keyrings/kubernetes-archive-keyring.gpg >/dev/null cat < cndp="true" +kubectl label node NAME cndp="true" ``` Deploy the CNDP pod. diff --git a/containerization/k8s/logging-README.md b/containerization/k8s/logging-README.md index 3b0a795c..7512297c 100644 --- a/containerization/k8s/logging-README.md +++ b/containerization/k8s/logging-README.md @@ -1,19 +1,21 @@ # CNDP Kubernetes Reference Logging Architecture -CNDP provides a reference logging architecture based on Fluent Bit combined with the Elasticsearch -output plugin. Kibana provides a user interface to visualize the data stored in the Elasticsearch -database. +CNDP provides a reference logging architecture based on Fluent Bit combined with +the Elasticsearch output plugin. Kibana provides a user interface to visualize +the data stored in the Elasticsearch database. -This guide describes a procedure to deploy the logging stack and configure Kibana to view the logs. +This guide describes a procedure to deploy the logging stack and configure +Kibana to view the logs. ## Deploy logging stack -Use the following procedure to configure and deploy the Elasticsearch, Kibana, and Fluent Bit pods. +Use the following procedure to configure and deploy the Elasticsearch, Kibana, +and Fluent Bit pods. ### Elasticsearch and Kibana -Create elasticsearch.yaml and kibana.yaml deployment files. Both applications run in the "logging" -namespace and are reachable through a service NodePort. +Create elasticsearch.yaml and kibana.yaml deployment files. Both applications +run in the "logging" namespace and are reachable through a service NodePort. ```yaml cat < elasticsearch.yaml @@ -119,21 +121,23 @@ kubectl create -f kibana.yaml ### Fluent Bit -Fluent Bit needs access to some information about the pods running on its node so it needs a -RoleBinding. +Fluent Bit needs access to some information about the pods running on its node +so it needs a RoleBinding. ```bash kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/fluent-bit-service-account.yaml ``` -On K8s version <1.22 the API is v1beta. Use these if the K8s cluster version is <1.22. +On K8s version \<1.22 the API is v1beta. Use these if the K8s cluster version is +\<1.22. ```bash kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/fluent-bit-role.yaml kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/fluent-bit-role-binding.yaml ``` -On K8s version >=1.22 the API is v1beta. Use these if the K8s cluster version is >=1.22. +On K8s version >=1.22 the API is v1beta. Use these if the K8s cluster version is +\>=1.22. ```bash kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/fluent-bit-role-1.22.yaml @@ -149,9 +153,10 @@ kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes kubectl create -f https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/elasticsearch/fluent-bit-ds.yaml ``` -If the CRI used on the cluster is containerd, the default ConfigMap must be modified to change the -Parser from 'docker' to 'cri' and the default DaemonSet must be modified to change the log path from -'/var/lib/docker/containers' to '/var/log/pods'. +If the CRI used on the cluster is containerd, the default ConfigMap must be +modified to change the Parser from 'docker' to 'cri' and the default DaemonSet +must be modified to change the log path from '/var/lib/docker/containers' to +'/var/log/pods'. ```bash wget https://raw.githubusercontent.com/fluent/fluent-bit-kubernetes-logging/master/output/elasticsearch/fluent-bit-configmap.yaml @@ -164,17 +169,17 @@ kubectl create -f fluent-bit-ds.yaml ### Check Deployment -Assuming the above steps completed without error and containers were downloaded and started -successfully, run the following commands to check the deployment. +Assuming the above steps completed without error and containers were downloaded +and started successfully, run the following commands to check the deployment. #### Check Pods ```bash $ kubectl get pods -n logging -NAME READY STATUS RESTARTS AGE -elasticsearch-546795648c-r6dhz 1/1 Running 0 35m -fluent-bit-4lb7z 1/1 Running 0 34m -kibana-b56fc6484-24wc8 1/1 Running 0 35m +NAME READY STATUS RESTARTS AGE +elasticsearch-546795648c-r6dhz 1/1 Running 0 35m +fluent-bit-4lb7z 1/1 Running 0 34m +kibana-b56fc6484-24wc8 1/1 Running 0 35m ``` #### Check Services @@ -186,28 +191,31 @@ elasticsearch NodePort 10.107.119.4 9200:31816/TCP 35m kibana NodePort 10.101.28.159 5601:32348/TCP 35m ``` -To access the Kibana user interface on the node where services are deployed, open a browser and -navigate to localhost:32348. Note the actual port may different than the one displayed here. +To access the Kibana user interface on the node where services are deployed, +open a browser and navigate to localhost:32348. Note the actual port may +different than the one displayed here. -If the node does not have a browser, access the Kibana user interface through the node's IP instead -of localhost. +If the node does not have a browser, access the Kibana user interface through +the node's IP instead of localhost. ## Configure Kibana -Access the Kibana user interface, navigate to HOST:PORT/app/management/kibana/indexPatterns. +Access the Kibana user interface, navigate to +HOST:PORT/app/management/kibana/indexPatterns. -Create an Index Pattern named "logstash-\*" with a Timestamp Field equal to "@timestamp". +Create an Index Pattern named "logstash-\*" with a Timestamp Field equal to +"@timestamp". Navigate to HOST:PORT/app/discover. -From the "Available Fields" menu, find "Kubernetes.pod\_name" and click the "+" icon to add the -field. Do the same for the "Message" field. +From the "Available Fields" menu, find "Kubernetes.pod_name" and click the "+" +icon to add the field. Do the same for the "Message" field. -Use the Search bar to filter on "cndp". Deploy the CNDP pod and observe logs from the -cndp-device-plugin and cndp pod. +Use the Search bar to filter on "cndp". Deploy the CNDP pod and observe logs +from the cndp-device-plugin and cndp pod. ## References 1. [Fluent Bit](https://docs.fluentbit.io/manual/) -2. [Fluent Bit Kubernetes](https://docs.fluentbit.io/manual/installation/kubernetes) -3. [Elastic](https://www.elastic.co/guide/index.html) +1. [Fluent Bit Kubernetes](https://docs.fluentbit.io/manual/installation/kubernetes) +1. [Elastic](https://www.elastic.co/guide/index.html) diff --git a/containerization/k8s/networks/map-pinning-nad.yaml b/containerization/k8s/networks/map-pinning-nad.yaml index fcd6ec98..ce1d1c5e 100644 --- a/containerization/k8s/networks/map-pinning-nad.yaml +++ b/containerization/k8s/networks/map-pinning-nad.yaml @@ -1,5 +1,5 @@ # WARNING: This is an example definition only. Remove all comments before use. - +--- apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: diff --git a/containerization/k8s/networks/uds-nad.yaml b/containerization/k8s/networks/uds-nad.yaml index b48c4837..0bf93599 100644 --- a/containerization/k8s/networks/uds-nad.yaml +++ b/containerization/k8s/networks/uds-nad.yaml @@ -1,6 +1,5 @@ -# WARNING: This is an example definition only. Remove all comments before use. - -apiVersion: "k8s.cni.cncf.io/v1" +--- +apiVersion: "k8s.cni.cncf.io/v1" # WARNING: This is an example definition only. Remove all comments before use. kind: NetworkAttachmentDefinition metadata: name: afxdp-network # Name of this network, pods will request this network by name diff --git a/doc/guides/pmds/memif.rst b/doc/guides/pmds/memif.rst index 4b4920d9..1d712f8e 100644 --- a/doc/guides/pmds/memif.rst +++ b/doc/guides/pmds/memif.rst @@ -172,4 +172,3 @@ region n: +-----------------+ Buffers are dequeued and enqueued as needed. Offset descriptor field is calculated at tx. - diff --git a/doc/guides/prog_guide/cnet.rst b/doc/guides/prog_guide/cnet.rst index 33e309a4..346d5743 100644 --- a/doc/guides/prog_guide/cnet.rst +++ b/doc/guides/prog_guide/cnet.rst @@ -334,7 +334,7 @@ The **stk_id** is used to denote which stack structure the **chnl** structure is **ch_options** is a bit field of values to a channel instanace. The some of the flags are *SO_BROADCAST*, *SO_REUSEADDR*, *SO_REUSEPORT* and some others. The **ch_state** is the current state of channel, which includes *ISCONNECTED*, *ISCONNECTING*, *_ISDISCONNECTING* and other internal flags. The **ch_error** value is -the error that occured previously and was not reported. The value is then reported in other calls or request in +the error that occurred previously and was not reported. The value is then reported in other calls or request in the *chnl_opt_get** request. The **ch_cd** is the channel descriptor associated with this channel structure. The **ch_pcb** is the PCB (Process Control Block) attached to this channel structure. The *PCB* structure will diff --git a/doc/guides/prog_guide/img/cnet_overview.svg b/doc/guides/prog_guide/img/cnet_overview.svg index 09a8acf2..f4fe321e 100644 --- a/doc/guides/prog_guide/img/cnet_overview.svg +++ b/doc/guides/prog_guide/img/cnet_overview.svg @@ -1 +1 @@ -PODCNDPApplicationCNET graph(s)CNDP LibrariesCNDP I/O(pktdev/xskdev)TUNLinux KerneleBPFNetdev(s)SidecarContainerUDS *UDS = Unix Domain SocketCNET UDP, IPv4, QUIC(quicly), IPV6/TCP (2H’22)AF_XDPSocketsNIC(s)Network StackNetlinkvEth1 queue \ No newline at end of file +PODCNDPApplicationCNET graph(s)CNDP LibrariesCNDP I/O(pktdev/xskdev)TUNLinux KerneleBPFNetdev(s)SidecarContainerUDS *UDS = Unix Domain SocketCNET UDP, IPv4, QUIC(quicly), IPV6/TCP (2H’22)AF_XDPSocketsNIC(s)Network StackNetlinkvEth1 queue diff --git a/doc/guides/prog_guide/img/cnet_stack_view.svg b/doc/guides/prog_guide/img/cnet_stack_view.svg index f5d772e4..4c87aa2b 100644 --- a/doc/guides/prog_guide/img/cnet_stack_view.svg +++ b/doc/guides/prog_guide/img/cnet_stack_view.svg @@ -1 +1 @@ -struct cnetstk_t *stks[ ]CNDP Application ProcessStackandGraph data perthreadstackinfograph info*nodes[ ]Thread1stackinfograph info*nodes[ ]Thread2stackinfograph info*nodes[ ]Thread3stackinfograph info*nodes[ ]ThreadN \ No newline at end of file +struct cnetstk_t *stks[ ]CNDP Application ProcessStackandGraph data perthreadstackinfograph info*nodes[ ]Thread1stackinfograph info*nodes[ ]Thread2stackinfograph info*nodes[ ]Thread3stackinfograph info*nodes[ ]ThreadN diff --git a/doc/guides/prog_guide/pktmbuf_lib.rst b/doc/guides/prog_guide/pktmbuf_lib.rst index c3bbe0b8..f362ddc6 100644 --- a/doc/guides/prog_guide/pktmbuf_lib.rst +++ b/doc/guides/prog_guide/pktmbuf_lib.rst @@ -74,7 +74,7 @@ allocate and free buffers to get the best performance, which means each AF_XDP s its own mempool set of buffers in the UMEM buffer space. A multiple AF_XDP sockets could share a single mempool, but a socket could starve other sockets of -buffers if some type of limit is put into place. We use a mempool per socket to achive this type of +buffers if some type of limit is put into place. We use a mempool per socket to achieve this type of limiting of a single socket consuming all of the buffers. .. _multiple_mempools_umem: diff --git a/doc/guides/prog_guide/ring_lib.rst b/doc/guides/prog_guide/ring_lib.rst index 858d9a78..00fb091f 100644 --- a/doc/guides/prog_guide/ring_lib.rst +++ b/doc/guides/prog_guide/ring_lib.rst @@ -65,7 +65,7 @@ Additional Features Name ~~~~ -A ring is identified by a unique name. It's imporant that the application maintains +A ring is identified by a unique name. It's important that the application maintains the current rings and their names in order to avoid creating rings with a duplicate name. diff --git a/doc/guides/prog_guide/xskdev_buffer_mgmt.rst b/doc/guides/prog_guide/xskdev_buffer_mgmt.rst index 9b0ba32c..cf4e7141 100644 --- a/doc/guides/prog_guide/xskdev_buffer_mgmt.rst +++ b/doc/guides/prog_guide/xskdev_buffer_mgmt.rst @@ -175,5 +175,3 @@ A few examples of how the buffer management callbacks are invoked is shown below { return xi->buf_mgmt.buf_tx_burst(xi, bufs, nb_pkts); } - - diff --git a/doc/guides/sample_app_ug/k8s_dp_integration.rst b/doc/guides/sample_app_ug/k8s_dp_integration.rst index 0fd14269..dd22441d 100644 --- a/doc/guides/sample_app_ug/k8s_dp_integration.rst +++ b/doc/guides/sample_app_ug/k8s_dp_integration.rst @@ -64,8 +64,9 @@ deployments/daemonset.yaml for ``logFile``. .. note:: - The network attachment definition and pod spec below request a resource named cndp/pool1. The device plugin config would need to specify a pool called pool1 with atleast one device. If not, you may run into a pod failed scheduling warning: - 1 insufficient cndp/pool1. + The network attachment definition and pod spec below request a resource named cndp/pool1. The device plugin + config would need to specify a pool called pool1 with at least one device. If not, you may run into a pod + failed scheduling warning: 1 insufficient cndp/pool1. From the top level directory of the CNDP repo, create the network attachment definition diff --git a/examples/cndp-frr/README.md b/examples/cndp-frr/README.md index 7f7883e1..6b92b411 100644 --- a/examples/cndp-frr/README.md +++ b/examples/cndp-frr/README.md @@ -1,21 +1,20 @@ # CNDP-FRR Demo -This directory shows how to run a simple example of CNDP working with FRR. Two clients -reside in two different networks are interconnected via simple OSPF vRouters. Both routers -are running cnet+frr. +This directory shows how to run a simple example of CNDP working with FRR. Two +clients reside in two different networks are interconnected via simple OSPF +vRouters. Both routers are running cnet+frr. ![CNDP FRR example](./images/cndp-frr-overview.png) -> **_NOTE:_** This is not a performance optimized demo. -> **_NOTE:_** All container interfaces in this example are veth interfaces. +> **_NOTE:_** This is not a performance optimized demo. **_NOTE:_** All +> container interfaces in this example are veth interfaces. -This example loads a custom BPF program on the cndp-frr1 and the cndp-frr2 -veth interfaces to filter UDP traffic to CNDP and all other traffic to the -kernel. As the ethtool filtering capability cannot be used with this type -of interface. +This example loads a custom BPF program on the cndp-frr1 and the cndp-frr2 veth +interfaces to filter UDP traffic to CNDP and all other traffic to the kernel. As +the ethtool filtering capability cannot be used with this type of interface. > **_NOTE:_** CNDP is using the pinned map feature to access an xskmap loaded -through an xdp program with xdp-loader. +> through an xdp program with xdp-loader. The flow of traffic is shown in the diagram below: @@ -23,8 +22,8 @@ The flow of traffic is shown in the diagram below: ## 1. Build cndp-frr image -If you wish to build the CNDP-FRR docker images locally then in the top level directory -of this repo run: +If you wish to build the CNDP-FRR docker images locally then in the top level +directory of this repo run: ```cmd [root@nfvsdn-06 cndp]# make cndp-frr-image @@ -172,6 +171,7 @@ Start FRR ``` ## 8. Check FRR settings + ### cndp-frr1 settings Check configuration with vtysh. diff --git a/examples/cndp-frr/docker/frr-cfgs/90-routing-sysctl.conf b/examples/cndp-frr/docker/frr-cfgs/90-routing-sysctl.conf index 758bcf4b..d040e025 100644 --- a/examples/cndp-frr/docker/frr-cfgs/90-routing-sysctl.conf +++ b/examples/cndp-frr/docker/frr-cfgs/90-routing-sysctl.conf @@ -3,4 +3,3 @@ # Enable packet forwarding # net.ipv4.conf.all.forwarding=1 - diff --git a/examples/cndpfwd/l3-fwd.c b/examples/cndpfwd/l3-fwd.c index f67bd912..882e6646 100644 --- a/examples/cndpfwd/l3-fwd.c +++ b/examples/cndpfwd/l3-fwd.c @@ -37,7 +37,7 @@ l3fwd_fib_populate(struct fwd_info *fwd, struct cne_fib *fib) uint64_t nexthop; int tx_port; - /* Parse the comma seperated FIB entry */ + /* Parse the comma separated FIB entry */ if (cne_strtok(fwd->fib_rules[i], ",", entry, cne_countof(entry)) != 3) CNE_ERR_RET("invalid number of fields for entry [orange]%u[]\n", i); diff --git a/examples/cndpfwd/main.h b/examples/cndpfwd/main.h index 36623105..82eaae0d 100644 --- a/examples/cndpfwd/main.h +++ b/examples/cndpfwd/main.h @@ -193,7 +193,7 @@ int hsfwd_test(jcfg_lport_t *lport, struct fwd_info *fwd); * @param type * The string mode type used to compare to known modes * @return - * The index value of the mode or UNKNOW value is returned. + * The index value of the mode or UNKNOWN value is returned. */ static inline uint8_t get_app_mode(const char *type) @@ -238,7 +238,7 @@ get_app_mode(const char *type) * @param type * The string packet API type used to compare to known modes * @return - * The index value of the mode or UNKNOW value is returned. + * The index value of the mode or UNKNOWN value is returned. */ static inline uint8_t get_pkt_api(const char *type) diff --git a/examples/cnet-graph/cnet-graph.c b/examples/cnet-graph/cnet-graph.c index faf7618b..3974bc62 100644 --- a/examples/cnet-graph/cnet-graph.c +++ b/examples/cnet-graph/cnet-graph.c @@ -437,7 +437,7 @@ __on_exit(int val, void *arg, int exit_type) break; default: - cne_printf_pos(99, 1, "\n>>> [cyan]Unknow Exit type %d[]\n", exit_type); + cne_printf_pos(99, 1, "\n>>> [cyan]Unknown Exit type %d[]\n", exit_type); break; } my_quit(ci); diff --git a/examples/cnet-quic/README.md b/examples/cnet-quic/README.md index 8e2cbe9d..033b92f6 100644 --- a/examples/cnet-quic/README.md +++ b/examples/cnet-quic/README.md @@ -2,26 +2,30 @@ ## Overview -The example application links with the quicly stack to provide a simple PoC for QUIC and the CNET -UDP stack. The packets are copied from/to quicly library and will effect performance, but the goal -is to see if CNET interoperates with a QUIC stack. +The example application links with the quicly stack to provide a simple PoC for +QUIC and the CNET UDP stack. The packets are copied from/to quicly library and +will effect performance, but the goal is to see if CNET interoperates with a +QUIC stack. -The CNET stack is collecting and processing UDP frames for a given UDP destination port address 4433. -The normal port address for QUIC is 433, but for this test we are going to use 4433 instead. +The CNET stack is collecting and processing UDP frames for a given UDP +destination port address 4433. The normal port address for QUIC is 433, but for +this test we are going to use 4433 instead. -Use two machines to make it easy to setup and configure, plus connect the machines back to back with a cable. +Use two machines to make it easy to setup and configure, plus connect the +machines back to back with a cable. ## Remote machine setup, this machine will not run CNDP, but use the quicly example applications -Setup the interface connected to the other machine, use your own netdev interface name +Setup the interface connected to the other machine, use your own netdev +interface name -``` console +```console % sudo ifconfig ens260f0 198.18.0.3/24 up ``` ## Local machine setup, this machine will run CNDP/CNET/quicly -``` console +```console % sudo apt install libssl-dev % git clone https://github.com/h2o/quicly @@ -32,10 +36,10 @@ Setup the interface connected to the other machine, use your own netdev interfac % make ``` -> Note: Plus read the quicly/README.md file for more information. -> Clone and build picotls +> Note: Plus read the quicly/README.md file for more information. Clone and +> build picotls -``` console +```console % git clone https://github.com/h2o/picotls % git submodule init @@ -44,42 +48,44 @@ Setup the interface connected to the other machine, use your own netdev interfac > Build using cmake: -``` console +```console % cmake . % make ``` -> Plus read the picotls/README.md file for more information. -> Clone CNDP and build it. +> Plus read the picotls/README.md file for more information. Clone CNDP and +> build it. -``` console +```console % cd cndp % vi meson_options.txt ``` -Edit the two options quicly_path and picotls_path to point to quickly and picotls directories. The -paths must be absolute paths. +Edit the two options quicly_path and picotls_path to point to quickly and +picotls directories. The paths must be absolute paths. -CNDP should find the quicly and picotls directories along with the libraries needed to build the -the example in CNDP. +CNDP should find the quicly and picotls directories along with the libraries +needed to build the the example in CNDP. -``` console +```console % make rebuild-install ``` ## Running CNDP example -Edit the cndp/examples/quic.jsonc file to add your interfaces and other machine specific information. +Edit the cndp/examples/quic.jsonc file to add your interfaces and other machine +specific information. -``` console +```console % cd cndp % sudo ifconfig enp94s0f0 198.18.0.2/24 up % sudo ethtool -N enp94s0f0 flow-type udp4 action 11 # must match the qid in the jsonc file. % -% ./tools/rcndp cnet-quic -c examples/cnet-quic/quic.jsonc -- -c examples/cnet-quic/server.crt -k examples/cnet-quic/server.key 192.168.0.2 4433 +% ./tools/rcndp cnet-quic -c examples/cnet-quic/quic.jsonc -- -c examples/cnet-quic/server.crt \ + -k examples/cnet-quic/server.key 192.168.0.2 4433 ``` -``` console +```console Startup output look something like this: *** quic-echo, PID: 57482 lcore: 10 (initialize_graph : 110) INFO: Graph Name: 'cnet_1' @@ -91,22 +97,23 @@ CNDP-cli:/> A number of commands are available at the CLI prompt. -``` console +```console CNDP-cli:/> ls # list the current directory cnet and sbin contain commands CNDP-cli:/> route # display the current routing table -CNDP-cli:/> arp # display the currect ARP table from the host +CNDP-cli:/> arp # display the current ARP table from the host CNDP-cli:/> ifs # display the current interfaces configured for CNET CNDP-cli:/> pcb # display the current Protocol Control Block information ``` ## Quick test using quicly/cli command -``` console +```console % ./cli 198.18.0.2 4433 # 198.18.0.2 is the CNDP interface address. packets-received: 5, packets-decryption-failed: 0, packets-sent: 3, packets-lost: 0, ack-received: 2, late-acked: 0, bytes-received: 1760, bytes-sent: 1417, srtt: 1 -% ./cli -p /main.jpg 198.18.0.2 4433 # will grap the assets/main.jpg file and dump to stdout. +% ./cli -p /main.jpg 198.18.0.2 4433 # will grep the assets/main.jpg file and dump to stdout. `` The command will contact the quicly stack on the other machine and report back complete or transfer the requested file. +``` diff --git a/examples/cnet-quic/cnet-quic.c b/examples/cnet-quic/cnet-quic.c index 4cafa8c2..f2b8acaa 100644 --- a/examples/cnet-quic/cnet-quic.c +++ b/examples/cnet-quic/cnet-quic.c @@ -231,7 +231,7 @@ __on_exit(int val, void *arg, int exit_type) break; default: - cne_printf_pos(99, 1, "\n>>> [cyan]Unknow Exit type %d[]\n", exit_type); + cne_printf_pos(99, 1, "\n>>> [cyan]Unknown Exit type %d[]\n", exit_type); break; } my_quit(ci); diff --git a/examples/dlb_test/README.md b/examples/dlb_test/README.md index a78b9d76..82485ddc 100644 --- a/examples/dlb_test/README.md +++ b/examples/dlb_test/README.md @@ -1,4 +1,4 @@ -#Example CNDP DLB Test Example +# Example CNDP DLB Test Example ## Overview @@ -6,26 +6,27 @@ The example code uses the Intel's Dynamic Load Balancer (DLB) device formerly known as Hardware Queue Manager (HQM) to load balance the packets over given number of workers cores. It uses an externally linked libdlb user space library developed by Intel. A producer core receives packets from the NIC and enqueues -them in the DLB. Worker/s dequeue them and re-enqueue them into DLB from which -a consumer core dequeues them and transmits them through the NIC. +them in the DLB. Worker/s dequeue them and re-enqueue them into DLB from which a +consumer core dequeues them and transmits them through the NIC. ## Install DLB driver -Pull the latest libdlb source code from: https://01.org/group/37165/downloads +Pull the latest libdlb source code from: The tarball contains a DLB driver and libdlb (user space library). Make sure to install graphviz: $ apt-get install graphviz -Follow the instructions from the extracted tarball in docs/DLB_Driver_User_Guide.pdf -to install the DLB driver and library. +Follow the instructions from the extracted tarball in +docs/DLB_Driver_User_Guide.pdf to install the DLB driver and library. ## Copy the library into /usr/local/lib/x86_64-linux-gnu + $ cp libdlb.so /usr/local/lib/x86_64-linux-gnu/ && ldconfig ## Copy the header file into /usr/local/include -Create a directory named dlb and copy all the header files from -$BASE_DLB_DIR/libdlb*.h into /usr/local/include/dlb -CNDP will then link the library to the app if added as a dependency in the -example's meson file - deps += [libdlb] + +Create a directory named dlb and copy all the header files from +$BASE_DLB_DIR/libdlb\*.h into /usr/local/include/dlb CNDP will then link the +library to the app if added as a dependency in the example's meson file deps += +\[libdlb\] diff --git a/examples/dlb_test/meson.build b/examples/dlb_test/meson.build index a61ab235..94b31ace 100644 --- a/examples/dlb_test/meson.build +++ b/examples/dlb_test/meson.build @@ -19,4 +19,3 @@ if dlb_dep.found() else message('DLB test build missing library') endif - diff --git a/examples/ibroker/meson.build b/examples/ibroker/meson.build index 961e6b84..32e22724 100644 --- a/examples/ibroker/meson.build +++ b/examples/ibroker/meson.build @@ -10,4 +10,3 @@ broker = executable('ibroker', c_args: cflags, install: true, dependencies: deps) - diff --git a/examples/l3fwd-graph/fwd.c b/examples/l3fwd-graph/fwd.c index 87823bde..96cd6332 100644 --- a/examples/l3fwd-graph/fwd.c +++ b/examples/l3fwd-graph/fwd.c @@ -309,7 +309,7 @@ __on_exit(int val, void *arg, int exit_type) break; default: - cne_printf_pos(99, 1, "\n>>> [cyan]Unknow Exit type %d[]\n", exit_type); + cne_printf_pos(99, 1, "\n>>> [cyan]Unknown Exit type %d[]\n", exit_type); break; } fflush(stdout); diff --git a/examples/phil/phil.c b/examples/phil/phil.c index 57d06c31..16b1541b 100644 --- a/examples/phil/phil.c +++ b/examples/phil/phil.c @@ -34,7 +34,7 @@ whether they think quick (or shallow...) or long. The drawback is that the faster thinkers get to wait more for accessing the resource. The claim-based solution is addressing this by letting the faster thinkers access the resource as long as it is not claimed by another philosopher (in which case the -requestor still has to wait until the other philosopher has gotten a chance to +requester still has to wait until the other philosopher has gotten a chance to use the resource). INCLUDE FILES: N/A diff --git a/examples/vpp-plugin/README.md b/examples/vpp-plugin/README.md index dfc04b55..5ca737dd 100644 --- a/examples/vpp-plugin/README.md +++ b/examples/vpp-plugin/README.md @@ -4,8 +4,8 @@ The "cndp" directory contains code which should be copied to src/plugins within the VPP software repo. Before building the plugin, you should ensure that CNDP -is installed in a location which is searched by the compiler/linker. Do this -by building CNDP normally, then install with "sudo CNE_DEST_DIR=/ make install". +is installed in a location which is searched by the compiler/linker. Do this by +building CNDP normally, then install with "sudo CNE_DEST_DIR=/ make install". ## Known limitations @@ -17,21 +17,23 @@ using VPP version 22.02, they should be set to 0. The max number of devices supported right now is 6. This can be increased by increasing #define CNDP_MAX_DEVS 6 in cndp.h -The max number of queues that can be configured for the single threaded -VPP implementation is 30, this is hard coded in cndp.h and can be changed. +The max number of queues that can be configured for the single threaded VPP +implementation is 30, this is hard coded in cndp.h and can be changed. If using multiple workers with the CNDP plugin there are a few limitations: + - The number of threads must match the number of queues. - The max number of threads/queues supported is 4. These queue limitations are related to the number of buffers supported in VPP. -To support more lports make sure to configure the number of buffers per NUMA in the startup.conf: +To support more lports make sure to configure the number of buffers per NUMA in +the startup.conf: -``` +```text buffers { ## Increase number of buffers allocated, needed only in scenarios with ## large number of interfaces and worker threads. Value is per numa node. - ## Default is 16384 (8192 if running unpriviledged) + ## Default is 16384 (8192 if running unprivileged) buffers-per-numa 128000 ## Size of buffer data area @@ -45,33 +47,38 @@ Please also make sure to modify the #define CNDP_MAX_DEVS 6 and #define CNDP_MAX ``` ## RSS configuration -Take note of what your interface is configured to use before modifying the configuration. +Take note of what your interface is configured to use before modifying the +configuration. + +```sh +ethtool -x ens786f2 ``` -$ ethtool -x ens786f2 -``` -Modify the RSS configuration to feed the queues you would like to use with the CNDP plugin -``` -$ ethtool -X ens786f2 equal 2 start 10 + +Modify the RSS configuration to feed the queues you would like to use with the +CNDP plugin + +```sh +ethtool -X ens786f2 equal 2 start 10 ``` ## Run VPP with CNDP plugin -Once CNDP is installed, grab the VPP source code, copy the plugin, and build -VPP normally, e.g. +Once CNDP is installed, grab the VPP source code, copy the plugin, and build VPP +normally, e.g. Be sure to checkout version 21.01. -``` +```sh make install-dep make install-ext-dep make build-release ``` -Run vpp, then create a CNDP interface using the netdev name, and assign an -IP address, e.g. +Run vpp, then create a CNDP interface using the netdev name, and assign an IP +address, e.g. -``` +```sh make run-release vpp# create interface cndp name ens786f2 qs 1 offset 10 vpp# set interface ip address ens786f2 48.0.0.154/24 @@ -79,30 +86,34 @@ vpp# set interface state ens786f2 up ``` To trace packets through the cndp-input node, use: -``` + +```sh trace add cndp-input 10 ... traffic running ... show trace ``` To set a static arp entry use: -``` + +```sh set ip neighbor ens786f2 48.0.0.1 3c:fd:fe:9c:e7:22 ``` To enable/disable pcap capture use: -``` + +```sh pcap trace tx intfc ens786f2 file new.pcap pcap trace off ``` ## Examples startup.conf -There's an issue with a single worker threads that needs further investigation for the -configuration below. No workers or workers > 1 works fine. +There's an issue with a single worker threads that needs further investigation +for the configuration below. No workers or workers > 1 works fine. A simple startup.conf would be: -``` + +```text unix { nodaemon interactive @@ -147,11 +158,10 @@ cpu { ``` where setup.txt is -``` + +```sh create interface cndp name ens786f2 qs 2 offset 10 set interface ip address ens786f2 48.0.0.154/24 set interface state ens786f2 up set ip neighbor ens786f2 48.0.0.1 3c:fd:fe:9c:e7:22 ``` - - diff --git a/examples/vpp-plugin/cndp/setup.txt b/examples/vpp-plugin/cndp/setup.txt index 64116d76..b1ed6afe 100644 --- a/examples/vpp-plugin/cndp/setup.txt +++ b/examples/vpp-plugin/cndp/setup.txt @@ -2,4 +2,3 @@ create interface cndp name ens786f2 qs 2 offset 10 set interface ip address ens786f2 48.0.0.154/24 set interface state ens786f2 up set ip neighbor ens786f2 48.0.0.1 3c:fd:fe:9c:e7:22 - diff --git a/lang/go/bindings/cne/packet.go b/lang/go/bindings/cne/packet.go index e5819056..8c02f2c5 100644 --- a/lang/go/bindings/cne/packet.go +++ b/lang/go/bindings/cne/packet.go @@ -24,10 +24,10 @@ ipv6_phdr_cksum(const struct cne_ipv6_hdr *hdr) */ import "C" import ( - "fmt" - "unsafe" "encoding/binary" + "fmt" "hash/fnv" + "unsafe" ) type Packet C.pktmbuf_t // Packet is the interface type for C.pktmbuf_t structure @@ -312,7 +312,7 @@ func GetHash(pkt *Packet) uint32 { copy(t3Tuple[IPv6AddrLen:], ipv6.DstAddr[:IPv6AddrLen]) t3Tuple = append(t3Tuple, ipv6.Proto) } - var hash uint32 + var hash uint32 if ipv4 != nil || ipv6 != nil { h := fnv.New32a() h.Write(t3Tuple) @@ -320,4 +320,3 @@ func GetHash(pkt *Packet) uint32 { } return hash } - diff --git a/lang/go/bindings/examples/distributor/README.md b/lang/go/bindings/examples/distributor/README.md index d9ebde6f..3554f391 100644 --- a/lang/go/bindings/examples/distributor/README.md +++ b/lang/go/bindings/examples/distributor/README.md @@ -6,35 +6,45 @@ A example application to distribute packets to workers. This example contains 1 rx thread, 1 tx thread, and 4 worker threads. -The rx thread receives packets, and then passes one packet to a worker via lockless ring each time. +The rx thread receives packets, and then passes one packet to a worker via +lockless ring each time. -The worker thread dequeues packets from its lockless ring and swaps packets' MAC address, and enqueues processed packets to another lockless ring shared by all workers. +The worker thread dequeues packets from its lockless ring and swaps packets' MAC +address, and enqueues processed packets to another lockless ring shared by all +workers. The tx thread reads packets from the lockless ring to send. ## Config + - Configure an ethtool filter to steer packets to a specific queue. + ```bash sudo ethtool -N flow-type udp4 dst-port action sudo ip link set dev up ``` -- Edit `config.jsonc`, make sure the `lports` section has the same netdev name and queue id for which the ethtool filter is configured. Make sure the `threads` section has the correct `lports` configured + +- Edit `config.jsonc`, make sure the `lports` section has the same netdev name + and queue id for which the ethtool filter is configured. Make sure the + `threads` section has the correct `lports` configured ## Usage + ```bash An example to distribute packets via lockless rings between worker threads Usage: - distributor -c config.jsonc [flags] +distributor -c config.jsonc [flags] Flags: - -c, --config string path to configuration file - -h, --help help for distributor - -V, --verbose verbose output - -v, --version version for distributor +-c, --config string path to configuration file +-h, --help help for distributor +-V, --verbose verbose output +-v, --version version for distributor ``` ## Run + ```bash ./run_distributor -c config.jsonc -``` \ No newline at end of file +``` diff --git a/lang/go/bindings/examples/sampling/doc.go b/lang/go/bindings/examples/sampling/doc.go index eec9756a..e87da678 100644 --- a/lang/go/bindings/examples/sampling/doc.go +++ b/lang/go/bindings/examples/sampling/doc.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2023 Intel Corporation -// Brief Description about Sampling Go Apllication +// Brief Description about Sampling Go Application // 1. Go Sampling Application maintains. // Context information using 3 tuples (src ip, dst ip, protocol) // of a receiving packet. One of the pieces of information included in this context is diff --git a/lang/go/stats/prometheus/README.md b/lang/go/stats/prometheus/README.md index 0f1ee16b..3b0e1113 100644 --- a/lang/go/stats/prometheus/README.md +++ b/lang/go/stats/prometheus/README.md @@ -1,8 +1,8 @@ -### Install the prometheus go client library +# Install the prometheus go client library You can install the prometheus, promauto, and promhttp libraries by running: -``` +```sh go get github.com/prometheus/client_golang/prometheus go get github.com/prometheus/client_golang/prometheus/promauto go get github.com/prometheus/client_golang/prometheus/promhttp @@ -10,18 +10,19 @@ go get github.com/prometheus/client_golang/prometheus/promhttp To run the cndp prometheus client just run: -``` +```sh go run prometheus.go ``` You can then access the metrics using: -``` +```sh curl http://localhost:2112/metrics ``` -### Metrics naming best practices +## Metrics naming best practices The best practices for naming metrics with prometheus is explained here: -https://sysdig.com/blog/prometheus-metrics/ -https://prometheus.io/docs/practices/naming/ \ No newline at end of file + +- +- diff --git a/lang/go/tools/pkgs/etimers/etimers.go b/lang/go/tools/pkgs/etimers/etimers.go index 3a098044..182e04b2 100644 --- a/lang/go/tools/pkgs/etimers/etimers.go +++ b/lang/go/tools/pkgs/etimers/etimers.go @@ -120,7 +120,7 @@ func (te *EventTimers) doTimeout() { // Process an action when a timer event happens func (te *EventTimers) doAction(a *EventAction) { - // Covert the action to a string for the switch below + // Convert the action to a string for the switch below action := strings.ToLower(a.Action) te.lock.Lock() diff --git a/lang/rs/Cargo.toml b/lang/rs/Cargo.toml index 1f8b3276..535bda21 100644 --- a/lang/rs/Cargo.toml +++ b/lang/rs/Cargo.toml @@ -13,4 +13,3 @@ members = [ [profile.release] lto = true - diff --git a/lang/rs/README.md b/lang/rs/README.md index 2cb67c41..160c2997 100644 --- a/lang/rs/README.md +++ b/lang/rs/README.md @@ -2,71 +2,100 @@ Rust bindings for CNDP CNE C library. -Following are the steps required to build Rust bindings, high level APIs and example applications. +Following are the steps required to build Rust bindings, high level APIs and +example applications. -1. Build CNDP. Refer CNDP [INSTALL.md](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md) +1. Build CNDP. Refer CNDP + [INSTALL.md](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md) -2. Install CNDP. +1. Install CNDP. - 1. To install CNDP in the directory from where CNDP was built, use the command `make install`. + 1. To install CNDP in the directory from where CNDP was built, use the + command `make install`. - 2. To install CNDP in a system wide path, use the command `sudo CNE_DEST_DIR=/ make install`. - This will install CNDP under `/usr/local` directory. + 1. To install CNDP in a system wide path, use the command + `sudo CNE_DEST_DIR=/ make install`. This will install CNDP under + `/usr/local` directory. - 3. Append *PKG_CONFIG_PATH* environment variable to directory containing CNDP pkg-config file. - This step is optional. This is required if pkg-config is used to resolve CNDP dependencies - when building applications/libraries. + 1. Append *PKG_CONFIG_PATH* environment variable to directory containing CNDP + pkg-config file. This step is optional. This is required if pkg-config is + used to resolve CNDP dependencies when building applications/libraries. - `export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig` + `export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig` - 4. Append LD_LIBRARY_PATH environment variable with CNDP library path. + 1. Append LD_LIBRARY_PATH environment variable with CNDP library path. - Ubuntu: `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu` - Fedora: `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64` + Ubuntu: + `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu` + Fedora: `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64` -3. Install [Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html). Rust version >= 1.63.0 is required. - If you have a previous version of Rust installed via rustup, run `rustup update stable` to get latest version. +1. Install + [Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html). + Rust version >= 1.63.0 is required. If you have a previous version of Rust + installed via rustup, run `rustup update stable` to get latest version. -4. Install dependencies needed by rust bindgen tool. Please refer rust bindgen [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) for details. +1. Install dependencies needed by rust bindgen tool. Please refer rust bindgen + [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) + for details. - Ubuntu: `sudo apt-get install llvm-dev libclang-dev clang` - Fedora: `dnf install clang-devel` + Ubuntu: `sudo apt-get install llvm-dev libclang-dev clang` Fedora: + `dnf install clang-devel` -5. `cd lang/rs` +1. `cd lang/rs` + +1. Build: -6. Build: 1. If CNDP is installed in a system wide path run `cargo build`. - 2. If CNDP is installed in a custom location run `CNDP_INSTALL_PATH= cargo build`. - Here path refers to the absolute path of top-level directory where CNDP is installed. + 1. If CNDP is installed in a custom location run + `CNDP_INSTALL_PATH= cargo build`. Here path refers to the absolute + path of top-level directory where CNDP is installed. -7. Execute tests. - 1. Configure ethtool filter and fwd.jsonc file referred in the script similar to [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) - 2. Run CNE tests: `cd apis/cne`. Execute [./run_cne_test.sh](./run_cne_test.sh). +1. Execute tests. -8. Run example applications. - 1. To get best performance build in release mode: `cargo build --release`. - 2. Configure ethtool filter and fwd.jsonc file referred in the script similar to [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) - 3. Refer the script for details on command line options which can be passed when running the script. - If no command line options are passed, the script will be executed with default values used in the script. - 4. Run loopback example: `cd apis/cne`. Execute [./run_loopback.sh](./run_loopback.sh) - 5. Run echo server example: `cd examples/echo_server`. Execute [./run_echo_server.sh](./run_echo_server.sh) - 6. Run packet forward example: `cd examples/fwd`. Execute [./run_fwd.h](./run_fwd.h) `` `[[drop | rx-only], tx-only, [fwd | forward], [lb | loopback]]` + 1. Configure ethtool filter and fwd.jsonc file referred in the script similar + to + [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) + 1. Run CNE tests: `cd apis/cne`. Execute + [./run_cne_test.sh](./run_cne_test.sh). -9. To generate high level API crate documentation execute [./generate_cne_docs.sh](./generate_cne_docs.sh) +1. Run example applications. + + 1. To get best performance build in release mode: `cargo build --release`. + 1. Configure ethtool filter and fwd.jsonc file referred in the script similar + to + [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) + 1. Refer the script for details on command line options which can be passed + when running the script. If no command line options are passed, the script + will be executed with default values used in the script. + 1. Run loopback example: `cd apis/cne`. Execute + [./run_loopback.sh](./run_loopback.sh) + 1. Run echo server example: `cd examples/echo_server`. Execute + [./run_echo_server.sh](./run_echo_server.sh) + 1. Run packet forward example: `cd examples/fwd`. Execute + [./run_fwd.h](./run_fwd.h) `` + `[[drop | rx-only], tx-only, [fwd | forward], [lb | loopback]]` + +1. To generate high level API crate documentation execute + [./generate_cne_docs.sh](./generate_cne_docs.sh) ## Wireguard with CNDP -Wireguard user space (implemented in Rust) uses CNDP to send and receive packets from/to user space. +Wireguard user space (implemented in Rust) uses CNDP to send and receive packets +from/to user space. -1. Clone Wireguard Rust repo : `git clone https://github.com/WireGuard/wireguard-rs.git` +1. Clone Wireguard Rust repo : + `git clone https://github.com/WireGuard/wireguard-rs.git` -2. `cd wireguard-rs` +1. `cd wireguard-rs` -3. Checkout the version tested with CNDP: `git checkout 7d84ef9` +1. Checkout the version tested with CNDP: `git checkout 7d84ef9` -4. Apply the Wireguard CNDP patch present in [location](./wireguard/patch). Ignore the whitespace warning errors. +1. Apply the Wireguard CNDP patch present in [location](./wireguard/patch). + Ignore the whitespace warning errors. `git am *.patch` -5. Build Wireguard with CNDP: `cargo build --release` -6. In Wireguard repo, refer to *src/platform/linux/cndp/README.md* file under usage section to configure and start Wireguard with CNDP. +1. Build Wireguard with CNDP: `cargo build --release` + +1. In Wireguard repo, refer to *src/platform/linux/cndp/README.md* file under + usage section to configure and start Wireguard with CNDP. diff --git a/lang/rs/apis/cne/README.md b/lang/rs/apis/cne/README.md index bb1f021f..438130c1 100644 --- a/lang/rs/apis/cne/README.md +++ b/lang/rs/apis/cne/README.md @@ -4,44 +4,57 @@ High-level Rust API interface for CNDP C library. Following are the steps required to build this library and run test cases. -1. Build CNDP. Refer CNDP [INSTALL.md](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md) +1. Build CNDP. Refer CNDP + [INSTALL.md](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md) -2. Install CNDP. +1. Install CNDP. - 1. To install CNDP in the directory from where CNDP was built, use the command `make install`. - 2. To install CNDP in a system wide path, use the command `sudo CNE_DEST_DIR=/ make install`. - This will install CNDP under `/usr/local` directory. - 3. Append *PKG_CONFIG_PATH* environment variable to directory containing CNDP pkg-config file. - This step is optional. This is required if pkg-config is used to resolve CNDP dependencies - when building applications /libraries. + 1. To install CNDP in the directory from where CNDP was built, use the + command `make install`. + 1. To install CNDP in a system wide path, use the command + `sudo CNE_DEST_DIR=/ make install`. This will install CNDP under + `/usr/local` directory. + 1. Append *PKG_CONFIG_PATH* environment variable to directory containing CNDP + pkg-config file. This step is optional. This is required if pkg-config is + used to resolve CNDP dependencies when building applications /libraries. - ​ `export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig` + `export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig` - 4. Append LD_LIBRARY_PATH environment variable with CNDP library path. + 1. Append LD_LIBRARY_PATH environment variable with CNDP library path. - ​ Ubuntu:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu` - ​ Fedora:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64` + Ubuntu:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu` + Fedora:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64` -3. This crate depends on cne-sys crate which uses Rust bindgen tool. Install dependencies needed by rust bindgen tool. Please refer rust bindgen [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) for details. +1. This crate depends on cne-sys crate which uses Rust bindgen tool. Install + dependencies needed by rust bindgen tool. Please refer rust bindgen + [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) + for details. Ubuntu:`sudo apt-get install llvm-dev libclang-dev clang` Fedora:`dnf install clang-devel` -4. `cd lang/rs/apis/cne` +1. `cd lang/rs/apis/cne` + +1. Build CNE Rust high level crate. Rust version >= 1.63.0 is required. -5. Build CNE Rust high level crate. Rust version >= 1.63.0 is required. 1. If CNDP is installed in a system wide path run `cargo build`. - 2. If CNDP is installed in a custom location run `CNDP_INSTALL_PATH= cargo build`. - Here path refers to the absolute path of top-level directory where CNDP is installed. + 1. If CNDP is installed in a custom location run + `CNDP_INSTALL_PATH= cargo build`. Here path refers to the absolute + path of top-level directory where CNDP is installed. + +1. Configure ethtool filter and fwd.jsonc similar to + [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) -6. Configure ethtool filter and fwd.jsonc similar to [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) +1. Execute the test script [./rust_cne_test.sh](./run_cne_test.sh). Running + tests need sudo privileges. -7. Execute the test script [./rust_cne_test.sh](./run_cne_test.sh). Running tests need sudo privileges. +1. Run loopback example: -8. Run loopback example: 1. To get best performance build in release mode: `cargo build --release`. - 2. Configure ethtool filter and fwd.jsonc file referred in the script similar to [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) - 3. Refer the script for details on command line options which can be passed when running the - script. If no command line options are passed, the script will be executed with default - values used in the script. - 4. Execute [./run_loopback.sh](./run_loopback.sh). + 1. Configure ethtool filter and fwd.jsonc file referred in the script similar + to + [cndpfwd application](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md#cndpfwd) + 1. Refer the script for details on command line options which can be passed + when running the script. If no command line options are passed, the script + will be executed with default values used in the script. + 1. Execute [./run_loopback.sh](./run_loopback.sh). diff --git a/lang/rs/apis/cne/src/instance.rs b/lang/rs/apis/cne/src/instance.rs index a52cb2f3..7a7c86f4 100644 --- a/lang/rs/apis/cne/src/instance.rs +++ b/lang/rs/apis/cne/src/instance.rs @@ -128,7 +128,7 @@ impl CneInstance { /// Returns an id or error in case of failure. /// /// # Arguments - /// * `s` - Thread name to be regsitered with CNE. + /// * `s` - Thread name to be registered with CNE. /// /// # Errors /// Returns [CneError::RegisterError] if an error is encountered. diff --git a/lang/rs/bindings/cne-sys/README.md b/lang/rs/bindings/cne-sys/README.md index f390f6bb..570827df 100644 --- a/lang/rs/bindings/cne-sys/README.md +++ b/lang/rs/bindings/cne-sys/README.md @@ -4,33 +4,39 @@ Rust bindings for CNDP CNE C library. Following are the steps required to build this library and run test cases. -1. Build CNDP. Refer CNDP [INSTALL.md](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md) +1. Build CNDP. Refer CNDP + [INSTALL.md](https://github.com/CloudNativeDataPlane/cndp/blob/main/INSTALL.md) -2. Install CNDP. +1. Install CNDP. - 1. To install CNDP in the directory from where CNDP was built, use the command `make install`. - 2. To install CNDP in a system wide path, use the command `sudo CNE_DEST_DIR=/ make install`. - This will install CNDP under `/usr/local` directory. - 3. Append *PKG_CONFIG_PATH* environment variable to directory containing CNDP pkg-config file. - This step is optional. This is required if pkg-config is used to resolve CNDP dependencies - when building applications/libraries. + 1. To install CNDP in the directory from where CNDP was built, use the + command `make install`. + 1. To install CNDP in a system wide path, use the command + `sudo CNE_DEST_DIR=/ make install`. This will install CNDP under + `/usr/local` directory. + 1. Append *PKG_CONFIG_PATH* environment variable to directory containing CNDP + pkg-config file. This step is optional. This is required if pkg-config is + used to resolve CNDP dependencies when building applications/libraries. - ​ `export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig` + `export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig` - 4. Append LD_LIBRARY_PATH environment variable with CNDP library path. + 1. Append LD_LIBRARY_PATH environment variable with CNDP library path. - ​ Ubuntu:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu` - ​ Fedora:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64` + Ubuntu:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu` + Fedora:`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64` -3. Install dependencies needed by rust bindgen tool. Please refer rust bindgen [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) for details. - Ubuntu:`sudo apt-get install llvm-dev libclang-dev clang` +1. Install dependencies needed by rust bindgen tool. Please refer rust bindgen + [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) + for details. Ubuntu:`sudo apt-get install llvm-dev libclang-dev clang` Fedora:`dnf install clang-devel` -4. `cd lang/rs/bindings/cne-sys` +1. `cd lang/rs/bindings/cne-sys` + +1. Build CNE Rust bindings library. Rust version >= 1.63.0 is required. -5. Build CNE Rust bindings library. Rust version >= 1.63.0 is required. 1. If CNDP is installed in a system wide path run `cargo build` - 2. If CNDP is installed in a custom location run `CNDP_INSTALL_PATH= cargo build`. - Here path refers to the absolute path of top-level directory where CNDP is installed. + 1. If CNDP is installed in a custom location run + `CNDP_INSTALL_PATH= cargo build`. Here path refers to the absolute + path of top-level directory where CNDP is installed. -6. Run tests: `cargo test` +1. Run tests: `cargo test` diff --git a/lang/rs/examples/echo_server/Cargo.toml b/lang/rs/examples/echo_server/Cargo.toml index 093d9d6c..5cee29d1 100644 --- a/lang/rs/examples/echo_server/Cargo.toml +++ b/lang/rs/examples/echo_server/Cargo.toml @@ -16,4 +16,3 @@ ctrlc = "3.2.2" env_logger = "0.9.0" log = "0.4" pnet ="0.30.0" - diff --git a/lang/rs/examples/echo_server/src/main.rs b/lang/rs/examples/echo_server/src/main.rs index d23a3566..e657637a 100644 --- a/lang/rs/examples/echo_server/src/main.rs +++ b/lang/rs/examples/echo_server/src/main.rs @@ -26,7 +26,7 @@ use pnet::packet::ethernet::MutableEthernetPacket; // to required n/w interface. The performance of CNE/libpnet echo server can be checked // at load generator end by observing packets per sec (pps) of echoed packets. // An example script run.sh is provided to build and run the application. Please refer -// the script for descrption on how to run the application with command line parameters. +// the script for description on how to run the application with command line parameters. fn main() { // Parse command line arguments. let matches = App::new("echo_server") diff --git a/lib/cnet/chnl/chnl_priv.h b/lib/cnet/chnl/chnl_priv.h index 1a6c3884..43982963 100644 --- a/lib/cnet/chnl/chnl_priv.h +++ b/lib/cnet/chnl/chnl_priv.h @@ -101,7 +101,7 @@ enum { * Return the current channel state value * * @param ch - * The channel stucture pointer + * The channel structure pointer * @return * Channel state or _NOSTATE is returned for invalid channel */ diff --git a/lib/cnet/chnl/cnet_chnl.c b/lib/cnet/chnl/cnet_chnl.c index 3e46cbd1..8d6c5a57 100644 --- a/lib/cnet/chnl/cnet_chnl.c +++ b/lib/cnet/chnl/cnet_chnl.c @@ -725,7 +725,7 @@ sendit(int cd, struct sockaddr *sa, pktmbuf_t **mbufs, uint16_t nb_mbufs) return __errno_set(EFAULT); if (chnl_state_tst(ch, _CHNL_FREE) || is_set(ch->ch_state, _CANTSENDMORE)) - CNE_ERR_RET_VAL(__errno_set(EPIPE), "State is free or cant sent more\n"); + CNE_ERR_RET_VAL(__errno_set(EPIPE), "State is free or can't sent more\n"); if (nb_mbufs == 0) return 0; diff --git a/lib/cnet/icmp6/icmp6.h b/lib/cnet/icmp6/icmp6.h index 788f4e8d..a56b41e3 100644 --- a/lib/cnet/icmp6/icmp6.h +++ b/lib/cnet/icmp6/icmp6.h @@ -116,7 +116,7 @@ typedef struct icmp6ip_s { #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ #ifndef _KERNEL -/* the followings are for backward compatibility to old KAME apps. */ +/* the following are for backward compatibility to old KAME apps. */ #define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY #define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT #define MLD6_LISTENER_DONE MLD_LISTENER_DONE @@ -570,13 +570,13 @@ struct icmp6_filter { #endif /* _KERNEL */ #define ICMP6_FILTER_SETPASS(type, filterp) \ - (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type)&31))) + (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) #define ICMP6_FILTER_SETBLOCK(type, filterp) \ - (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type)&31))) + (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) #define ICMP6_FILTER_WILLPASS(type, filterp) \ - ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type)&31))) != 0) + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) #define ICMP6_FILTER_WILLBLOCK(type, filterp) \ - ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type)&31))) == 0) + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) /* * Variables related to this implementation diff --git a/lib/cnet/ipv4/cnet_ipv4.h b/lib/cnet/ipv4/cnet_ipv4.h index ae79419c..771823b7 100644 --- a/lib/cnet/ipv4/cnet_ipv4.h +++ b/lib/cnet/ipv4/cnet_ipv4.h @@ -70,7 +70,7 @@ struct ipv4_entry { } __cne_cache_aligned; #define IPv4(a, b, c, d) \ - ((uint32_t)(((a)&0xff) << 24) | (((b)&0xff) << 16) | (((c)&0xff) << 8) | ((d)&0xff)) + ((uint32_t)(((a) & 0xff) << 24) | (((b) & 0xff) << 16) | (((c) & 0xff) << 8) | ((d) & 0xff)) /* Internet protocol header structure */ /* Basic IPv4 packet header diff --git a/lib/cnet/sbin/cnet_ifshow.c b/lib/cnet/sbin/cnet_ifshow.c index 2d8ac8b9..dddf2dc3 100644 --- a/lib/cnet/sbin/cnet_ifshow.c +++ b/lib/cnet/sbin/cnet_ifshow.c @@ -117,7 +117,7 @@ netif_show(struct netif *netif, char *ifname) cne_printf("\n"); cne_printf("%9s[magenta]RXE[]:[red]%'16" PRIu64 "[] [magenta]TXE[]:[red]%'16" PRIu64 - "[] [magenta]MIS[]:[red]%'16" PRIu64 "[] \n", + "[] [magenta]MISS[]:[red]%'16" PRIu64 "[] \n", "", ps->ierrors, ps->oerrors, ps->imissed); } diff --git a/lib/cnet/tcp/cnet_tcp.c b/lib/cnet/tcp/cnet_tcp.c index 6ee823b4..1ec2ec11 100644 --- a/lib/cnet/tcp/cnet_tcp.c +++ b/lib/cnet/tcp/cnet_tcp.c @@ -2079,7 +2079,7 @@ _process_data(struct seg_entry *seg, struct tcb_entry *tcb __cne_unused) * every second full-sized segment is listed in [Bra89] in one * place as a SHOULD and another as a MUST. Here we unambiguously * state it is a SHOULD. We also emphasize that this is a SHOULD, - * meaning that an implementor should indeed only deviate from + * meaning that an implementer should indeed only deviate from * this requirement after careful consideration of the * implications. See the discussion of "Stretch ACK violation" * in [PAD+98] and the references therein for a discussion of diff --git a/lib/cnet/tcp/tcp_output.c b/lib/cnet/tcp/tcp_output.c index d4679222..2519a43b 100644 --- a/lib/cnet/tcp/tcp_output.c +++ b/lib/cnet/tcp/tcp_output.c @@ -64,7 +64,7 @@ tcp_output_node_process(struct cne_graph *graph __cne_unused, struct cne_node *n if (!tcb) tcb = pcb->tcb; else if (tcb != pcb->tcb) { - CNE_DEBUG("TCB chagned from [orange]%p[] --> [orange]%p[]\n", tcb, pcb->tcb); + CNE_DEBUG("TCB changed from [orange]%p[] --> [orange]%p[]\n", tcb, pcb->tcb); cnet_tcp_output(tcb); tcb = pcb->tcb; } diff --git a/lib/common/uds/meson.build b/lib/common/uds/meson.build index 1ef481a1..454a9ab3 100644 --- a/lib/common/uds/meson.build +++ b/lib/common/uds/meson.build @@ -8,4 +8,3 @@ libuds = library(libname, sources, install: true, dependencies: deps) uds = declare_dependency(link_with: libuds, include_directories: include_directories('.')) cndp_libs += uds - diff --git a/lib/core/hash/cne_hash_crc.h b/lib/core/hash/cne_hash_crc.h index 04daa05c..2e1900db 100644 --- a/lib/core/hash/cne_hash_crc.h +++ b/lib/core/hash/cne_hash_crc.h @@ -296,7 +296,7 @@ static const uint32_t crc32c_tables[8][256] = {{ // clang-format on #define CRC32_UPD(crc, n) \ - (crc32c_tables[(n)][(crc)&0xFF] ^ crc32c_tables[(n)-1][((crc) >> 8) & 0xFF]) + (crc32c_tables[(n)][(crc) & 0xFF] ^ crc32c_tables[(n)-1][((crc) >> 8) & 0xFF]) static inline uint32_t crc32c_1byte(uint8_t data, uint32_t init_val) diff --git a/lib/core/mempool/mempool.c b/lib/core/mempool/mempool.c index 1acbc473..205f62d1 100644 --- a/lib/core/mempool/mempool.c +++ b/lib/core/mempool/mempool.c @@ -20,7 +20,7 @@ #include "cne_stdio.h" // for cne_fprintf #define CACHE_FLUSHTHRESH_MULTIPLIER 1.5 -#define CALC_CACHE_FLUSHTHRESH(c) ((typeof(c))((c)*CACHE_FLUSHTHRESH_MULTIPLIER)) +#define CALC_CACHE_FLUSHTHRESH(c) ((typeof(c))((c) * CACHE_FLUSHTHRESH_MULTIPLIER)) static void mempool_add_elem(struct cne_mempool *mp, __cne_unused void *opaque, void *obj __cne_unused) diff --git a/lib/core/pktmbuf/pktmbuf_offload.h b/lib/core/pktmbuf/pktmbuf_offload.h index 8a734187..f78be661 100644 --- a/lib/core/pktmbuf/pktmbuf_offload.h +++ b/lib/core/pktmbuf/pktmbuf_offload.h @@ -8,7 +8,7 @@ /** * @file - * This file contains definiton of CNE pktmbuf structure itself, + * This file contains definition of CNE pktmbuf structure itself, * packet offload flags and some related macros. * For majority of CNDP entities, it is not recommended to include * this file directly, use include instead. diff --git a/lib/core/pktmbuf/pktmbuf_ptype.h b/lib/core/pktmbuf/pktmbuf_ptype.h index 6fffbcb9..3867ad6a 100644 --- a/lib/core/pktmbuf/pktmbuf_ptype.h +++ b/lib/core/pktmbuf/pktmbuf_ptype.h @@ -691,14 +691,14 @@ struct cne_net_hdr_lens { * one, bit 4 is selected to be used for IPv4 only. Then checking bit 4 can * determine if it is an IPV4 packet. */ -#define CNE_ETH_IS_IPV4_HDR(ptype) ((ptype)&CNE_PTYPE_L3_IPV4) +#define CNE_ETH_IS_IPV4_HDR(ptype) ((ptype) & CNE_PTYPE_L3_IPV4) /** * Check if the (outer) L3 header is IPv6. To avoid comparing IPv6 types one by * one, bit 6 is selected to be used for IPv6 only. Then checking bit 6 can * determine if it is an IPV6 packet. */ -#define CNE_ETH_IS_IPV6_HDR(ptype) ((ptype)&CNE_PTYPE_L3_IPV6) +#define CNE_ETH_IS_IPV6_HDR(ptype) ((ptype) & CNE_PTYPE_L3_IPV6) /* Check if it is a tunneling packet */ #define CNE_ETH_IS_TUNNEL_PKT(ptype) \ diff --git a/lib/core/pmds/net/tap/pmd_tap.c b/lib/core/pmds/net/tap/pmd_tap.c index 44eec20f..05b4446e 100644 --- a/lib/core/pmds/net/tap/pmd_tap.c +++ b/lib/core/pmds/net/tap/pmd_tap.c @@ -50,7 +50,7 @@ struct pmd_lport { struct tap_info *ti; /**< Pointer for tun/tap setup */ struct ether_addr eth_addr; /**< MAC address of the interface */ struct tap_rx_q *rxq; /**< Receive queue pointer */ - struct tap_tx_q *txq; /*<< Tranmit queue pointer */ + struct tap_tx_q *txq; /*<< Transmit queue pointer */ }; static inline pktmbuf_t * diff --git a/lib/include/net/cne_ip.h b/lib/include/net/cne_ip.h index 0a53d4d0..3ed1e9d8 100644 --- a/lib/include/net/cne_ip.h +++ b/lib/include/net/cne_ip.h @@ -46,7 +46,7 @@ struct cne_ipv4_hdr { /** Create IPv4 address */ #define CNE_IPV4(a, b, c, d) \ - ((uint32_t)(((a)&0xff) << 24) | (((b)&0xff) << 16) | (((c)&0xff) << 8) | ((d)&0xff)) + ((uint32_t)(((a) & 0xff) << 24) | (((b) & 0xff) << 16) | (((c) & 0xff) << 8) | ((d) & 0xff)) /** Maximal IPv4 packet length (including a header) */ #define CNE_IPV4_MAX_PKT_LEN 65535 @@ -470,10 +470,11 @@ cne_ipv6_udptcp_cksum_verify(const struct cne_ipv6_hdr *ipv6_hdr, const void *l4 #define CNE_IPV6_FRAG_USED_MASK (CNE_IPV6_EHDR_MF_MASK | CNE_IPV6_EHDR_FO_MASK) -#define CNE_IPV6_GET_MF(x) ((x)&CNE_IPV6_EHDR_MF_MASK) +#define CNE_IPV6_GET_MF(x) ((x) & CNE_IPV6_EHDR_MF_MASK) #define CNE_IPV6_GET_FO(x) ((x) >> CNE_IPV6_EHDR_FO_SHIFT) -#define CNE_IPV6_SET_FRAG_DATA(fo, mf) (((fo)&CNE_IPV6_EHDR_FO_MASK) | ((mf)&CNE_IPV6_EHDR_MF_MASK)) +#define CNE_IPV6_SET_FRAG_DATA(fo, mf) \ + (((fo) & CNE_IPV6_EHDR_FO_MASK) | ((mf) & CNE_IPV6_EHDR_MF_MASK)) struct cne_ipv6_fragment_ext { uint8_t next_header; /**< Next header type */ diff --git a/lib/usr/app/cli/cli_cmap.c b/lib/usr/app/cli/cli_cmap.c index c493a214..9f9ec0a7 100644 --- a/lib/usr/app/cli/cli_cmap.c +++ b/lib/usr/app/cli/cli_cmap.c @@ -178,7 +178,7 @@ closest_gte(lcore_t *lc, lcore_t *sel, unsigned v, getter_fn get) /* * Makes the property returned and set by 'get'/'set' start from zero - * and increase by one for each unique value that propery has. + * and increase by one for each unique value that property has. * Ex: core id "0,1,4,5,0,1,4,5" -> "0,1,2,3,0,1,2,3" */ static void diff --git a/lib/usr/app/cli/cli_cmds.c b/lib/usr/app/cli/cli_cmds.c index 12a9f843..af167737 100644 --- a/lib/usr/app/cli/cli_cmds.c +++ b/lib/usr/app/cli/cli_cmds.c @@ -598,7 +598,7 @@ static int mkdir_cmd(int argc, char **argv) { if (argc != 2) { - cne_printf("Must have at least one path/driectory\n"); + cne_printf("Must have at least one path/directory\n"); return -1; } diff --git a/lib/usr/app/cli/cli_file.h b/lib/usr/app/cli/cli_file.h index efde9453..d235716f 100644 --- a/lib/usr/app/cli/cli_file.h +++ b/lib/usr/app/cli/cli_file.h @@ -58,7 +58,7 @@ enum { * Test to see if a CLI node is a file type * * @param opt - * The option flags read/write/excutable/... + * The option flags read/write/executable/... * @param cmpflags * The option flags to compare with * @return diff --git a/lib/usr/app/cli/cli_lib.rst b/lib/usr/app/cli/cli_lib.rst index 1515c1ae..94dbddde 100644 --- a/lib/usr/app/cli/cli_lib.rst +++ b/lib/usr/app/cli/cli_lib.rst @@ -585,7 +585,7 @@ Understanding the CLI system ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The command line interface is defined as a fake directory tree with executables, -directorys and files. The user uses shell like standard commands to move about +directories and files. The user uses shell like standard commands to move about the directory and execute commands. The CLI is not a powerful as the Bash shell, but has a number of similar concepts. diff --git a/lib/usr/app/cli/cli_map.h b/lib/usr/app/cli/cli_map.h index f913bebb..249db822 100644 --- a/lib/usr/app/cli/cli_map.h +++ b/lib/usr/app/cli/cli_map.h @@ -39,7 +39,7 @@ struct cli_map { * %4 - IPv4 address * %6 - IPv6 address * %k - kvargs list of \=\[,...] strings - * %l - list format, if constains space then quote the string first + * %l - list format, if contains space then quote the string first * %| - Fixed list of valid strings * @param argc * Number of arguments in \p argv diff --git a/lib/usr/clib/acl/acl_run_avx512.c b/lib/usr/clib/acl/acl_run_avx512.c index db1edb23..8cf2a0bd 100644 --- a/lib/usr/clib/acl/acl_run_avx512.c +++ b/lib/usr/clib/acl/acl_run_avx512.c @@ -71,7 +71,7 @@ update_flow_mask(const struct acl_flow_avx512 *flow, uint32_t *fmsk, uint32_t *r } /* - * Resolve matches for multiple categories (LE 8, use 128b instuctions/regs) + * Resolve matches for multiple categories (LE 8, use 128b instructions/regs) */ static inline void resolve_mcle8_avx512x1(uint32_t result[], const struct cne_acl_match_results pr[], diff --git a/lib/usr/clib/acl/acl_run_avx512x16.h b/lib/usr/clib/acl/acl_run_avx512x16.h index 047dfb04..0237b5ee 100644 --- a/lib/usr/clib/acl/acl_run_avx512x16.h +++ b/lib/usr/clib/acl/acl_run_avx512x16.h @@ -239,7 +239,7 @@ _F_(gather_bytes)(__m512i zero, const __m512i p[2], const uint32_t m[2], uint32_ } /* - * Resolve matches for multiple categories (GT 8, use 512b instuctions/regs) + * Resolve matches for multiple categories (GT 8, use 512b instructions/regs) */ static inline void resolve_mcgt8_avx512x1(uint32_t result[], const struct cne_acl_match_results pr[], diff --git a/lib/usr/clib/acl/cne_acl.h b/lib/usr/clib/acl/cne_acl.h index 00b8727c..799a11ca 100644 --- a/lib/usr/clib/acl/cne_acl.h +++ b/lib/usr/clib/acl/cne_acl.h @@ -96,7 +96,7 @@ enum { }; #define CNE_ACL_MASKLEN_TO_BITMASK(v, s) \ - ((v) == 0 ? (v) : (typeof(v))((uint64_t)-1 << ((s)*CHAR_BIT - (v)))) + ((v) == 0 ? (v) : (typeof(v))((uint64_t)-1 << ((s) * CHAR_BIT - (v)))) /** * Miscellaneous data for ACL rule. diff --git a/lib/usr/clib/cthread/cthread_api.h b/lib/usr/clib/cthread/cthread_api.h index 4c6404f0..036db442 100644 --- a/lib/usr/clib/cthread/cthread_api.h +++ b/lib/usr/clib/cthread/cthread_api.h @@ -1259,7 +1259,7 @@ CNDP_API int cthread_once_reset(struct cthread_once *once); * @param once * Pointer to pointer of a cthread_once structure * @param func - * The function to call only once passsing the argument value. + * The function to call only once passing the argument value. * @param arg * The opaque data to pass to \p func. * @return diff --git a/lib/usr/clib/cthread/cthread_int.h b/lib/usr/clib/cthread/cthread_int.h index 20333c60..0570aee0 100644 --- a/lib/usr/clib/cthread/cthread_int.h +++ b/lib/usr/clib/cthread/cthread_int.h @@ -145,7 +145,7 @@ enum join_st { }; /** - * defnition of an cthread stack object + * definition of an cthread stack object */ struct cthread_stack { struct cthread_sched *sched; diff --git a/lib/usr/clib/cthread/cthread_tls.h b/lib/usr/clib/cthread/cthread_tls.h index 7105b7c5..8f39e865 100644 --- a/lib/usr/clib/cthread/cthread_tls.h +++ b/lib/usr/clib/cthread/cthread_tls.h @@ -12,7 +12,7 @@ extern "C" { #endif #ifndef __APPLE__ -#define CNE_PER_CTHREAD_SECTION_SIZE ((uintptr_t)&__stop_per_dt - (uintptr_t)&__start_per_dt) +#define CNE_PER_CTHREAD_SECTION_SIZE ((uintptr_t) & __stop_per_dt - (uintptr_t) & __start_per_dt) #else #define CNE_PER_CTHREAD_SECTION_SIZE 0 #endif diff --git a/lib/usr/clib/fib/cne_fib6.h b/lib/usr/clib/fib/cne_fib6.h index 963681a5..52d1b333 100644 --- a/lib/usr/clib/fib/cne_fib6.h +++ b/lib/usr/clib/fib/cne_fib6.h @@ -108,7 +108,7 @@ int cne_fib6_lookup_bulk(struct cne_fib6 *fib, uint8_t ips[][IPV6_ADDR_LEN], uin * FIB6 object handle * @return * Pointer on the dataplane struct on success - * NULL othervise + * NULL otherwise */ void *cne_fib6_get_dp(struct cne_fib6 *fib); @@ -119,7 +119,7 @@ void *cne_fib6_get_dp(struct cne_fib6 *fib); * FIB object handle * @return * Pointer on the RIB6 on success - * NULL othervise + * NULL otherwise */ struct cne_rib6 *cne_fib6_get_rib(struct cne_fib6 *fib); diff --git a/lib/usr/clib/fib/trie_avx512.c b/lib/usr/clib/fib/trie_avx512.c index ae2d6af8..15a002ea 100644 --- a/lib/usr/clib/fib/trie_avx512.c +++ b/lib/usr/clib/fib/trie_avx512.c @@ -103,7 +103,7 @@ trie_vec_lookup_x16x2(void *p, uint8_t ips[32][IPV6_ADDR_LEN], uint64_t *next_ho /** * lookup in tbl24 - * Put it inside branch to make compiller happy with -O0 + * Put it inside branch to make compiler happy with -O0 */ if (size == sizeof(uint16_t)) { res_1 = _mm512_i32gather_epi32(idxes_1, (const int *)dp->tbl24, 2); diff --git a/lib/usr/clib/hmap/meson.build b/lib/usr/clib/hmap/meson.build index 73d103d4..5d8e490e 100644 --- a/lib/usr/clib/hmap/meson.build +++ b/lib/usr/clib/hmap/meson.build @@ -10,4 +10,3 @@ libhmap = library(libname, sources, install: true, dependencies: deps) hmap = declare_dependency(link_with: libhmap, include_directories: include_directories('.')) cndp_libs += hmap - diff --git a/lib/usr/slib/ibroker/meson.build b/lib/usr/slib/ibroker/meson.build index bc76db21..235bbc6a 100644 --- a/lib/usr/slib/ibroker/meson.build +++ b/lib/usr/slib/ibroker/meson.build @@ -8,4 +8,3 @@ libibroker = library(libname, sources, install: true, dependencies: deps) ibroker = declare_dependency(link_with: libibroker, include_directories: include_directories('.')) cndp_libs += ibroker - diff --git a/meson_options.txt b/meson_options.txt index 52dbfe8b..4072c790 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -91,4 +91,3 @@ option('quicly_path', type: 'string', value: '/work/projects/intel/networking.da option('verbose', type: 'boolean', value: false, description: 'Verbose build messages') - diff --git a/test/common/test.h b/test/common/test.h index abe86632..cb970f16 100644 --- a/test/common/test.h +++ b/test/common/test.h @@ -182,9 +182,6 @@ void add_test_command(struct test_command *t); .command = CNE_STR(cmd), \ .callback = func, \ }; \ - CNE_INIT(test_register_##cmd) \ - { \ - add_test_command(&test_struct_##cmd); \ - } + CNE_INIT(test_register_##cmd) { add_test_command(&test_struct_##cmd); } #endif diff --git a/test/fuzz/README.md b/test/fuzz/README.md index 9361e1b8..59a26b2c 100644 --- a/test/fuzz/README.md +++ b/test/fuzz/README.md @@ -2,34 +2,36 @@ ## Introduction -Fuzzing or Fuzz Testing is the act of testing with random or otherwise unexpected -data. The files in this directory accomplish that with the help of +Fuzzing or Fuzz Testing is the act of testing with random or otherwise +unexpected data. The files in this directory accomplish that with the help of [libFuzzer](https://llvm.org/docs/LibFuzzer.html). Because we use the built-in functionality from llvm, we need to compile with clang and clang++. ## Build CNDP with fuzzing support -Fortunately for us, meson provides native support for enabling sanitizers. To build CNDP with -the required sanitizers, use b\_sanitize and b\_lundef options. Both release and debug examples -are shown below, but you can use what you need. +Fortunately for us, meson provides native support for enabling sanitizers. To +build CNDP with the required sanitizers, use b_sanitize and b_lundef options. +Both release and debug examples are shown below, but you can use what you need. -``` +```text CC=clang CXX=clang++ meson -Dbuildtype=release -Db_sanitize=address -Db_lundef=false build-clang-release CC=clang CXX=clang++ meson -Dbuildtype=debug -Db_sanitize=address -Db_lundef=false build-clang-debug ``` Build the environment that meson created using ninja. -``` +```sh ninja -C build-clang-release ninja -C build-clang-debug ``` ## Running the fuzzers -The fuzzers are built in, e.g. build-clang-\*/test/fuzz/fuzz\_\* from sources in test/fuzz/\*.cc +The fuzzers are built in, e.g. build-clang-\*/test/fuzz/fuzz\_\* from sources in +test/fuzz/\*.cc -Run the fuzzers using options like -detect\_leaks=0, -max\_total\_time=180, -help=1, etc. +Run the fuzzers using options like -detect_leaks=0, -max_total_time=180, +-help=1, etc. ## References diff --git a/test/testcne/fib_perf_test.c b/test/testcne/fib_perf_test.c index f7cf5888..9602bcdf 100644 --- a/test/testcne/fib_perf_test.c +++ b/test/testcne/fib_perf_test.c @@ -350,7 +350,7 @@ test_fib_perf(void) fib = cne_fib_create(__func__, &config); TEST_FIB_ASSERT(fib != NULL); - /* Measue add. */ + /* Measure add. */ begin = cne_rdtsc(); for (i = 0; i < NUM_ROUTE_ENTRIES; i++) { diff --git a/test/testcne/hash_test.c b/test/testcne/hash_test.c index 27257b05..6023608f 100644 --- a/test/testcne/hash_test.c +++ b/test/testcne/hash_test.c @@ -159,7 +159,7 @@ test_crc32_hash_alg_equiv(void) { uint32_t hash_val; uint32_t init_val; - uint64_t data64[CRC32_DWORDS]; + uint64_t data64[CRC32_DWORDS] = {0}; unsigned i, j; size_t data_len; diff --git a/test/testcne/ring_profile.c b/test/testcne/ring_profile.c index 9a07c1c2..a52e494f 100644 --- a/test/testcne/ring_profile.c +++ b/test/testcne/ring_profile.c @@ -73,7 +73,7 @@ ring_profile(int argc, char **argv) * creating ring */ {"sp", no_argument, &single_producer, RING_F_SP_ENQ}, /** - * use signle producer ring + * use single producer ring */ {"sc", no_argument, &single_consumer, RING_F_SC_DEQ}, /** * use single consumer ring diff --git a/tools/cne-build.sh b/tools/cne-build.sh index 6f14037a..bf65ffbc 100755 --- a/tools/cne-build.sh +++ b/tools/cne-build.sh @@ -113,12 +113,12 @@ function build_rust_apps() { function cargo_build_rust_app() { if [ "$buildtype" == "release" ]; then if ! cargo build --release; then - echo "Cargo builld rust app failed" + echo "Cargo build rust app failed" return 1 fi else if ! cargo build; then - echo "Cargo builld rust app failed" + echo "Cargo build rust app failed" return 1 fi fi diff --git a/tools/jsonc_gen.sh b/tools/jsonc_gen.sh index 2f9a3c21..9de6ea0a 100755 --- a/tools/jsonc_gen.sh +++ b/tools/jsonc_gen.sh @@ -23,7 +23,7 @@ while getopts "kp" flag; do case $flag in k) KIND=true ;; p) PINNED_BPF_MAP=true ;; - *) echo 'error unkown flag' >&2 + *) echo 'error unknown flag' >&2 exit 1 esac done diff --git a/usrtools/txgen/INSTALL.md b/usrtools/txgen/INSTALL.md index 4facad8f..d7fc3651 100644 --- a/usrtools/txgen/INSTALL.md +++ b/usrtools/txgen/INSTALL.md @@ -1,48 +1,45 @@ -TXGen - Traffic Generator powered by CNDP -===================================================== +# TXGen - Traffic Generator powered by CNDP -**TXGen is a traffic generator powered by CNDP at wire rate traffic with 64 byte frames.** +**TXGen is a traffic generator powered by CNDP at wire rate traffic with 64 byte +frames.** -** (TXGen) Sounds like 'Packet-Gen'** +\*\* (TXGen) Sounds like 'Packet-Gen'\*\* ---- -**Copyright © \2019-2022\ Intel Corporation. All rights reserved.** +______________________________________________________________________ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +**Copyright © \\2019-2022\\ Intel Corporation. All rights reserved.** -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -- Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the -distribution. +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -- Neither the name of Intel Corporation nor the names of its -contributors may be used to endorse or promote products derived -from this software without specific prior written permission. +- Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. +- Neither the name of Intel Corporation nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SPDX-License-Identifier: BSD-3-Clause ---- +______________________________________________________________________ -# Installation +## Installation -## Environment and Install prerequisites +### Environment and Install prerequisites Please see the CNDP INSTALL.md diff --git a/usrtools/txgen/README.md b/usrtools/txgen/README.md index 48ce26a3..7b9c45c3 100644 --- a/usrtools/txgen/README.md +++ b/usrtools/txgen/README.md @@ -1,21 +1,14 @@ # TXGen - Traffic Generator powered by CNDP -===================================================== - -**TXGen is a traffic generator powered by CNDP at wire rate traffic with 64 byte frames.** - -## (TXGen) Sounds like 'Packet-Gen' - ---- +TXGen is a traffic generator powered by CNDP at wire rate traffic with 64 byte +frames. TXGen Sounds like 'Packet-Gen' ```console SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2019-2023 Intel Corporation. ``` ---- - -## TXGen command line directory format *** +## TXGen command line directory format ```console -- TXGen Ver: 20.11.0 (CNDP 20.11.0) Powered by CNDP --------------- @@ -109,15 +102,19 @@ Usage: ./builddir/txgen/app [-h] [-c json_file] ``` ## Building TXGen + TXgGen is built by default when CNDP is built ## Running TXGen + Running TXGen is similar to running any of the applications. -1. Start with the provided txgen.json.c and modify it to include appropriate configurations: such as interface names... +1. Start with the provided txgen.json.c and modify it to include appropriate + configurations: such as interface names... -NOTE: that the threads roles for TXGen are different to thread roles from the simple examples. +NOTE: that the threads roles for TXGen are different to thread roles from the +simple examples. -2. Create appropriate ethtool filters if you plan on Receiving Traffic. +1. Create appropriate ethtool filters if you plan on Receiving Traffic. -3. Run the TXGen application +1. Run the TXGen application diff --git a/usrtools/txgen/app/capture.c b/usrtools/txgen/app/capture.c index bf2aeb29..50ee2f2c 100644 --- a/usrtools/txgen/app/capture.c +++ b/usrtools/txgen/app/capture.c @@ -18,7 +18,7 @@ #include "cne_mmap.h" // for mmap_addr, mmap_alloc, mmap_name_by_type #include "jcfg.h" // for jcfg_lport_t #include "netdev_funcs.h" // for netdev_link -#include "pktmbuf.h" // for pktmbuf_info_t, DEFAULT_MBUF_COUNT, DEFAUL... +#include "pktmbuf.h" // for pktmbuf_info_t, DEFAULT_MBUF_COUNT, DEFAULT... #include "txgen.h" // for pktmbuf_t, txgen_tst_port_flags, txgen_clr... #define CAPTURE_BUFF_SIZE (4 * (1024 * 1024)) diff --git a/usrtools/txgen/app/cli-functions.c b/usrtools/txgen/app/cli-functions.c index 66f66461..12b419a3 100644 --- a/usrtools/txgen/app/cli-functions.c +++ b/usrtools/txgen/app/cli-functions.c @@ -564,7 +564,7 @@ static const char *misc_help[] = { "save - Save a configuration file using the filename", "load - Load a command/script file from the given path", "clear stats - Clear the statistics", - "clr - Clear all Statistices", + "clr - Clear all statistics", "reset - Reset the configuration the lports to the default", "rst - Reset the configuration for all lports", "lports per page [1-6] - Set the number of lports displayed per page", diff --git a/usrtools/txgen/app/txgen.c b/usrtools/txgen/app/txgen.c index 53ff71e0..54612c04 100644 --- a/usrtools/txgen/app/txgen.c +++ b/usrtools/txgen/app/txgen.c @@ -807,7 +807,7 @@ txgen_launch_one_lcore(void *arg) jcfg_thd_t *thd = arg; jcfg_lport_t *lport; port_info_t *info; - void (*func)(port_info_t * info); + void (*func)(port_info_t *info); struct { void (*func)(port_info_t *info); } thread_types[] = {{NULL}, {txgen_rxtx}, {txgen_rx}, {txgen_tx}}; diff --git a/usrtools/txgen/docs/source/commands.rst b/usrtools/txgen/docs/source/commands.rst index 01db21d6..239b24f4 100644 --- a/usrtools/txgen/docs/source/commands.rst +++ b/usrtools/txgen/docs/source/commands.rst @@ -47,7 +47,7 @@ Show the commands inside the ``txgen/bin`` directory:: clear.stats help TXGen:/> -Showin the ``1s`` command at root:: +Showing the ``1s`` command at root:: TXGen:/> ls [txgen] [sbin] copyright @@ -182,7 +182,7 @@ The odd or special commands:: save - Save a configuration file using the filename load - Load a command/script file from the given path clear stats - Clear the statistics - clr - Clear all Statistices + clr - Clear all Statistics reset - Reset the configuration the lports to the default rst - Reset the configuration for all lports lports per page [1-6] - Set the number of lports displayed per page diff --git a/usrtools/xskmap_load_send/README.md b/usrtools/xskmap_load_send/README.md index 199fe367..3b3d39f5 100644 --- a/usrtools/xskmap_load_send/README.md +++ b/usrtools/xskmap_load_send/README.md @@ -1,17 +1,17 @@ # xsk_map load and send utility -This is a simple utility that loads a pinned xsk_map fd and sends it to -a CNDP application that's configured to work in unprivileged mode. It -allows the end user to load their own custom BPF programs besides the -default AF_XDP redirect program provided by the kernel. For +This is a simple utility that loads a pinned xsk_map fd and sends it to a CNDP +application that's configured to work in unprivileged mode. It allows the end +user to load their own custom BPF programs besides the default AF_XDP redirect +program provided by the kernel. For [example](https://github.com/maryamtahhan/xdp-progs/blob/main/xdp-filter-udp/xdp_prog_kern.c). -> **_NOTE_** The loading is left outside the scope of CNDP as there are -many options available for use. +> **_NOTE_** The loading is left outside the scope of CNDP as there are many +> options available for use. -Running the application will create a UDS named `app_socket.{proc_id}` -in the path `/var/run/cndp/`. An example configuration for the `cndpfwd` -application to be used alongside this utility is shown below: +Running the application will create a UDS named `app_socket.{proc_id}` in the +path `/var/run/cndp/`. An example configuration for the `cndpfwd` application to +be used alongside this utility is shown below: ```json ...