From 149f64f5b77e74b82713b1c3600fcd6279219764 Mon Sep 17 00:00:00 2001 From: Maryam Tahhan Date: Fri, 26 Jul 2024 05:18:57 -0400 Subject: [PATCH] cndp: deprecate ansible Signed-off-by: Maryam Tahhan --- ansible/README.md | 134 -------------- ansible/cndp-ansible/group_vars/all | 31 ---- ansible/cndp-ansible/hosts.ini | 6 - .../cndp-ansible/localhost-kernel-install.yml | 36 ---- .../localhost-post-kernel-install.yml | 31 ---- ansible/cndp-ansible/multi-host.yml | 20 --- .../roles/check_hugepages/tasks/main.yml | 19 -- .../roles/check_os/tasks/main.yml | 19 -- .../roles/check_updated_kernel/tasks/main.yml | 44 ----- .../roles/common/defaults/main.yml | 30 ---- .../cndp-ansible/roles/common/tasks/main.yml | 27 --- .../roles/install_kernel/defaults/main.yml | 10 -- .../roles/install_kernel/tasks/main.yml | 53 ------ .../roles/install_libbpf/tasks/main.yml | 47 ----- .../roles/install_libxdp/defaults/main.yml | 14 -- .../roles/install_libxdp/tasks/main.yml | 79 --------- .../roles/setup_hugepages/defaults/main.yml | 6 - .../roles/setup_hugepages/tasks/main.yml | 93 ---------- ansible/cndp-config/README.md | 13 -- ansible/cndp-config/generate_jsonc.yml | 19 -- ansible/cndp-config/group_vars/all | 40 ----- .../roles/config_ethtool/tasks/main.yml | 19 -- .../roles/gen_config/tasks/main.yml | 8 - ansible/cndp-config/templates/fwd.jsonc.j2 | 164 ------------------ doc/guides/linux_gsg/linux_gsg.rst | 125 ------------- 25 files changed, 1087 deletions(-) delete mode 100644 ansible/README.md delete mode 100644 ansible/cndp-ansible/group_vars/all delete mode 100644 ansible/cndp-ansible/hosts.ini delete mode 100644 ansible/cndp-ansible/localhost-kernel-install.yml delete mode 100644 ansible/cndp-ansible/localhost-post-kernel-install.yml delete mode 100644 ansible/cndp-ansible/multi-host.yml delete mode 100644 ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/check_os/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/check_updated_kernel/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/common/defaults/main.yml delete mode 100644 ansible/cndp-ansible/roles/common/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/install_kernel/defaults/main.yml delete mode 100644 ansible/cndp-ansible/roles/install_kernel/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/install_libxdp/defaults/main.yml delete mode 100644 ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml delete mode 100644 ansible/cndp-ansible/roles/setup_hugepages/defaults/main.yml delete mode 100644 ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml delete mode 100644 ansible/cndp-config/README.md delete mode 100644 ansible/cndp-config/generate_jsonc.yml delete mode 100644 ansible/cndp-config/group_vars/all delete mode 100644 ansible/cndp-config/roles/config_ethtool/tasks/main.yml delete mode 100644 ansible/cndp-config/roles/gen_config/tasks/main.yml delete mode 100644 ansible/cndp-config/templates/fwd.jsonc.j2 diff --git a/ansible/README.md b/ansible/README.md deleted file mode 100644 index 0b49c9ad..00000000 --- a/ansible/README.md +++ /dev/null @@ -1,134 +0,0 @@ -# CNDP Ansible Playbook - -## Overview - -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. - -## Prerequisites - -### apt proxy - -If required, create a proxy.conf and configure the apt proxy settings. - -```bash -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). - -### 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). - -As root on both nodes run: - -```bash -ssh-keygen -ssh-copy-id -``` - -where `target` is an IP address or localhost. - -Three playbooks are provided: - -1. multi-host.yml: Requires a control node and a managed node. -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. -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 -└── 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 -``` - -## Running the Ansible playbook - -> 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 - -### 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: - -```bash -export PKG_CONFIG_PATH=/usr/lib/pkgconfig -make rebuild-install -``` diff --git a/ansible/cndp-ansible/group_vars/all b/ansible/cndp-ansible/group_vars/all deleted file mode 100644 index 9dd35063..00000000 --- a/ansible/cndp-ansible/group_vars/all +++ /dev/null @@ -1,31 +0,0 @@ ---- -# Common Variables - -############## -# PROXY VARS # -############## -# Edit these variables to include your proxy -proxy_env: -# http_proxy: http://proxy.cndp.com:111 -# https_proxy: http://proxy.cndp.com:111 - -############### -# KERNEL VARS # -############### -installed_kernel: "5.13" - -# Edit the variables below to your preference -num_threads: "{{ ansible_processor_vcpus }}" - -##################### -# Distribution VARS # -##################### -required_dist: "Ubuntu" -dist_ver: "20.04" - -################# -# Hugepage VARS # -################# -# Edit these variable to your preference. A value of 0 disables hugepage configuration -hugepages_2MB: 1024 -hugepages_1GB: 2 diff --git a/ansible/cndp-ansible/hosts.ini b/ansible/cndp-ansible/hosts.ini deleted file mode 100644 index abd3c061..00000000 --- a/ansible/cndp-ansible/hosts.ini +++ /dev/null @@ -1,6 +0,0 @@ -[cndp] -192.168.1.11 -cndphost.domain.com - -[cndp_single] -localhost ansible_connection=local diff --git a/ansible/cndp-ansible/localhost-kernel-install.yml b/ansible/cndp-ansible/localhost-kernel-install.yml deleted file mode 100644 index 4aadbf82..00000000 --- a/ansible/cndp-ansible/localhost-kernel-install.yml +++ /dev/null @@ -1,36 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -- hosts: cndp_single - vars: - localhost_install: true - become: true - become_user: root - gather_facts: true - tasks: - - include_role: - name: check_os - apply: - delegate_to: localhost - tags: 00_check_os - - include_role: - name: check_hugepages - apply: - delegate_to: localhost - tags: 00_check_mem - - include_role: - name: common - apply: - delegate_to: localhost - tags: 01_install_packages - - include_role: - name: setup_hugepages - apply: - delegate_to: localhost - tags: 02_setup_hugepages - - include_role: - name: install_kernel - 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 deleted file mode 100644 index a31a2a30..00000000 --- a/ansible/cndp-ansible/localhost-post-kernel-install.yml +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -- hosts: cndp_single - vars: - localhost_install: true - become: true - become_user: root - gather_facts: true - tasks: - - include_role: - name: check_os - apply: - delegate_to: localhost - tags: 00_check_os - - include_role: - name: check_updated_kernel - apply: - delegate_to: localhost - tags: 01_check_kernel - - include_role: - name: install_libbpf - apply: - delegate_to: localhost - tags: 02_install_libbpf - - include_role: - name: install_libxdp - apply: - delegate_to: localhost - tags: 03_install_libxdp diff --git a/ansible/cndp-ansible/multi-host.yml b/ansible/cndp-ansible/multi-host.yml deleted file mode 100644 index 8247e6ad..00000000 --- a/ansible/cndp-ansible/multi-host.yml +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- - -- hosts: cndp - vars: - localhost_install: false - become: true - become_user: root - gather_facts: true - roles: - - check_os - - check_hugepages - - common - - setup_hugepages - - install_kernel - - check_updated_kernel - - install_libbpf - - install_libxdp diff --git a/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml b/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml deleted file mode 100644 index 6f47b30e..00000000 --- a/ansible/cndp-ansible/roles/check_hugepages/tasks/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -# 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 -- name: Memory Check - fail: - msg: - - trying to allocate {{ ((hugepages_2MB|int * 2) + (hugepages_1GB|int * 1024)) }} MiB of - - memory only {{ ansible_memtotal_mb }} MiB available - when: ansible_memtotal_mb < ((hugepages_2MB|int * 2) + (hugepages_1GB|int * 1024)) - tags: - - check_mem - -- name: Memory Check Success - debug: - msg: Memory Check is good - tags: - - check_mem diff --git a/ansible/cndp-ansible/roles/check_os/tasks/main.yml b/ansible/cndp-ansible/roles/check_os/tasks/main.yml deleted file mode 100644 index 6a698b60..00000000 --- a/ansible/cndp-ansible/roles/check_os/tasks/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -# This role checks if the right base OS is installed for -# CNDP -- name: Distribution Check - fail: - msg: CNDP requires {{ required_dist }} {{ dist_ver }} - when: (ansible_distribution != required_dist) or - (ansible_distribution_version is version (dist_ver, '<')) - tags: - - check_os - -- name: Distribution Check - debug: - msg: Distribution is good - tags: - - 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 deleted file mode 100644 index 86ba7316..00000000 --- a/ansible/cndp-ansible/roles/check_updated_kernel/tasks/main.yml +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -# This role check the updated kernel after installation -- name: Get updated facts - setup: - tags: - - check_updated_kernel - -- name: Kernel Version OK Check - debug: - 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 }} - when: ansible_kernel is version (installed_kernel, '<') - tags: - - check_updated_kernel - -- name: check i40e_xsk_wakeup - 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 - -- name: Print i40e_xsk_wakeup result - 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 }} - tags: - - check_updated_kernel diff --git a/ansible/cndp-ansible/roles/common/defaults/main.yml b/ansible/cndp-ansible/roles/common/defaults/main.yml deleted file mode 100644 index a3ff94f0..00000000 --- a/ansible/cndp-ansible/roles/common/defaults/main.yml +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Intel Corporation - -common_pkgs: - ubuntu: - - build-essential - - libbsd-dev - - libelf-dev - - libjson-c-dev - - libnuma-dev - - libpcap-dev - - meson - - pkg-config - - doxygen - - python3-sphinx - - libnl-3-dev - - libnl-cli-3-dev - fedora: - - "@development-tools" - - git - - libbsd-devel - - json-c-devel - - libnl3-devel - - libnl3-cli - - numactl-libs - - meson - - ninja-build - - gcc-c++ - - libpcap - - libpcap-devel diff --git a/ansible/cndp-ansible/roles/common/tasks/main.yml b/ansible/cndp-ansible/roles/common/tasks/main.yml deleted file mode 100644 index a1243cbc..00000000 --- a/ansible/cndp-ansible/roles/common/tasks/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -# This role installs all the packages needed for CNDP -# Template for installing packages -# - name: install -# package: -# name: -# state: present -# environment: "{{ proxy_env }}" -# tags: install_pkgs - -- name: update package manager cache - tags: - - cache_update - package: - update_cache: yes # yamllint disable-line rule:truthy - environment: "{{ proxy_env }}" - -- name: install packages - package: - 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/defaults/main.yml b/ansible/cndp-ansible/roles/install_kernel/defaults/main.yml deleted file mode 100644 index f2bb3032..00000000 --- a/ansible/cndp-ansible/roles/install_kernel/defaults/main.yml +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Intel Corporation - -kernel_pkgs: - ubuntu: - - linux-image-unsigned-5.13.0-1009-oem - - linux-headers-5.13.0-1009-oem - - linux-tools-5.13.0-1009-oem - fedora: - - kernel diff --git a/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml b/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml deleted file mode 100644 index 94f3fd3a..00000000 --- a/ansible/cndp-ansible/roles/install_kernel/tasks/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -# This role checks if the kernel version is the one -# needed for CNDP, then installs and reboots -# the target host if it's not. -- name: Kernel Version Check - debug: - msg: Kernel version {{ ansible_kernel }} is OK no need to update - when: - - ansible_kernel is version ( installed_kernel, '>=') - tags: - - check_kernel - -- name: Kernel Version Needs update - debug: - msg: Kernel will be updated - when: - - ansible_kernel is version ( installed_kernel, '<') - tags: - - check_kernel - -- name: install kernel for ubuntu - package: - name: "{{ item }}" - state: present - environment: "{{ proxy_env }}" - tags: install_kernel - with_items: "{{ kernel_pkgs[required_dist | lower] }}" - when: - - ansible_kernel is version ( installed_kernel, '<') - - required_dist | lower == "ubuntu" - -- name: update kernel for fedora - package: - name: "{{ item }}" - state: latest - environment: "{{ proxy_env }}" - tags: install_kernel - with_items: "{{ kernel_pkgs[required_dist | lower] }}" - when: - - ansible_kernel is version ( installed_kernel, '<') - - required_dist | lower == "fedora" - -- name: Reboot the host after kernel installation - reboot: - reboot_timeout: 3600 - # pre_reboot_delay: 60 - when: - - ansible_kernel is version ( installed_kernel, '<') and localhost_install != true - tags: - - reboot_cndp_remote diff --git a/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml b/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml deleted file mode 100644 index 24d03430..00000000 --- a/ansible/cndp-ansible/roles/install_libbpf/tasks/main.yml +++ /dev/null @@ -1,47 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -# This role checks if the libbpf is already installed. -# If not, then it installs it. -- name: check if libbpf shared lib is already installed - stat: - path: /usr/lib/libbpf.so - register: bpf_shared_installed - tags: - - check_libbpf - -- name: check if libbpf static lib is already installed - stat: - path: /usr/lib/libbpf.a - register: bpf_static_installed - tags: - - check_libbpf - -- name: libbpf installed check result - debug: - msg: libbpf already installed - when: bpf_static_installed.stat.exists == True or bpf_shared_installed.stat.exists == True - tags: - - check_libbpf - -- name: Unarchive libbpf - unarchive: - src: https://github.com/libbpf/libbpf/archive/refs/tags/v1.0.0.tar.gz - dest: /tmp - 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: - - unarchive_libbpf - -- name: Install libbpf - make: - chdir: /tmp/libbpf-1.0.0/src - target: install - params: - NUM_THREADS: "{{ num_threads }}" - LIBDIR: /usr/lib - 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/defaults/main.yml b/ansible/cndp-ansible/roles/install_libxdp/defaults/main.yml deleted file mode 100644 index 8788f3f5..00000000 --- a/ansible/cndp-ansible/roles/install_libxdp/defaults/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Intel Corporation - -clang_pkgs: - ubuntu: - - gcc-multilib - - clang-11 - - llvm-11 - - lld-11 - - m4 - fedora: - - clang - - llvm - - bpftool diff --git a/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml b/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml deleted file mode 100644 index 53dd2438..00000000 --- a/ansible/cndp-ansible/roles/install_libxdp/tasks/main.yml +++ /dev/null @@ -1,79 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Intel Corporation - ---- -# This role checks if the libxdp is already installed. -# If not, then it installs it. - -- name: update package manager cache - tags: - - cache_update - package: - update_cache: yes # yamllint disable-line rule:truthy - environment: "{{ proxy_env }}" - -- name: install packages - package: - 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 - register: xdp_shared_installed - tags: - - check_libxdp - -- name: check if libxdp static lib is already installed - stat: - path: /usr/lib/libxdp.a - register: xdp_static_installed - tags: - - check_libxdp - -- name: libxdp installed check result - debug: - msg: libxdp already installed - when: xdp_static_installed.stat.exists == True or xdp_shared_installed.stat.exists == True - tags: - - 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 # 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 - -- name: Install libxdp - make: - 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 - -- 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 - -- name: Print xsk_socket__create_shared result - debug: - msg: xsk_socket__create_shared check result {{ xsk_shared_check_output.stdout }} - when: xsk_shared_check_output.stdout != "FOUND" - tags: - - check_xsk_shared - -- name: ldconfig - shell: ldconfig diff --git a/ansible/cndp-ansible/roles/setup_hugepages/defaults/main.yml b/ansible/cndp-ansible/roles/setup_hugepages/defaults/main.yml deleted file mode 100644 index f111c4b8..00000000 --- a/ansible/cndp-ansible/roles/setup_hugepages/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Intel Corporation - -update_grub_cmd: - ubuntu: update-grub - fedora: grub2-mkconfig -o "$(readlink -e /etc/grub2.conf)" diff --git a/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml b/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml deleted file mode 100644 index c2ffbb60..00000000 --- a/ansible/cndp-ansible/roles/setup_hugepages/tasks/main.yml +++ /dev/null @@ -1,93 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -# This role will setup hugepages for CNDP -################################################################ -# 2MB pages config # -################################################################ -- name: Check 2MB Hugepages Support - shell: cat /proc/cpuinfo | grep -q pse && echo "FOUND" || echo "NOT FOUND" - register: hugepages_2MB_check - tags: - - check_hugepages_2MB - -- name: Check 2MB Hugepages - debug: - msg: Selected 2MB hugepages but these are "{{ hugepages_2MB_check.stdout }}" on the system - when: hugepages_2MB_check.stdout != "FOUND" and hugepages_2MB|int > 0 - tags: - - check_hugepages_2MB - -- name: Configure Persistent 2MB Hugepages if missing in /etc/sysctl.conf - lineinfile: - path: /etc/sysctl.conf - backup: yes # yamllint disable-line rule:truthy - regexp: 'vm.nr_hugepages = [0-9]+' - state: absent - insertafter: 'EOF' - line: 'vm.nr_hugepages = {{ hugepages_2MB }}' - when: - - hugepages_2MB_check.stdout == "FOUND" and hugepages_2MB|int > 0 - tags: - - hugepages_2MB_config - -- name: Edit Persistent 2MB Hugepages if it already exists - lineinfile: - path: /etc/sysctl.conf - 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 - - -################################################################ -# 1GB pages config # -################################################################ - -- name: Check 1GB Hugepages Support in cpuinfo - shell: cat /proc/cpuinfo | grep -q pdpe1gb && echo "FOUND" || echo "NOT FOUND" - register: hugepages_1GB_check - tags: - - check_1GB_hugepages - -- name: Check cpuinfo result - debug: - msg: selected 1GB hugepages but these are not supported by the system - when: hugepages_1GB > 0 and hugepages_1GB_check.stdout != "FOUND" - tags: - - check_1GB_hugepages - -- name: Modify existing 1GB Hugepages configuration if it exists - replace: - path: /etc/default/grub - regexp: "{{ item.regex }}" - replace: "{{ item.config }}" - when: - - hugepages_1GB > 0 and hugepages_1GB_check.stdout == "FOUND" - loop: - - {regex: '(GRUB_CMDLINE_LINUX=.*)([hugepagesz=][0-9][G|MB])(.*)', config: '\1=1G\3'} - - {regex: '(GRUB_CMDLINE_LINUX=.*)([hugepages=][0-9]+)(.*)', config: '\1={{ hugepages_1GB }}\3'} - tags: - - config_1GB_hugepages - -- name: Insert new 1GB configuration in grub if it doesn't exist - replace: - dest: /etc/default/grub - regexp: "(GRUB_CMDLINE_LINUX=(?!.* default_hugepagesz)(?!.* hugepagesz)(?!.* hugepages)\"[^\"]*)(\".*)" - replace: '\1 hugepagesz=1G hugepages={{ hugepages_1GB }}\2' - when: - - hugepages_1GB > 0 and hugepages_1GB_check.stdout == "FOUND" - tags: - - config_1GB_hugepages - -- name: update grub - shell: "{{ update_grub_cmd[required_dist | lower] }}" - when: - - hugepages_1GB > 0 and hugepages_1GB_check.stdout == "FOUND" - tags: - - config_1GB_hugepages diff --git a/ansible/cndp-config/README.md b/ansible/cndp-config/README.md deleted file mode 100644 index c683aed2..00000000 --- a/ansible/cndp-config/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Run Playbook - -1. Modify the global vars in the all file under group_vars -1. Run the playbook: - -```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... diff --git a/ansible/cndp-config/generate_jsonc.yml b/ansible/cndp-config/generate_jsonc.yml deleted file mode 100644 index c0f75246..00000000 --- a/ansible/cndp-config/generate_jsonc.yml +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation ---- -- hosts: localhost - vars: - localhost_install: true - become: true - become_user: root - tasks: - - include_role: - name: gen_config - apply: - delegate_to: localhost - tags: 00_gen_config - - include_role: - name: config_ethtool - apply: - delegate_to: localhost - tags: 00_config_ethtool diff --git a/ansible/cndp-config/group_vars/all b/ansible/cndp-config/group_vars/all deleted file mode 100644 index b6e323e8..00000000 --- a/ansible/cndp-config/group_vars/all +++ /dev/null @@ -1,40 +0,0 @@ ---- -# Common Variables - -######################## -# config file location # -######################## -config_dst: /tmp - - -############## -# UMEM VARS # -############## -umem_num: 30 # 1 umem per lport -umem_regions_num: 1 -umem_regions: 32 - -################ -# LPORT VARS # -################ -num_lports: 30 -iface: ens786f2 -starting_qid: 1 - -############## -# CORE VARS # -############## -c_default: "9-8" -c_initial: 10 -c_starting_group: 13 - -############### -# THREAD VARS # -############### -num_threads: "{{ ansible_processor_vcpus }}" - -################ -# ETHTOOL VARS # -################ -sport: 1234 -dport: 5678 diff --git a/ansible/cndp-config/roles/config_ethtool/tasks/main.yml b/ansible/cndp-config/roles/config_ethtool/tasks/main.yml deleted file mode 100644 index 3cc5035e..00000000 --- a/ansible/cndp-config/roles/config_ethtool/tasks/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation ---- -- name: RESET ethtool filters Step 1 - command: > - ethtool -K {{ iface }} ntuple off - -- name: RESET ethtool filters Step 2 - command: > - ethtool -K {{ iface }} ntuple on - -- name: RESET ethtool filters Step 2 - command: > - ethtool -N {{ iface }} rx-flow-hash udp4 fn - -- name: Configure ethtool filters - command: > - ethtool -N {{ iface }} flow-type udp4 src-port {{ sport +item|int }} dst-port {{ dport }} action {{ item|int +1 }} - with_sequence: start=0 end={{num_lports}} stride=1 diff --git a/ansible/cndp-config/roles/gen_config/tasks/main.yml b/ansible/cndp-config/roles/gen_config/tasks/main.yml deleted file mode 100644 index 6821313f..00000000 --- a/ansible/cndp-config/roles/gen_config/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2020-2023 Intel Corporation - ---- -- name: create json configuration for CNDP - template: - src: templates/fwd.jsonc.j2 - dest: "{{ config_dst }}/fwd.jsonc" diff --git a/ansible/cndp-config/templates/fwd.jsonc.j2 b/ansible/cndp-config/templates/fwd.jsonc.j2 deleted file mode 100644 index b814aafc..00000000 --- a/ansible/cndp-config/templates/fwd.jsonc.j2 +++ /dev/null @@ -1,164 +0,0 @@ -{ - // (R) - Required entry - // (O) - Optional entry - // All descriptions are optional and short form is 'desc' - // The order of the entries in this file are handled when it is parsed and the - // entries can be in any order. - - // (R) Application information - // name - (O) the name of the application - // description - (O) the description of the application - "application": { - "name": "cndpfwd", - "description": "A simple packet forwarder for pktdev and xskdev" - }, - - // (O) Default values - // bufcnt - (O) UMEM default buffer count in 1K increments - // bufsz - (O) UMEM buffer size in 1K increments - // rxdesc - (O) Number of RX ring descriptors in 1K increments - // txdesc - (O) Number of TX ring descriptors in 1K increments - // cache - (O) MBUF Pool cache size in number of entries - // mtype - (O) Memory type for mmap allocations - "defaults": { - "bufcnt": 16, - "bufsz": 2, - "rxdesc": 2, - "txdesc": 2, - "cache": 256, - "mtype": "2MB" - }, - - // List of all UMEM's to be created - // key/val - (R) The 'key' is the name of the umem for later reference. - // The 'val' is the object describing the UMEM buffer. - // Multiple umem regions can be defined. - // A UMEM can support multiple lports using the regions array. Each lports can use - // one of the regions. - // bufcnt - (R) The number of buffers in 1K increments in the UMEM space. - // bufsz - (R) The size in 1K increments of each buffer in the UMEM space. - // mtype - (O) If missing or empty string or missing means use 4KB or default system pages. - // regions - (O) Array of sizes one per region in 1K increments, total must be <= bufcnt - // rxdesc - (O) Number of RX descriptors to be allocated in 1K increments, - // if not present or zero use defaults.rxdesc, normally zero. - // txdesc - (O) Number of TX descriptors to be allocated in 1K increments, - // if not present or zero use defaults.txdesc, normally zero. - // shared_umem - (O) Set to true to use xsk_socket__create_shared() API, default false - // description | desc - (O) Description of the umem space. - "umems": { - {% for i in range(umem_num) %} - "umem{{i}}": { - "bufcnt": 32, - "bufsz": 2, - "mtype": "2MB", - "regions": [ - {% for n in range(umem_regions_num) %} - {{ umem_regions }} {%- if n < umem_regions_num-1 %},{% endif %} - - {% endfor %} - ], - "rxdesc": 0, - "txdesc": 0, - "description": "UMEM Description {{i}}" - - }{% if i < umem_num - 1 %},{% endif %} - - {% endfor %} - - }, - - // List of all lports to be used in the application - // An lport is defined by a netdev/queue ID pair, which is a socket containing a Rx/Tx ring pair. - // Each queue ID is assigned to a single socket or a socket is the lport defined by netdev/qid. - // Note: A netdev can be shared between lports as the qid is unique per lport - // If netdev is not defined or empty then it must be a virtual interface and not - // associated with a netdev/queue ID. - // key/val - (R) The 'key' is the logical name e.g. 'eth0:0', 'eth1:0', ... to be used by the - // application to reference an lport. The 'val' object contains information about - // each lport. - // netdev - (R) The netdev device to be used, the part before the colon - // must reflect the netdev name - // pmd - (R) All PMDs have a name i.e. 'net_af_xdp', 'ring', ... - // qid - (R) Is the queue id to use for this lport, defined by ethtool command line - // umem - (R) The UMEM assigned to this lport - // region - (O) UMEM region index value, default region 0 - // busy_poll - (O) Enable busy polling support, true or false, default false - // busy_polling - Same as above - // busy_timeout - (O) 1-65535 or 0 - use default value, values in milliseconds - // busy_budget - (O) 0xFFFF disabled, 0 use default, >0 budget value - // force_wakeup - (O) force TX wakeup calls for CVL NIC, default false - // skb_mode - (O) Enable XDP_FLAGS_SKB_MODE when creating af_xdp socket, forces copy mode, default false - // description - (O) the description, 'desc' can be used as well - // xsk_pin_path - (O) Path to pinned bpf map - // uds_path - (O) Path to unix domain socket to get xsk map fd - "lports": { - {% for i in range(num_lports) %} - "{{iface}}:{{i}}": { - "pmd": "net_af_xdp", - "qid": {{starting_qid + i}}, - "umem": "umem{{i}}", - "region": 0, - "description": "LAN {{i}} port" - }{% if i < num_lports - 1 %},{% endif %} - - {% endfor %} - - }, - - // (O) Define the lcore groups for each thread to run - // Can be integers or a string for a range of lcores - // e.g. [10], [10-14,16], [10-12, 14-15, 17-18, 20] - // Names of a lcore group and its lcores assigned to the group. - // The initial group is for the main thread of the application. - // The default group is special and is used if a thread if not assigned to a group. - "lcore-groups": { - "initial": [{{c_initial}}], - {% for i in range(num_lports) %} - "group{{i}}": [{{c_starting_group + i}}], - - {% endfor %} - - "default": ["{{ c_default | quote }}"] - }, - - // (O) Set of common options application defined. - // The Key can be any string and value can be boolean, string, array or integer - // An array must contain only a single value type, boolean, integer, string and - // can't be a nested array. - // pkt_api - (O) Set the type of packet API xskdev or pktdev - // no-metrics - (O) Disable metrics gathering and thread - // no-restapi - (O) Disable RestAPI support - // cli - (O) Enable/Disable CLI supported - // mode - (O) Mode type [drop | rx-only], tx-only, [lb | loopback], fwd, acl-strict, acl-permissive - "options": { - "pkt_api": "xskdev", - "no-metrics": false, - "no-restapi": false, - "cli": true, - "mode": "loopback" - }, - - // List of threads to start and information for that thread. Application can start - // it's own threads for any reason and are not required to be configured by this file. - // - // Key/Val - (R) A unique thread name. - // The format is [:] the ':' and identifier - // are optional if all thread names are unique - // group - (O) The lcore-group this thread belongs to. The - // lports - (O) The list of lports assigned to this thread and can not shared lports. - // description | desc - (O) The description - "threads": { - "main": { - "group": "initial", - "description": "CLI Thread" - }, - - {% for i in range(num_lports) %}"fwd:{{i}}": { - "group": "group{{i}}", - "lports": ["{{iface}}:{{i}}"], - "description": "Thread {{i}}" - }{% if i < num_lports - 1 %},{% endif %} - - {% endfor %} - } -} diff --git a/doc/guides/linux_gsg/linux_gsg.rst b/doc/guides/linux_gsg/linux_gsg.rst index 53c52b8d..d9211b18 100644 --- a/doc/guides/linux_gsg/linux_gsg.rst +++ b/doc/guides/linux_gsg/linux_gsg.rst @@ -37,9 +37,6 @@ System Requirements and Building CNDP This chapter describes the packages required to compile CNDP. It assumes you are building on an Ubuntu 21.04 host. -To bypass manual installation, use the ansible scripts provided by CNDP in the section: -`Installation of CNDP requirements using Ansible`_. - BIOS Settings ------------- @@ -315,125 +312,3 @@ launch the application, specifying the updated configuration file. .. code-block:: console sudo ./builddir/examples/cndpfwd/cndpfwd -c examples/cndpfwd/fwd.jsonc drop - - -Installation of CNDP requirements using Ansible ------------------------------------------------ - -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. - -Prerequisites -~~~~~~~~~~~~~ - -dependencies -^^^^^^^^^^^^ - -apt-get should now work to install the packages needed to use ansible. - -.. code-block:: console - - sudo apt-get update - sudo apt-get install -y ansible - -.. note:: - - If ansible isn't available in the package tree, it can be installed by - following these `instructions `_. - -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). - -As root on both nodes run: - -.. code-block:: console - - ssh-keygen - ssh-copy-id - -where is an IP address or localhost. - -CNDP Ansible tree -~~~~~~~~~~~~~~~~~ - -Below is the full directory tree of Ansible playbooks and roles. - -.. code-block:: console - - . - ├── 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 - └── 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 - -Three playbooks are provided: - -#. multi-host.yml: Requires a control node and a managed node. - -#. localhost-kernel-install.yml: Installs all the required packages and updates kernel to 5.13 - with XDP enabled (on the localhost). A user is expected to reboot the system after this script - runs. - -#. 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: - -#. hosts.ini: to add the hosts that you wish the multi-node playbook to setup. - -#. group_vars/all: to edit proxy variables. - -Running the Ansible playbook -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. note:: - - It's important to edit group_vars/all and hosts.ini before running any playbooks. - -.. code-block:: console - - sudo ansible-playbook -i hosts.ini - -.. 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, CNDP can be built by typing `make` in the -top level dir: - -.. code-block:: console - - make