Full Code of pktgen/Pktgen-DPDK for AI

main f5f4ac0e84c7 cached
305 files
1.7 MB
503.9k tokens
1714 symbols
1 requests
Download .txt
Showing preview only (1,816K chars total). Download the full file or copy to clipboard to get everything.
Repository: pktgen/Pktgen-DPDK
Branch: main
Commit: f5f4ac0e84c7
Files: 305
Total size: 1.7 MB

Directory structure:
gitextract_j5vqx0kd/

├── .clang-format
├── .claude/
│   └── settings.local.json
├── .editorconfig
├── .githooks/
│   └── pre-commit
├── .github/
│   └── workflows/
│       ├── clang-format.yml
│       ├── doc.yml
│       └── markdownlint.yml
├── .gitignore
├── .markdownlint.yml
├── .pre-commit-config.yaml
├── .readthedocs.yaml
├── 2-ports
├── 2-vf-ports
├── CLAUDE.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.TXT
├── CONTRIBUTING.md
├── INSTALL.md
├── LICENSE
├── Makefile
├── Pktgen.lua
├── README.md
├── VERSION
├── app/
│   ├── .gitignore
│   ├── cli-functions.c
│   ├── cli-functions.h
│   ├── l2p.c
│   ├── l2p.h
│   ├── lpktgenlib.c
│   ├── lpktgenlib.h
│   ├── meson.build
│   ├── pktgen-arp.c
│   ├── pktgen-arp.h
│   ├── pktgen-capture.c
│   ├── pktgen-capture.h
│   ├── pktgen-cmds.c
│   ├── pktgen-cmds.h
│   ├── pktgen-constants.h
│   ├── pktgen-cpu.c
│   ├── pktgen-cpu.h
│   ├── pktgen-display.c
│   ├── pktgen-display.h
│   ├── pktgen-dump.c
│   ├── pktgen-dump.h
│   ├── pktgen-ether.c
│   ├── pktgen-ether.h
│   ├── pktgen-gre.c
│   ├── pktgen-gre.h
│   ├── pktgen-gtpu.c
│   ├── pktgen-gtpu.h
│   ├── pktgen-ipv4.c
│   ├── pktgen-ipv4.h
│   ├── pktgen-ipv6.c
│   ├── pktgen-ipv6.h
│   ├── pktgen-latency.c
│   ├── pktgen-latency.h
│   ├── pktgen-log.c
│   ├── pktgen-log.h
│   ├── pktgen-main.c
│   ├── pktgen-main.h
│   ├── pktgen-pcap.c
│   ├── pktgen-pcap.h
│   ├── pktgen-port-cfg.c
│   ├── pktgen-port-cfg.h
│   ├── pktgen-random.c
│   ├── pktgen-random.h
│   ├── pktgen-range.c
│   ├── pktgen-range.h
│   ├── pktgen-seq.c
│   ├── pktgen-seq.h
│   ├── pktgen-stats.c
│   ├── pktgen-stats.h
│   ├── pktgen-sys.c
│   ├── pktgen-sys.h
│   ├── pktgen-tcp.c
│   ├── pktgen-tcp.h
│   ├── pktgen-txbuff.h
│   ├── pktgen-udp.c
│   ├── pktgen-udp.h
│   ├── pktgen-version.h
│   ├── pktgen-vlan.c
│   ├── pktgen-vlan.h
│   ├── pktgen.c
│   ├── pktgen.h
│   ├── xorshift64star.c
│   └── xorshift64star.h
├── cfg/
│   ├── 2-ports.cfg
│   ├── 2-vf-ports.cfg
│   ├── bond.cfg
│   ├── client_memif.cfg
│   ├── client_mif.cfg
│   ├── cnet-fwd-2.cfg
│   ├── cnet-fwd.cfg
│   ├── dapi-l3fwd.cfg
│   ├── default-100G.cfg
│   ├── default-gui.cfg
│   ├── default.cfg
│   ├── dfs.cfg
│   ├── dnet-echo.cfg
│   ├── four-ports.cfg
│   ├── half-bond.cfg
│   ├── hs-fwd.cfg
│   ├── ioat.cfg
│   ├── lat.cfg
│   ├── lb-fwd.cfg
│   ├── many-cores.cfg
│   ├── multi-port.cfg
│   ├── one-port.cfg
│   ├── pcap.cfg
│   ├── pdump.cfg
│   ├── pktgen-1.cfg
│   ├── pktgen-2.cfg
│   ├── server_memif.cfg
│   ├── server_mif.cfg
│   ├── socket.cfg
│   ├── two-ports-shared.cfg
│   ├── two-ports.cfg
│   ├── tx_perf.cfg
│   ├── vfio-fwd.cfg
│   ├── xdp-100.cfg
│   ├── xdp-40.cfg
│   └── xl710.cfg
├── docs/
│   ├── LUA_API.md
│   ├── QUICKSTART.md
│   ├── STYLE.md
│   ├── api/
│   │   ├── doxy-api-index.md
│   │   ├── doxy-api.conf.in
│   │   ├── doxy-html-custom.sh
│   │   ├── generate_doxygen.sh
│   │   ├── generate_examples.sh
│   │   └── meson.build
│   ├── meson.build
│   └── source/
│       ├── changes.rst
│       ├── cli_design.rst
│       ├── commands.rst
│       ├── conf.py
│       ├── contents.rst
│       ├── copyright.rst
│       ├── custom.css
│       ├── getting_started.rst
│       ├── index.rst
│       ├── license.rst
│       ├── lua.rst
│       ├── meson.build
│       ├── running.rst
│       ├── scripts.rst
│       ├── socket.rst
│       ├── usage_eal.rst
│       └── usage_pktgen.rst
├── examples/
│   ├── meson.build
│   └── pktperf/
│       ├── README.md
│       ├── meson.build
│       ├── parse.c
│       ├── pktperf.c
│       ├── pktperf.h
│       ├── port.c
│       ├── stats.c
│       └── utils.c
├── lib/
│   ├── cli/
│   │   ├── DESIGN.md
│   │   ├── README
│   │   ├── cli.c
│   │   ├── cli.h
│   │   ├── cli.rst
│   │   ├── cli_auto_complete.c
│   │   ├── cli_auto_complete.h
│   │   ├── cli_cmap.c
│   │   ├── cli_cmap.h
│   │   ├── cli_cmds.c
│   │   ├── cli_cmds.h
│   │   ├── cli_common.h
│   │   ├── cli_env.c
│   │   ├── cli_env.h
│   │   ├── cli_file.c
│   │   ├── cli_file.h
│   │   ├── cli_gapbuf.c
│   │   ├── cli_gapbuf.h
│   │   ├── cli_help.c
│   │   ├── cli_help.h
│   │   ├── cli_history.c
│   │   ├── cli_history.h
│   │   ├── cli_input.c
│   │   ├── cli_input.h
│   │   ├── cli_lib.rst
│   │   ├── cli_map.c
│   │   ├── cli_map.h
│   │   ├── cli_scrn.c
│   │   ├── cli_scrn.h
│   │   ├── cli_search.c
│   │   ├── cli_search.h
│   │   ├── cli_vt100.c
│   │   └── meson.build
│   ├── common/
│   │   ├── cksum.c
│   │   ├── cksum.h
│   │   ├── cmdline_parse_args.c
│   │   ├── cmdline_parse_args.h
│   │   ├── copyright_info.c
│   │   ├── copyright_info.h
│   │   ├── coreinfo.c
│   │   ├── coreinfo.h
│   │   ├── lscpu.c
│   │   ├── lscpu.h
│   │   ├── meson.build
│   │   ├── pg_compat.h
│   │   ├── pg_delay.h
│   │   ├── pg_ether.h
│   │   ├── pg_inet.c
│   │   ├── pg_inet.h
│   │   ├── pg_strings.c
│   │   ├── pg_strings.h
│   │   ├── port_config.c
│   │   ├── port_config.h
│   │   ├── utils.c
│   │   └── utils.h
│   ├── hmap/
│   │   ├── README.md
│   │   ├── hmap.c
│   │   ├── hmap.h
│   │   ├── hmap_helper.h
│   │   ├── hmap_log.h
│   │   └── meson.build
│   ├── lua/
│   │   ├── lua_config.c
│   │   ├── lua_config.h
│   │   ├── lua_dapi.c
│   │   ├── lua_dapi.h
│   │   ├── lua_dpdk.c
│   │   ├── lua_dpdk.h
│   │   ├── lua_pktmbuf.c
│   │   ├── lua_pktmbuf.h
│   │   ├── lua_socket.c
│   │   ├── lua_socket.h
│   │   ├── lua_stdio.c
│   │   ├── lua_stdio.h
│   │   ├── lua_utils.c
│   │   ├── lua_utils.h
│   │   ├── lua_vec.c
│   │   ├── lua_vec.h
│   │   └── meson.build
│   ├── meson.build
│   ├── plugin/
│   │   ├── meson.build
│   │   ├── plugin.c
│   │   └── plugin.h
│   ├── utils/
│   │   ├── _atoip.c
│   │   ├── _atoip.h
│   │   ├── heap.c
│   │   ├── heap.h
│   │   ├── inet_pton.c
│   │   ├── meson.build
│   │   ├── parson_json.c
│   │   ├── parson_json.h
│   │   ├── portlist.c
│   │   └── portlist.h
│   └── vec/
│       ├── meson.build
│       ├── vec.c
│       └── vec.h
├── meson.build
├── meson_options.txt
├── pcap/
│   ├── big.pcap
│   ├── gtpv1-u-1024.pcap
│   ├── large.pcap
│   ├── test1.pcap
│   └── traffic_sample.pcap
├── scripts/
│   ├── latency-samples.lua
│   ├── latency.lua
│   ├── port_stats_dump.lua
│   ├── rfc2544.lua
│   ├── rfc2544_tput_test.lua
│   └── traffic-profile.lua
├── style/
│   ├── call_GNU_Indent.pro
│   ├── call_GNU_Indent.sh
│   ├── call_Uncrustify.cfg
│   └── call_Uncrustify.sh
├── test/
│   ├── dump.lua
│   ├── generate-sequences.sh
│   ├── gtpu-range.lua
│   ├── hello-world.lua
│   ├── info.lua
│   ├── mac.pkt.3.4.ip-range-gen.txt
│   ├── mac.pkt.sequences.txt
│   ├── main.lua
│   ├── port_info.lua
│   ├── portstats.lua
│   ├── portstats_with_delay.lua
│   ├── range.lua
│   ├── screen_off.lua
│   ├── set_gtpu_seq.lua
│   ├── set_seq.lua
│   ├── simple_range.lua
│   ├── test.lua
│   ├── test1.lua
│   ├── test2.lua
│   ├── test3.lua
│   ├── test_range.lua
│   ├── test_save.lua
│   ├── test_seq.lua
│   ├── tx-rx-loopback.lua
│   └── vlan_udp_range.lua
├── themes/
│   ├── black-yellow.theme
│   └── white-black.theme
└── tools/
    ├── call-sphinx-build.py
    ├── dpdk-version.sh
    ├── format-clang.sh
    ├── meson.build
    ├── pktgen-build.sh
    ├── run.py
    ├── sudoGDB
    └── vfio-setup.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .clang-format
================================================
---
Language:        Cpp
# BasedOnStyle:  LLVM
AccessModifierOffset: 0
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands:   true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
  AfterCaseLabel:  false
  AfterClass:      false
  AfterControlStatement: false
  AfterEnum:       false
  AfterFunction:   true
  AfterNamespace:  false
  AfterObjCDeclaration: false
  AfterStruct:     false
  AfterUnion:      false
  AfterExternBlock: false
  BeforeCatch:     false
  BeforeElse:      false
  IndentBraces:    false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit:     100
CommentPragmas:  '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
  - STAILQ_FOREACH
  - TAILQ_FOREACH_SAFE
  - PKTDEV_FOREACH
  - TAILQ_FOREACH
  - json_array_foreach
  - json_object_object_foreach
  - json_object_object_foreachC
  - CIRCLEQ_FOREACH
  - jcfg_application_foreach
  - jcfg_defaults_foreach
  - jcfg_umem_foreach
  - jcfg_lport_foreach
  - jcfg_lgroup_foreach
  - jcfg_options_foreach
  - jcfg_thread_foreach
IncludeBlocks:   Preserve
IncludeCategories:
  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
    Priority:        2
  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
    Priority:        3
  - Regex:           '.*'
    Priority:        1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth:     4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 4
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 100
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments:  true
SortIncludes:    false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 8
SpacesInAngles:  false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard:        Cpp11
StatementMacros:
  - Q_UNUSED
  - QT_REQUIRE_VERSION
TabWidth:        4
UseTab:          Never
...


================================================
FILE: .claude/settings.local.json
================================================
{
  "permissions": {
    "allow": [
      "Bash(ninja:*)",
      "Bash(wc:*)",
      "Bash(ls:*)",
      "Read(//work/projects/intel/pktgen-dpdk/**)",
      "Bash(find:*)",
      "Bash(clang-format:*)",
      "Bash(git -C /work/projects/intel/pktgen-dpdk diff --stat lib/)",
      "Bash(grep -rn \"pktgen_stats_clear\\\\|\\\\.qstats\\\\|\\\\.curr\\\\|\\\\.prev\\\\|\\\\.rate\\\\|rte_eth_stats_get\" /work/projects/intel/pktgen-dpdk/app/*.c)"
    ]
  }
}


================================================
FILE: .editorconfig
================================================
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2019 6WIND S.A.
# See https://editorconfig.org/ for syntax reference.

root = true

[**]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
tab_width = 4
max_line_length = 100

[*.py]
indent_style = space
indent_size = 4

[*.rst]
indent_style = space
indent_size = 3

[*.build]
indent_style = space
indent_size = 4

[*.yml]
indent_size = 2

[COMMIT_EDITMSG]
max_line_length = 72


================================================
FILE: .githooks/pre-commit
================================================
#!/usr/bin/env bash
# Pre-commit hook for Markdown linting and optional auto-fix.
# Usage: ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
# Requires Node.js (npx). Installs markdownlint-cli2 on demand (no permanent dependency).

set -euo pipefail

REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"

STAGED_MD_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(md|MD)$' || true)
[ -z "$STAGED_MD_FILES" ] && exit 0

if ! command -v npx >/dev/null 2>&1; then
  echo "[pre-commit] npx (Node.js) not found. Install Node.js to lint Markdown." >&2
  exit 1
fi

echo "[pre-commit] Linting Markdown files:"
echo "$STAGED_MD_FILES" | sed 's/^/  - /'

if ! npx --yes -- markdownlint-cli2 --version >/dev/null 2>&1; then
  echo "[pre-commit] Installing markdownlint-cli2 (ephemeral)." >&2
  npm install --no-save markdownlint-cli2 >/dev/null 2>&1 || {
    echo "[pre-commit] Failed to install markdownlint-cli2." >&2
    exit 1
  }
fi

CONFIG_FILE=".markdownlint.yml"
[ -f "$CONFIG_FILE" ] || CONFIG_FILE=".markdownlint.yaml"

LINT_OK=1
if ! npx --yes -- markdownlint-cli2 $STAGED_MD_FILES --config "$CONFIG_FILE"; then
  LINT_OK=0
fi

if [ $LINT_OK -eq 0 ]; then
  echo "[pre-commit] Markdown issues detected. Attempting optional auto-fix (markdownlint legacy)." >&2
  if npx --yes -- markdownlint --version >/dev/null 2>&1; then
    npx --yes -- markdownlint --fix $STAGED_MD_FILES || true
    git add $STAGED_MD_FILES || true
  fi
  echo "[pre-commit] Commit aborted. Review fixes and re-stage." >&2
  exit 1
fi

echo "[pre-commit] Markdown lint passed."
exit 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



================================================
FILE: .github/workflows/clang-format.yml
================================================
name: clang-format Check
on:
  push:
    branches: [main]
  pull_request:

jobs:
  formatting-check:
    name: Formatting Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          # Fetch enough history to diff against the base branch on PRs,
          # or against the previous commit on direct pushes.
          fetch-depth: 0

      - name: Install clang-format-21
        run: |
          wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 21
          sudo apt-get install -y clang-format-21
          sudo update-alternatives --install /usr/bin/clang-format clang-format \
            /usr/bin/clang-format-21 100
          clang-format --version

      - name: Resolve changed C/C++ files
        id: changed
        run: |
          if [ "${{ github.event_name }}" = "pull_request" ]; then
            BASE="${{ github.event.pull_request.base.sha }}"
          else
            BASE="${{ github.event.before }}"
          fi

          # Gracefully handle the first push to a branch (no previous commit).
          if git cat-file -t "$BASE" 2>/dev/null | grep -q commit; then
            FILES=$(git diff --name-only --diff-filter=ACMR "$BASE" HEAD \
              | grep -E '\.(c|h|cpp|hpp|cc|hh)$' || true)
          else
            FILES=$(git ls-files '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh')
          fi

          echo "files<<EOF" >> "$GITHUB_OUTPUT"
          echo "$FILES"     >> "$GITHUB_OUTPUT"
          echo "EOF"        >> "$GITHUB_OUTPUT"

          if [ -z "$FILES" ]; then
            echo "No C/C++ files changed – skipping format check."
            echo "skip=true" >> "$GITHUB_OUTPUT"
          else
            echo "Checking $(echo "$FILES" | wc -l) file(s):"
            echo "$FILES"
            echo "skip=false" >> "$GITHUB_OUTPUT"
          fi

      - name: Check formatting
        if: steps.changed.outputs.skip == 'false'
        run: |
          echo "${{ steps.changed.outputs.files }}" \
            | xargs -r clang-format --dry-run --Werror


================================================
FILE: .github/workflows/doc.yml
================================================
name: Doc Deploy

on:
  push:
    branches: [main]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Install dependencies
        run: |
          sudo apt install python3-sphinx meson ninja-build
      - name: Build docs
        run: |
          meson -Donly_docs=true builddir
          make docs
      - name: Setup Pages
        uses: actions/configure-pages@v4
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          path: "./builddir/docs/source/html"
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4


================================================
FILE: .github/workflows/markdownlint.yml
================================================
name: Markdown Lint

on:
  pull_request:
    paths:
      - '**/*.md'
      - '.markdownlint.yml'
  push:
    branches: [ main ]
    paths:
      - '**/*.md'
      - '.markdownlint.yml'

jobs:
  markdownlint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install markdownlint tools
        run: |
          npm install --no-save markdownlint-cli2

      - name: Run markdownlint
        run: |
          npx markdownlint-cli2 "**/*.md" "!usr/**" "!builddir/**"

      - name: Upload markdownlint report (always)
        if: always()
        run: |
          # Create simple summary artifact (non-blocking)
          echo "Markdown lint completed" > markdownlint-summary.txt
        
      - name: Store summary artifact
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: markdownlint-summary
          path: markdownlint-summary.txt


================================================
FILE: .gitignore
================================================
*.o
*.a
*.d
*~
_install
_postinstall
_preinstall
_postbuild
_postclean
lib/common/common/
docs/build/
.project
.pydevproject
node_modules
.vscode
gulpfile.js
x86_64-*
lib/lua/build
builddir/
usr/local
tx_perf


================================================
FILE: .markdownlint.yml
================================================
# Markdownlint configuration
# Adjusted for Pktgen project documentation style.
# Rule references: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md

# Disable long line rule; technical lines (URLs, tables, commands) often exceed 80 chars.
MD013: false

# Allow inline HTML only if absolutely needed (currently we removed it).
MD033: true  # Disallow inline HTML (set to false to allow)

# Require fenced code block style consistency (use backticks).
MD048:
  style: backtick

# Enforce heading style ATX (# ...)
MD003:
  style: atx

# No multiple consecutive blank lines
MD012: true

# Trailing spaces not allowed (except for deliberate hard-breaks)
MD009:
  strict: true

# Lists: allow different markers but keep consistent indentation
MD004: true

# Ordered list numbering can be all '1.' for simplicity
MD029:
  style: one

# Code blocks and lists separated by blank lines
MD031: true

# First line should be a top-level heading
MD041: true

# Horizontal rules style (enforce ---)
MD035:
  style: ---

# Emphasis markers style (prefer *)
MD049:
  style: asterisk

# Strong emphasis style (prefer **)
MD050:
  style: asterisk

# Heading levels should only increment by one level at a time
MD001: true


================================================
FILE: .pre-commit-config.yaml
================================================
# Pre-commit configuration for FastIPC
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# Global exclusions - ignore build directories and specifications
exclude: '^(builddir/.*|specs/.*|.github/.*|.githooks/.*)'

repos:
  # General code quality hooks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: trailing-whitespace
        args: [--markdown-linebreak-ext=md]
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files
        args: ['--maxkb=1000']
      - id: check-case-conflict
      - id: check-merge-conflict
      - id: check-symlinks
      - id: debug-statements
      - id: detect-private-key
      - id: mixed-line-ending
        args: ['--fix=lf']

  # C/C++ specific formatting and linting
  - repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v22.1.0
    hooks:
      - id: clang-format
        args: ['-i']
        types_or: [c, c++]

  # Additional C/C++ static analysis (manual use)
  # Uncomment to enable clang-tidy in pre-commit (requires compilation database)
  # - repo: local
  #   hooks:
  #     - id: clang-tidy
  #       name: clang-tidy
  #       entry: clang-tidy
  #       language: system
  #       files: \.(c|h)$
  #       args: [--format-style=file]

  # Meson build file validation (manual)
  # Run manually with: meson setup --dry-run build-test

  # Documentation and markdown
  - repo: https://github.com/igorshubovych/markdownlint-cli
    rev: v0.47.0
    hooks:
      - id: markdownlint
        args: ['--fix', '--disable', 'MD013', 'MD033']



  # Shell script linting
  # - repo: https://github.com/shellcheck-py/shellcheck-py
  #   rev: v0.10.0.1
  #   hooks:
  #     - id: shellcheck

  # Security scanning
  #- repo: https://github.com/Yelp/detect-secrets
  #  rev: v1.5.0
  #  hooks:
  #    - id: detect-secrets
  #      args: ['--baseline', '.secrets.baseline']

#ci:
#  autofix_commit_msg: |
#    [pre-commit.ci] auto fixes from pre-commit.com hooks
#
#    for more information, see https://pre-commit.ci
#  autofix_prs: true
#  autoupdate_branch: ''
#  autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
#  autoupdate_schedule: weekly
#  skip: []
#  submodules: false


================================================
FILE: .readthedocs.yaml
================================================
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
  os: ubuntu-22.04
  tools:
    python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
  configuration: docs/source/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
#   install:
#   - requirements: docs/requirements.txt


================================================
FILE: 2-ports
================================================
#
# Pktgen 25.08.2
# Copyright(c) <2010-2025>, Intel Corporation. All rights reserved., Powered by DPDK 26.03.0-rc0

# Command line arguments: (DPDK args are defaults)
# ./usr/local/bin/pktgen -c fe -n 3 -m 512 --proc-type primary -- -v -T -P -G -m [2-3:4].0 -m [5-6:7].1 -f themes/black-yellow.theme

#######################################################################
# Pktgen Configuration script information:
#   Flags 00008814
#   Number of ports: 2
#   Number ports per page: 4
#   Number descriptors: RX 1024 TX: 1024
#   Promiscuous mode is Enabled


# Global configuration:
#   geometry 132x56
disable mac_from_arp

######################### Port  0 ##################################
#
# Port:  0, Burst (Rx/Tx): 64/ 32, Rate:100%, Flags:            1000, TX Count:Forever
#           Sequence count:0, Prime:1 VLAN ID:0001, Link: <UP-100000-FD>
#
# Set up the primary port information:
set 0 count 0
set 0 size 64
set 0 rate 100
set 0 rxburst 64
set 0 txburst 32
set 0 sport 1234
set 0 dport 5678
set 0 prime 1
set 0 type ipv4
set 0 proto tcp
set 0 dst ip 192.168.1.1
set 0 src ip 192.168.0.1/24
set 0 tcp flags ack
set 0 tcp seq 74616
set 0 tcp ack 74640
set 0 dst mac 6c:fe:54:a0:84:f0
set 0 src mac 6c:fe:54:a0:86:80
set 0 vlan 1

set 0 pattern abc

set 0 jitter 50
disable 0 mpls
range 0 mpls entry 0x0
disable 0 qinq
set 0 qinqids 0 0
disable 0 gre
disable 0 gre_eth
disable 0 vxlan
set 0 vxlan 0x0 0 0
#
# Port flag values:
disable 0 icmp
disable 0 pcap
disable 0 range
disable 0 latency
disable 0 process
disable 0 capture
disable 0 vlan
#
# Range packet information:
range 0 src mac start 6c:fe:54:a0:86:80
range 0 src mac min 00:00:00:00:00:00
range 0 src mac max 00:00:00:00:00:00
range 0 src mac inc 00:00:00:00:00:00

range 0 dst mac start 6c:fe:54:a0:86:81
range 0 dst mac min 00:00:00:00:00:00
range 0 dst mac max 00:00:00:00:00:00
range 0 dst mac inc 00:00:00:00:00:00

range 0 src ip start 192.168.0.1
range 0 src ip min 192.168.0.1
range 0 src ip max 192.168.0.254
range 0 src ip inc 0.0.0.0

range 0 dst ip start 192.168.1.1
range 0 dst ip min 192.168.1.1
range 0 dst ip max 192.168.1.254
range 0 dst ip inc 0.0.0.1

range 0 proto tcp

range 0 src port start 1234
range 0 src port min 0
range 0 src port max 65535
range 0 src port inc 1

range 0 dst port start 5678
range 0 dst port min 0
range 0 dst port max 65535
range 0 dst port inc 1

range 0 tcp flags ack

range 0 tcp seq start 74616
range 0 tcp seq min 0
range 0 tcp seq max 536870911
range 0 tcp seq inc 0

range 0 tcp ack start 74640
range 0 tcp ack min 0
range 0 tcp ack max 536870911
range 0 tcp ack inc 0

range 0 ttl start 64
range 0 ttl min 0
range 0 ttl max 255
range 0 ttl inc 0

range 0 vlan start 1
range 0 vlan min 1
range 0 vlan max 4095
range 0 vlan inc 0

range 0 cos start 0
range 0 cos min 0
range 0 cos max 7
range 0 cos inc 0

range 0 tos start 0
range 0 tos min 0
range 0 tos max 255
range 0 tos inc 0
range 0 gre key 0

range 0 size start 64
range 0 size min 64
range 0 size max 1518
range 0 size inc 0

#
# Set up the sequence data for the port.
set 0 seq_cnt 0

######################### Port  1 ##################################
#
# Port:  1, Burst (Rx/Tx): 64/ 32, Rate:100%, Flags:            1000, TX Count:Forever
#           Sequence count:0, Prime:1 VLAN ID:0001, Link: <UP-100000-FD>
#
# Set up the primary port information:
set 1 count 0
set 1 size 64
set 1 rate 100
set 1 rxburst 64
set 1 txburst 32
set 1 sport 1234
set 1 dport 5678
set 1 prime 1
set 1 type ipv4
set 1 proto tcp
set 1 dst ip 192.168.0.1
set 1 src ip 192.168.1.1/24
set 1 tcp flags ack
set 1 tcp seq 74616
set 1 tcp ack 74640
set 1 dst mac 6c:fe:54:a0:84:f1
set 1 src mac 6c:fe:54:a0:86:81
set 1 vlan 1

set 1 pattern abc

set 1 jitter 50
disable 1 mpls
range 1 mpls entry 0x0
disable 1 qinq
set 1 qinqids 0 0
disable 1 gre
disable 1 gre_eth
disable 1 vxlan
set 1 vxlan 0x0 0 0
#
# Port flag values:
disable 1 icmp
disable 1 pcap
disable 1 range
disable 1 latency
disable 1 process
disable 1 capture
disable 1 vlan
#
# Range packet information:
range 1 src mac start 6c:fe:54:a0:86:81
range 1 src mac min 00:00:00:00:00:00
range 1 src mac max 00:00:00:00:00:00
range 1 src mac inc 00:00:00:00:00:00

range 1 dst mac start 6c:fe:54:a0:86:80
range 1 dst mac min 00:00:00:00:00:00
range 1 dst mac max 00:00:00:00:00:00
range 1 dst mac inc 00:00:00:00:00:00

range 1 src ip start 192.168.1.1
range 1 src ip min 192.168.1.1
range 1 src ip max 192.168.1.254
range 1 src ip inc 0.0.0.0

range 1 dst ip start 192.168.2.1
range 1 dst ip min 192.168.2.1
range 1 dst ip max 192.168.2.254
range 1 dst ip inc 0.0.0.1

range 1 proto tcp

range 1 src port start 1234
range 1 src port min 0
range 1 src port max 65535
range 1 src port inc 1

range 1 dst port start 5678
range 1 dst port min 0
range 1 dst port max 65535
range 1 dst port inc 1

range 1 tcp flags ack

range 1 tcp seq start 74616
range 1 tcp seq min 0
range 1 tcp seq max 536870911
range 1 tcp seq inc 0

range 1 tcp ack start 74640
range 1 tcp ack min 0
range 1 tcp ack max 536870911
range 1 tcp ack inc 0

range 1 ttl start 64
range 1 ttl min 0
range 1 ttl max 255
range 1 ttl inc 0

range 1 vlan start 1
range 1 vlan min 1
range 1 vlan max 4095
range 1 vlan inc 0

range 1 cos start 0
range 1 cos min 0
range 1 cos max 7
range 1 cos inc 0

range 1 tos start 0
range 1 tos min 0
range 1 tos max 255
range 1 tos inc 0
range 1 gre key 0

range 1 size start 64
range 1 size min 64
range 1 size max 1518
range 1 size inc 0

#
# Set up the sequence data for the port.
set 1 seq_cnt 0

################################ Done #################################


================================================
FILE: 2-vf-ports
================================================
#
# Pktgen 25.07.1
# Copyright(c) <2010-2025>, Intel Corporation. All rights reserved., Powered by DPDK 25.07.0

# Command line arguments: (DPDK args are defaults)
# ./usr/local/bin/pktgen -c 7c000 -n 3 -m 512 --proc-type primary -- -v -T -P -G -m [15:16].0 -m [17:18].1 -f themes/black-yellow.theme -f 2-ports

#######################################################################
# Pktgen Configuration script information:
#   Flags 00008814
#   Number of ports: 2
#   Number ports per page: 4
#   Number descriptors: RX 1024 TX: 1024
#   Promiscuous mode is Enabled


# Global configuration:
#   geometry 132x56
disable mac_from_arp

######################### Port  0 ##################################
#
# Port:  0, Burst (Rx/Tx): 64/ 32, Rate:100%, Flags:            1000, TX Count:Forever
#           Sequence count:0, Prime:1 VLAN ID:0001, Link: <UP-100000-FD>
#
# Set up the primary port information:
set 0 count 0
set 0 size 64
set 0 rate 100
set 0 rxburst 64
set 0 txburst 32
set 0 sport 1234
set 0 dport 5678
set 0 prime 1
set 0 type ipv4
set 0 proto tcp
set 0 dst ip 192.168.66.161
set 0 src ip 192.168.66.101/24
set 0 tcp flags ack
set 0 tcp seq 74616
set 0 tcp ack 74640
set 0 dst mac 52:54:00:00:16:01
set 0 src mac 06:bd:a3:87:a7:96
set 0 vlan 1

set 0 pattern abc

set 0 jitter 50
disable 0 mpls
range 0 mpls entry 0x0
disable 0 qinq
set 0 qinqids 0 0
disable 0 gre
disable 0 gre_eth
disable 0 vxlan
set 0 vxlan 0x0 0 0
#
# Port flag values:
disable 0 icmp
disable 0 pcap
disable 0 range
disable 0 latency
disable 0 process
disable 0 capture
disable 0 vlan
#
# Range packet information:
range 0 src mac start 06:bd:a3:87:a7:96
range 0 src mac min 00:00:00:00:00:00
range 0 src mac max 00:00:00:00:00:00
range 0 src mac inc 00:00:00:00:00:00

range 0 dst mac start 2e:f9:d1:05:fb:e7
range 0 dst mac min 00:00:00:00:00:00
range 0 dst mac max 00:00:00:00:00:00
range 0 dst mac inc 00:00:00:00:00:00

range 0 src ip start 192.168.0.1
range 0 src ip min 192.168.0.1
range 0 src ip max 192.168.0.254
range 0 src ip inc 0.0.0.0

range 0 dst ip start 192.168.1.1
range 0 dst ip min 192.168.1.1
range 0 dst ip max 192.168.1.254
range 0 dst ip inc 0.0.0.1

range 0 proto tcp

range 0 src port start 1234
range 0 src port min 0
range 0 src port max 65535
range 0 src port inc 1

range 0 dst port start 5678
range 0 dst port min 0
range 0 dst port max 65535
range 0 dst port inc 1

range 0 tcp flags ack

range 0 tcp seq start 74616
range 0 tcp seq min 0
range 0 tcp seq max 536870911
range 0 tcp seq inc 0

range 0 tcp ack start 74640
range 0 tcp ack min 0
range 0 tcp ack max 536870911
range 0 tcp ack inc 0

range 0 ttl start 64
range 0 ttl min 0
range 0 ttl max 255
range 0 ttl inc 0

range 0 vlan start 1
range 0 vlan min 1
range 0 vlan max 4095
range 0 vlan inc 0

range 0 cos start 0
range 0 cos min 0
range 0 cos max 7
range 0 cos inc 0

range 0 tos start 0
range 0 tos min 0
range 0 tos max 255
range 0 tos inc 0
range 0 gre key 0

range 0 size start 64
range 0 size min 64
range 0 size max 1518
range 0 size inc 0

#
# Set up the sequence data for the port.
set 0 seq_cnt 0

######################### Port  1 ##################################
#
# Port:  1, Burst (Rx/Tx): 64/ 32, Rate:100%, Flags:            1000, TX Count:Forever
#           Sequence count:0, Prime:1 VLAN ID:0001, Link: <UP-100000-FD>
#
# Set up the primary port information:
set 1 count 0
set 1 size 64
set 1 rate 100
set 1 rxburst 64
set 1 txburst 32
set 1 sport 1234
set 1 dport 5678
set 1 prime 1
set 1 type ipv4
set 1 proto tcp
set 1 dst ip 192.168.66.162
set 1 src ip 192.168.66.102/24
set 1 tcp flags ack
set 1 tcp seq 74616
set 1 tcp ack 74640
set 1 dst mac 52:54:00:00:16:02
set 1 src mac 2e:f9:d1:05:fb:e7
set 1 vlan 1

set 1 pattern abc

set 1 jitter 50
disable 1 mpls
range 1 mpls entry 0x0
disable 1 qinq
set 1 qinqids 0 0
disable 1 gre
disable 1 gre_eth
disable 1 vxlan
set 1 vxlan 0x0 0 0
#
# Port flag values:
disable 1 icmp
disable 1 pcap
disable 1 range
disable 1 latency
disable 1 process
disable 1 capture
disable 1 vlan
#
# Range packet information:
range 1 src mac start 2e:f9:d1:05:fb:e7
range 1 src mac min 00:00:00:00:00:00
range 1 src mac max 00:00:00:00:00:00
range 1 src mac inc 00:00:00:00:00:00

range 1 dst mac start 06:bd:a3:87:a7:96
range 1 dst mac min 00:00:00:00:00:00
range 1 dst mac max 00:00:00:00:00:00
range 1 dst mac inc 00:00:00:00:00:00

range 1 src ip start 192.168.1.1
range 1 src ip min 192.168.1.1
range 1 src ip max 192.168.1.254
range 1 src ip inc 0.0.0.0

range 1 dst ip start 192.168.2.1
range 1 dst ip min 192.168.2.1
range 1 dst ip max 192.168.2.254
range 1 dst ip inc 0.0.0.1

range 1 proto tcp

range 1 src port start 1234
range 1 src port min 0
range 1 src port max 65535
range 1 src port inc 1

range 1 dst port start 5678
range 1 dst port min 0
range 1 dst port max 65535
range 1 dst port inc 1

range 1 tcp flags ack

range 1 tcp seq start 74616
range 1 tcp seq min 0
range 1 tcp seq max 536870911
range 1 tcp seq inc 0

range 1 tcp ack start 74640
range 1 tcp ack min 0
range 1 tcp ack max 536870911
range 1 tcp ack inc 0

range 1 ttl start 64
range 1 ttl min 0
range 1 ttl max 255
range 1 ttl inc 0

range 1 vlan start 1
range 1 vlan min 1
range 1 vlan max 4095
range 1 vlan inc 0

range 1 cos start 0
range 1 cos min 0
range 1 cos max 7
range 1 cos inc 0

range 1 tos start 0
range 1 tos min 0
range 1 tos max 255
range 1 tos inc 0
range 1 gre key 0

range 1 size start 64
range 1 size min 64
range 1 size max 1518
range 1 size inc 0

#
# Set up the sequence data for the port.
set 1 seq_cnt 0

################################ Done #################################


================================================
FILE: CLAUDE.md
================================================
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

---

## Build Commands

The project uses **Meson/Ninja**. A `builddir/` is typically already initialised.

```bash
# Incremental build (most common)
ninja -C builddir

# Full configure + build from scratch
meson setup builddir
meson compile -C builddir

# Makefile wrapper (delegates to tools/pktgen-build.sh)
make build          # release build
make rebuild        # clean + release build
make debug          # debug build (no optimisation)
make debugopt       # debug with -O2
make buildlua       # release + Lua scripting enabled
make clean

# Build options (pass to meson setup)
meson setup builddir -Denable_lua=true
meson setup builddir -Denable_docs=true
meson setup builddir -Donly_docs=true      # docs only, skip app/lib

# Code formatting
ninja -C builddir clang-format-check       # check only (CI does this)
ninja -C builddir clang-format             # auto-fix in place

# Documentation
make docs                                  # Sphinx + Doxygen

# Tests
ninja -C builddir test                     # meson test runner
# Integration tests are Lua scripts in test/ that connect to a running
# pktgen instance over its TCP socket (port 22022).
```

Build is strict: **warning_level=3** and **werror=true**. Any new warning is a build failure.

---

## Pre-commit Hook Setup

```bash
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
chmod +x .githooks/pre-commit
```

This runs `clang-format -i` on staged C files and `markdownlint` on staged Markdown.

---

## Commit Message Convention

From `CONTRIBUTING.md`:

```
<short summary in imperative mood>

<context / motivation>
<what changed>
<any impact / migration notes>
```

Example prefix pattern observed in recent commits: `refactor:`, `fix:`, `stats:`, etc.

---

## High-Level Architecture

Pktgen is a DPDK-based wire-rate packet generator. The binary is `builddir/app/pktgen`.

### Module layout

```
lib/
  hmap/      Hash-map (type-safe, 64-bit unified storage)
  common/    Shared utilities: checksums, IP parsing, strings, CPU info, port config
  utils/     Portlist parsing, heap, inet_pton, JSON (parson)
  vec/       Dynamic-array (vector) container
  plugin/    dlopen-based plugin loader (up to 32 plugins, start/stop lifecycle)
  cli/       Full interactive shell: node tree, gap-buffer editor, TAB completion,
             history, help, env vars, map-driven argument parsing
  lua/       Lua 5.3/5.4 scripting bindings (conditional on -Denable_lua=true)

app/
  pktgen-main.c      Entry point: arg parsing, EAL init, port setup, CLI loop start
  pktgen.c           Core TX loop logic, packet rate calculation, timer callbacks
  pktgen.h           Global pktgen_t struct, page/flag enums, per-port iteration macros
  pktgen-port-cfg.h  port_info_t (per-port state), SEND_* flag bits, pkt_seq_t layout
  pktgen-cmds.c      ~112 KB command implementation dispatcher
  cli-functions.c    ~74 KB CLI map tables + command handler glue (registers maps)
  l2p.c / l2p.h      Lcore-to-Port mapping matrix, mempool ownership
  pktgen-{ipv4,ipv6,tcp,udp,arp,vlan,gre,gtpu,ether}.c   Protocol header builders
  pktgen-range.c     Incrementing-field packet generation
  pktgen-seq.c       16-slot packet sequence
  pktgen-random.c    Per-field random bitfield masks
  pktgen-pcap.c      PCAP file load/replay
  pktgen-capture.c   Packet capture to memory
  pktgen-latency.c   Latency sampling & histograms
  pktgen-stats.c     Per-port / per-queue stats and rate calculation
  pktgen-display.c   Terminal UI page rendering (10 display pages)
  pktgen-log.c       Ring-buffer message log
```

### Build dependency order (lib subdirectories)

```
hmap → common → utils → vec → plugin → cli → lua
```

All lib modules compile to static libraries and are linked into the single `pktgen` executable.

### Data-flow summary

1. **Initialisation** (`pktgen-main.c`): parse `-m` matrix string → populate `l2p_t` (which lcores own which ports/queues) → allocate per-queue mempools (`rx_mp`, `tx_mp`, `sp_mp`) → build default packet templates via `pktgen_packet_ctor()` → launch one worker per lcore.

2. **TX loop** (`pktgen.c:pktgen_launch_one_lcore`): each worker polls its assigned port/queue. The active sending mode is determined by the port's `port_flags` atomic (e.g. `SEND_SINGLE_PKTS`, `SEND_RANGE_PKTS`, `SEND_SEQ_PKTS`, `SEND_PCAP_PKTS`). Rate limiting uses cycle-based inter-burst timing (`tx_cycles`).

3. **RX path**: received packets are optionally processed (`PROCESS_INPUT_PKTS` — handles ARP/ICMP echo), captured (`CAPTURE_PKTS`), or used for latency measurement (`SAMPLING_LATENCIES`).

4. **CLI / command path**: the interactive shell runs on the main lcore. Commands are dispatched via `cli_map` pattern matching in `cli-functions.c` → actual logic in `pktgen-cmds.c`. Changing a port setting typically sets a flag (`SETUP_TRANSMIT_PKTS`) so the worker rebuilds its packet template on the next iteration.

5. **Display refresh**: a periodic timer (`UPDATE_DISPLAY_TICK_RATE`) triggers `pktgen_page_display()` which re-renders the current screen page using stats collected via `rte_eth_stats_get` / extended stats.

### Key global state

- `pktgen_t pktgen` — single global (defined in `pktgen.c`, declared `extern` in `pktgen.h`). Holds port count, display state, CPU info, capture buffers, Lua handles.
- `l2p_t` — lcore↔port mapping. Accessed via `l2p_get_port_pinfo(pid)` and the per-lcore `l2p_get_lport(lid)`.
- `port_info_t` — per-port struct (embedded inside `l2p_port_t.pinfo`). Contains packet templates (`seq_pkt[NUM_TOTAL_PKTS]`), range config, stats, latency, random-field masks, and the 64-bit `port_flags` atomic.
- `this_cli` — `RTE_PER_LCORE` pointer to `struct cli`. The CLI tree, gap buffer, history, and the `cmd_maps` registry all live here.

### Port-flag model

`port_flags` is a 64-bit atomic on each `port_info_t`. Bits are grouped:

| Group | Bits | Semantics |
|---|---|---|
| Non-exclusive RX/misc | 0–9 | ARP, ICMP echo, capture, latency sampling |
| Exclusive TX mode | 12–15 | Exactly one of SINGLE/PCAP/RANGE/SEQ must be set |
| Exclusive pkt-type | 16–23 | VLAN, MPLS, GRE, VxLAN, random, latency |
| Control | 28–31 | SETUP_TRANSMIT_PKTS, SENDING_PACKETS, SEND_FOREVER |

The macros `EXCLUSIVE_MODES` and `EXCLUSIVE_PKT_MODES` define the mutual-exclusion masks.

### CLI auto-completion architecture

TAB completion has two layers:

1. **Tree completion** — walks `cli_node` children of the current directory, matches prefixes of command/dir/file names.
2. **Map completion** — once the first token (command name) is typed, `cli_get_cmd_map(argv[0])` returns the registered `cli_map` table. The completer scans all map entries whose fixed tokens match what has been typed so far, then offers candidates or placeholder hints (e.g. `<portlist>`, `<ipv4-addr>`) for the current argument position.

Map registration happens automatically: `cli_help_add(group, map, help)` calls `cli_register_cmd_maps(map)` which extracts every unique first-token and stores `{token → map}` in the growable `cmd_maps` array on `this_cli`. Do not call `cli_register_cmd_map()` manually after `cli_help_add()` — it would be a redundant no-op.

Map format tokens: `%d` (32-bit), `%D` (64-bit), `%u`/`%U` (unsigned), `%h`/`%H` (hex), `%b` (8-bit), `%n` (number), `%s` (string), `%c` (comma-list), `%m` (MAC), `%4` (IPv4), `%6` (IPv6), `%P` (portlist), `%C` (corelist), `%k` (kvargs), `%l` (list), `%|opt1|opt2|…` (choice token).

### Packet-slot layout (`pkt_seq_t` array)

Each port has `NUM_TOTAL_PKTS = 20` slots:

| Index | Role |
|---|---|
| 0–15 | Sequence packets (cycled in `SEND_SEQ_PKTS` mode) |
| 16 (`SINGLE_PKT`) | Default single-packet template |
| 17 (`SPECIAL_PKT`) | Temporary / scratch packet |
| 18 (`RANGE_PKT`) | Template rebuilt each burst in range mode |
| 19 (`LATENCY_PKT`) | Latency probe packet |

---

## Coding Conventions

- **Formatting**: LLVM-based `.clang-format`, 100-column limit, 4-space indent, right-aligned pointers. Run `clang-format -i` on any file you touch.
- **New files**: must carry the SPDX header (`SPDX-License-Identifier: BSD-3-Clause`) and a copyright line.
- **Port iteration**: use the `forall_ports(_action)` or `foreach_port(_portlist, _action)` macros from `pktgen.h` rather than hand-rolling port loops.
- **TAILQ / CIRCLEQ**: the CLI and help systems use POSIX tail-queues extensively. New linked structures should follow the same pattern.
- **Atomic port flags**: always use `rte_atomic64_t` operations when reading or writing `port_info_t.port_flags` from worker lcores.
- **cli_map entries**: every entry in a `cli_map` array must have a corresponding `case` in the command handler's switch on `m->index`. Orphan entries cause phantom command registrations and broken auto-complete.

---

## CI Checks (GitHub Actions)

Three workflows run on every PR:

| Workflow | What it checks |
|---|---|
| `clang-format.yml` | All C/C++ files pass `clang-format --dry-run` (clang-format 21) |
| `markdownlint.yml` | All `.md` files pass `markdownlint-cli2` (config in `.markdownlint.yml`) |
| `doc.yml` | Sphinx docs build cleanly (runs on push to `main` only) |

Markdown rules of note: bare URLs must be wrapped in `< >`, numbered lists should use `1.` style, fenced code blocks must have a language hint.


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct

We are committed to fostering a welcoming, respectful, and productive environment for all contributors and users of Pktgen-DPDK.

This project adopts (by reference) the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) (Version 2.1) as the foundation of expected behavior.

## 1. Scope

Applies to all project spaces: GitHub issues, pull requests, discussions, documentation, community chats, and any project-related events.

## 2. Summary of Expectations

- Be respectful, inclusive, and patient.
- Provide constructive feedback; focus on ideas, not individuals.
- Use welcoming and professional language; avoid harassment or discrimination.
- Assume good intent while clarifying misunderstandings.
- Respect differing viewpoints and experiences.

## 3. Unacceptable Behavior (Examples)

- Harassment, intimidation, or discrimination of any form.
- Personal or political attacks.
- Trolling, insults, or derogatory comments.
- Public or private harassment.
- Publishing others’ private information without explicit permission.
- Conduct inconsistent with professional standards.

## 4. Reporting

If you experience or witness unacceptable behavior:

- Preferred: Open a confidential issue labeled `coc-report` (omit sensitive personal details; maintainers will follow up privately), or
- Email the maintainers (if listed in `README.md`) with details: date/time, participants, context, and any supporting material.

Reports will be handled promptly, respectfully, and—when requested—confidentially.

## 5. Enforcement

Maintainers are responsible for clarifying and enforcing this Code. Actions may include (progressively, as appropriate):

1. Informal warning
1. Formal written warning
1. Temporary exclusion from discussions or repository interactions
1. Permanent ban from project spaces

Severe violations (e.g. threats, doxxing, hate speech) may result in immediate permanent removal without prior warning.

## 6. Appeals

If you believe an enforcement decision was made in error, you may request a review by contacting the maintainers with a concise rationale.

## 7. Attribution

This document is adapted from the Contributor Covenant, Version 2.1.

See: <https://www.contributor-covenant.org/version/2/1/code_of_conduct/>

---
Questions or feedback regarding this Code of Conduct are welcome—open an issue to discuss improvements.


================================================
FILE: CONTRIBUTING.TXT
================================================
Contributors Guide
==================

This document outlines how to contribute code to the PKTGEN project.

Getting the code
----------------

The PKTGEN code can be cloned from the repository on Github as follows:

    git clone https://github.com/pktgen/Pktgen-DPDK.git

The code can be browsed at https://github.com/pktgen/Pktgen-DPDK

Submitting Patches
------------------

Contributions to PKTGEN should be submitted as merge requests on Github.

The commit message must end with a "Signed-off-by:" line which is added using:

    git commit --signoff # or -s

The purpose of the signoff is explained in the Linux kernel guidelines
Developer's Certificate of Origin:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Note:
    All developers must ensure that they have read, understood and complied
    with the Developer's Certificate of Origin section of the documentation
    prior to applying the signoff and submitting a patch.

The DPDK Code Contributors guidelines contain information that is
useful for submitting patches to PKTGEN:
http://dpdk.org/doc/guides/contributing/index.html

Coding Guidelines
-----------------

* C code should follow the DPDK coding standards.
* Lua code should follow existing code.

Maintainer
----------

The PKTGEN maintainer is: Keith Wiles <keith.wiles@intel.com>


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Pktgen-DPDK

Thank you for your interest in improving Pktgen-DPDK. This short guide complements the main `README.md` and highlights the key expectations for contributions.

## 1. Before You Start

- Skim the project overview and feature list in the README.
- Make sure you can build and run the tool (see "Quick Start" and "Clone and Build" sections).
- Search existing issues and pull requests to avoid duplication.

## 2. Development Environment

- Build system: Meson/Ninja (optional simple `Makefile` wrapper provided).
- Required: A recent DPDK build with a valid `libdpdk.pc` on your `PKG_CONFIG_PATH`.
- Recommended: Enable the pre-commit hook for markdown linting:
  - `ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit && chmod +x .githooks/pre-commit`

## 3. Coding & Style

- Follow existing C coding patterns; prefer readability and minimal global state changes.
- Keep commits focused; one logical change per commit when possible.
- Document non-obvious code with concise comments.
- Avoid introducing new external dependencies without discussion.

## 4. Documentation Standards

- All Markdown must pass `markdownlint` (CI will enforce).
- Use fenced code blocks with language hints.
- Wrap bare URLs in `< >`.
- Numbered lists may all use `1.` style.
- If adding new user-facing features, update the relevant README section or create a doc under `docs/`.
- Refer to the extended style guidance in [`docs/STYLE.md`](./docs/STYLE.md) for formatting patterns and examples.

## 5. Commit Messages

Use the following structure:

```text
<short summary imperative>

<context / motivation>
<what changed>
<any impact / migration notes>
```

Examples:

```text
stats: fix link status refresh on state change

Previously link duplex/speed changes were ignored unless carrier toggled. Update
logic to trigger display refresh on any field difference.
```

## 6. Submitting Pull Requests

- Fork, branch from `main`.
- Rebase (not merge) to update your branch before final push.
- Ensure `meson compile` succeeds and (if applicable) tests or sample scripts still run.
- CI must be green (markdownlint, build, etc.).
- Reference related issues with `Fixes #NNN` when appropriate.

## 7. Reporting Issues

Include (when relevant):

- Pktgen version (`cat VERSION`)
- DPDK version and configuration
- NIC model(s) and driver versions
- Reproduction steps and minimal config (`cfg/` file if relevant)
- Expected vs. actual behavior

## 8. Performance / Feature Discussions

Open an issue first for large changes (subsystems, new protocol modules, architectural refactors). Describe:

- Problem statement / use case
- Proposed design sketch
- Anticipated impacts (performance, config format, user CLI)

## 9. Security

Do not publicly disclose potential security-impacting bugs without prior coordination—open a private issue if possible or contact maintainers directly.

See also the community standards in the [`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md).

## 10. Licensing

By contributing you agree your changes are under the existing project license (BSD-3-Clause). Ensure any new files include the appropriate SPDX identifier header where applicable.

## 11. Quick Reference

| Area | Where to Look |
|------|---------------|
| Build & Run | README Quick Start / Build sections |
| Config examples | `cfg/` directory |
| Lua automation | README Automation section / `test/*.lua` |
| Themes | `themes/` directory |
| Plugins | `lib/plugin/` |

---
Questions? Open an issue or start a discussion. Happy hacking!


================================================
FILE: INSTALL.md
================================================
# Pktgen - Traffic Generator powered by DPDK

---
Pktgen is a traffic generator powered by DPDK at wire rate traffic with 64 byte frames.**

## (Pktgen) Sounds like 'Packet-Gen'

---
**Copyright &copy; \<2010-2026\>, 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:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- 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.

- 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

Pktgen: Created 2010-2024 by Keith Wiles @ Intel.com

---

## Installation

INSTALL for setting up Pktgen with DPDK on Ubuntu 22.04 to 23.10 desktop it should work on most Linux systems as long as the kernel has hugeTLB page support and builds DPDK.

## Please Note

> Pktgen-DPDK main repo is located @ <https://github.com/pktgen/Pktgen-DPDK>
> Documentation can be found @ <https://pktgen.github.io/Pktgen-DPDK/>

### Submitting bug fixes or enhancements to Pktgen-DPDK

> Please fork Pktgen-DPDK from GitHub and submit a pull-request as I do not accept patches sent to DPDK mailing list. If you have any questions or issues please create an issue on Github.
> Tested with Ubuntu 23.10 kernel version 6.5.0-28-generic (Mantic), and other earlier versions should work.
> Please use the latest DPDK and latest Pktgen versions other combinations may work, but with limited resources and time the latest versions are the only ones tested.
>
> Please install the latest version of DPDK from dpdk.org and follow the build instructions using meson/ninja. Then install DPDK on your system.

## Building Pktgen

Pktgen has been converted to use meson/ninja for configuration and building. **Makefiles have been removed.** This may require DPDK to be built
using meson/ninja. At least a libdpdk.pc file must be present in the system for Pktgen to locate the headers and libraries.

>Please read the DPDK.org documentation to understand more on building DPDK. The following is the minimum set of
instructions to build DPDK. You may need to install meson and ninja, if not already installed.

May need to install the BSD headers to build Pktgen code base for Ubuntu do the following:

```console
sudo apt-get install libbsd-dev
```

```console
git clone git://dpdk.org/dpdk

Or if git is blocked

git clone http://dpdk.org/git/dpdk

cd dpdk
meson setup build
ninja -C build
sudo ninja -C build install
sudo ldconfig  # make sure ld.so is pointing new DPDK libraries
```

DPDK places the libdpdk.pc (pkg-config file) in a non-standard location and you need to set enviroment variable PKG_CONFIG_PATH to the location of the file. On Ubuntu 20.04 build of DPDK it places the file here /usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc

```console
export PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig
```

Building Pktgen after you have built and installed DPDK. The new build system uses meson/ninja, but Pktgen has a build script
called 'tools/pktgen-build.sh' and uses a very simple Makefile to help build Pktgen without having to fully understand meson/ninja command line.

If you prefer you can still use meson/ninja directly.

```console
git clone https://github.com/pktgen/Pktgen-DPDK

cd pktgen-dpdk # or Pktgen-DPDK or whatever name you gave the cloned directory

make
or
make build    # Same as 'make'
or
make rebuild  # Rebuild Pktgen, which removes the 'builddir' then builds it again via meson/ninja
or
make rebuildlua # to enable Lua builds

# Use 'make help' to read the help message for building.

# DPDK does not add a /etc/ld.so.conf.d/<dpdk-libs> like file. This means you may need to
# edit /etc/ld.so.conf.d/x86_64-linux-gnu.conf file and add /usr/local/lib/x86_64-linux-gnu
# Then do 'sudo ldconfig' to locate the DPDK libraries.

# If you want to use vfio-pci then edit /etc/default/grub and add 'intel_iommu=on' to the LINUX default line
# Then use 'update-grub' command then reboot the system.
```

Editing the meson_options.txt can be done, but normally you should use a meson command line options to enable/disable options.

## Pktgen Information

The pktgen output display needs 132 columns and about 42 lines to display
correctly. I am using an xterm of 132x42, but you can have a larger display
and maybe a bit smaller. If you are displaying more then 4-6 ports then you
will need a wider display. Pktgen allows you to view a set of ports if they
do not all fit on the screen at one time via the 'page' command.

Type 'help' at the 'Pktgen>' prompt to see the complete Pktgen command line
commands. Pktgen uses VT100 control codes or escape codes to display the screens,
which means your terminal must support VT100.

### Note

`Hyperterminal in Windows is not going to work for Pktgen as it has a few problems with VT100 codes.`

## Quick comment on Pktgen modes

Pktgen has a number of modes to send packets single, range, random, sequence and
PCAP modes. Each mode has its own set of packet buffers and you must configure
each mode to work correctly. The single packet mode is the information displayed
at startup screen or when using the 'page main or page 0' command. The other
screens can be accessed using 'page seq|range|rnd|pcap|stats' command.

The pktgen program as built can send up to 16 packets per port in a sequence
and you can configure a port using the 'seq' pktgen command. A script file
can be loaded from the shell command line via the -f option and you can 'load'
a script file from within pktgen as well.

## Setup Pktgen-DPDK

At the pktgen-DPDK level directory we have the 'tools/setup.sh' script,
which needs to be run as root once per boot. The script contains a commands to setup
the environment.

Before you run the script you will need to run:

```bash
export RTE_SDK=<DPDKinstallDir>
export RTE_TARGET=x86_64-native-linux-gcc
```

Make sure you run the setup script as root via `./tools/setup.sh`. The setup
script is a bash script and tries to setup the system correctly, but you may have to
change the script to match your number of huge pages you configured above and ports.

The `modprobe uio` command, in the setup script, loads the UIO support module into the
kernel plus it loads the igb-uio.ko module into the kernel. The two echo commands,
in the setup script, finish setting up the huge pages one for each socket. If you
only have a single socket system then comment out the second echo command. The last
command is to display the huge TLB setup.

Edit your .bashrc or .profile or .cshrc to add the environment variables.
I am using bash: `# vi ~/.bashrc`

Add the following lines: Change the $RTE_SDK to the location of the DPDK version
directory. Your SDK directory maybe named differently, but should point to the DPDK
SDK directory.

```bash
export RTE_SDK=<DPDKinstallDir>
export RTE_TARGET=x86_64-native-linux-gcc
```

or use clang if you have it installed

```bash
export RTE_TARGET=x86_64-native-linux-clang
```

Create the DPDK build tree if you haven't already:

```bash
cd $RTE_SDK
make install T=x86_64-native-linux-gcc -j
```

The above command will create the x86_64-native-linux-gcc directory in the
top level of the current-dkdp directory. The above command will build the basic
DPDK libraries and build tree.

Next we build pktgen:

```bash
cd <PktgenInstallDir>
make -j
```

For CentOS and pcap support you may need to try (for libpcap-devel):

```bash
yum install dnf-plugins-core
yum config-manager --set-enabled PowerTools
yum repolist
```

You should now have pktgen built.

To get started, see README.md.


================================================
FILE: LICENSE
================================================
#   BSD LICENSE
#
#   Copyright(c) <2010-2025> 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:
#
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * 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.
#     * 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.
#
# Created 2010 by Keith Wiles @ windriver.com
#
# SPDX-License-Identifier: BSD-3-Clause
#


================================================
FILE: Makefile
================================================
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) <2019-2025> Intel Corporation

#
# Head Makefile for compiling Pktgen-DPDK, but just a wrapper around
# meson and ninja using the tools/pktgen-build.sh script.
#
# Use 'make' or 'make build' to build Pktgen-DPDK. If the build directory does
# not exist it will be created with these two build types.
#

Build=./tools/pktgen-build.sh

build: FORCE
	${Build} build

rebuild: FORCE
	${Build} clean build

buildlua: FORCE
	${Build} clean buildlua

debuglua: FORCE
	${Build} clean debuglua

debug: FORCE
	${Build} clean debug

debugopt: FORCE
	${Build} clean debugopt

clean: FORCE
	${Build} clean

install: FORCE
	${Build} install

uninstall: FORCE
	${Build} uninstall

docs: FORCE
	${Build} docs

help: FORCE
	${Build} help

FORCE:
	@echo ">>> Use 'make help' for more commands\n"


================================================
FILE: Pktgen.lua
================================================
-- SPDX-License-Identifier: BSD-3-Clause

-- Create some short cuts to the real functions.
gsub	    = string.gsub
gmatch      = string.gmatch
strrep	    = string.rep
strsub      = string.sub
strfmt      = string.format
strmatch    = string.match
strrep      = string.rep
strfind     = string.find
strlen      = string.len
tolower     = string.lower
unlink      = os.remove
system      = os.execute
tinsert     = table.insert
tgetn       = table.getn
tconcat     = table.concat

-- ===========================================================================
-- getPwd - Get the current working directory path.
-- Works for both dos and cygwin shell, which may emit an error if one failes.
--
function getPwd( func )
	local s = syscmd("pwd", func);
	if ( s == nil ) then
		s = syscmd("sh pwd", func);
	end
	return s;
end

-- ===========================================================================
-- d2u - convert dos backslashes to unix forward slashes.
--
function d2u( str )
    return gsub(str or "", "\\", "/");
end

-- ===========================================================================
-- u2d - convert unix forward slashes to dos backslashes.
--
function u2d( str )
    return gsub(str or "", "/", "\\");
end

-- ===========================================================================
-- str2tbl - convert a string to a table.
--
function str2tbl( str )
    local t = {};
    local s;

    for s in gmatch(str or "", "(.-)\n") do
        tinsert(t, s);
    end
    return t
end

-- ===========================================================================
-- trims the string of beginning and trailing spaces and tabs.
--
function trim(txt) return gsub(txt, "%s*(.-)%s*$", "%1", 1); end

-- ===========================================================================
-- A formatted output routine just like the real printf.
--
function printf(...) io.write(strfmt(...)); io.flush(); end

-- ===========================================================================
-- returns the table size or number of items in table.
--
function getn( t )

    local   i = 0;

    if ( (t ~= nil) and (type(t) == "table") ) then
        i = tgetn(t);
        if ( i > 0 ) then
            return i;
        end
        for k in pairs(t) do
            i = i + 1;
        end
    end
    return i;
end

-- ===========================================================================
-- returns the 'basename' and the 'basedir'
--
function basename(filename)
    local   fn, dn;

    -- Convert the '\' to '/' in the path name.
    filename = d2u(filename);

    fn = gsub(filename, "(.*/)(.*)", "%2") or filename;
    dn = gsub(filename, "(.*/)(.*)", "%1")

    dn = strsub(dn, 1, -2);

    return fn, dn;
end

-- ===========================================================================
-- Default routine to read data from syscmd function.
--
local function __doRead(fn)
    local   data, f;

    -- Open and read all of the data.
    f = assert(io.open(fn));
    data = f:read("*all");
    f:close();

    unlink(fn);

    return data;
end

-- ===========================================================================
-- Execute the system command return the command output if needed.
--
function syscmd( cmd, funcPtr )
    local tmpFile = "syscmd_tmp";

    system( cmd .. " > " .. tmpFile );

    funcPtr = funcPtr or __doRead;

    return funcPtr(tmpFile);    -- tmpFile is removed by the function.
end

-- ===========================================================================
-- Execute the string and return true/false.
--
function isTrue(f)
    local   s;

    if ( f == nil ) then
        return 0;
    end

    s = "if ( "..f.." ) then return 1 else return 0 end";
    return assert(loadstring(s))();
end

-- ===========================================================================
-- Output a message and return.
--
function msg(m, ...)

    if ( m ~= nil ) then io.write("++ "..strfmt(m, ...)); io.flush(); end
end
-- ===========================================================================
-- Display an error message and exit.
--
function errmsg(m, ...)

    if ( m ~= nil ) then printf("** %s", strfmt(m, ...)); end

    os.exit(1);
end

-- ===========================================================================
-- Output a 'C' like block comment.
--
function cPrintf(m, ...)

    printf("/* ");
    io.write(strfmt(m, ...));
    printf(" */\n");
end
-- ===========================================================================
-- Output a 'C' like comment.
--
function comment(msg)

    printf("/* %s */\n", msg or "ooops");
end

-- Standard set of functions for normal operation.
--

-----------------------------------------------------------------------------
-- serializeIt - Convert a variable to text or its type of variable.
--
local function serializeIt(v)
    local   s;
    local   t = type(v);

    if (t == "number") then
        s = tostring(v);
    elseif (t == "table") then
        s = tostring(v);
    elseif (t == "string") then
        s = strfmt("%q", v);
    elseif (t == "boolean") then
        s = tostring(v);
    elseif (t == "function") then
        s = strfmt("()");
    elseif (t == "userdata") then
        s = tostring(v);
    elseif (t == "nil") then
        s = "nil";
    else
        s = strfmt("<%s>", tostring(v));
    end

    return s;
end

-----------------------------------------------------------------------------
-- Serialize a value
--    k - is the variable name string.
--    o - is the orignal variable name for tables.
--    v - the value of the variable.
--    saved - is the saved table to detect loops.
--    tab - is the current tab depth.
--
local function doSerialize(k, o, v, saved, tab)
	local s, t;
    local space = function(t) return strrep(" ", t); end;

    tab     = tab or 0;
    t       = type(v);
    saved   = saved or {};

	if (t == "table") then
        if ( saved[v] ~= nil ) then
            return strfmt("%s[%s] = %s,\n", space(tab), serializeIt(o), saved[v]);
        else
            local   kk, vv, mt;

            saved[v] = k;

            if ( tab == 0 ) then
                s = strfmt("%s%s = {\n", space(tab), tostring(k));
            else
                s = strfmt("%s[%s] = {\n", space(tab), serializeIt(o));
            end
            for kk,vv in pairs(v) do
                local fn = strfmt("%s[%s]", tostring(k), serializeIt(kk));

                s = s .. doSerialize(fn, kk, vv, saved, tab+2);
            end

			if ( tab == 0 ) then
            	return s .. strfmt("%s}\n", space(tab));
			else
            	return s .. strfmt("%s},\n", space(tab));
			end
        end
	else
        return strfmt("%s[%s] = %s,\n", space(tab), serializeIt(o), serializeIt(v));
	end
end

-----------------------------------------------------------------------------
-- serialize - For a given key serialize the global variable.
--    k is a string for display and t is the table to display.
--    e.g. printf(serialize("foo", { ["bar"] = "foobar" } ));
--
function serialize(k, t)

    if ( k == nil ) then
	    k = "Globals";
        t = _G;			-- Dump out globals
    end
	if ( t == nil ) then
		t = _G;
	end

   	return doSerialize(k, k, t, {}, 0);
end

function prints(k, t) io.write(serialize(k, t)); io.flush(); end
function sleep(t) pktgen.delay(t * 1000); end


================================================
FILE: README.md
================================================
# Pktgen — DPDK Traffic Generator

High‑performance, scriptable packet generator capable of wire‑rate transmission with 64‑byte frames.

Pronounced: “packet‑gen”

[Documentation](https://pktgen.github.io/Pktgen-DPDK/) · [Releases](https://github.com/pktgen/Pktgen-DPDK/releases)

---

## Table of Contents

1. [Overview](#1-overview)
1. [Features](#2-features-partial-list)
1. [Quick Start](#3-quick-start)
1. [Building](#4-building-details)
1. [Configuration Files](#5-configuration-files-cfg)
1. [Configuration Key Reference](#6-configuration-key-reference)
1. [Runtime Modes & Pages](#7-runtime-modes--pages)
1. [Automation & Remote Control](#8-automation--remote-control)
1. [Advanced Topics](#9-advanced-topics)
1. [Contributing](#10-contributing)
1. [License](#11-license)
1. [Related Links](#12-related-links)
1. [Acknowledgments](#13-acknowledgments)

---

## 1. Overview

Pktgen is a multi‑port, multi‑core traffic generator built on top of [DPDK]. It targets realistic, repeatable performance and functional packet tests while remaining fully controllable via an interactive console, Lua scripts, or a remote TCP socket.

> Primary repository: <https://github.com/pktgen/Pktgen-DPDK>

## 2. Features (Partial List)

- Wire‑rate 64B packet generation (hardware and core count permitting)
- Multi‑port / multi‑queue scaling
- IPv4 / IPv6, TCP / UDP, VLAN, GRE, GTP-U support
- Packet sequence, range, random, pcap replay and latency modes
- Latency & jitter measurement, per‑queue and extended stats pages
- Lua scripting (local or remote) + TCP control socket (default port 22022)
- Configurable theming and multiple display pages (main, seq, range, rnd, pcap, stats, xstats)
- Plugin architecture (`lib/plugin`), capture and pcap dumping
- Dynamic rate control and pacing recalculated on size/speed changes

## 3. Quick Start

Prerequisites (typical Ubuntu 22.04+):

- Latest DPDK (build + install using Meson/Ninja)
- libbsd (`sudo apt install libbsd-dev`)
- Hugepages configured (e.g. 1G or 2M pages) and NICs bound to `vfio-pci` or `igb_uio`
- Python 3.x for helper scripts

Clone and build:

```bash
git clone https://github.com/pktgen/Pktgen-DPDK.git
cd Pktgen-DPDK
meson setup builddir
meson compile -C builddir
```

Initial device setup (only once per boot) then run a config:

```bash
sudo ./tools/run.py -s default   # bind devices & prepare environment
sudo ./tools/run.py default      # launch using cfg/default.cfg
```

Minimal manual run (no helper script) example (adjust cores/ports):

```bash
sudo ./builddir/app/pktgen -l 0-3 -n 4 -- -P -m "[1:2].0" -T
```

## 4. Building (Details)

Pktgen uses Meson/Ninja. A convenience `Makefile` and `tools/pktgen-build.sh` wrap standard steps.

1. Build and install DPDK so `libdpdk.pc` is installed (often under `/usr/local/lib/x86_64-linux-gnu/pkgconfig`).
1. Export or append to `PKG_CONFIG_PATH` if that path is non‑standard:

```bash
export PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
```

1. Build Pktgen:

```bash
meson setup builddir
meson compile -C builddir
```

Or use:

```bash
make          # uses Meson/Ninja under the hood
make rebuild  # clean reconfigure & build
make rebuildlua
```

1. (Optional) Install Pktgen artifacts via Meson if desired.

Troubleshooting hints:

- If runtime fails to find DPDK libs: run `sudo ldconfig` or add the library path to `/etc/ld.so.conf.d/`.
- Enable IOMMU for vfio: edit GRUB adding `intel_iommu=on` (or `amd_iommu=on`) then `update-grub` and reboot.

## 5. Configuration Files (`cfg/`)

Configuration files are Python fragments consumed by `tools/run.py`. They define two dictionaries: `setup` (device binding, privilege wrapper) and `run` (execution parameters).

Trimmed example:

```python
description = 'Simple default configuration'

setup = {
    'devices': (
        '81:00.0','81:00.1'
    ),
    'uio': 'vfio-pci'
}

run = {
    'app_name': 'pktgen',
    'cores': '14,15-16',      # control lcore, then worker/core ranges
    'map': ('[15:16].0',),     # tx:rx core pair -> port
    'opts': ('-T','-P'),       # -T: color theme, -P: promiscuous
    'theme': 'themes/black-yellow.theme'
}
```

Common keys (not exhaustive):

- `devices`: PCI BDFs to bind.
- `blocklist`: exclude listed devices.
- `cores`: control and worker core list/ranges.
- `map`: mapping of core pairs to ports `[tx:rx].port`.
- `opts`: extra runtime flags passed after `--`.
- `nrank`, `proc`, `log`, `prefix`: process / logging / multi‑process tuning.

See existing examples in `cfg/` (e.g. `default.cfg`, `two-ports.cfg`, `pktgen-1.cfg`, `pktgen-2.cfg`).

## 6. Configuration Key Reference

| Key | Location | Type | Example | Description |
|-----|----------|------|---------|-------------|
| devices | setup | tuple/list | `('81:00.0','81:00.1')` | PCI BDFs to bind to DPDK |
| uio | setup | string | `vfio-pci` | Kernel driver to bind (vfio-pci / igb_uio / uio_pci_generic) |
| exec | setup/run | tuple | `('sudo')` | Wrapper for privileged execution |
| app_name | run | string | `pktgen` | Binary name; resolved via `app_path` list |
| app_path | run | tuple/list | `('./app/%(target)s/%(app_name)s', ...)` | Candidate paths to locate binary |
| cores | run | string | `14,15-16` | Control + worker cores; ranges and commas allowed |
| map | run | tuple/list | `('[15:16].0',)` | TX:RX core pair mapped to port id |
| opts | run | tuple/list | `('-T','-P')` | Extra runtime flags passed after `--` |
| theme | run | string | `themes/black-yellow.theme` | Color/theme selection |
| blocklist | run | tuple/list | `('81:00.2',)` | Exclude listed PCI devices |
| nrank | run | string/int | `4` | Multi-process ranking parameter (advanced) |
| proc | run | string | `auto` | Process type / role selection |
| log | run | string/int | `7` | Log verbosity level |
| prefix | run | string | `pg` | DPDK shared resource (memzone) prefix |

> Not all keys are required; unused advanced keys can be omitted. Refer to examples in `cfg/` for patterns.

## 7. Runtime Modes & Pages

Modes: single (default), sequence, range, random, pcap replay, latency.

Display pages correspond to configuration areas: `page main|seq|range|rnd|pcap|stats|xstats`.
Each mode maintains separate packet template buffers—configure the active mode explicitly.

## 8. Automation & Remote Control

Pktgen exposes a TCP socket (default port `22022`) offering a Lua REPL‑like interface (no prompt). Examples:

Interactive with socat:

```bash
socat -d -d READLINE TCP4:localhost:22022
```

Run a Lua script remotely:

```bash
socat - TCP4:localhost:22022 < test/hello-world.lua
```

Single command:

```bash
echo "f,e=loadfile('test/hello-world.lua'); f();" | socat - TCP4:localhost:22022
```

Example script (`test/hello-world.lua`):

```lua
package.path = package.path .. ";?.lua;test/?.lua;app/?.lua;"
printf("Lua Version: %s\n", pktgen.info.Lua_Version)
printf("Pktgen Version: %s\n", pktgen.info.Pktgen_Version)
printf("Pktgen Copyright: %s\n", pktgen.info.Pktgen_Copyright)
printf("Pktgen Authors: %s\n", pktgen.info.Pktgen_Authors)
printf("\nHello World!!!!\n")
```

## 9. Advanced Topics

- Multiple instances: see `pktgen-1.cfg` / `pktgen-2.cfg` for running concurrently (ensure isolated devices/cores).
- Themes: located under `themes/`, selected via `-T` or config `theme` key.
- Latency: latency packets can be injected in any mode; view stats on `page stats` / latency display.
- Capture & PCAP: capture to pcap files or replay existing pcaps (`pcap/` directory contains samples).
- Performance tuning: pin isolated cores, match NUMA locality (ports & mempools), ensure sufficient mbufs, verify TSC stability.
- Plugins: extend via modules under `lib/plugin`.

## 10. Contributing

Please fork and submit pull requests via GitHub. Patches sent to the DPDK mailing list are not accepted for this repo.

For detailed guidelines (coding style, commit message format, documentation rules) see [`CONTRIBUTING.md`](./CONTRIBUTING.md).
Extended Markdown formatting conventions are documented in [`docs/STYLE.md`](./docs/STYLE.md).
Community expectations and reporting process: see [`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md).

Report issues / feature requests: <https://github.com/pktgen/Pktgen-DPDK/issues>

When filing issues include:

- Pktgen version (`cat VERSION` → current: 25.08.0)
- DPDK version & build config
- NIC model(s) & driver
- Reproduction steps + minimal config

### 10.1 Markdown Linting (Pre-Commit Hook)

Documentation style is enforced via markdownlint.

Enable the hook:

```bash
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
chmod +x .githooks/pre-commit
```

Requirements:

```bash
node --version   # ensure Node.js installed
npm install --no-save markdownlint-cli2  # optional; hook auto-installs if missing
```

On commit, staged `*.md` files are linted. If violations are found the commit is aborted; some fixable rules may be auto-corrected—re-add and recommit.

Staged C source/header files (`*.c`, `*.h`) are auto-formatted with `clang-format` (if present) before commit.

## 11. License

SPDX-License-Identifier: BSD-3-Clause
Copyright © 2010-2026 Intel Corporation

Full license text is available in [`LICENSE`](./LICENSE).

## 12. Related Links

- Documentation: <https://pktgen.github.io/Pktgen-DPDK/>
- Install guide (legacy / extended details): [`INSTALL.md`](./INSTALL.md)
- Example pcaps: `pcap/`

## 13. Acknowledgments

Created and maintained by Keith Wiles @ Intel Corporation with contributions from the community.

---

If this tool helps your testing, consider starring the project or contributing improvements.

[DPDK]: https://www.dpdk.org/


================================================
FILE: VERSION
================================================
26.03.0


================================================
FILE: app/.gitignore
================================================
pktgen
t/libtap/libtap.a
t/libtap/tap.o
build/
t/*.t
!t/*.pl.t


================================================
FILE: app/cli-functions.c
================================================
/*-
 * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Created 2018 by Keith Wiles @ intel.com */

#include "cli-functions.h"

#include <stdio.h>
#include <termios.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>

#include <rte_version.h>
#include <rte_atomic.h>
#include <rte_devargs.h>
#include <rte_ether.h>
#include <rte_string_fns.h>
#include <pg_strings.h>
#include <rte_hexdump.h>
#include <rte_cycles.h>
#include <rte_malloc.h>

#include <lua_config.h>

#include "pktgen.h"

#include <cli.h>
#include <cli_map.h>
#include <plugin.h>

#include "copyright_info.h"
#include "pktgen-cmds.h"
#include "pktgen-main.h"
#include "lpktgenlib.h"
#include "pktgen-display.h"
#include "pktgen-random.h"
#include "pktgen-log.h"
#include "pg_ether.h"
#if defined(RTE_LIBRTE_PMD_BOND) || defined(RTE_NET_BOND)
#include <rte_eth_bond.h>
#include <rte_eth_bond_8023ad.h>
#endif
#include <hmap.h>

static inline uint16_t
valid_gtpu_teid(port_info_t *info __rte_unused, char *val)
{
    uint16_t gtpu_teid;

    gtpu_teid = atoi(val);

    return gtpu_teid;
}

/**********************************************************/
static const char *title_help[] = {
    "   *** Pktgen Help information ***",
    "",
    NULL,
};

static const char *status_help[] = {
    "",
    "       Flags: P------------------------- - Promiscuous mode enabled",
    "               E                         - ICMP Echo enabled",
    "                B                        - Bonding enabled LACP 802.3ad",
    "                 I                       - Process packets on input enabled",
    "                  L                      - Sends latency packets",
    "                   i                     - Randomizing the source IP address",
    "                    p                    - Randomizing the source port",
    "                     R                   - Perform bit randomization (`rnd` page)",
    "                      C                  - Capture received packets",
    "                       <.......>         - Modes: Single, pcap, sequence, latency, "
    "Rate",
    "                                <......> - Modes: VLAN, VxLAN, MPLS, QnQ, GRE IPv4, GRE ETH",
    "Notes: <state>       - Use enable|disable or on|off to set the state.",
    "       <portlist>    - a list of ports (no spaces) as 2,4,6-9,12 or 3-5,8 or 5 or the word "
    "'all'",
    "       Colors best seen on a black background for now",
    CLI_HELP_PAUSE,
    NULL};

#define SMMI "%|start|minimum|maximum|increment|min|max|inc"
// clang-format off
static struct cli_map range_map[] = {
    {20, "range %P dst mac " SMMI " %m"},
    {21, "range %P src mac " SMMI " %m"},
    {22, "range %P dst mac %m %m %m %m"},
    {23, "range %P src mac %m %m %m %m"},
    {30, "range %P dst ip " SMMI " %4"},
    {31, "range %P src ip " SMMI " %4"},
    {32, "range %P dst ip %4 %4 %4 %4"},
    {33, "range %P src ip %4 %4 %4 %4"},
    {34, "range %P dst ip " SMMI " %6"},
    {35, "range %P src ip " SMMI " %6"},
    {36, "range %P dst ip %6 %6 %6 %6"},
    {37, "range %P src ip %6 %6 %6 %6"},
    {40, "range %P proto %|tcp|udp"},
    {41, "range %P type %|ipv4|ipv6"},
    {42, "range %P tcp %|flag|flags %c"},
    {44, "range %P tcp seq %d %d %d %d"},
    {45, "range %P tcp ack %d %d %d %d"},
    {46, "range %P tcp seq " SMMI " %d"},
    {47, "range %P tcp ack " SMMI " %d"},
    {50, "range %P dst port " SMMI " %d"},
    {51, "range %P src port " SMMI " %d"},
    {52, "range %P dst port %d %d %d %d"},
    {53, "range %P src port %d %d %d %d"},
    {55, "range %P ttl " SMMI " %b"},
    {56, "range %P ttl %b %b %b %b"},
    {60, "range %P vlan " SMMI " %d"},
    {61, "range %P vlan %d %d %d %d"},
    {70, "range %P size " SMMI " %d"},
    {71, "range %P size %d %d %d %d"},
    {80, "range %P mpls entry %h"},
    {85, "range %P qinq index %d %d"},
    {90, "range %P gre key %d"},
    {91, "range %P gre_key %d"},
    {100, "range %P gtpu " SMMI " %d"},
    {101, "range %P gtpu %d %d %d %d"},
    {160, "range %P cos " SMMI " %d"},
    {161, "range %P cos %d %d %d %d"},
    {170, "range %P tos " SMMI " %d"},
    {171, "range %P tos %d %d %d %d"},
    {172, "range %P hop_limits " SMMI " %b"},
    {173, "range %P hop_limits %d %d %d %d"},
    {174, "range %P traffic_class " SMMI " %d"},
    {175, "range %P traffic_class %d %d %d %d"},
    {-1, NULL}
};
// clang-format on

static const char *range_help[] = {
    "",
    "  -- Setup the packet range values --",
    "     note: SMMI = start|min|max|inc (start, minimum, maximum, increment)",
    "",
    "range <portlist> src|dst mac <SMMI> <etheraddr> - Set destination/source MAC address",
    "      e.g: range 0 src mac start 00:00:00:00:00:00",
    "           range 0 dst mac max 00:12:34:56:78:90",
    "      or  range 0 src mac 00:00:00:00:00:00 00:00:00:00:00:00 00:12:34:56:78:90 "
    "00:00:00:01:01:01",
    "range <portlist> src|dst ip <SMMI> <ipaddr>   - Set source IP start address",
    "      e.g: range 0 dst ip start 0.0.0.0",
    "           range 0 dst ip min 0.0.0.0",
    "           range 0 dst ip max 1.2.3.4",
    "           range 0 dst ip inc 0.0.1.0",
    "       or  range 0 dst ip 0.0.0.0 0.0.0.0 1.2.3.4 0.0.1.0",
    "range <portlist> type ipv4|ipv6               - Set the range packet type to IPv4 or IPv6",
    "range <portlist> proto tcp|udp                - Set the IP protocol type",
    "range <portlist> tcp flags <string>           - Set comma delimited TCP flags: "
    "cwr,ece,urg,ack,psh,rst,syn,fin,clr",
    "range <portlist> tcp seq <SMMI> <value>       - Set the TCP sequence number",
    "       or  range <portlist> tcp seq <start> <min> <max> <inc>",
    "range <portlist> tcp ack <SMMI> <value>       - Set the TCP acknowledge number",
    "       or  range <portlist> tcp ack <start> <min> <max> <inc>",
    "range <portlist> src|dst port <SMMI> <value>  - Set UDP/TCP source/dest port number",
    "       or  range <portlist> src|dst port <start> <min> <max> <inc>",
    "range <portlist> vlan <SMMI> <value>          - Set vlan id start address",
    "      or  range <portlist> vlan <start> <min> <max> <inc>",
    "range <portlist> size <SMMI> <value>          - Set pkt size start address",
    "      or  range <portlist> size <start> <min> <max> <inc>",
    "range <portlist> teid <SMMI> <value>          - Set TEID value",
    "      or  range <portlist> teid <start> <min> <max> <inc>",
    "range <portlist> mpls entry <hex-value>       - Set MPLS entry value",
    "range <portlist> qinq index <val1> <val2>     - Set QinQ index values",
    "range <portlist> gre key <value>              - Set GRE key value",
    "range <portlist> cos <SMMI> <value>           - Set cos value",
    "range <portlist> tos <SMMI> <value>           - Set tos value",
    "range <portlist> ttl <SMMI> <value>           - Set TTL",
    "range <portlist> hop_limits <SMMI> <value>    - Set Hop Limits",
    "range <portlist> traffic_class <SMMI> <value> - Set Traffic Class value",

    CLI_HELP_PAUSE,
    NULL};

static int
range_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;
    struct pg_ipaddr ip;
    struct rte_ether_addr mac[4];
    char *what, *p;
    const char *val;

    m = cli_mapping(range_map, argc, argv);
    if (!m)
        return cli_cmd_error("Range command error", "Range", argc, argv);

    portlist_parse(argv[1], pktgen.nb_ports, &portlist);

    what = argv[4];
    val  = (const char *)argv[5];
    switch (m->index) {
    case 20:
        if (pg_ether_aton(val, &mac[0]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", val);
            break;
        }
        foreach_port(portlist, range_set_dest_mac(pinfo, what, &mac[0]));
        break;
    case 21:
        if (pg_ether_aton(val, &mac[0]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", val);
            break;
        }
        foreach_port(portlist, range_set_src_mac(pinfo, what, &mac[0]));
        break;
    case 22:
        if (pg_ether_aton(argv[4], &mac[0]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[4]);
            break;
        }
        if (pg_ether_aton(argv[5], &mac[1]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[5]);
            break;
        }
        if (pg_ether_aton(argv[6], &mac[2]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[6]);
            break;
        }
        if (pg_ether_aton(argv[7], &mac[3]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[7]);
            break;
        }
        foreach_port(portlist, range_set_dest_mac(pinfo, "start", &mac[0]);
                     range_set_dest_mac(pinfo, "min", &mac[1]);
                     range_set_dest_mac(pinfo, "max", &mac[2]);
                     range_set_dest_mac(pinfo, "inc", &mac[3]));
        break;
    case 23:
        if (pg_ether_aton(argv[4], &mac[0]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[4]);
            break;
        }
        if (pg_ether_aton(argv[5], &mac[1]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[5]);
            break;
        }
        if (pg_ether_aton(argv[6], &mac[2]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[6]);
            break;
        }
        if (pg_ether_aton(argv[7], &mac[3]) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[7]);
            break;
        }
        foreach_port(portlist, range_set_src_mac(pinfo, "start", &mac[0]);
                     range_set_src_mac(pinfo, "min", &mac[1]);
                     range_set_src_mac(pinfo, "max", &mac[2]);
                     range_set_src_mac(pinfo, "inc", &mac[3]));
        break;
    case 30:
        /* Remove the /XX mask value is supplied */
        p = strchr(argv[4], '/');
        if (p)
            *p = '\0';
        _atoip(val, 0, &ip, sizeof(ip));
        foreach_port(portlist, range_set_dst_ip(pinfo, what, &ip));
        break;
    case 31:
        /* Remove the /XX mask value is supplied */
        p = strchr(argv[4], '/');
        if (p)
            *p = '\0';
        _atoip(argv[5], 0, &ip, sizeof(ip));
        foreach_port(portlist, range_set_src_ip(pinfo, what, &ip));
        break;
    case 32:
        // clang-format off
        foreach_port(portlist, _atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"start", &ip);
                     _atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"min", &ip);
                     _atoip(argv[6], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"max", &ip);
                     _atoip(argv[7], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"inc", &ip));
        // clang-format on
        break;
    case 33:
        // clang-format off
        foreach_port(portlist, _atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"start", &ip);
                     _atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"min", &ip);
                     _atoip(argv[6], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"max", &ip);
                     _atoip(argv[7], PG_IPADDR_V4, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"inc", &ip));
        // clang-format on
        break;
    case 34:
        /* Remove the /XX mask value is supplied */
        p = strchr(argv[4], '/');
        if (p)
            *p = '\0';
        _atoip(val, 0, &ip, sizeof(ip));
        foreach_port(portlist, range_set_dst_ip(pinfo, what, &ip));
        break;
    case 35:
        /* Remove the /XX mask value is supplied */
        p = strchr(argv[4], '/');
        if (p)
            *p = '\0';
        _atoip(argv[5], 0, &ip, sizeof(ip));
        foreach_port(portlist, range_set_src_ip(pinfo, what, &ip));
        break;
    case 36:
        // clang-format off
        foreach_port(portlist, _atoip(argv[4], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"start", &ip);
                     _atoip(argv[5], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"min", &ip);
                     _atoip(argv[6], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"max", &ip);
                     _atoip(argv[7], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_dst_ip(pinfo, (char *)(uintptr_t)"inc", &ip));
        // clang-format on
        break;
    case 37:
        // clang-format off
        foreach_port(portlist, _atoip(argv[4], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"start", &ip);
                     _atoip(argv[5], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"min", &ip);
                     _atoip(argv[6], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"max", &ip);
                     _atoip(argv[7], PG_IPADDR_V6, &ip, sizeof(ip));
                     range_set_src_ip(pinfo, (char *)(uintptr_t)"inc", &ip));
        // clang-format on
        break;
    case 40:
        foreach_port(portlist, range_set_proto(pinfo, argv[3]));
        break;
    case 41:
        foreach_port(portlist, range_set_pkt_type(pinfo, argv[3]));
        break;
    case 42:
        foreach_port(portlist, range_set_tcp_flags(pinfo, argv[4]));
        break;
    case 44:
        // clang-format off
        foreach_port(portlist, range_set_tcp_seq(pinfo, (char *)(uintptr_t)"start", atoi(argv[4]));
                     range_set_tcp_seq(pinfo, (char *)(uintptr_t)"min", atoi(argv[5]));
                     range_set_tcp_seq(pinfo, (char *)(uintptr_t)"max", atoi(argv[6]));
                     range_set_tcp_seq(pinfo, (char *)(uintptr_t)"inc", atoi(argv[7])));
        // clang-format on
        break;
    case 45:
        // clang-format off
        foreach_port(portlist, range_set_tcp_ack(pinfo, (char *)(uintptr_t)"start", atoi(argv[4]));
                     range_set_tcp_ack(pinfo, (char *)(uintptr_t)"min", atoi(argv[5]));
                     range_set_tcp_ack(pinfo, (char *)(uintptr_t)"max", atoi(argv[6]));
                     range_set_tcp_ack(pinfo, (char *)(uintptr_t)"inc", atoi(argv[7])));
        // clang-format on
        break;
    case 46:
        foreach_port(portlist, range_set_tcp_seq(pinfo, what, atoi(val)));
        break;
    case 47:
        foreach_port(portlist, range_set_tcp_ack(pinfo, what, atoi(val)));
        break;
    case 50:
        foreach_port(portlist, range_set_dst_port(pinfo, what, atoi(val)));
        break;
    case 51:
        foreach_port(portlist, range_set_src_port(pinfo, what, atoi(val)));
        break;
    case 52:
        // clang-format off
        foreach_port(portlist, range_set_dst_port(pinfo, (char *)(uintptr_t)"start", atoi(argv[4]));
                     range_set_dst_port(pinfo, (char *)(uintptr_t)"min", atoi(argv[5]));
                     range_set_dst_port(pinfo, (char *)(uintptr_t)"max", atoi(argv[6]));
                     range_set_dst_port(pinfo, (char *)(uintptr_t)"inc", atoi(argv[7])));
        // clang-format on
        break;
    case 53:
        // clang-format off
        foreach_port(portlist, range_set_src_port(pinfo, (char *)(uintptr_t)"start", atoi(argv[4]));
                     range_set_src_port(pinfo, (char *)(uintptr_t)"min", atoi(argv[5]));
                     range_set_src_port(pinfo, (char *)(uintptr_t)"max", atoi(argv[6]));
                     range_set_src_port(pinfo, (char *)(uintptr_t)"inc", atoi(argv[7])));
        // clang-format on
        break;
    case 55:
        foreach_port(portlist, range_set_ttl(pinfo, argv[3], atoi(argv[4])));
        break;
    case 56:
        // clang-format off
        foreach_port(portlist, range_set_ttl(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_ttl(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_ttl(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_ttl(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])));
        // clang-format on
        break;
    case 60:
        foreach_port(portlist, range_set_vlan_id(pinfo, argv[3], atoi(what)));
        break;
    case 61:
        // clang-format off
        foreach_port(portlist, range_set_vlan_id(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_vlan_id(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_vlan_id(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_vlan_id(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])));
        // clang-format on
        break;
    case 70:
        foreach_port(portlist,
                     range_set_pkt_size(pinfo, argv[3],
                                        strcmp("inc", argv[3]) ? atoi(argv[4]) : atoi(argv[3])));
        break;
    case 71:
        // clang-format off
        foreach_port(portlist, range_set_pkt_size(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_pkt_size(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_pkt_size(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_pkt_size(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])););
        // clang-format on
        break;
    case 80:
        foreach_port(portlist, range_set_mpls_entry(pinfo, strtoul(what, NULL, 16)));
        break;
    case 85:
        foreach_port(portlist, range_set_qinqids(pinfo, atoi(what), atoi(val)));
        break;
    case 90:
    case 91:
        foreach_port(portlist, range_set_gre_key(pinfo, strtoul(what, NULL, 10)));
        break;
    case 100:
        foreach_port(portlist,
                     range_set_gtpu_teid(pinfo, argv[3],
                                         strcmp("inc", argv[3]) ? valid_gtpu_teid(pinfo, what)
                                                                : atoi(what)));
        break;
    case 101:
        // clang-format off
        foreach_port(
            portlist,
            range_set_gtpu_teid(pinfo, (char *)(uintptr_t)"start", valid_gtpu_teid(pinfo, argv[3]));
            range_set_gtpu_teid(pinfo, (char *)(uintptr_t)"min", valid_gtpu_teid(pinfo, argv[4]));
            range_set_gtpu_teid(pinfo, (char *)(uintptr_t)"max", valid_gtpu_teid(pinfo, argv[5]));
            range_set_gtpu_teid(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])););
        // clang-format on
        break;
    case 160:
        foreach_port(portlist, range_set_cos_id(pinfo, argv[3], atoi(what)));
        break;
    case 161:
        // clang-format off
        foreach_port(portlist, range_set_cos_id(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_cos_id(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_cos_id(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_cos_id(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])););
        // clang-format on
        break;
    case 170:
        foreach_port(portlist, range_set_tos_id(pinfo, argv[3], atoi(what)));
        break;
    case 171:
        // clang-format off
        foreach_port(portlist, range_set_tos_id(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_tos_id(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_tos_id(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_tos_id(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])));
        // clang-format on
        break;
    case 172:
        foreach_port(portlist, range_set_hop_limits(pinfo, argv[3], atoi(what)));
        break;
    case 173:
        // clang-format off
        foreach_port(portlist,
                     range_set_hop_limits(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_hop_limits(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_hop_limits(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_hop_limits(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])));
        // clang-format on
        break;
    case 174:
        foreach_port(portlist, range_set_traffic_class(pinfo, argv[3], atoi(what)));
        break;
    case 175:
        // clang-format off
        foreach_port(portlist,
                     range_set_traffic_class(pinfo, (char *)(uintptr_t)"start", atoi(argv[3]));
                     range_set_traffic_class(pinfo, (char *)(uintptr_t)"min", atoi(argv[4]));
                     range_set_traffic_class(pinfo, (char *)(uintptr_t)"max", atoi(argv[5]));
                     range_set_traffic_class(pinfo, (char *)(uintptr_t)"inc", atoi(argv[6])));
        // clang-format on
        break;

    default:
        return cli_cmd_error("Range command error", "Range", argc, argv);
    }
    pktgen_update_display();
    return 0;
}

#define set_types         \
    "count|"     /*  0 */ \
    "size|"      /*  1 */ \
    "rate|"      /*  2 */ \
    "burst|"     /*  3 */ \
    "tx_cycles|" /*  4 */ \
    "sport|"     /*  5 */ \
    "dport|"     /*  6 */ \
    "prime|"     /*  7 */ \
    "dump|"      /*  8 */ \
    "vlan|"      /*  9 */ \
    "vlanid|"    /* 10 */ \
    "seq_cnt|"   /* 11 */ \
    "seqCnt|"    /* 12 */ \
    "seqcnt|"    /* 13 */ \
    "ttl|"       /* 14 */ \
    "txburst|"   /* 15 */ \
    "rxburst"    /* 16 */

// clang-format off
static struct cli_map set_map[] = {
    {10, "set %P %|" set_types " %d"},
    {11, "set %P jitter %D"},
    {20, "set %P type %|arp|ipv4|ipv6|ip4|ip6|vlan"},
    {21, "set %P proto %|udp|tcp|icmp"},
    {22, "set %P src mac %m"},
    {23, "set %P dst mac %m"},
    {24, "set %P pattern %|abc|none|user|zero"},
    {25, "set %P user pattern %s"},
    {30, "set %P src ip %4"},
    {31, "set %P dst ip %4"},
    {32, "set %P src ip %6"},
    {33, "set %P dst ip %6"},
    {34, "set %P tcp %|flag|flags %c"},
    {36, "set %P tcp seq %d"},
    {37, "set %P tcp ack %d"},
    {40, "set ports_per_page %d"},
    {50, "set %P qinqids %d %d"},
    {60, "set %P rnd %d %d %s"},
    {70, "set %P cos %d"},
    {80, "set %P tos %d"},
    {90, "set %P vxlan %h %d %d"},
    {100, "set %P latsampler %|simple|poisson %d %d %s"},
    {-1, NULL}
};
// clang format on

static const char *set_help[] = {
    "",
    "    note: <portlist>               - a list of ports (no spaces) e.g. 2,4,6-9,12 or the word "
    "'all'",
    "set <portlist> count <value>       - number of packets to transmit",
    "set <portlist> size <value>        - size of the packet to transmit",
    "set <portlist> rate <percent>      - Packet rate in percentage",
    "set <portlist> txburst|burst <value> - number of packets in a TX burst",
    "set <portlist> rxburst <value>     - number of packets in a RX burst",
    "set <portlist> tx_cycles <value>   - DEBUG to set the number of cycles per TX burst",
    "set <portlist> sport <value>       - Source port number for UDP/TCP",
    "set <portlist> dport <value>       - Destination port number for UDP/TCP",
    "set <portlist> ttl <value>         - Set the TTL value for the single port more",
    "set <portlist> seq_cnt|seqcnt|seqCnt <value>",
    "                                   - Set the number of packet in the sequence to send [0-16]",
    "set <portlist> prime <value>       - Set the number of packets to send on prime command",
    "set <portlist> dump <value>        - Dump the next 1-32 received packets to the screen",
    "                                     Dumped packets are in the log, use 'page log' to view",
    "set <portlist> vlan|vlanid <value> - Set the VLAN ID value for the portlist",
    "set <portlist> jitter <value>      - Set the jitter threshold in micro-seconds",
    "set <portlist> src|dst mac <addr>  - Set MAC addresses 00:11:22:33:44:55 or 0011:2233:4455 "
    "format",
    "set <portlist> type ipv4|ipv6|vlan|arp - Set the packet type to IPv4 or IPv6 or VLAN",
    "set <portlist> proto udp|tcp|icmp  - Set the packet protocol to UDP or TCP or ICMP per port",
    "set <portlist> pattern <type>      - Set the fill pattern type",
    "                 type - abc        - Default pattern of abc string",
    "                        none       - No fill pattern, maybe random data",
    "                        zero       - Fill of zero bytes",
    "                        user       - User supplied string of max 16 bytes",
    "set <portlist> user pattern <string> - A 16 byte string, must set 'pattern user' command",
    "set <portlist> [src|dst] ip ipaddr - Set IP addresses, Source must include network mask e.g. "
    "10.1.2.3/24",
    "set <portlist> tcp flags <string>  - Set comma delimited TCP flags: cwr,ece,urg,ack,psh,rst,syn,fin,clr",
    "set <portlist> tcp seq <sequence>  - Set the TCP sequence number",
    "set <portlist> tcp ack <acknowledge> - Set the TCP acknowledge number",
    "set <portlist> qinqids <id1> <id2> - Set the Q-in-Q ID's for the portlist",
    "set <portlist> rnd <idx> <off> <mask> - Set random mask for all transmitted packets from "
    "portlist",
    "    idx: random mask index slot",
    "    off: offset in bytes to apply mask value",
    "    mask: up to 32 bit long mask specification (empty to disable):",
    "          0: bit will be 0",
    "          1: bit will be 1",
    "          .: bit will be ignored (original value is retained)",
    "          X: bit will get random value",
    "set <portlist> cos <value>         - Set the CoS value for the portlist",
    "set <portlist> tos <value>         - Set the ToS value for the portlist",
    "set <portlist> vxlan <flags> <group id> <vxlan_id> - Set the vxlan values",
    "set <portlist> latsampler [simple|poisson] <num-samples> <rate> <outfile>	- Set latency "
    "sampler parameters",
    "		num-samples: number of samples.",
    "		rate: sampling rate i.e., samples per second.",
    "		outfile: path to output file to dump all sampled latencies",
    "set ports_per_page <value>         - Set ports per page value 1 - 6",
    CLI_HELP_PAUSE,
    NULL};

static int
set_cmd(int argc, char **argv)
{
    portlist_t portlist;
    struct rte_ether_addr mac;
    char *what, *p;
    int value, n;
    struct cli_map *m;
    struct pg_ipaddr ip;
    uint16_t id1, id2;
    uint32_t u1, u2;
    int ip_ver;

    m = cli_mapping(set_map, argc, argv);
    if (!m)
        return cli_cmd_error("Set command is invalid", "Set", argc, argv);

    portlist_parse(argv[1], pktgen.nb_ports, &portlist);

    what  = argv[2];
    value = atoi(argv[3]);

    switch (m->index) {
    case 10:
        n = cli_map_list_search(m->fmt, argv[2], 2);
        foreach_port(portlist, _do(switch (n) {
            case 0:
                single_set_tx_count(pinfo, value);
                break;
            case 1:
                single_set_pkt_size(pinfo, atoi(argv[3]));
                break;
            case 2:
                single_set_tx_rate(pinfo, argv[3]);
                break;
            case 3:
                single_set_tx_burst(pinfo, value);
                break;
            case 4:
                debug_set_tx_cycles(pinfo, value);
                break;
            case 5:
                single_set_port_value(pinfo, what[0], value);
                break;
            case 6:
                single_set_port_value(pinfo, what[0], value);
                break;
            case 7:
                pktgen_set_port_prime(pinfo, value);
                break;
            case 8:
                debug_set_port_dump(pinfo, value);
                break;
            case 9: /* vlanid and vlan are valid */
            case 10:
                single_set_vlan_id(pinfo, value);
                break;
            case 11:
                /* FALLTHRU */
            case 12:
                /* FALLTHRU */
            case 13:
                pktgen_set_port_seqCnt(pinfo, value);
                break;
            case 14:
                single_set_ttl_value(pinfo, value);
                break;
            case 15:
                single_set_tx_burst(pinfo, value);
                break;
            case 16:
                single_set_rx_burst(pinfo, value);
                break;
            default:
                return cli_cmd_error("Set command is invalid", "Set", argc, argv);
        }));
        break;
    case 11:
        foreach_port(portlist, single_set_jitter(pinfo, strtoull(argv[3], NULL, 0)));
        break;
    case 20:
        foreach_port(portlist, single_set_pkt_type(pinfo, argv[3]));
        break;
    case 21:
        foreach_port(portlist, single_set_proto(pinfo, argv[3]));
        break;
    case 22:
        if (pg_ether_aton(argv[4], &mac) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[4]);
            break;
        }
        foreach_port(portlist, single_set_src_mac(pinfo, &mac));
        break;
    case 23:
        if (pg_ether_aton(argv[4], &mac) == NULL) {
            cli_printf("Failed to parse MAC address from (%s)\n", argv[4]);
            break;
        }
        foreach_port(portlist, single_set_dst_mac(pinfo, &mac));
        break;
    case 24:
        foreach_port(portlist, pattern_set_type(pinfo, argv[3]));
        break;
    case 25:
        foreach_port(portlist, pattern_set_user_pattern(pinfo, argv[4]));
        break;
    case 30:
        p = strchr(argv[4], '/');
        if (!p)
            cli_printf("src IP address should contain subnet value, default /32 for IPv4\n");
        ip_ver = _atoip(argv[4], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));
        foreach_port(portlist, single_set_ipaddr(pinfo, 's', &ip, ip_ver));
        break;
    case 31:
        /* Remove the /XX mask value if supplied */
        p = strchr(argv[4], '/');
        if (p) {
            cli_printf("Subnet mask not required, removing subnet mask value\n");
            *p = '\0';
        }
        ip_ver = _atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));
        foreach_port(portlist, single_set_ipaddr(pinfo, 'd', &ip, ip_ver));
        break;
    case 32:
        p = strchr(argv[4], '/');
        if (!p)
            cli_printf("src IP address should contain subnet value, default /128 for IPv6\n");

        ip_ver = _atoip(argv[4], PG_IPADDR_V6 | PG_IPADDR_NETWORK, &ip, sizeof(ip));
        foreach_port(portlist, single_set_ipaddr(pinfo, 's', &ip, ip_ver));
        break;
    case 33:
        /* Remove the /XX mask value if supplied */
        p = strchr(argv[4], '/');
        if (p) {
            cli_printf("Subnet mask not required, removing subnet mask value\n");
            *p = '\0';
        }
        ip_ver = _atoip(argv[4], PG_IPADDR_V6, &ip, sizeof(ip));
        foreach_port(portlist, single_set_ipaddr(pinfo, 'd', &ip, ip_ver));
        break;
    case 34:
        foreach_port(portlist, single_set_tcp_flags(pinfo, argv[4]));
        break;
    case 36:
        foreach_port(portlist, single_set_tcp_seq(pinfo, atoi(argv[4])));
        break;
    case 37:
        foreach_port(portlist, single_set_tcp_ack(pinfo, atoi(argv[4])));
        break;
    case 40:
        pktgen_set_page_size(atoi(argv[2]));
        break;
    case 50:
        id1 = strtol(argv[3], NULL, 0);
        id2 = strtol(argv[4], NULL, 0);
        foreach_port(portlist, single_set_qinqids(pinfo, id1, id2));
        break;
    case 60: {
        char mask[34] = {0}, *m;
        char cb;

        id1 = strtol(argv[3], NULL, 0);
        id2 = strtol(argv[4], NULL, 0);
        m   = argv[5];
        if (strcmp(m, "off")) {
            int idx;
            /* Filter invalid characters from provided mask. This way the user can
             * more easily enter long bitmasks, using for example '_' as a separator
             * every 8 bits. */
            for (n = 0, idx = 0; (idx < 32) && ((cb = m[n]) != '\0'); n++)
                if ((cb == '0') || (cb == '1') || (cb == '.') || (cb == 'X') || (cb == 'x'))
                    mask[idx++] = cb;
        }
        foreach_port(portlist, enable_random(pinfo, pktgen_set_random_bitfield(pinfo->rnd_bitfields,
                                                                              id1, id2, mask)
                                                       ? ENABLE_STATE
                                                       : DISABLE_STATE));
    } break;
    case 70:
        id1 = strtol(argv[3], NULL, 0);
        foreach_port(portlist, single_set_cos(pinfo, id1));
        break;
    case 80:
        id1 = strtol(argv[3], NULL, 0);
        foreach_port(portlist, single_set_tos(pinfo, id1));
        break;
    case 90:
        id1 = strtol(argv[3], NULL, 0);
        id2 = strtol(argv[4], NULL, 0);
        u1  = strtol(argv[5], NULL, 0);
        foreach_port(portlist, single_set_vxlan(pinfo, id1, id2, u1));
        break;
    case 100:
        u1 = strtol(argv[4], NULL, 0);
        u2 = strtol(argv[5], NULL, 0);
        foreach_port(portlist, single_set_latsampler_params(pinfo, argv[3], u1, u2, argv[6]));
        break;
    default:
        return cli_cmd_error("Command invalid", "Set", argc, argv);
    }

    pktgen_update_display();
    return 0;
}

// clang-format off
static struct cli_map pcap_map[] = {
    {10, "pcap %D"},
    {20, "pcap show"},
    {21, "pcap show all"},
    {30, "pcap filter %P %s"},
    {-1, NULL}
};
// clang-format on

static const char *pcap_help[] = {
    "",
    "pcap show                          - Show PCAP information",
    "pcap <index>                       - Move the PCAP file index to the given packet number,\n   "
    "    0 - rewind, -1 - end of file",
    "pcap filter <portlist> <string>    - PCAP filter string to filter packets on receive",
    CLI_HELP_PAUSE,
    NULL};

static int
pcap_cmd(int argc, char **argv)
{
    struct cli_map *m;
    pcap_info_t *pcap;
    uint32_t max_cnt;
    uint32_t value;
    portlist_t portlist;
    port_info_t *pinfo;

    m = cli_mapping(pcap_map, argc, argv);
    if (!m)
        return cli_cmd_error("PCAP command invalid", "PCAP", argc, argv);

    pinfo = l2p_get_port_pinfo(pktgen.curr_port);
    switch (m->index) {
    case 10:
        pcap  = l2p_get_pcap(pinfo->pid);
        value = strtoul(argv[1], NULL, 10);

        if (pcap) {
            max_cnt = pcap->pkt_count;
            if (value >= max_cnt)
                pcap->pkt_index = max_cnt - RTE_MIN(PCAP_PAGE_SIZE, (int)max_cnt);
            else
                pcap->pkt_index = value;
            pktgen.flags |= PRINT_LABELS_FLAG;
        } else
            pktgen_log_error(" ** PCAP file is not loaded on port %d", pktgen.curr_port);
        break;
    case 20:
        pcap = l2p_get_pcap(pinfo->pid);
        if (pcap)
            pktgen_pcap_info(pcap, pktgen.curr_port, 1);
        else
            pktgen_log_error(" ** PCAP file is not loaded on port %d", pktgen.curr_port);
        break;
    case 21:
        for (int pid = 0; pid < pktgen.nb_ports; pid++) {
            pcap = l2p_get_pcap(pid);
            if (pcap)
                pktgen_pcap_info(pcap, pid, 1);
        }
        break;
    case 30:
        portlist_parse(argv[2], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pcap_filter(pinfo, argv[3]));
        break;
    default:
        return cli_cmd_error("PCAP command invalid", "PCAP", argc, argv);
    }
    pktgen_update_display();
    return 0;
}

// clang-format off
static struct cli_map start_map[] = {
    {10, "start %P"},
    {20, "stop %P"},
    {40, "start %P prime"},
    {50, "start %P arp %|request|gratuitous|req|grat"},
    {60, "start %P latsampler"},
    {70, "stop %P latsampler"},
    {-1, NULL}
};
// clang-format on

static const char *start_help[] = {
    "",
    "start <portlist>                   - Start transmitting packets",
    "stop <portlist>                    - Stop transmitting packets",
    "stp                                - Stop all ports from transmitting",
    "str                                - Start all ports transmitting",
    "start <portlist> prime             - Transmit packets on each port listed. See set prime "
    "command above",
    "start <portlist> arp <type>        - Send a ARP type packet",
    "    type - request | gratuitous | req | grat",
    "start <portlist> latsampler        - Start latency sampler, make sure to set sampling "
    "parameters before starting",
    "stop <portlist> latsampler        	- Stop latency sampler, dumps to file if specified",
    CLI_HELP_PAUSE,
    NULL};

static int
start_stop_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;

    m = cli_mapping(start_map, argc, argv);
    if (!m)
        return cli_cmd_error("Start/Stop command invalid", "Start", argc, argv);

    portlist_parse(argv[1], pktgen.nb_ports, &portlist);

    switch (m->index) {
    case 10:
        foreach_port(portlist, pktgen_start_transmitting(pinfo));
        break;
    case 20:
        foreach_port(portlist, pktgen_stop_transmitting(pinfo));
        break;
    case 40:
        foreach_port(portlist, pktgen_prime_ports(pinfo));
        break;
    case 50:
        if (argv[3][0] == 'g')
            foreach_port(portlist, pktgen_send_arp_requests(pinfo, GRATUITOUS_ARP));
        else
            foreach_port(portlist, pktgen_send_arp_requests(pinfo, 0));
        break;
    case 60:
        foreach_port(portlist, pktgen_start_latency_sampler(pinfo));
        break;
    case 70:
        foreach_port(portlist, pktgen_stop_latency_sampler(pinfo));
        break;
    default:
        return cli_cmd_error("Start/Stop command invalid", "Start", argc, argv);
    }
    pktgen_update_display();
    return 0;
}

// clang-format off
static struct cli_map theme_map[] = {
    {0, "theme"},
    {10, "theme %|on|off"},
    {20, "theme %s %s %s %s"},
    {30, "theme save %s"},
    {-1, NULL}
};
// clang-format on

static const char *theme_help[] = {
    "",
    "theme <item> <fg> <bg> <attr>      - Set color for item with fg/bg color and attribute value",
    "theme show                         - List the item strings, colors and attributes to the "
    "items",
    "theme save <filename>              - Save the current color theme to a file",
    CLI_HELP_PAUSE,
    NULL};

static int
theme_cmd(int argc, char **argv)
{
    struct cli_map *m;

    m = cli_mapping(theme_map, argc, argv);
    if (!m)
        return cli_cmd_error("Theme command invalid", "Theme", argc, argv);

    switch (m->index) {
    case 0:
        pktgen_theme_show();
        break;
    case 10:
        pktgen_theme_state(argv[1]);
        pktgen_clear_display();
        break;
    case 20:
        pktgen_set_theme_item(argv[1], argv[2], argv[3], argv[4]);
        break;
    case 30:
        pktgen_theme_save(argv[2]);
        break;
    default:
        return cli_help_show_group("Theme");
    }
    return 0;
}

#define ed_type          \
    "process|"  /*  0 */ \
    "mpls|"     /*  1 */ \
    "qinq|"     /*  2 */ \
    "gre|"      /*  3 */ \
    "gre_eth|"  /*  4 */ \
    "vlan|"     /*  5 */ \
    "random|"   /*  6 */ \
    "latency|"  /*  7 */ \
    "pcap|"     /*  8 */ \
    "blink|"    /*  9 */ \
    "icmp|"     /* 10 */ \
    "range|"    /* 11 */ \
    "capture|"  /* 12 */ \
    "bonding|"  /* 13 */ \
    "vxlan|"    /* 14 */ \
    "rate|"     /* 15 */ \
    "rnd_s_ip|" /* 16 */ \
    "rnd_s_pt|" /* 17 */ \
    "lat"       /* 18 */

// clang-format off
static struct cli_map enable_map[] = {
    {10, "enable %P %|" ed_type},
    {20, "disable %P %|" ed_type},
    {30, "enable %|screen|mac_from_arp"},
    {31, "disable %|screen|mac_from_arp"},
    {40, "enable clock_gettime"},
    {41, "disable clock_gettime"},
    {-1, NULL}
};
// clang-format off

static const char *enable_help[] = {
    "",
    "enable|disable <portlist> process  - Enable or Disable processing of ARP/ICMP/IPv4/IPv6 "
    "packets",
    "enable|disable <portlist> mpls     - Enable/disable sending MPLS entry in packets",
    "enable|disable <portlist> qinq     - Enable/disable sending Q-in-Q header in packets",
    "enable|disable <portlist> gre      - Enable/disable GRE support",
    "enable|disable <portlist> gre_eth  - Enable/disable GRE with Ethernet frame payload",
    "enable|disable <portlist> vlan     - Enable/disable VLAN tagging",
    "enable|disable <portlist> rnd_s_ip - Enable/disable randomizing the source IP address on "
    "every packet",
    "enable|disable <portlist> rnd_s_pt - Enable/disable randomizing the source port on every packet",
    "enable|disable <portlist> random   - Enable/disable Random packet support through the `rnd` page",
    "enable|disable <portlist> latency  - Enable/disable latency testing",
    "enable|disable <portlist> pcap     - Enable or Disable sending pcap packets on a portlist",
    "enable|disable <portlist> blink    - Blink LED on port(s)",
    "enable|disable <portlist> icmp     - Enable/Disable sending ICMP packets",
    "enable|disable <portlist> range    - Enable or Disable the given portlist for sending a range "
    "of packets",
    "enable|disable <portlist> capture  - Enable/disable packet capturing on a portlist, will "
    "capture RX packets",
    "                                     Disable capture on a port to save the data into the "
    "current working directory.",
    "enable|disable <portlist> bonding  - Enable call TX with zero packets for bonding driver",
    "enable|disable <portlist> vxlan    - Send VxLAN packets",
    "enable|disable mac_from_arp        - Enable/disable MAC address from ARP packet",
    "enable|disable clock_gettime       - Enable/disable use of new clock_gettime() instead of rdtsc()",
    "enable|disable screen              - Enable/disable updating the screen and unlock/lock window",
    "    off                            - screen disable shortcut",
    "    on                             - screen enable shortcut",
    CLI_HELP_PAUSE,
    NULL};

static int
en_dis_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;
    int n, state;

    m = cli_mapping(enable_map, argc, argv);
    if (!m)
        return cli_cmd_error("Enable/Disable invalid command", "Enable", argc, argv);

    portlist_parse(argv[1], pktgen.nb_ports, &portlist);

    switch (m->index) {
    case 10:
    case 20:
        n = cli_map_list_search(m->fmt, argv[2], 2);

        state = estate(argv[0]);

        switch (n) {
        case 0: // process
            foreach_port(portlist, enable_process(pinfo, state));
            break;
        case 1: // mpls
            foreach_port(portlist, enable_mpls(pinfo, state));
            break;
        case 2: // qinq
            foreach_port(portlist, enable_qinq(pinfo, state));
            break;
        case 3: // gre
            foreach_port(portlist, enable_gre(pinfo, state));
            break;
        case 4: // gre_eth
            foreach_port(portlist, enable_gre_eth(pinfo, state));
            break;
        case 5: // vlan
            foreach_port(portlist, enable_vlan(pinfo, state));
            break;
        case 6: // random
            foreach_port(portlist, enable_random(pinfo, state));
            break;
        case 7: // latency
            foreach_port(portlist, enable_latency(pinfo, state));
            break;
        case 8: // pcap
            foreach_port(portlist, enable_pcap(pinfo, state));
            break;
        case 9: // blink
            foreach_port(portlist, debug_blink(pinfo, state));

            if (pktgen.blinklist)
                pktgen.flags |= BLINK_PORTS_FLAG;
            else
                pktgen.flags &= ~BLINK_PORTS_FLAG;
            break;
        case 10: // icmp
            foreach_port(portlist, enable_icmp_echo(pinfo, state));
            break;
        case 11: // range
            foreach_port(portlist, enable_range(pinfo, state));
            break;
        case 12: // capture
            foreach_port(portlist, pktgen_set_capture(pinfo, state));
            break;
        case 13: // bonding
#if defined(RTE_LIBRTE_PMD_BOND) || defined(RTE_NET_BOND)
            foreach_port(portlist, enable_bonding(pinfo, state));
#endif
            break;
        case 14: // vxlan
            foreach_port(portlist, enable_vxlan(pinfo, state));
            break;
        case 16: // rnd_s_ip
            foreach_port(portlist, enable_rnd_s_ip(pinfo, state));
            break;
        case 17: // rnd_s_pt
            foreach_port(portlist, enable_rnd_s_pt(pinfo, state));
            break;
        case 18: // lat type alias latency
            foreach_port(portlist, enable_latency(pinfo, state));
            break;
        default:
            return cli_cmd_error("Enable/Disable invalid command", "Enable", argc, argv);
        }
        break;

    case 30:
    case 31:
        state = estate(argv[0]);

        if (argv[1][0] == 'm')
            enable_mac_from_arp(state);
        else
            pktgen_screen(state);
        break;
    case 40:
    case 41:
        enable_clock_gettime(estate(argv[0]));
        break;
    default:
        return cli_cmd_error("Enable/Disable invalid command", "Enable", argc, argv);
    }
    pktgen_update_display();
    return 0;
}

// clang-format off
static struct cli_map dbg_map[] = {
    {20, "dbg %|tx_dbg|dbg"},
    {21, "dbg tx_rate %P"},
    {30, "dbg %|mempool|dump %P %s"},
    {50, "dbg memzone"},
    {51, "dbg memseg"},
    {60, "dbg hexdump %H %d"},
    {61, "dbg hexdump %H"},
    {80, "dbg break"},
    {90, "dbg memcpy"},
    {91, "dbg memcpy %d %d"},
#ifdef TX_DEBUG
    {100, "dbg %|enable|disable|on|off tx pcap %P"},
#endif
    {-1, NULL}
};
// clang-format on

static const char *dbg_help[] = {
    "",
    "dbg tx_dbg|dbg                        - Enable tx debug output",
    "dbg tx_rate <portlist>                - Show packet rate for all ports",
    "dbg mempool|dump <portlist> <type>    - Dump out the mempool info for a given type",
    "                                        types - rx|tx",
    "dbg memzone                           - List all of the current memzones",
    "dbg memseg                            - List all of the current memsegs",
    "dbg hexdump <addr> <len>              - hex dump memory at given address",
    "dbg break                             - break into the debugger",
    "dbg memcpy [loop-cnt KBytes]          - run a memcpy test",
#ifdef TX_DEBUG
    "dbg enable|disable tx pcap <portlist> - Enable/disable writing pcap file for transmitted "
    "packets",
#endif
    CLI_HELP_PAUSE,
    NULL};

static void
rte_memcpy_perf(unsigned int cnt, unsigned int kb, int flag)
{
    char *buf[2], *src, *dst;
    uint64_t start_time, total_time;
    uint64_t total_bits, bits_per_tick;
    unsigned int i;

    kb *= 1024;

    buf[0] = malloc(kb + RTE_CACHE_LINE_SIZE);
    buf[1] = malloc(kb + RTE_CACHE_LINE_SIZE);

    src = RTE_PTR_ALIGN(buf[0], RTE_CACHE_LINE_SIZE);
    dst = RTE_PTR_ALIGN(buf[1], RTE_CACHE_LINE_SIZE);

    start_time = rte_get_tsc_cycles();
    for (i = 0; i < cnt; i++) {
        if (flag)
            rte_memcpy(dst, src, kb);
        else
            memcpy(dst, src, kb);
    }
    total_time = rte_get_tsc_cycles() - start_time;

    total_bits = ((uint64_t)cnt * (uint64_t)kb) * 8L;

    bits_per_tick = total_bits / total_time;

    free(buf[0]);
    free(buf[1]);

#define MEGA (uint64_t)(1024 * 1024)
    printf("%3d Kbytes for %8d loops, ", (kb / 1024), cnt);
    printf("%3ld bits/tick, ", bits_per_tick);
    printf("%6ld Mbits/sec with %s\n", (bits_per_tick * pktgen_get_timer_hz()) / MEGA,
           (flag) ? "rte_memcpy" : "memcpy");
}

static int
dbg_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;
    unsigned int len, cnt;
    const void *addr;

    m = cli_mapping(dbg_map, argc, argv);
    if (!m)
        return cli_cmd_error("Debug invalid command", "Debug", argc, argv);

    len = 32;
    cnt = 100000;
    switch (m->index) {
    case 20:
        if ((pktgen.flags & TX_DEBUG_FLAG) == 0)
            pktgen.flags |= TX_DEBUG_FLAG;
        else
            pktgen.flags &= ~TX_DEBUG_FLAG;
        pktgen_clear_display();
        break;
    case 21:
        portlist_parse(argv[2], pktgen.nb_ports, &portlist);
        foreach_port(portlist, debug_tx_rate(pinfo));
        break;
    case 30:
        portlist_parse(argv[2], pktgen.nb_ports, &portlist);
        foreach_port(portlist, debug_mempool_dump(pinfo, argv[3]));
        break;
    case 50:
        rte_memzone_dump(stdout);
        break;
    case 51:
        rte_dump_physmem_layout(stdout);
        break;
    case 60:
    case 61:
        addr = (void *)(uintptr_t)strtoull(argv[2], NULL, 0);
        if (argc == 3)
            len = 64;
        else
            len = strtoul(argv[3], NULL, 0);
        rte_hexdump(stdout, "", addr, len);
        break;
    case 80:
        kill(0, SIGINT);
        break;
    case 91:
        cnt = atoi(argv[2]);
        len = atoi(argv[3]);
        /*FALLTHRU*/
    case 90:
        rte_memcpy_perf(cnt, len, 0);
        rte_memcpy_perf(cnt, len, 1);
        break;
#ifdef TX_DEBUG
    case 100: /* enable/disable TX packets written to PCAP file */
        portlist_parse(argv[4], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pktgen_pcap_handler(pinfo, estate(argv[1])));
        break;
#endif
    default:
        return cli_cmd_error("Debug invalid command", "Debug", argc, argv);
    }
    return 0;
}

/**
 *
 * Set a sequence config for given port and slot.
 *
 * DESCRIPTION
 * Set up the sequence packets for a given port and slot.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 * 	"%|seq|sequence %d %P %m %m %4 %4 %d %d %|ipv4|ipv6 %|udp|tcp|icmp %d %d %d"
 */

static int
seq_1_set_cmd(int argc __rte_unused, char **argv)
{
    char *proto = argv[10], *p;
    char *eth   = argv[9];
    int seqnum  = atoi(argv[1]);
    portlist_t portlist;
    struct pg_ipaddr dst, src;
    struct rte_ether_addr dmac, smac;
    uint32_t teid;

    if ((proto[0] == 'i') && (eth[3] == '6')) {
        cli_printf("Must use IPv4 with ICMP type packets\n");
        return -1;
    }

    if (seqnum >= NUM_SEQ_PKTS) {
        cli_printf("sequence number too large\n");
        return -1;
    }

    teid = (argc == 14) ? strtoul(argv[13], NULL, 10) : 0;
    p    = strchr(argv[5], '/'); /* remove subnet if found */
    if (p)
        *p = '\0';
    _atoip(argv[5], 0, &dst, sizeof(dst));
    p = strchr(argv[6], '/');
    if (!p) {
        cli_printf(
            "src IP address should contain subnet value, default /32 for IPv4, /128 for IPv6\n");
    }
    _atoip(argv[6], PG_IPADDR_NETWORK, &src, sizeof(src));
    portlist_parse(argv[2], pktgen.nb_ports, &portlist);
    if (pg_ether_aton(argv[3], &dmac) == NULL) {
        cli_printf("invalid MAC string (%s)\n", argv[3]);
        return -1;
    }
    if (pg_ether_aton(argv[4], &smac) == NULL) {
        cli_printf("invalid MAC string (%s)\n", argv[4]);
        return -1;
    }
    foreach_port(portlist, pktgen_set_seq(pinfo, seqnum, &dmac, &smac, &dst, &src, atoi(argv[7]),
                                          atoi(argv[8]), eth[3], proto[0], atoi(argv[11]),
                                          atoi(argv[12]), teid));

    pktgen_update_display();
    return 0;
}

/**
 *
 * Set a sequence config for given port and slot.
 *
 * DESCRIPTION
 * Set up the sequence packets for a given port and slot.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 * 	"%|seq|sequence %d %P dst %m src %m dst %4 src %4 sport %d dport %d %|ipv4|ipv6 %|udp|tcp|icmp
 * vlan %d size %d teid %d"
 */

static int
seq_2_set_cmd(int argc __rte_unused, char **argv)
{
    char *proto = argv[16], *p;
    char *eth   = argv[15];
    int seqnum  = atoi(argv[1]);
    portlist_t portlist;
    struct pg_ipaddr dst, src;
    struct rte_ether_addr dmac, smac;
    uint32_t teid;

    if ((proto[0] == 'i') && (eth[3] == '6')) {
        cli_printf("Must use IPv4 with ICMP type packets\n");
        return -1;
    }

    if (seqnum >= NUM_SEQ_PKTS) {
        cli_printf("Sequence number too large\n");
        return -1;
    }

    teid = (argc == 23) ? strtoul(argv[22], NULL, 10) : 0;
    p    = strchr(argv[8], '/'); /* remove subnet if found */
    if (p)
        *p = '\0';
    _atoip(argv[8], 0, &dst, sizeof(dst));
    p = strchr(argv[10], '/');
    if (p == NULL) {
        cli_printf(
            "src IP address should contain subnet value, default /32 for IPv4, /128 for IPv6\n");
    }
    _atoip(argv[10], PG_IPADDR_NETWORK, &src, sizeof(src));
    portlist_parse(argv[2], pktgen.nb_ports, &portlist);
    if (pg_ether_aton(argv[4], &dmac) == NULL) {
        cli_printf("invalid MAC string (%s)\n", argv[4]);
        return -1;
    }
    if (pg_ether_aton(argv[6], &smac) == NULL) {
        cli_printf("invalid MAC string (%s)\n", argv[6]);
        return -1;
    }
    foreach_port(portlist, pktgen_set_seq(pinfo, seqnum, &dmac, &smac, &dst, &src, atoi(argv[12]),
                                          atoi(argv[14]), eth[3], proto[0], atoi(argv[18]),
                                          atoi(argv[20]), teid));

    pktgen_update_display();
    return 0;
}

/**
 *
 * Set a sequence config for given port and slot.
 *
 * DESCRIPTION
 * Set up the sequence packets for a given port and slot.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 * 	"%|seq|sequence %d %P cos %d tos %d"
 */

static int
seq_3_set_cmd(int argc __rte_unused, char **argv)
{
    int seqnum = atoi(argv[1]);
    portlist_t portlist;
    uint32_t cos, tos;

    if (seqnum >= NUM_SEQ_PKTS) {
        cli_printf("Sequence number too large\n");
        return -1;
    }

    cos = strtoul(argv[4], NULL, 10);
    tos = strtoul(argv[6], NULL, 10);

    portlist_parse(argv[2], pktgen.nb_ports, &portlist);

    foreach_port(portlist, pktgen_set_cos_tos_seq(pinfo, seqnum, cos, tos));

    pktgen_update_display();
    return 0;
}

/**
 *
 * Set a sequence config for given port and slot.
 *
 * DESCRIPTION
 * Set up the sequence packets for a given port and slot.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 * 	"%|seq|sequence %d %P vxlan %d gid %d vid %d"
 */

static int
seq_4_set_cmd(int argc __rte_unused, char **argv)
{
    int seqnum = atoi(argv[1]);
    portlist_t portlist;
    uint32_t flag, gid, vid;

    if (seqnum >= NUM_SEQ_PKTS) {
        cli_printf("Sequence number too large\n");
        return -1;
    }

    flag = strtoul(argv[4], NULL, 0);
    gid  = strtoul(argv[6], NULL, 10);
    vid  = strtoul(argv[8], NULL, 10);

    portlist_parse(argv[2], pktgen.nb_ports, &portlist);

    foreach_port(portlist, pktgen_set_vxlan_seq(pinfo, seqnum, flag, gid, vid));

    pktgen_update_display();
    return 0;
}

static int
seq_5_set_cmd(int argc __rte_unused, char **argv)
{
    int seqnum = atoi(argv[1]);
    portlist_t portlist;

    if (seqnum >= NUM_SEQ_PKTS) {
        cli_printf("Sequence number too large\n");
        return -1;
    }

    portlist_parse(argv[2], pktgen.nb_ports, &portlist);

    foreach_port(portlist, seq_set_tcp_flags(pinfo, seqnum, argv[5]));

    pktgen_update_display();
    return 0;
}

// clang-format off
static struct cli_map seq_map[] = {
    {10, "%|seq|sequence %d %P %m %m %4 %4 %d %d %|ipv4|ipv6 %|udp|tcp|icmp %d %d"},
    {11, "%|seq|sequence %d %P %m %m %4 %4 %d %d %|ipv4|ipv6 %|udp|tcp|icmp %d %d %d"},

    {12, "%|seq|sequence %d %P dst %m src %m dst %4 src %4 sport %d dport %d %|ipv4|ipv6 "
         "%|udp|tcp|icmp vlan %d size %d"},
    {13, "%|seq|sequence %d %P dst %m src %m dst %4 src %4 sport %d dport %d %|ipv4|ipv6 "
         "%|udp|tcp|icmp vlan %d size %d teid %d"},

    {15, "%|seq|sequence %d %P cos %d tos %d"},
    {16, "%|seq|sequence %d %P vxlan %d gid %d vid %d"},
    {17, "%|seq|sequence %d %P vxlan %h gid %d vid %d"},

    {18, "%|seq|sequence %d %P tcp %|flag|flags %c"},
    {-1, NULL}
};
// clang-format on

static const char *seq_help[] = {
    "",
    "sequence <seq#> <portlist> dst <Mac> src <Mac> dst <IP> src <IP> sport <val> dport <val> "
    "ipv4|ipv6 udp|tcp|icmp vlan <val> size <val> [teid <val>]",
    "sequence <seq#> <portlist> <dst-Mac> <src-Mac> <dst-IP> <src-IP> <sport> <dport> ipv4|ipv6 "
    "udp|tcp|icmp <vlanid> <pktsize> [<teid>]",
    "sequence <seq#> <portlist> cos <cos> tos <tos>",
    "sequence <seq#> <portlist> vxlan <flags> gid <group_id> vid <vxlan_id>",
    "                                   - Set the sequence packet information, make sure the "
    "src-IP",
    "                                     has the netmask value eg 1.2.3.4/24",
    "sequence <seq#> <portlist> tcp %|flag|flags <flags> - Set comma delimited TCP flags: "
    "cwr,ece,urg,ack,psh,rst,syn,fin,clr",
    CLI_HELP_PAUSE,
    NULL};

static int
seq_cmd(int argc, char **argv)
{
    struct cli_map *m;

    m = cli_mapping(seq_map, argc, argv);
    if (!m)
        return cli_cmd_error("Sequence invalid command", "Sequence", argc, argv);

    switch (m->index) {
    case 10:
    case 11:
        seq_1_set_cmd(argc, argv);
        break;
    case 12:
    case 13:
        seq_2_set_cmd(argc, argv);
        break;
    case 15:
        seq_3_set_cmd(argc, argv);
        break;
    case 16:
    case 17:
        seq_4_set_cmd(argc, argv);
        break;
    case 18:
        seq_5_set_cmd(argc, argv);
        break;
    default:
        return cli_cmd_error("Sequence invalid command", "Sequence", argc, argv);
    }
    return 0;
}

#ifdef LUA_ENABLED
/**
 *
 * script_cmd - Command to execute a script.
 *
 * DESCRIPTION
 * Load the script file and execute the commands.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
script_cmd(int argc __rte_unused, char **argv)
{
    lua_State *L = pktgen.ld->L;

    if (L == NULL) {
        pktgen_log_error("Lua is not initialized!");
        return -1;
    }

    if (is_help(argc, argv)) {
        cli_printf("\nUsage: %s <script-string>\n", argv[0]);
        return 0;
    }

    if (luaL_dofile(L, argv[1]) != 0)
        pktgen_log_error("%s", lua_tostring(L, -1));
    return 0;
}

/**
 *
 * cmd_exec_lua_parsed - Command to execute lua code on command line.
 *
 * DESCRIPTION
 * Execute a string of lua code
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
exec_lua_cmd(int argc __rte_unused, char **argv __rte_unused)
{
    lua_State *L = pktgen.ld->L;
    char buff[1024], *p;
    int i;
    size_t n, sz;

    if (L == NULL) {
        pktgen_log_error("Lua is not initialized!");
        return -1;
    }

    if (is_help(argc, argv)) {
        cli_printf("\nUsage: %s <script-string>\n", argv[0]);
        return 0;
    }

    sz = sizeof(buff);
    memset(buff, 0, sz);
    sz--; /* Make sure a NULL is at the end of the string */
    n = 0;
    for (i = 1, p = buff; i < argc; i++) {
        if ((strlen(argv[i]) + 1) > (sz - n)) {
            cli_printf("Input line too long > %ld bytes\n", sizeof(buff));
            return -1;
        }
        n += snprintf(&p[n], sz - n, "%s ", argv[i]);
    }

    if (luaL_dostring(L, buff) != 0)
        pktgen_log_error("%s", lua_tostring(L, -1));
    return 0;
}
#endif

// clang-format off
static struct cli_map misc_map[] = {
    {10, "clear %P stats"},
    {20, "geometry"},
    {30, "load %s"},

#ifdef LUA_ENABLED
    {40, "script %l"},
    {50, "lua %l"},
#endif
    {60, "save %s"},
    {70, "redisplay"},
    {100, "reset %P"},
    {110, "restart %P"},
    {130, "port %d"},
    {140, "ping4 %P"},
#ifdef INCLUDE_PING6
    {141, "ping6 %P"},
#endif
    {-1, NULL}
};
// clang-format on
static const char *misc_help[] = {
    "",
    "save <path-to-file>                - Save a configuration file using the filename",
    "load <path-to-file>                - Load a command/script file from the given path",

#ifdef LUA_ENABLED
    "script <filename>                  - Execute the Lua script code in file (www.lua.org).",
    "lua 'lua string'                   - Execute the Lua code in the string needs quotes",
#endif
    "geometry                           - Show the display geometry Columns by Rows (ColxRow)",
    "clear <portlist> stats             - Clear the statistics",
    "clr                                - Clear all Statistics",
    "reset <portlist>                   - Reset the configuration the ports to the default",
    "rst                                - Reset the configuration for all ports",
    "ports per page [1-6]               - Set the number of ports displayed per page",
    "port <number>                      - Sets the sequence packets to display for a given port",
    "restart <portlist>                 - Restart or stop a ethernet port and restart",
    "ping4 <portlist>                   - Send a IPv4 ICMP echo request on the given portlist",
#ifdef INCLUDE_PING6
    "ping6 <portlist>                   - Send a IPv6 ICMP echo request on the given portlist",
#endif
    CLI_HELP_PAUSE,
    NULL};

static int
misc_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;
    uint16_t rows, cols;

    m = cli_mapping(misc_map, argc, argv);
    if (!m)
        return cli_cmd_error("Misc invalid command", "Misc", argc, argv);

    switch (m->index) {
    case 10:
        portlist_parse(argv[1], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pktgen_clear_stats(pinfo));
        pktgen_clear_display();
        break;
    case 20:
        pktgen_display_get_geometry(&rows, &cols);
        break;
    case 30:
        if (cli_execute_cmdfile(argv[1]))
            cli_printf("load command failed for %s\n", argv[1]);
        break;
#ifdef LUA_ENABLED
    case 40:
        script_cmd(argc, argv);
        break;
    case 50:
        exec_lua_cmd(argc, argv);
        break;
#endif
    case 60:
        pktgen_save(argv[1]);
        break;
    case 70:
        pktgen_clear_display();
        break;
    case 100:
        portlist_parse(argv[1], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pktgen_reset(pinfo));
        break;
    case 110:
        portlist_parse(argv[1], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pktgen_port_restart(pinfo));
        break;
    case 130:
        pktgen_set_port_number((uint16_t)atoi(argv[1]));
        break;
    case 140:
        portlist_parse(argv[1], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pktgen_ping4(pinfo));
        pktgen_force_update();
        break;
#ifdef INCLUDE_PING6
    case 141:
        portlist_parse(argv[1], pktgen.nb_ports, &portlist);
        foreach_port(portlist, pktgen_ping6(info));
        pktgen_update_display();
        break;
#endif
    default:
        return cli_cmd_error("Misc invalid command", "Misc", argc, argv);
    }
    return 0;
}

// clang-format off
static struct cli_map page_map[] = {
    {10, "page %d"},
    {11, "page %|main|range|cpu|system|sys|next|sequence|seq|rnd|"
         "log|latency|lat|stats|qstats|xstats"},
    {-1, NULL}
};

static const char *page_help[] = {
    "",
    "page [0-7]                         - Show the port pages or configuration or sequence page",
    "page main                          - Display page zero",
    "page range                         - Display the range packet page",
    "page cpu                           - Display the CPU page",
    "page system | sys                  - Display some information about the CPU system",
    "page sequence | seq                - sequence will display a set of packets for a given port",
    "                                     Note: use the 'port <number>' to display a new port "
    "sequence",
    "page rnd                           - Display the random bitfields to packets for a given port",
    "                                     Note: use the 'port <number>' to display a new port "
    "sequence",
    "page log                           - Display the log messages page",
    "page latency | lat                 - Display the latency page",
    "page qstats | stats                - Display per port queue stats",
    "page xstats                        - Display port XSTATS values",
    CLI_HELP_PAUSE,
    NULL
};
// clang-format on

static int
page_cmd(int argc, char **argv)
{
    struct cli_map *m;

    m = cli_mapping(page_map, argc, argv);
    if (!m)
        return cli_cmd_error("Page invalid command", "Page", argc, argv);

    switch (m->index) {
    case 10:
    case 11:
        pktgen_set_page(argv[1]);
        break;
    default:
        return cli_cmd_error("Page invalid command", "Page", argc, argv);
    }
    return 0;
}

// clang-format off
static struct cli_map plugin_map[] = {
    {10, "plugin"},
    {20, "plugin load %s"},
    {21, "plugin load %s %s"},
    {30, "plugin %|rm|del|delete %s"},
    {-1, NULL}
};

static const char *plugin_help[] = {
    "",
    "plugin                             - Show the plugins currently installed",
    "plugin load <filename>             - Load a plugin file",
    "plugin load <filename> <path>      - Load a plugin file at path",
    "plugin rm|delete <plugin>          - Remove or delete a plugin",
    CLI_HELP_PAUSE,
    NULL
};
// clang-format on

static int
plugin_cmd(int argc, char **argv)
{
    struct cli_map *m;
    int inst;

    m = cli_mapping(plugin_map, argc, argv);
    if (!m)
        return cli_cmd_error("Plugin invalid command", "Plugin", argc, argv);

    switch (m->index) {
    case 10:
        plugin_dump(stdout);
        break;
    case 20:
    case 21:
        if ((inst = plugin_create(argv[2], argv[3])) < 0) {
            printf("Plugin not loaded %s, %s\n", argv[2], argv[3]);
            return -1;
        }

        if (plugin_start(inst, NULL), 0) {
            plugin_destroy(inst);
            return -1;
        }
        break;
    case 30:
        inst = plugin_find_by_name(argv[2]);
        if (inst < 0)
            return -1;
        plugin_stop(inst);
        plugin_destroy(inst);
        break;
    default:
        return cli_cmd_error("Plugin invalid command", "Plugin", argc, argv);
    }
    return 0;
}

#if defined(RTE_LIBRTE_PMD_BOND) || defined(RTE_NET_BOND)
// clang-format off
static struct cli_map bonding_map[] = {
    {10, "bonding %P show"},
    {20, "bonding show"},
    {-1, NULL}
};
// clang-format on

static const char *bonding_help[] = {
    "", "bonding <portlist> show          - Show the bonding configuration for <portlist>",
    "bonding show                     - Show all bonding configurations", CLI_HELP_PAUSE, NULL};

static void
bonding_dump(port_info_t *pinfo)
{
    uint16_t pid;

    RTE_ETH_FOREACH_DEV(pid)
    {
        struct rte_eth_bond_8023ad_conf conf;

        if (pinfo->pid != pid)
            continue;

        if (rte_eth_bond_8023ad_conf_get(pid, &conf) < 0)
            continue;

        printf("Port %d information:\n", pid);
        show_bonding_mode(pinfo);
        printf("\n");
    }
}

static int
bonding_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;

    m = cli_mapping(bonding_map, argc, argv);
    if (!m)
        return cli_cmd_error("bonding invalid command", "Bonding", argc, argv);

    switch (m->index) {
    case 10:
        portlist_parse(argv[1], pktgen.nb_ports, &portlist);
        foreach_port(portlist, bonding_dump(pinfo));
        break;
    case 20:
        portlist = 0xFFFFFFFF;
        foreach_port(portlist, bonding_dump(pinfo));
        break;
    default:
        return cli_cmd_error("Bonding invalid command", "Bonding", argc, argv);
    }
    return 0;
}
#endif

// clang-format off
static struct cli_map latency_map[] = {
    {10, "latency %P rate %u"},
    {20, "latency %P entropy %u"},
    {-1, NULL}
};

static const char *latency_help[] = {
    "",
    "latency <portlist> rate <value>      - Rate in milli-seconds to send a latency packet",
    "latency <portlist> entropy <value>   - Entropy value to adjust the src-port by (SPORT + (i % N)) (default: 1)",
    "                                       e.eg. latency 0 entropy 16",
    CLI_HELP_PAUSE,
    NULL
};
// clang-format on

static int
latency_cmd(int argc, char **argv)
{
    struct cli_map *m;
    portlist_t portlist;
    int value;

    m = cli_mapping(latency_map, argc, argv);
    if (!m)
        return cli_cmd_error("Latency invalid command", "Latency", argc, argv);

    portlist_parse(argv[1], pktgen.nb_ports, &portlist);

    value = atoi(argv[3]);

    switch (m->index) {
    case 10:
        foreach_port(portlist, latency_set_rate(pinfo, value));
        break;
    case 20:
        foreach_port(portlist, latency_set_entropy(pinfo, (uint16_t)value));
        break;
    default:
        return cli_cmd_error("Latency invalid command", "Latency", argc, argv);
    }

    pktgen_update_display();
    return 0;
}

// clang-format off
static struct cli_map hmap_map[] = {
    {10, "hmap list"},
    {20, "hmap dump all"},
    {30, "hmap dump %s"},
    {-1, NULL}
};

static const char *hmap_help[] = {
    "",
    "hmap list               - Show the hmap names currently active",
    "hmap dump all           - Dump all hmap information",
    "hmap dump <hmap-name>   - Dump the hmap information for <hmap-name>",
    CLI_HELP_PAUSE,
    NULL
};
// clang-format on
static int
hmap_cmd(int argc, char **argv)
{
    struct cli_map *m;

    m = cli_mapping(hmap_map, argc, argv);
    if (!m)
        return cli_cmd_error("hmap invalid command", "Hashmap", argc, argv);

    switch (m->index) {
    case 10:
        hmap_list_names(NULL);
        break;
    case 20:
        hmap_list_all(NULL, true);
        break;
    case 30:
        hmap_list_by_name(NULL, argv[2], true);
        break;
    default:
        return cli_cmd_error("Hashmap invalid command", "Hashmap", argc, argv);
    }

    pktgen_update_display();
    return 0;
}

/**********************************************************/
/**********************************************************/
/****** CONTEXT (list of instruction) */

static int help_cmd(int argc, char **argv);

// clang-format off
static struct cli_tree default_tree[] = {
    c_dir("/pktgen/bin"),
    c_cmd("help", help_cmd, "help command"),

    c_cmd("clear", misc_cmd, "clear stats, ..."),
    c_alias("clr", "clear all stats", "clear all port stats"),
    c_cmd("geometry", misc_cmd, "show the screen geometry"),
    c_alias("geom", "geometry", "show the screen geometry"),
    c_cmd("load", misc_cmd, "load command file"),
#ifdef LUA_ENABLED
    c_cmd("script", misc_cmd, "run a Lua script"),
    c_cmd("lua", misc_cmd, "execute a Lua string"),
#endif
    c_cmd("save", misc_cmd, "save the current state"),
    c_cmd("redisplay", misc_cmd, "redisplay the screen"),
    c_alias("cls", "redisplay", "redraw screen"),
    c_cmd("reset", misc_cmd, "reset pktgen configuration"),
    c_alias("rst", "reset all", "reset all ports"),
    c_cmd("restart", misc_cmd, "restart port"),
    c_cmd("port", misc_cmd, "Switch between ports"),
    c_cmd("ping4", misc_cmd, "Send a ping packet for IPv4"),
#ifdef INCLUDE_PING6
    c_cmd("ping6", misc_cmd, "Send a ping packet for IPv6"),
#endif

    c_cmd("sequence", seq_cmd, "sequence command"),
    c_alias("seq", "sequence", "sequence command"),

    c_cmd("page", page_cmd, "change page displays"),
    c_cmd("theme", theme_cmd, "Set, save, show the theme"),
    c_cmd("range", range_cmd, "Range commands"),
    c_cmd("enable", en_dis_cmd, "enable features"),
    c_cmd("disable", en_dis_cmd, "disable features"),
    c_cmd("start", start_stop_cmd, "start features"),
    c_cmd("stop", start_stop_cmd, "stop features"),
    c_alias("str", "start all", "start all ports sending packets"),
    c_alias("stp", "stop all", "stop all ports sending packets"),
    c_cmd("pcap", pcap_cmd, "pcap commands"),
    c_cmd("set", set_cmd, "set a number of options"),
    c_cmd("dbg", dbg_cmd, "debug commands"),
    c_cmd("plugin", plugin_cmd, "Plugin a shared object file"),
#if defined(RTE_LIBRTE_PMD_BOND) || defined(RTE_NET_BOND)
    c_cmd("bonding", bonding_cmd, "Bonding commands"),
#endif
    c_cmd("latency", latency_cmd, "Latency setup commands"),
    c_cmd("hmap", hmap_cmd, "hashmap commands"),

    c_alias("on", "enable screen", "Enable screen updates"),
    c_alias("off", "disable screen", "Disable screen updates"),

    c_end()
};
// clang-format on
static int
init_tree(void)
{
    /* Add the system default commands in /sbin directory */
    if (cli_default_tree_init())
        return -1;

    /* Add the Pktgen directory tree */
    if (cli_add_tree(cli_root_node(), default_tree))
        return -1;

    cli_help_add("Title", NULL, title_help);
    cli_help_add("Page", page_map, page_help);
    cli_help_add("Enable", enable_map, enable_help);
    cli_help_add("Set", set_map, set_help);
    cli_help_add("Range", range_map, range_help);
    cli_help_add("Sequence", seq_map, seq_help);
    cli_help_add("PCAP", pcap_map, pcap_help);
    cli_help_add("Start", start_map, start_help);
    cli_help_add("Debug", dbg_map, dbg_help);
    cli_help_add("Misc", misc_map, misc_help);
    cli_help_add("Theme", theme_map, theme_help);
    cli_help_add("Plugin", plugin_map, plugin_help);
    cli_help_add("Latency", latency_map, latency_help);
    cli_help_add("Hashmap", hmap_map, hmap_help);
#if defined(RTE_LIBRTE_PMD_BOND) || defined(RTE_NET_BOND)
    cli_help_add("Bonding", bonding_map, bonding_help);
#endif
    cli_help_add("Status", NULL, status_help);

    /* Make sure the pktgen commands are executable in search path */
    if (cli_add_bin_path("/pktgen/bin"))
        return -1;

    return 0;
}

static int
my_prompt(int cont __rte_unused)
{
    int nb;

    pktgen_display_set_color("pktgen.prompt");
    nb = cli_printf("Pktgen:%s> ", cli_path_string(NULL, NULL));
    pktgen_display_set_color("stats.stat.values");

    return nb;
}

int
pktgen_cli_create(void)
{
    int ret = -1;

    if (!cli_create()) {
        if (!cli_setup_with_tree(init_tree)) {
            cli_set_prompt(my_prompt);
            ret = 0;
        }
    }
    return ret;
}

/**
 *
 * Display the help screen and pause if needed.
 *
 * DESCRIPTION
 * Display the help and use pause to show screen full of messages.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
help_cmd(int argc __rte_unused, char **argv __rte_unused)
{
    int paused;

    paused = scrn_is_paused();

    if (!paused)
        scrn_pause();

    scrn_setw(1);
    scrn_cls();
    scrn_pos(1, 1);

    cli_help_show_all("** Pktgen Help Information **");

    if (!paused) {
        scrn_setw(pktgen.last_row + 1);
        scrn_resume();
        pktgen_clear_display();
    }
    return 0;
}


================================================
FILE: app/cli-functions.h
================================================
/*-
 * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Created 2018 by Keith Wiles @ intel.com */

#ifndef _CLI_COMMANDS_H_
#define _CLI_COMMANDS_H_

/**
 * @file
 *
 * Pktgen interactive CLI command tree creation.
 */

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Build and register the full Pktgen CLI command tree.
 *
 * Registers all command maps, directory nodes, and help strings with the
 * CLI engine.  Must be called once during initialisation before entering
 * the interactive shell loop.
 *
 * @return
 *   0 on success, -1 on failure.
 */
int pktgen_cli_create(void);

#ifdef __cplusplus
}
#endif

#endif /* _CLI_COMMANDS_H_ */


================================================
FILE: app/l2p.c
================================================
/*-
 * Copyright(c) <2012-2026>, Intel Corporation. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Created 2012 by Keith Wiles @ intel.com */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include <alloca.h>
#include <pthread.h>

#include <rte_version.h>
#include <rte_config.h>
#include <rte_lcore.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_pci.h>
#include <rte_debug.h>
#include <rte_memory.h>

#include <pktgen.h>
#include <pg_strings.h>
#include "l2p.h"
#include "utils.h"

static l2p_t l2p_info, *l2p = &l2p_info;

l2p_t *
l2p_get(void)
{
    return l2p;
}

/**
 * Create and initialize the lcore to port object
 *
 * RETURNS: Pointer to l2p_t or NULL on error.
 */
void
l2p_create(void)
{
    for (int i = 0; i < RTE_MAX_ETHPORTS; i++)
        l2p->ports[i].pid = RTE_MAX_ETHPORTS + 1;
}

static struct rte_mempool *
l2p_pktmbuf_create(const char *type, l2p_port_t *port, uint16_t qid, int nb_mbufs, int cache_size)
{
    struct rte_mempool *mp;
    char name[RTE_MEMZONE_NAMESIZE];
    uint64_t sz;
    int sid;

    sid = pg_eth_dev_socket_id(port->pid);

    snprintf(name, sizeof(name) - 1, "%s-P%u/Q%u/S%u", type, port->pid, qid, sid);

    const int bufSize = pktgen.mbuf_buf_size;

    sz = nb_mbufs * bufSize;
    sz = RTE_ALIGN_CEIL(sz + sizeof(struct rte_mempool), 1024);

    pktgen.mem_used += sz;
    pktgen.total_mem_used += sz;

    /* create the mbuf pool */
    mp = rte_pktmbuf_pool_create(name, nb_mbufs, cache_size, DEFAULT_PRIV_SIZE, bufSize, sid);
    if (mp == NULL)
        rte_exit(EXIT_FAILURE,
                 "Cannot create mbuf pool (%s) port %d, queue %u, nb_mbufs %d, NUMA %d: %s\n", name,
                 port->pid, qid, nb_mbufs, sid, rte_strerror(rte_errno));

    pktgen_log_info("  Create: '%-*s' - Memory used (MBUFs %'6u x size %'6u) = %'8lu KB @ %p\n", 24,
                    name, nb_mbufs, bufSize, sz / 1024, mp);

    return mp;
}

static int
parse_cores(uint16_t pid, const char *cores, int mode)
{
    l2p_t *l2p       = l2p_get();
    l2p_port_t *port = &l2p->ports[pid];
    char *core_map   = NULL;
    int num_cores    = 0, l, h, num_fields;
    char *fields[3]  = {0}, *f0, *f1;
    int mbuf_count   = MAX_MBUFS_PER_PORT(DEFAULT_RX_DESC, DEFAULT_TX_DESC);
    char name[64];

    core_map = alloca(MAX_ALLOCA_SIZE);
    if (!core_map)
        rte_exit(EXIT_FAILURE, "out of memory for core string\n");

    snprintf(core_map, MAX_ALLOCA_SIZE - 1, "%s", cores);

    num_fields = rte_strsplit(core_map, strlen(core_map), fields, RTE_DIM(fields), '-');
    if (num_fields <= 0 || num_fields > 2)
        rte_exit(EXIT_FAILURE, "invalid core mapping '%s'\n", cores);
    f0 = fields[0];
    f1 = (fields[1] == NULL) ? f0 : fields[1];
    f0 = pg_strtrimset(f0, "[]");
    f0 = pg_strtrimset(f0, "{}");
    f1 = pg_strtrimset(f1, "[]");
    f1 = pg_strtrimset(f1, "{}");

    l = strtol(f0, NULL, 10);
    h = strtol(f1, NULL, 10);

    do {
        l2p_lport_t *lport;
        int32_t sid = pg_eth_dev_socket_id(port->pid);

        lport = l2p->lports[l];
        if (lport == NULL) {
            snprintf(name, sizeof(name) - 1, "lport-%u:%u", l, port->pid);
            lport = rte_zmalloc_socket(name, sizeof(l2p_lport_t), RTE_CACHE_LINE_SIZE, sid);
            if (!lport)
                rte_exit(EXIT_FAILURE, "Failed to allocate memory for lport info\n");
            lport->lid = l;

            l2p->lports[l] = lport;
        } else
            printf("Err: lcore %u already in use\n", l);

        num_cores++;
        lport->port = port;
        lport->mode = mode;
        switch (mode) {
        case LCORE_MODE_RX:
            if (port->num_rx_qids >= MAX_QUEUES_PER_PORT)
                rte_exit(EXIT_FAILURE, "Too many RX queues for port %u (max %u)\n", port->pid,
                         (unsigned)MAX_QUEUES_PER_PORT);
            lport->rx_qid = port->num_rx_qids++;
            break;
        case LCORE_MODE_TX:
            if (port->num_tx_qids >= MAX_QUEUES_PER_PORT)
                rte_exit(EXIT_FAILURE, "Too many TX queues for port %u (max %u)\n", port->pid,
                         (unsigned)MAX_QUEUES_PER_PORT);
            lport->tx_qid = port->num_tx_qids++;
            break;
        case LCORE_MODE_BOTH:
            if (port->num_rx_qids >= MAX_QUEUES_PER_PORT)
                rte_exit(EXIT_FAILURE, "Too many RX queues for port %u (max %u)\n", port->pid,
                         (unsigned)MAX_QUEUES_PER_PORT);
            if (port->num_tx_qids >= MAX_QUEUES_PER_PORT)
                rte_exit(EXIT_FAILURE, "Too many TX queues for port %u (max %u)\n", port->pid,
                         (unsigned)MAX_QUEUES_PER_PORT);
            lport->rx_qid = port->num_rx_qids++;
            lport->tx_qid = port->num_tx_qids++;
            break;
        default:
            rte_exit(EXIT_FAILURE, "invalid port mode\n");
            break;
        }

        if (mode == LCORE_MODE_RX || mode == LCORE_MODE_BOTH) {
            const uint16_t qid = lport->rx_qid;
            if (port->rx_mp[qid] == NULL) {
                /* Create the Rx mbuf pool one per port/queue */
                port->rx_mp[qid] =
                    l2p_pktmbuf_create("RX", port, qid, mbuf_count, MEMPOOL_CACHE_SIZE);
                if (port->rx_mp[qid] == NULL)
                    rte_exit(EXIT_FAILURE, "Cannot init port %d qid %u for Default RX mbufs",
                             port->pid, qid);
            }
        }

        if (mode == LCORE_MODE_TX || mode == LCORE_MODE_BOTH) {
            const uint16_t qid = lport->tx_qid;
            if (port->tx_mp[qid] == NULL) {
                port->tx_mp[qid] =
                    l2p_pktmbuf_create("TX", port, qid, mbuf_count, MEMPOOL_CACHE_SIZE);
                if (port->tx_mp[qid] == NULL)
                    rte_exit(EXIT_FAILURE, "Cannot init port %d qid %u for Default TX mbufs",
                             port->pid, qid);
            }
            if (port->sp_mp[qid] == NULL) {
                /* Used for sending special packets like ARP requests */
                port->sp_mp[qid] = l2p_pktmbuf_create("SP", port, qid, MAX_SPECIAL_MBUFS, 0);
                if (port->sp_mp[qid] == NULL)
                    rte_exit(EXIT_FAILURE, "Cannot init port %d qid %u for Special TX mbufs", pid,
                             qid);
            }
        }
    } while (l++ < h);

    return num_cores;
}

static int
parse_mapping(const char *map)
{
    l2p_t *l2p      = l2p_get();
    char *fields[3] = {0}, *f0, *f1, *lcores[3] = {0}, *c0, *c1;
    char *mapping = NULL;
    int num_fields, num_cores, num_lcores;
    uint16_t pid;

    if (!map || strlen(map) == 0) {
        printf("no mapping specified or string empty\n");
        goto leave;
    }

    mapping = alloca(MAX_ALLOCA_SIZE);
    if (!mapping) {
        printf("unable to allocate map string\n");
        goto leave;
    }
    snprintf(mapping, MAX_ALLOCA_SIZE - 1, "%s", map);

    /* parse map into a lcore list and port number */
    num_fields = rte_strsplit(mapping, strlen(mapping), fields, RTE_DIM(fields), '.');
    if (num_fields != 2) {
        printf("Invalid mapping format '%s'\n", map);
        goto leave;
    }
    f0 = fields[0];
    f1 = (fields[1] == NULL) ? f0 : fields[1];
    f0 = pg_strtrimset(f0, "[]");
    f0 = pg_strtrimset(f0, "{}");
    f1 = pg_strtrimset(f1, "[]");
    f1 = pg_strtrimset(f1, "{}");

    pid = strtol(f1, NULL, 10);
    if (pid >= RTE_MAX_ETHPORTS) {
        printf("Invalid port number '%s'\n", f1);
        goto leave;
    }

    l2p->ports[pid].pid = pid;
    l2p->num_ports++;

    num_lcores = rte_strsplit(f0, strlen(f0), lcores, RTE_DIM(lcores), ':');
    if (num_lcores <= 0 || num_lcores > 2) {
        printf("Invalid mapping format '%s'\n", fields[0]);
        goto leave;
    }
    c0 = lcores[0];
    c1 = (lcores[1] == NULL) ? c0 : lcores[1];
    c0 = pg_strtrimset(c0, "[]");
    c0 = pg_strtrimset(c0, "{}");
    c1 = pg_strtrimset(c1, "[]");
    c1 = pg_strtrimset(c1, "{}");

    if (num_lcores == 1) {
        num_cores = parse_cores(pid, c0, LCORE_MODE_BOTH);
        if (num_cores <= 0) {
            printf("Invalid mapping format '%s'\n", c0);
            goto leave;
        }
    } else {
        num_cores = parse_cores(pid, c0, LCORE_MODE_RX);
        if (num_cores <= 0) {
            printf("Invalid mapping format '%s'\n", c0);
            goto leave;
        }

        num_cores = parse_cores(pid, c1, LCORE_MODE_TX);
        if (num_cores <= 0) {
            printf("Invalid mapping format '%s'\n", c1);
            goto leave;
        }
    }
    return 0;
leave:
    return -1;
}

/**
 *
 * pg_parse_matrix - Parse the command line argument for port configuration
 *
 * DESCRIPTION
 * Parse the command line argument for port configuration.
 *
 * BNF: (or kind of BNF)
 *      <matrix-string> := """ <lcore-port> { "," <lcore-port>} """
 *		<lcore-port>	:= <lcore-list> "." <port>
 *		<lcore-list>	:= "[" <rx-list> ":" <tx-list> "]"
 *		<port>      	:= <num>
 *		<rx-list>		:= <num> { "/" (<num> | <list>) }
 *		<tx-list>		:= <num> { "/" (<num> | <list>) }
 *		<list>			:= <num>           { "/" (<range> | <list>) }
 *		<range>			:= <num> "-" <num> { "/" <range> }
 *		<num>			:= <digit>+
 *		<digit>			:= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
 *
 * BTW: A single lcore can only handle a single port/queue, which means
 *      you can not have a single core processing more then one network device or port.
 *
 *	1.0, 2.1, 3.2                   - core 1 handles port 0 rx/tx,
 *					  core 2 handles port 1 rx/tx
 *	[0-1].0, [2/4-5].1, ...		- cores 0-1 handle port 0 rx/tx,
 *					  cores 2,4,5 handle port 1 rx/tx
 *	[1:2].0, [4:6].1, ...		- core 1 handles port 0 rx,
 *					  core 2 handles port 0 tx,
 *	[1:2-3].0, [4:5-6].1, ...	- core 1 handles port 1 rx, cores 2,3 handle port 0 tx
 *					  core 4 handles port 1 rx & core 5,6 handles port 1 tx
 *	[1-2:3].0, [4-5:6].1, ...	- core 1,2 handles port 0 rx, core 3 handles port 0 tx
 *					  core 4,5 handles port 1 rx & core 6 handles port 1 tx
 *	[1-2:3-5].0, [4-5:6/8].1, ...	- core 1,2 handles port 0 rx, core 3,4,5 handles port 0 tx
 *					  core 4,5 handles port 1 rx & core 6,8 handles port 1 tx
 *	BTW: you can use "{}" instead of "[]" as it does not matter to the syntax.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */
int
l2p_parse_mappings(void)
{
    l2p_t *l2p = l2p_get();

    for (int i = 0; i < l2p->num_mappings; i++)
        if (parse_mapping(l2p->mappings[i]))
            return -1;
    pktgen_log_info("%*sTotal memory used = %'8" PRIu64 " KB", 54, " ",
                    (pktgen.total_mem_used + 1023) / 1024);
    return 0;
}

int
l2p_parse_mapping_add(const char *str)
{
    l2p_t *l2p = l2p_get();

    if (!str || l2p->num_mappings > RTE_MAX_ETHPORTS)
        return -1;
    l2p->mappings[l2p->num_mappings++] = strdup(str);
    return 0;
}


================================================
FILE: app/l2p.h
================================================
/*-
 * Copyright(c) <2012-2026>, Intel Corporation. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Created 2014 by Keith Wiles @ intel.com */

#ifndef __L2P_H
#define __L2P_H

/**
 * @file
 *
 * Lcore-to-Port (L2P) mapping for Pktgen.
 *
 * Manages the assignment of logical cores to Ethernet port/queue pairs,
 * the per-port mempool ownership, and provides accessors for obtaining
 * port_info_t pointers, queue counts, and PCAP state from any lcore or
 * port index.
 */

#include <string.h>
#include <pthread.h>

#include <rte_memory.h>
#include <rte_atomic.h>

#include <pktgen-pcap.h>
#include <pktgen-log.h>
#include <pktgen-stats.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_MATRIX_ENTRIES 128 /**< Maximum number of lcore/port mapping entries */
#define MAX_STRING         256 /**< Maximum length of a mapping string */

#define MAX_MAP_PORTS  (RTE_MAX_ETHPORTS + 1) /**< Sentinel-inclusive port array size */
#define MAX_MAP_LCORES (RTE_MAX_LCORE + 1)    /**< Sentinel-inclusive lcore array size */

/** Lcore operating mode: unknown, RX-only, TX-only, or both. */
enum { LCORE_MODE_UNKNOWN = 0, LCORE_MODE_RX = 1, LCORE_MODE_TX = 2, LCORE_MODE_BOTH = 3 };

#define MAX_MAPPINGS       32   /**< Maximum number of port/queue mappings */
#define MAX_ALLOCA_SIZE    1024 /**< Maximum size of a stack allocation */
#define MEMPOOL_CACHE_SIZE (RTE_MEMPOOL_CACHE_MAX_SIZE / 2) /**< Per-lcore mempool cache size */

struct port_info_s;

/**
 * Per-port L2P state: mempools, queue counts, and PCAP context.
 */
typedef struct l2p_port_s {
    struct port_info_s *pinfo;                      /**< Port information pointer */
    uint16_t pid;                                   /**< Port ID attached to lcore */
    uint16_t num_rx_qids;                           /**< Number of Rx queues */
    uint16_t num_tx_qids;                           /**< Number of Tx queues */
    struct rte_mempool *rx_mp[MAX_QUEUES_PER_PORT]; /**< Rx pktmbuf pool per queue */
    struct rte_mempool *tx_mp[MAX_QUEUES_PER_PORT]; /**< Tx pktmbuf pool per queue */
    struct rte_mempool *sp_mp[MAX_QUEUES_PER_PORT]; /**< Special TX pktmbuf pool per queue */
    pcap_info_t *pcap_info;                         /**< PCAP packet structure */
} l2p_port_t;

/**
 * Per-lcore L2P state: mode, queue IDs, and a pointer to the owning port.
 */
typedef struct l2p_lport_s {
    uint16_t mode;    /**< LCORE_MODE_RX, LCORE_MODE_TX, or LCORE_MODE_BOTH */
    uint16_t lid;     /**< Lcore ID */
    uint16_t rx_qid;  /**< RX queue ID assigned to this lcore */
    uint16_t tx_qid;  /**< TX queue ID assigned to this lcore */
    l2p_port_t *port; /**< Pointer to the owning port structure */
} l2p_lport_t;

/**
 * Top-level L2P mapping table.
 */
typedef struct {
    l2p_lport_t *lports[RTE_MAX_LCORE]; /**< Per-lcore port/queue assignment */
    l2p_port_t ports[RTE_MAX_ETHPORTS]; /**< Per-port L2P state */
    char *mappings[RTE_MAX_ETHPORTS];   /**< Raw mapping strings from the command line */
    uint16_t num_mappings;              /**< Number of mapping strings */
    uint16_t num_ports;                 /**< Number of active ports */
} l2p_t;

/** Log an error message with the enclosing function name as prefix. */
#define L2P_ERR(fmt, args...) printf("%s: " fmt "\n", __func__, ##args);

/** Log an error message and return -1. */
#define L2P_ERR_RET(fmt, args...) \
    do {                          \
        L2P_ERR(fmt, ##args);     \
        return -1;                \
    } while (0)

/** Log an error message and return NULL. */
#define L2P_NULL_RET(fmt, args...) \
    do {                           \
        L2P_ERR(fmt, ##args);      \
        return NULL;               \
    } while (0)

/**
 * Return the global l2p_t singleton.
 *
 * @return
 *   Pointer to the global l2p_t mapping table.
 */
l2p_t *l2p_get(void);

/**
 * Return the l2p_port_t for a given port ID.
 *
 * @param pid
 *   Port ID to look up.
 * @return
 *   Pointer to the l2p_port_t, or NULL if @p pid is invalid.
 */
static __inline__ l2p_port_t *
l2p_get_port(uint16_t pid)
{
    l2p_t *l2p = l2p_get();

    return ((pid < RTE_MAX_ETHPORTS) && (l2p->ports[pid].pid < RTE_MAX_ETHPORTS)) ? &l2p->ports[pid]
                                                                                  : NULL;
}

/**
 * Return the number of active ports in the L2P mapping.
 *
 * @return
 *   Number of configured ports.
 */
static __inline__ uint16_t
l2p_get_port_cnt(void)
{
    l2p_t *l2p = l2p_get();

    return l2p->num_ports;
}

/**
 * Return the lcore ID associated with a port.
 *
 * Scans the lport table and returns the first lcore mapped to @p pid.
 *
 * @param pid
 *   Port ID to search for.
 * @return
 *   Lcore ID, or RTE_MAX_LCORE if none found.
 */
static __inline__ uint16_t
l2p_get_lcore_by_pid(uint16_t pid)
{
    l2p_t *l2p   = l2p_get();
    uint16_t lid = RTE_MAX_LCORE;

    for (uint16_t i = 0; i < RTE_MAX_LCORE; i++) {
        if (l2p->lports[i] && l2p->lports[i]->port->pid == pid) {
            lid = l2p->lports[i]->lid;
            break;
        }
    }
    return lid;
}

/**
 * Return the port ID assigned to a given lcore.
 *
 * @param lid
 *   Lcore ID to look up.
 * @return
 *   Port ID, or RTE_MAX_ETHPORTS if @p lid has no port assignment.
 */
static __inline__ uint16_t
l2p_get_pid_by_lcore(uint16_t lid)
{
    l2p_t *l2p   = l2p_get();
    uint16_t pid = RTE_MAX_ETHPORTS;

    if (!l2p->lports[lid] || !l2p->lports[lid]->port)
        return pid;
    if (l2p->lports[lid]->port->pid >= RTE_MAX_ETHPORTS)
        return pid;

    return l2p->lports[lid]->port->pid;
}

/**
 * Return the RX mempool for a given port and queue.
 *
 * @param pid
 *   Port ID.
 * @param qid
 *   RX queue ID.
 * @return
 *   Pointer to the RX mempool, or NULL on error.
 */
static __inline__ struct rte_mempool *
l2p_get_rx_mp(uint16_t pid, uint16_t qid)
{
    l2p_t *l2p = l2p_get();

    if (pid >= RTE_MAX_ETHPORTS)
        L2P_NULL_RET("Invalid port ID %u", pid);

    if (qid >= MAX_QUEUES_PER_PORT)
        L2P_NULL_RET("Invalid queue ID %u", qid);

    return l2p->ports[pid].rx_mp[qid];
}

/**
 * Return the TX mempool for a given port and queue.
 *
 * @param pid
 *   Port ID.
 * @param qid
 *   TX queue ID.
 * @return
 *   Pointer to the TX mempool, or NULL on error.
 */
static __inline__ struct rte_mempool *
l2p_get_tx_mp(uint16_t pid, uint16_t qid)
{
    l2p_t *l2p = l2p_get();

    if (pid >= RTE_MAX_ETHPORTS)
        L2P_NULL_RET("Invalid port ID %u", pid);

    if (qid >= MAX_QUEUES_PER_PORT)
        L2P_NULL_RET("Invalid queue ID %u", qid);

    return l2p->ports[pid].tx_mp[qid];
}

/**
 * Return the special TX mempool for a given port and queue.
 *
 * @param pid
 *   Port ID.
 * @param qid
 *   TX queue ID.
 * @return
 *   Pointer to the special TX mempool, or NULL on error.
 */
static __inline__ struct rte_mempool *
l2p_get_sp_mp(uint16_t pid, uint16_t qid)
{
    l2p_t *l2p = l2p_get();

    if (pid >= RTE_MAX_ETHPORTS)
        L2P_NULL_RET("Invalid port ID %u", pid);

    if (qid >= MAX_QUEUES_PER_PORT)
        L2P_NULL_RET("Invalid queue ID %u", qid);

    return l2p->ports[pid].sp_mp[qid];
}

/**
 * Return the lcore operating mode (RX, TX, or both).
 *
 * @param lid
 *   Lcore ID to query.
 * @return
 *   LCORE_MODE_* constant, or -1 on error.
 */
static __inline__ int
l2p_get_type(uint16_t lid)
{
    l2p_t *l2p = l2p_get();

    if (lid >= RTE_MAX_LCORE)
        L2P_ERR_RET("Invalid lcore ID %u", lid);

    return l2p->lports[lid]->mode;
}

/**
 * Return the port_info_t for a given port ID.
 *
 * @param pid
 *   Port ID to look up.
 * @return
 *   Pointer to port_info_t, or NULL if @p pid is invalid.
 */
static __inline__ struct port_info_s *
l2p_get_port_pinfo(uint16_t pid)
{
    l2p_port_t *port = l2p_get_port(pid);

    return (port == NULL) ? NULL : port->pinfo;
}

/**
 * Set the port_info_t pointer for a given port ID.
 *
 * @param pid
 *   Port ID to update.
 * @param pinfo
 *   Pointer to the port_info_t to associate.
 * @return
 *   0 on success, -1 on invalid @p pid.
 */
static __inline__ int
l2p_set_port_pinfo(uint16_t pid, struct port_info_s *pinfo)
{
    l2p_port_t *port = l2p_get_port(pid);

    if (port == NULL)
        L2P_ERR_RET("Invalid port ID %u", pid);

    port->pinfo = pinfo;
    return 0;
}

/**
 * Return the port_info_t for the port assigned to a given lcore.
 *
 * @param lid
 *   Lcore ID to look up.
 * @return
 *   Pointer to port_info_t, or NULL if @p lid is invalid.
 */
static __inline__ struct port_info_s *
l2p_get_pinfo_by_lcore(uint16_t lid)
{
    l2p_t *l2p = l2p_get();
    l2p_port_t *port;

    if (lid >= RTE_MAX_LCORE || l2p->lports[lid]->lid >= RTE_MAX_LCORE ||
        (port = l2p->lports[lid]->port) == NULL)
        L2P_NULL_RET("Invalid lcore ID %u", lid);

    return port->pinfo;
}

/**
 * Set the port_info_t pointer for the port assigned to a given lcore.
 *
 * @param lid
 *   Lcore ID to update.
 * @param pinfo
 *   Pointer to the port_info_t to associate.
 * @return
 *   0 on success, -1 on invalid @p lid.
 */
static __inline__ int
l2p_set_pinfo_by_lcore(uint16_t lid, struct port_info_s *pinfo)
{
    l2p_t *l2p = l2p_get();
    l2p_port_t *port;

    if (lid >= RTE_MAX_LCORE || l2p->lports[lid]->lid >= RTE_MAX_LCORE ||
        (port = l2p->lports[lid]->port) == NULL)
        L2P_ERR_RET("Invalid lcore ID %u", lid);

    port->pinfo = pinfo;

    return 0;
}

/**
 * Return the RX and TX queue counts for a port.
 *
 * @param pid
 *   Port ID to query.
 * @param rx_qid
 *   Output: number of RX queues (may be NULL).
 * @param tx_qid
 *   Output: number of TX queues (may be NULL).
 * @return
 *   0 on success, -1 on invalid @p pid.
 */
static __inline__ int
l2p_get_qcnt(uint16_t pid, uint16_t *rx_qid, uint16_t *tx_qid)
{
    l2p_t *l2p = l2p_get();

    if (pid < RTE_MAX_ETHPORTS && l2p->ports[pid].pid < RTE_MAX_ETHPORTS) {
        if (rx_qid)
            *rx_qid = l2p->ports[pid].num_rx_qids;
        if (tx_qid)
            *tx_qid = l2p->ports[pid].num_tx_qids;
        return 0;
    }
    return -1;
}

/**
 * Return the number of RX queues for a port.
 *
 * @param pid
 *   Port ID to query.
 * @return
 *   RX queue count, or 0 on invalid @p pid.
 */
static __inline__ int
l2p_get_rxcnt(uint16_t pid)
{
    l2p_t *l2p = l2p_get();

    if (pid < RTE_MAX_ETHPORTS && l2p->ports[pid].pid < RTE_MAX_ETHPORTS)
        return l2p->ports[pid].num_rx_qids;
    return 0;
}

/**
 * Return the number of TX queues for a port.
 *
 * @param pid
 *   Port ID to query.
 * @return
 *   TX queue count, or 0 on invalid @p pid.
 */
static __inline__ int
l2p_get_txcnt(uint16_t pid)
{
    l2p_t *l2p = l2p_get();

    if (pid < RTE_MAX_ETHPORTS && l2p->ports[pid].pid < RTE_MAX_ETHPORTS)
        return l2p->ports[pid].num_tx_qids;
    return 0;
}

/**
 * Return the RX queue ID assigned to a given lcore.
 *
 * @param lid
 *   Lcore ID to query.
 * @return
 *   RX queue ID, or 0 on invalid @p lid.
 */
static __inline__ int
l2p_get_rxqid(uint16_t lid)
{
    l2p_t *l2p = l2p_get();

    if (lid < RTE_MAX_LCORE && l2p->lports[lid] != NULL && l2p->lports[lid]->port != NULL)
        return l2p->lports[lid]->rx_qid;
    return 0;
}

/**
 * Return the TX queue ID assigned to a given lcore.
 *
 * @param lid
 *   Lcore ID to query.
 * @return
 *   TX queue ID, or 0 on invalid @p lid.
 */
static __inline__ int
l2p_get_txqid(uint16_t lid)
{
    l2p_t *l2p = l2p_get();

    if (lid < RTE_MAX_LCORE && l2p->lports[lid] != NULL && l2p->lports[lid]->port != NULL)
        return l2p->lports[lid]->tx_qid;
    return 0;
}

/**
 * Return the RX and TX queue IDs for a port (via the first mapped lcore).
 *
 * @param pid
 *   Port ID to query.
 * @param rx_qid
 *   Output: RX queue ID (may be NULL).
 * @param tx_qid
 *   Output: TX queue ID (may be NULL).
 * @return
 *   0 on success, -1 on invalid @p pid.
 */
static __inline__ int
l2p_get_qids(uint16_t pid, uint16_t *rx_qid, uint16_t *tx_qid)
{
    l2p_t *l2p = l2p_get();

    if (pid < RTE_MAX_ETHPORTS && l2p->ports[pid].pid < RTE_MAX_ETHPORTS) {
        if (rx_qid)
            *rx_qid = l2p_get_rxqid(pid);
        if (tx_qid)
            *tx_qid = l2p_get_txqid(pid);
        return 0;
    }
    return -1;
}

/**
 * Return the PCAP info structure for a port.
 *
 * @param pid
 *   Port ID to look up.
 * @return
 *   Pointer to pcap_info_t, or NULL on invalid @p pid.
 */
static __inline__ pcap_info_t *
l2p_get_pcap(uint16_t pid)
{
    l2p_t *l2p = l2p_get();

    if (pid < RTE_MAX_ETHPORTS && l2p->ports[pid].pid < RTE_MAX_ETHPORTS)
        return l2p->ports[pid].pcap_info;
    L2P_NULL_RET("Invalid port ID %u", pid);
}

/**
 * Set the PCAP info pointer for a port.
 *
 * @param pid
 *   Port ID to update.
 * @param pcap_info
 *   PCAP info structure to associate with the port.
 * @return
 *   0 on success, -1 on invalid @p pid.
 */
static __inline__ int
l2p_set_pcap_info(uint16_t pid, pcap_info_t *pcap_info)
{
    l2p_t *l2p = l2p_get();

    if (pid >= RTE_MAX_ETHPORTS || l2p->ports[pid].pid >= RTE_MAX_ETHPORTS)
        L2P_ERR_RET("Invalid port ID %u", pid);
    l2p->ports[pid].pcap_info = pcap_info;
    return 0;
}

/**
 * Return the PCAP mempool for a port.
 *
 * @param pid
 *   Port ID to look up.
 * @return
 *   Pointer to the PCAP mempool, or NULL on error.
 */
static __inline__ struct rte_mempool *
l2p_get_pcap_mp(uint16_t pid)
{
    l2p_t *l2p = l2p_get();

    if (pid >= RTE_MAX_ETHPORTS || l2p->ports[pid].pid >= RTE_MAX_ETHPORTS ||
        l2p->ports[pid].pcap_info == NULL)
        L2P_NULL_RET("Invalid port ID %u", pid);

    return l2p->ports[pid].pcap_info->mp;
}

/**
 * Set the PCAP mempool for a port.
 *
 * @param pid
 *   Port ID to update.
 * @param mp
 *   Mempool to associate with the port's PCAP state.
 * @return
 *   0 on success, -1 on invalid @p pid.
 */
static __inline__ int
l2p_set_pcap_mp(uint16_t pid, struct rte_mempool *mp)
{
    l2p_t *l2p = l2p_get();

    if (pid >= RTE_MAX_ETHPORTS || l2p->ports[pid].pid >= RTE_MAX_ETHPORTS)
        L2P_ERR_RET("Invalid port ID %u", pid);

    l2p->ports[pid].pcap_info->mp = mp;
    return 0;
}

/**
 * Allocate and initialise the global l2p_t mapping table.
 */
void l2p_create(void);

/**
 * Parse all registered mapping strings and populate the l2p_t table.
 *
 * @return
 *   0 on success, negative on parse error.
 */
int l2p_parse_mappings(void);

/**
 * Register a mapping string for later parsing.
 *
 * @param str
 *   Mapping string in the form expected by the -m argument parser.
 * @return
 *   0 on success, negative on error.
 */
int l2p_parse_mapping_add(const char *str);

/**
 * Parse a hex portmask string into a bitmask of port indices.
 *
 * @param portmask
 *   Null-terminated hex string (e.g. "0x3" selects ports 0 and 1).
 * @return
 *   Bitmask of selected port IDs.
 */
uint32_t l2p_parse_portmask(const char *portmask);

#ifdef __cplusplus
}
#endif

#endif /* __L2P_H */


================================================
FILE: app/lpktgenlib.c
================================================
/*-
 * Copyright(c) <2011-2026>, Intel Corporation. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Created 2011 by Keith Wiles @ intel.com */

#define lpktgenlib_c
#define LUA_LIB
#define lua_c

#include <pg_ether.h>
#include <pg_inet.h>
#include "lpktgenlib.h"

#include <stdint.h>
#include <netinet/in.h>

#include <lua_config.h>
#include <lua_stdio.h>
#include <lua_utils.h>

#include "pktgen-cmds.h"
#include <cli.h>
#include <copyright_info.h>
#include <luaconf.h>
#include <lualib.h>

#include <rte_net.h>
#include <rte_ether.h>
#include <lua_config.h>
#include <lua_stdio.h>
#include <pg_delay.h>
#include <pg_strings.h>

#include <rte_bus_pci.h>
#include <rte_bus.h>

#include <cli_help.h>

#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wcast-qual"
#endif

extern pktgen_t pktgen;

void pktgen_quit(void);

static int
pktgen_exit(lua_State *L __rte_unused)
{
    pktgen_quit();
    return 0;
}

static inline double
cycles_to_us(uint64_t cycles)
{
    return (cycles == 0) ? 0.0 : ((1.0 / pktgen.hz) * (double)cycles) * Million;
}

static inline portlist_t
pktgen_get_portlist(lua_State *L, int index)
{
    portlist_t portlist;

    if (lua_isstring(L, index)) {
        if (portlist_parse(luaL_checkstring(L, index), pktgen.nb_ports, &portlist) < 0)
            portlist = INVALID_PORTLIST;
    } else if (lua_isnumber(L, index))
        portlist = (uint64_t)lua_tonumber(L, index);
    else if (lua_isinteger(L, index))
        portlist = (uint64_t)lua_tointeger(L, index);
    else {
        printf("%s: unknown Lua variable type not a string, number or int\n", __func__);
        portlist = INVALID_PORTLIST;
    }

    return portlist;
}

/**
 *
 * setf_integer - Helper routine to set Lua variables.
 *
 * DESCRIPTION
 * Helper routine to a set Lua variables.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static __inline__ void
setf_integer(lua_State *L, const char *name, lua_Integer value)
{
    lua_pushinteger(L, value);
    lua_setfield(L, -2, name);
}

/**
 *
 * setf_number - Helper routine to set Lua variables.
 *
 * DESCRIPTION
 * Helper routine to a set Lua variables.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static __inline__ void
setf_number(lua_State *L, const char *name, lua_Number value)
{
    lua_pushnumber(L, value);
    lua_setfield(L, -2, name);
}

/**
 *
 * setf_string - Helper routine to set Lua variables.
 *
 * DESCRIPTION
 * Helper routine to a set Lua variables.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static __inline__ void
setf_string(lua_State *L, const char *name, const char *value)
{
    lua_pushstring(L, value);
    lua_setfield(L, -2, name);
}

static __inline__ void
setf_eth_stats(lua_State *L, const struct rte_eth_stats *stats)
{
    setf_integer(L, "ipackets", stats->ipackets);
    setf_integer(L, "opackets", stats->opackets);
    setf_integer(L, "ibytes", stats->ibytes);
    setf_integer(L, "obytes", stats->obytes);
    setf_integer(L, "ierrors", stats->ierrors);
    setf_integer(L, "oerrors", stats->oerrors);
    setf_integer(L, "rx_nombuf", stats->rx_nombuf);
    setf_integer(L, "imissed", stats->imissed);
}

static __inline__ void
setf_qstats(lua_State *L, const qstats_t *qs)
{
    setf_integer(L, "ipackets", qs->q_ipackets);
    setf_integer(L, "opackets", qs->q_opackets);
    setf_integer(L, "errors", qs->q_errors);
}

static void
push_port_stats_t(lua_State *L, const port_stats_t *ps, uint16_t rxq_cnt)
{
    /* Assumes a Lua table is on the top of the stack. */
    lua_newtable(L); /* curr */
    setf_eth_stats(L, &ps->curr);
    lua_setfield(L, -2, "curr");

    lua_newtable(L); /* sizes */
    setf_integer(L, "_64", ps->sizes._64);
    setf_integer(L, "_65_127", ps->sizes._65_127);
    setf_integer(L, "_128_255", ps->sizes._128_255);
    setf_integer(L, "_256_511", ps->sizes._256_511);
    setf_integer(L, "_512_1023", ps->sizes._512_1023);
    setf_integer(L, "_1024_1522", ps->sizes._1024_1522);
    setf_integer(L, "broadcast", ps->sizes.broadcast);
    setf_integer(L, "multicast", ps->sizes.multicast);
    setf_integer(L, "jumbo", ps->sizes.jumbo);
    setf_integer(L, "runt", ps->sizes.runt);
    setf_integer(L, "unknown", ps->sizes.unknown);
    lua_setfield(L, -2, "sizes");

    lua_newtable(L); /* qstats */
    if (rxq_cnt > MAX_QUEUES_PER_PORT)
        rxq_cnt = MAX_QUEUES_PER_PORT;
    for (uint16_t qid = 0; qid < rxq_cnt; qid++) {
        lua_pushinteger(L, qid);
        lua_newtable(L);
        setf_qstats(L, &ps->qstats[qid]);
        lua_rawset(L, -3);
    }
    lua_setfield(L, -2, "qstats");
}

static __inline__ void
getf_etheraddr(lua_State *L, const char *field, struct rte_ether_addr *value)
{
    lua_getfield(L, 3, field);
    if (lua_isstring(L, -1))
        if (pg_ether_aton(luaL_checkstring(L, -1), value) == NULL)
            lua_putstring("failed to convert MAC string %s\n", luaL_checkstring(L, -1));
    lua_pop(L, 1);
}

static __inline__ void
getf_ipaddr(lua_State *L, const char *field, void *value, uint32_t flags)
{
    lua_getfield(L, 3, field);
    if (lua_isstring(L, -1)) {
        _atoip((char *)(uintptr_t)luaL_checkstring(L, -1), flags, value, sizeof(struct pg_ipaddr));
    }
    lua_pop(L, 1);
}

static __inline__ uint32_t
getf_integer(lua_State *L, const char *field)
{
    uint32_t value = 0;

    lua_getfield(L, 3, field);
    if (lua_isinteger(L, -1))
        value = luaL_checkinteger(L, -1);
    lua_pop(L, 1);

    return value;
}

static __inline__ char *
getf_string(lua_State *L, const char *field)
{
    char *value = NULL;

    lua_getfield(L, 3, field);
    if (lua_isstring(L, -1))
        value = (char *)luaL_checkstring(L, -1);
    lua_pop(L, 1);

    return value;
}

/**
 *
 * pktgen_set - Set a number of Pktgen values.
 *
 * DESCRIPTION
 * Set a number of Pktgen values for a given port list.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_set(lua_State *L)
{
    uint32_t value;
    portlist_t portlist;
    char *what;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "set, wrong number of arguments");
    case 3:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    what  = (char *)luaL_checkstring(L, 2);
    value = luaL_checknumber(L, 3);

    foreach_port(
        portlist,
        _do(if (!strcasecmp(what, "count")) single_set_tx_count(pinfo, value);
            else if (!strcasecmp(what, "size")) single_set_pkt_size(pinfo, value);
            else if (!strcasecmp(what, "rate")) single_set_tx_rate(pinfo, luaL_checkstring(L, 3));
            else if (!strcasecmp(what, "burst")) single_set_tx_burst(pinfo, value);
            else if (!strcasecmp(what, "txburst")) single_set_tx_burst(pinfo, value);
            else if (!strcasecmp(what, "rxburst")) single_set_rx_burst(pinfo, value);
            else if (!strcasecmp(what, "cycles")) debug_set_tx_cycles(pinfo, value);
            else if (!strcasecmp(what, "sport")) single_set_port_value(pinfo, what[0], value);
            else if (!strcasecmp(what, "dport")) single_set_port_value(pinfo, what[0], value);
            else if (!strcasecmp(what, "ttl")) single_set_ttl_value(pinfo, value);
            else if (!strcasecmp(what, "seq_cnt")) pktgen_set_port_seqCnt(pinfo, value);
            else if (!strcasecmp(what, "seqCnt")) pktgen_set_port_seqCnt(pinfo, value);
            else if (!strcasecmp(what, "prime")) pktgen_set_port_prime(pinfo, value);
            else if (!strcasecmp(what, "dump")) debug_set_port_dump(pinfo, value);
            else return luaL_error(L, "set does not support %s", what);));

    pktgen_update_display();
    return 0;
}

/**
 *
 * set_seq - Set the sequence data for a given port.
 *
 * DESCRIPTION
 * Set the sequence data for a given port and sequence number.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
set_seq(lua_State *L, uint32_t seqnum)
{
    portlist_t portlist;
    uint32_t pktsize, sport, dport, gtpu_teid;
    uint16_t vlanid;
    uint8_t cos, tos;
    struct rte_ether_addr daddr;
    struct rte_ether_addr saddr;
    struct pg_ipaddr ip_daddr;
    struct pg_ipaddr ip_saddr;
    char *proto, *ip;

    portlist = pktgen_get_portlist(L, 2);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    if (pg_ether_aton(luaL_checkstring(L, 3), &daddr) == NULL) {
        lua_putstring("invalid destination MAC string %s\n", luaL_checkstring(L, 3));
        return -1;
    }
    if (pg_ether_aton(luaL_checkstring(L, 4), &saddr) == NULL) {
        lua_putstring("invalid source MAC string %s\n", luaL_checkstring(L, 4));
        return -1;
    }

    sport = luaL_checkinteger(L, 7);
    dport = luaL_checkinteger(L, 8);

    /* Determine if we are IPv4 or IPv6 packets */
    ip = (char *)luaL_checkstring(L, 9);
    _atoip(luaL_checkstring(L, 5), 0, &ip_daddr, sizeof(struct pg_ipaddr));
    _atoip(luaL_checkstring(L, 6), PG_IPADDR_NETWORK, &ip_saddr, sizeof(struct pg_ipaddr));
    proto   = (char *)luaL_checkstring(L, 10);
    vlanid  = luaL_checkinteger(L, 11);
    pktsize = luaL_checkinteger(L, 12);
    if (lua_gettop(L) == 13)
        gtpu_teid = luaL_checkinteger(L, 13);
    else
        gtpu_teid = 0;

    cos = 0;
    tos = 0;
    if (lua_gettop(L) > 13) {
        cos = luaL_checkinteger(L, 14);
        tos = luaL_checkinteger(L, 15);
    }

    if ((proto[0] == 'i') && (ip[3] == '6')) {
        lua_putstring("Must use IPv4 with ICMP type packets\n");
        return -1;
    }

    foreach_port(portlist,
                 pktgen_set_seq(pinfo, seqnum, &daddr, &saddr, &ip_daddr, &ip_saddr, sport, dport,
                                ip[3], proto[0], vlanid, pktsize, gtpu_teid);
                 pktgen_set_cos_tos_seq(pinfo, seqnum, cos, tos));

    pktgen_update_display();

    return 0;
}

/**
 *
 * pktgen_seq - Set the sequence data for a given port.
 *
 * DESCRIPTION
 * Set the sequence data for a given port and sequence number.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_seq(lua_State *L)
{
    uint32_t seqnum;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "seq, wrong number of arguments");
    case 12:
    case 13:
        break;
    }
    seqnum = luaL_checkinteger(L, 1);
    if (seqnum >= NUM_SEQ_PKTS)
        return -1;

    return set_seq(L, seqnum);
}

/**
 *
 * set_seqTable - Set the sequence data for a given port.
 *
 * DESCRIPTION
 * Set the sequence data for a given port and sequence number.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
set_seqTable(lua_State *L, uint32_t seqnum)
{
    portlist_t portlist;
    uint32_t pktSize, sport, dport, gtpu_teid;
    uint16_t vlanid;
    uint8_t cos, tos;
    struct rte_ether_addr daddr;
    struct rte_ether_addr saddr;
    struct pg_ipaddr ip_daddr;
    struct pg_ipaddr ip_saddr;
    char *ipProto, *ethType, *tcp_flags;

    portlist = pktgen_get_portlist(L, 2);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    getf_etheraddr(L, "eth_dst_addr", &daddr);
    getf_etheraddr(L, "eth_src_addr", &saddr);
    getf_ipaddr(L, "ip_dst_addr", &ip_daddr, PG_IPADDR_V4);
    getf_ipaddr(L, "ip_src_addr", &ip_saddr, PG_IPADDR_NETWORK | PG_IPADDR_V4);

    sport     = getf_integer(L, "sport");
    dport     = getf_integer(L, "dport");
    ipProto   = getf_string(L, "ipProto");
    ethType   = getf_string(L, "ethType");
    vlanid    = getf_integer(L, "vlanid");
    pktSize   = getf_integer(L, "pktSize");
    cos       = getf_integer(L, "cos");
    tos       = getf_integer(L, "tos");
    tcp_flags = getf_string(L, "tcp_flags");

    gtpu_teid = getf_integer(L, "gtpu_teid");

    if ((ipProto[0] == 'i') && (ethType[3] == '6')) {
        lua_putstring("Must use IPv4 with ICMP type packets\n");
        return -1;
    }

    foreach_port(portlist,
                 pktgen_set_seq(pinfo, seqnum, &daddr, &saddr, &ip_daddr, &ip_saddr, sport, dport,
                                ethType[3], ipProto[0], vlanid, pktSize, gtpu_teid);
                 pktgen_set_cos_tos_seq(pinfo, seqnum, cos, tos);
                 seq_set_tcp_flags(pinfo, seqnum, tcp_flags));

    pktgen_update_display();

    return 0;
}

/**
 *
 * pktgen_seqTable - Set the sequence data for a given port.
 *
 * DESCRIPTION
 * Set the sequence data for a given port and sequence number.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_seqTable(lua_State *L)
{
    uint32_t seqnum;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "seqTable, wrong number of arguments");
    case 3:
        break;
    }
    seqnum = luaL_checkinteger(L, 1);
    if (seqnum >= NUM_SEQ_PKTS)
        return -1;

    return set_seqTable(L, seqnum);
}

/**
 *
 * pktgen_seq_tcp_flag - Set the TCP Flags for a given port and sequence number.
 *
 * DESCRIPTION
 * Set the sequence data for a given port and sequence number.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_seq_tcp_flags(lua_State *L)
{
    portlist_t portlist;
    uint32_t seqnum;
    const char *flag_str;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "seq_tcp_flags, wrong number of arguments");
    case 3:
        break;
    }
    seqnum = luaL_checkinteger(L, 1);
    if (seqnum >= NUM_SEQ_PKTS)
        return -1;

    portlist = pktgen_get_portlist(L, 2);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    flag_str = luaL_checkstring(L, 3);

    foreach_port(portlist, seq_set_tcp_flags(pinfo, seqnum, flag_str));

    return 0;
}

/**
 *
 * pktgen_ports_per_page - Set the number of ports per page.
 *
 * DESCRIPTION
 * Set the number of ports per page.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_ports_per_page(lua_State *L)
{
    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "ports_per_page, wrong number of arguments");
    case 1:
        break;
    }
    pktgen_set_page_size(luaL_checkinteger(L, 1));
    return 0;
}

/**
 *
 * pktgen_icmp - Enable or Disable ICMP echo processing.
 *
 * DESCRIPTION
 * Enable or disable ICMP echo process for a given port list.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_icmp(lua_State *L)
{
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "icmp, wrong number of arguments");
    case 2:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    foreach_port(portlist, enable_icmp_echo(pinfo, estate((char *)luaL_checkstring(L, 2))));
    return 0;
}

/**
 *
 * pktgen_sendARP - Send ARP type packets from a given port list.
 *
 * DESCRIPTION
 * Send APR request and gratuitous packets for a given port list.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_sendARP(lua_State *L)
{
    portlist_t portlist;
    char *what;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "sendARP, wrong number of arguments");
    case 2:
        break;
    }
    what     = (char *)luaL_checkstring(L, 2);
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    foreach_port(portlist, pktgen_send_arp_requests(pinfo, (what[0] == 'g') ? GRATUITOUS_ARP : 0));
    return 0;
}

/**
 *
 * pktgen_set_mac - Set the MAC address for a set of ports.
 *
 * DESCRIPTION
 * Set the MAC address for a set of ports.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_set_mac(lua_State *L)
{
    portlist_t portlist;
    struct rte_ether_addr mac;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "set_mac, wrong number of arguments");
    case 3:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    if (pg_ether_aton(luaL_checkstring(L, 3), &mac) == NULL) {
        lua_putstring("invalid MAC string (%s)\n ", luaL_checkstring(L, 3));
        return luaL_error(L, "invalid MAC string");
    }

    foreach_port(portlist, single_set_mac(pinfo, luaL_checkstring(L, 2), &mac));

    pktgen_update_display();
    return 0;
}

/**
 *
 * pktgen_macFromArp - Enable or Disable getting MAC address from ARP packets.
 *
 * DESCRIPTION
 * Enable or disable getting MAC address from an ARP request.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_macFromArp(lua_State *L)
{
    char *state;
    uint32_t onOff;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "mac_from_arp, wrong number of arguments");
    case 1:
        break;
    }
    state = (char *)luaL_checkstring(L, 1);

    onOff = estate(state);

    enable_mac_from_arp(onOff);

    return 0;
}

/**
 *
 * pktgen_prototype - Set the packet protocol type.
 *
 * DESCRIPTION
 * Set the packet protocol type.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_prototype(lua_State *L)
{
    char *type;
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "set_proto, wrong number of arguments");
    case 2:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    type = (char *)luaL_checkstring(L, 2);

    foreach_port(portlist, single_set_proto(pinfo, type));

    return 0;
}

/**
 *
 * pktgen_set_ip_addr - Set the ip address value for src and dst.
 *
 * DESCRIPTION
 * Set the IP address for src and dst.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_set_ip_addr(lua_State *L)
{
    portlist_t portlist;
    struct pg_ipaddr ipaddr;
    int flags;
    char *type;
    int ip_ver;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "set_ipaddr, wrong number of arguments");
    case 3:
        break;
    }
    type     = (char *)luaL_checkstring(L, 2);
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    if (type[0] == 's')
        flags = PG_IPADDR_NETWORK;
    ip_ver = _atoip(luaL_checkstring(L, 3), flags, &ipaddr, sizeof(struct pg_ipaddr));

    foreach_port(portlist, single_set_ipaddr(pinfo, type[0], &ipaddr, ip_ver));

    pktgen_update_display();
    return 0;
}

/**
 *
 * pktgen_set_type - Set the type of packet IPv4/v6
 *
 * DESCRIPTION
 * Set the port packet types to IPv4 or v6.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_set_type(lua_State *L)
{
    char *type;
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "set_type, wrong number of arguments");
    case 2:
        break;
    }
    type     = (char *)luaL_checkstring(L, 2);
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    foreach_port(portlist, single_set_pkt_type(pinfo, type));

    pktgen_update_display();
    return 0;
}

/**
 *
 * pktgen_set_tcp_flags - Set the TCP flags
 *
 * DESCRIPTION
 * Set the port packet types to IPv4 or v6.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_set_tcp_flags(lua_State *L)
{
    char *type;
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "set_type, wrong number of arguments");
    case 2:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    type = (char *)luaL_checkstring(L, 2);
    foreach_port(portlist, single_set_tcp_flags(pinfo, type));

    pktgen_update_display();
    return 0;
}

/**
 *
 * pktgen_send_ping4 - Send ping packets for IPv4
 *
 * DESCRIPTION
 * Send a ping packet for IPv4.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_send_ping4(lua_State *L)
{
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "ping4, wrong number of arguments");
    case 1:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    foreach_port(portlist, pktgen_ping4(pinfo));

    return 0;
}

#ifdef INCLUDE_PING6
/**
 *
 * pktgen_send_ping6 - Send IPv6 ICMP echo requests.
 *
 * DESCRIPTION
 * Send IPv6 ICMP echo requests.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_send_ping6(lua_State *L)
{
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "ping6, wrong number of arguments");
    case 1:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    foreach_port(portlist, pktgen_ping6(pinfo));

    return 0;
}

#endif

/**
 *
 * pktgen_pcap - Enable or disable PCAP support sending.
 *
 * DESCRIPTION
 * Enable or disable PCAP sending.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_pcap(lua_State *L)
{
    portlist_t portlist;
    char *what;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "pcap, wrong number of arguments");
    case 2:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");
    what = (char *)luaL_checkstring(L, 2);

    foreach_port(portlist, enable_pcap(pinfo, estate(what)));

    return 0;
}

/**
 *
 * pktgen_start - Start ports sending packets.
 *
 * DESCRIPTION
 * Start ports sending packets.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_start(lua_State *L)
{
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "start, wrong number of arguments");
    case 1:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    foreach_port(portlist, pktgen_start_transmitting(pinfo));

    return 0;
}

/**
 *
 * pktgen_stop - Stop ports from sending packets
 *
 * DESCRIPTION
 * Stop port from sending packets.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_stop(lua_State *L)
{
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "stop, wrong number of arguments");
    case 1:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    foreach_port(portlist, pktgen_stop_transmitting(pinfo));
    return 0;
}

/**
 *
 * pktgen_scrn - Enable or Disable the screen updates.
 *
 * DESCRIPTION
 * Enable or disable screen updates.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_scrn(lua_State *L)
{
    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "screen, wrong number of arguments");
    case 1:
        break;
    }
    pktgen_screen(estate((const char *)luaL_checkstring(L, 1)));
    return 0;
}

/**
 *
 * pktgen_prime - Send a set of packet to prime the forwarding tables.
 *
 * DESCRIPTION
 * Send a small set of packet to prime the forwarding table on a port.
 *
 * RETURNS: N/A
 *
 * SEE ALSO:
 */

static int
pktgen_prime(lua_State *L)
{
    portlist_t portlist;

    switch (lua_gettop(L)) {
    default:
        return luaL_error(L, "prime, wrong number of arguments");
    case 1:
        break;
    }
    portlist = pktgen_get_portlist(L, 1);
    if (portlist == INVALID_PORTLIST)
        return luaL_error(L, "invalid portlist");

    foreach_port(portlist, pktgen_prime_ports(pinfo));
    return 0;
}

static __inline__ void
__delay(int32_t t)
{
    int32_t n;

    while (t > 0) {
        n = (t > 10) ? 10 : t;
        rte_delay_us_s
Download .txt
gitextract_j5vqx0kd/

├── .clang-format
├── .claude/
│   └── settings.local.json
├── .editorconfig
├── .githooks/
│   └── pre-commit
├── .github/
│   └── workflows/
│       ├── clang-format.yml
│       ├── doc.yml
│       └── markdownlint.yml
├── .gitignore
├── .markdownlint.yml
├── .pre-commit-config.yaml
├── .readthedocs.yaml
├── 2-ports
├── 2-vf-ports
├── CLAUDE.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.TXT
├── CONTRIBUTING.md
├── INSTALL.md
├── LICENSE
├── Makefile
├── Pktgen.lua
├── README.md
├── VERSION
├── app/
│   ├── .gitignore
│   ├── cli-functions.c
│   ├── cli-functions.h
│   ├── l2p.c
│   ├── l2p.h
│   ├── lpktgenlib.c
│   ├── lpktgenlib.h
│   ├── meson.build
│   ├── pktgen-arp.c
│   ├── pktgen-arp.h
│   ├── pktgen-capture.c
│   ├── pktgen-capture.h
│   ├── pktgen-cmds.c
│   ├── pktgen-cmds.h
│   ├── pktgen-constants.h
│   ├── pktgen-cpu.c
│   ├── pktgen-cpu.h
│   ├── pktgen-display.c
│   ├── pktgen-display.h
│   ├── pktgen-dump.c
│   ├── pktgen-dump.h
│   ├── pktgen-ether.c
│   ├── pktgen-ether.h
│   ├── pktgen-gre.c
│   ├── pktgen-gre.h
│   ├── pktgen-gtpu.c
│   ├── pktgen-gtpu.h
│   ├── pktgen-ipv4.c
│   ├── pktgen-ipv4.h
│   ├── pktgen-ipv6.c
│   ├── pktgen-ipv6.h
│   ├── pktgen-latency.c
│   ├── pktgen-latency.h
│   ├── pktgen-log.c
│   ├── pktgen-log.h
│   ├── pktgen-main.c
│   ├── pktgen-main.h
│   ├── pktgen-pcap.c
│   ├── pktgen-pcap.h
│   ├── pktgen-port-cfg.c
│   ├── pktgen-port-cfg.h
│   ├── pktgen-random.c
│   ├── pktgen-random.h
│   ├── pktgen-range.c
│   ├── pktgen-range.h
│   ├── pktgen-seq.c
│   ├── pktgen-seq.h
│   ├── pktgen-stats.c
│   ├── pktgen-stats.h
│   ├── pktgen-sys.c
│   ├── pktgen-sys.h
│   ├── pktgen-tcp.c
│   ├── pktgen-tcp.h
│   ├── pktgen-txbuff.h
│   ├── pktgen-udp.c
│   ├── pktgen-udp.h
│   ├── pktgen-version.h
│   ├── pktgen-vlan.c
│   ├── pktgen-vlan.h
│   ├── pktgen.c
│   ├── pktgen.h
│   ├── xorshift64star.c
│   └── xorshift64star.h
├── cfg/
│   ├── 2-ports.cfg
│   ├── 2-vf-ports.cfg
│   ├── bond.cfg
│   ├── client_memif.cfg
│   ├── client_mif.cfg
│   ├── cnet-fwd-2.cfg
│   ├── cnet-fwd.cfg
│   ├── dapi-l3fwd.cfg
│   ├── default-100G.cfg
│   ├── default-gui.cfg
│   ├── default.cfg
│   ├── dfs.cfg
│   ├── dnet-echo.cfg
│   ├── four-ports.cfg
│   ├── half-bond.cfg
│   ├── hs-fwd.cfg
│   ├── ioat.cfg
│   ├── lat.cfg
│   ├── lb-fwd.cfg
│   ├── many-cores.cfg
│   ├── multi-port.cfg
│   ├── one-port.cfg
│   ├── pcap.cfg
│   ├── pdump.cfg
│   ├── pktgen-1.cfg
│   ├── pktgen-2.cfg
│   ├── server_memif.cfg
│   ├── server_mif.cfg
│   ├── socket.cfg
│   ├── two-ports-shared.cfg
│   ├── two-ports.cfg
│   ├── tx_perf.cfg
│   ├── vfio-fwd.cfg
│   ├── xdp-100.cfg
│   ├── xdp-40.cfg
│   └── xl710.cfg
├── docs/
│   ├── LUA_API.md
│   ├── QUICKSTART.md
│   ├── STYLE.md
│   ├── api/
│   │   ├── doxy-api-index.md
│   │   ├── doxy-api.conf.in
│   │   ├── doxy-html-custom.sh
│   │   ├── generate_doxygen.sh
│   │   ├── generate_examples.sh
│   │   └── meson.build
│   ├── meson.build
│   └── source/
│       ├── changes.rst
│       ├── cli_design.rst
│       ├── commands.rst
│       ├── conf.py
│       ├── contents.rst
│       ├── copyright.rst
│       ├── custom.css
│       ├── getting_started.rst
│       ├── index.rst
│       ├── license.rst
│       ├── lua.rst
│       ├── meson.build
│       ├── running.rst
│       ├── scripts.rst
│       ├── socket.rst
│       ├── usage_eal.rst
│       └── usage_pktgen.rst
├── examples/
│   ├── meson.build
│   └── pktperf/
│       ├── README.md
│       ├── meson.build
│       ├── parse.c
│       ├── pktperf.c
│       ├── pktperf.h
│       ├── port.c
│       ├── stats.c
│       └── utils.c
├── lib/
│   ├── cli/
│   │   ├── DESIGN.md
│   │   ├── README
│   │   ├── cli.c
│   │   ├── cli.h
│   │   ├── cli.rst
│   │   ├── cli_auto_complete.c
│   │   ├── cli_auto_complete.h
│   │   ├── cli_cmap.c
│   │   ├── cli_cmap.h
│   │   ├── cli_cmds.c
│   │   ├── cli_cmds.h
│   │   ├── cli_common.h
│   │   ├── cli_env.c
│   │   ├── cli_env.h
│   │   ├── cli_file.c
│   │   ├── cli_file.h
│   │   ├── cli_gapbuf.c
│   │   ├── cli_gapbuf.h
│   │   ├── cli_help.c
│   │   ├── cli_help.h
│   │   ├── cli_history.c
│   │   ├── cli_history.h
│   │   ├── cli_input.c
│   │   ├── cli_input.h
│   │   ├── cli_lib.rst
│   │   ├── cli_map.c
│   │   ├── cli_map.h
│   │   ├── cli_scrn.c
│   │   ├── cli_scrn.h
│   │   ├── cli_search.c
│   │   ├── cli_search.h
│   │   ├── cli_vt100.c
│   │   └── meson.build
│   ├── common/
│   │   ├── cksum.c
│   │   ├── cksum.h
│   │   ├── cmdline_parse_args.c
│   │   ├── cmdline_parse_args.h
│   │   ├── copyright_info.c
│   │   ├── copyright_info.h
│   │   ├── coreinfo.c
│   │   ├── coreinfo.h
│   │   ├── lscpu.c
│   │   ├── lscpu.h
│   │   ├── meson.build
│   │   ├── pg_compat.h
│   │   ├── pg_delay.h
│   │   ├── pg_ether.h
│   │   ├── pg_inet.c
│   │   ├── pg_inet.h
│   │   ├── pg_strings.c
│   │   ├── pg_strings.h
│   │   ├── port_config.c
│   │   ├── port_config.h
│   │   ├── utils.c
│   │   └── utils.h
│   ├── hmap/
│   │   ├── README.md
│   │   ├── hmap.c
│   │   ├── hmap.h
│   │   ├── hmap_helper.h
│   │   ├── hmap_log.h
│   │   └── meson.build
│   ├── lua/
│   │   ├── lua_config.c
│   │   ├── lua_config.h
│   │   ├── lua_dapi.c
│   │   ├── lua_dapi.h
│   │   ├── lua_dpdk.c
│   │   ├── lua_dpdk.h
│   │   ├── lua_pktmbuf.c
│   │   ├── lua_pktmbuf.h
│   │   ├── lua_socket.c
│   │   ├── lua_socket.h
│   │   ├── lua_stdio.c
│   │   ├── lua_stdio.h
│   │   ├── lua_utils.c
│   │   ├── lua_utils.h
│   │   ├── lua_vec.c
│   │   ├── lua_vec.h
│   │   └── meson.build
│   ├── meson.build
│   ├── plugin/
│   │   ├── meson.build
│   │   ├── plugin.c
│   │   └── plugin.h
│   ├── utils/
│   │   ├── _atoip.c
│   │   ├── _atoip.h
│   │   ├── heap.c
│   │   ├── heap.h
│   │   ├── inet_pton.c
│   │   ├── meson.build
│   │   ├── parson_json.c
│   │   ├── parson_json.h
│   │   ├── portlist.c
│   │   └── portlist.h
│   └── vec/
│       ├── meson.build
│       ├── vec.c
│       └── vec.h
├── meson.build
├── meson_options.txt
├── pcap/
│   ├── big.pcap
│   ├── gtpv1-u-1024.pcap
│   ├── large.pcap
│   ├── test1.pcap
│   └── traffic_sample.pcap
├── scripts/
│   ├── latency-samples.lua
│   ├── latency.lua
│   ├── port_stats_dump.lua
│   ├── rfc2544.lua
│   ├── rfc2544_tput_test.lua
│   └── traffic-profile.lua
├── style/
│   ├── call_GNU_Indent.pro
│   ├── call_GNU_Indent.sh
│   ├── call_Uncrustify.cfg
│   └── call_Uncrustify.sh
├── test/
│   ├── dump.lua
│   ├── generate-sequences.sh
│   ├── gtpu-range.lua
│   ├── hello-world.lua
│   ├── info.lua
│   ├── mac.pkt.3.4.ip-range-gen.txt
│   ├── mac.pkt.sequences.txt
│   ├── main.lua
│   ├── port_info.lua
│   ├── portstats.lua
│   ├── portstats_with_delay.lua
│   ├── range.lua
│   ├── screen_off.lua
│   ├── set_gtpu_seq.lua
│   ├── set_seq.lua
│   ├── simple_range.lua
│   ├── test.lua
│   ├── test1.lua
│   ├── test2.lua
│   ├── test3.lua
│   ├── test_range.lua
│   ├── test_save.lua
│   ├── test_seq.lua
│   ├── tx-rx-loopback.lua
│   └── vlan_udp_range.lua
├── themes/
│   ├── black-yellow.theme
│   └── white-black.theme
└── tools/
    ├── call-sphinx-build.py
    ├── dpdk-version.sh
    ├── format-clang.sh
    ├── meson.build
    ├── pktgen-build.sh
    ├── run.py
    ├── sudoGDB
    └── vfio-setup.sh
Download .txt
SYMBOL INDEX (1714 symbols across 124 files)

FILE: app/cli-functions.c
  function valid_gtpu_teid (line 50) | static inline uint16_t
  type cli_map (line 90) | struct cli_map
  function range_cmd (line 182) | static int
  function set_cmd (line 611) | static int
  type cli_map (line 818) | struct cli_map
  function pcap_cmd (line 836) | static int
  type cli_map (line 892) | struct cli_map
  function start_stop_cmd (line 919) | static int
  type cli_map (line 961) | struct cli_map
  function theme_cmd (line 979) | static int
  function en_dis_cmd (line 1074) | static int
  type cli_map (line 1182) | struct cli_map
  function rte_memcpy_perf (line 1218) | static void
  function dbg_cmd (line 1257) | static int
  function seq_1_set_cmd (line 1338) | static int
  function seq_2_set_cmd (line 1401) | static int
  function seq_3_set_cmd (line 1463) | static int
  function seq_4_set_cmd (line 1499) | static int
  function seq_5_set_cmd (line 1523) | static int
  type cli_map (line 1543) | struct cli_map
  function seq_cmd (line 1577) | static int
  function script_cmd (line 1624) | static int
  function exec_lua_cmd (line 1656) | static int
  type cli_map (line 1693) | struct cli_map
  function misc_cmd (line 1738) | static int
  type cli_map (line 1806) | struct cli_map
  function page_cmd (line 1835) | static int
  type cli_map (line 1856) | struct cli_map
  function plugin_cmd (line 1875) | static int
  type cli_map (line 1916) | struct cli_map
  function bonding_dump (line 1927) | static void
  function bonding_cmd (line 1948) | static int
  type cli_map (line 1975) | struct cli_map
  function latency_cmd (line 1991) | static int
  type cli_map (line 2022) | struct cli_map
  function hmap_cmd (line 2038) | static int
  type cli_tree (line 2072) | struct cli_tree
  function init_tree (line 2125) | static int
  function my_prompt (line 2162) | static int
  function pktgen_cli_create (line 2174) | int
  function help_cmd (line 2200) | static int

FILE: app/l2p.c
  function l2p_t (line 37) | l2p_t *
  function l2p_create (line 48) | void
  type rte_mempool (line 55) | struct rte_mempool
  type rte_mempool (line 58) | struct rte_mempool
  type rte_mempool (line 70) | struct rte_mempool
  function parse_cores (line 88) | static int
  function parse_mapping (line 199) | static int
  function l2p_parse_mappings (line 318) | int
  function l2p_parse_mapping_add (line 331) | int

FILE: app/l2p.h
  type port_info_s (line 50) | struct port_info_s
  type l2p_port_t (line 55) | typedef struct l2p_port_s {
  type l2p_lport_t (line 69) | typedef struct l2p_lport_s {
  type l2p_t (line 80) | typedef struct {
  function l2p_port_t (line 121) | static __inline__ l2p_port_t *
  function l2p_get_port_cnt (line 136) | static __inline__ uint16_t
  function l2p_get_lcore_by_pid (line 154) | static __inline__ uint16_t
  function l2p_get_pid_by_lcore (line 177) | static __inline__ uint16_t
  type rte_mempool (line 201) | struct rte_mempool
  type rte_mempool (line 225) | struct rte_mempool
  type rte_mempool (line 249) | struct rte_mempool
  function l2p_get_type (line 271) | static __inline__ int
  type port_info_s (line 290) | struct port_info_s
  function l2p_set_port_pinfo (line 308) | static __inline__ int
  type port_info_s (line 328) | struct port_info_s
  function l2p_set_pinfo_by_lcore (line 351) | static __inline__ int
  function l2p_get_qcnt (line 378) | static __inline__ int
  function l2p_get_rxcnt (line 401) | static __inline__ int
  function l2p_get_txcnt (line 419) | static __inline__ int
  function l2p_get_rxqid (line 437) | static __inline__ int
  function l2p_get_txqid (line 455) | static __inline__ int
  function l2p_get_qids (line 477) | static __inline__ int
  function pcap_info_t (line 500) | static __inline__ pcap_info_t *
  function l2p_set_pcap_info (line 520) | static __inline__ int
  type rte_mempool (line 539) | struct rte_mempool
  function l2p_set_pcap_mp (line 561) | static __inline__ int

FILE: app/lpktgenlib.c
  function pktgen_exit (line 50) | static int
  function cycles_to_us (line 57) | static inline double
  function portlist_t (line 63) | static inline portlist_t
  function setf_integer (line 95) | static __inline__ void
  function setf_number (line 114) | static __inline__ void
  function setf_string (line 133) | static __inline__ void
  function setf_eth_stats (line 140) | static __inline__ void
  function setf_qstats (line 153) | static __inline__ void
  function push_port_stats_t (line 161) | static void
  function getf_etheraddr (line 195) | static __inline__ void
  function getf_ipaddr (line 205) | static __inline__ void
  function getf_integer (line 215) | static __inline__ uint32_t
  function pktgen_set (line 253) | static int
  function set_seq (line 306) | static int
  function pktgen_seq (line 380) | static int
  function set_seqTable (line 411) | static int
  function pktgen_seqTable (line 473) | static int
  function pktgen_seq_tcp_flags (line 503) | static int
  function pktgen_ports_per_page (line 543) | static int
  function pktgen_icmp (line 568) | static int
  function pktgen_sendARP (line 598) | static int
  function pktgen_set_mac (line 630) | static int
  function pktgen_macFromArp (line 668) | static int
  function pktgen_prototype (line 701) | static int
  function pktgen_set_ip_addr (line 735) | static int
  function pktgen_set_type (line 776) | static int
  function pktgen_set_tcp_flags (line 811) | static int
  function pktgen_send_ping4 (line 846) | static int
  function pktgen_send_ping6 (line 879) | static int
  function pktgen_pcap (line 913) | static int
  function pktgen_start (line 947) | static int
  function pktgen_stop (line 979) | static int
  function pktgen_scrn (line 1010) | static int
  function pktgen_prime (line 1035) | static int
  function __delay (line 1054) | static __inline__ void
  function pktgen_delay (line 1078) | static int
  function pktgen_pause (line 1105) | static int
  function pktgen_continue (line 1139) | static int
  function pktgen_input (line 1177) | static int
  function pktgen_sleep (line 1220) | static int
  function pktgen_load (line 1245) | static int
  function pktgen_config_save (line 1275) | static int
  function pktgen_clear (line 1305) | static int
  function pktgen_clear_all (line 1338) | static int
  function pktgen_cls_screen (line 1359) | static int
  function pktgen_update_screen (line 1379) | static int
  function pktgen_reset_config (line 1399) | static int
  function pktgen_restart (line 1431) | static int
  function range_dst_mac (line 1463) | static int
  function range_src_mac (line 1501) | static int
  function range_set_type (line 1539) | static int
  function range_dst_ip (line 1574) | static int
  function range_src_ip (line 1611) | static int
  function range_dst_port (line 1648) | static int
  function range_ip_proto (line 1682) | static int
  function range_src_port (line 1717) | static int
  function range_ttl (line 1751) | static int
  function range_hop_limits (line 1785) | static int
  function range_gtpu_teid (line 1819) | static int
  function range_vlan_id (line 1853) | static int
  function range_cos (line 1888) | static int
  function range_tos (line 1923) | static int
  function range_traffic_class (line 1958) | static int
  function single_vlan_id (line 1994) | static int
  function single_cos (line 2031) | static int
  function single_tos (line 2068) | static int
  function single_vxlan_id (line 2103) | static int
  function single_vlan (line 2141) | static int
  function single_vxlan (line 2174) | static int
  function range_mpls_entry (line 2207) | static int
  function pktgen_mpls (line 2242) | static int
  function range_qinqids (line 2275) | static int
  function pktgen_qinq (line 2316) | static int
  function range_gre_key (line 2349) | static int
  function pktgen_gre (line 2384) | static int
  function pktgen_gre_eth (line 2417) | static int
  function pktgen_rnd_s_ip (line 2450) | static int
  function pktgen_rnd_s_pt (line 2483) | static int
  function range_pkt_size (line 2516) | static int
  function range (line 2553) | static int
  function pktgen_latency (line 2586) | static int
  function pktgen_jitter (line 2633) | static int
  function pktgen_pattern (line 2666) | static int
  function pktgen_user_pattern (line 2699) | static int
  function pktgen_page (line 2732) | static int
  function pktgen_port (line 2757) | static int
  function pktgen_process (line 2782) | static int
  function pktgen_capture (line 2815) | static int
  function pktgen_bonding (line 2849) | static int
  function pktgen_latsampler_params (line 2883) | static int
  function pktgen_latsampler (line 2919) | static int
  function pktgen_blink (line 2953) | static int
  function isSending (line 2991) | static void
  function pktgen_isSending (line 3013) | static int
  function link_state (line 3051) | static void
  function pktgen_linkState (line 3075) | static int
  function port_stats (line 3112) | static void
  function pktgen_portStats (line 3143) | static int
  function port_info (line 3182) | static void
  function pktgen_portInfo (line 3321) | static int
  function _pktgen_push_line (line 3348) | static void
  function pktgen_help (line 3374) | static int
  function pktgen_portCount (line 3396) | static int
  function pktgen_totalPorts (line 3416) | static int
  function pktgen_rnd (line 3436) | static int
  function add_rnd_pattern (line 3474) | static void
  function pktgen_rnd_list (line 3526) | static int
  function pktgen_run (line 3568) | static int
  function pktgen_clock_gettime (line 3601) | static int
  function pktgen_lua_help (line 3764) | static int
  function LUALIB_API (line 3914) | LUALIB_API int
  function pktgen_lua_openlib (line 3957) | void

FILE: app/pktgen-arp.c
  function arp_pkt_dump (line 20) | void
  function pktgen_send_arp (line 60) | void
  function pktgen_process_arp (line 129) | void

FILE: app/pktgen-arp.h
  type rte_mbuf (line 49) | struct rte_mbuf
  type rte_mbuf (line 57) | struct rte_mbuf

FILE: app/pktgen-capture.c
  function pktgen_packet_capture_init (line 43) | void
  function pktgen_set_capture (line 83) | void
  function pktgen_packet_capture_bulk (line 246) | void

FILE: app/pktgen-capture.h
  type cap_hdr_t (line 33) | typedef struct cap_hdr_s {
  type capture_t (line 41) | typedef struct capture_s {
  type rte_mbuf (line 73) | struct rte_mbuf

FILE: app/pktgen-cmds.c
  function pktgen_script_save (line 68) | static int
  function pktgen_lua_save (line 392) | static int
  function pktgen_save (line 764) | int
  function pktgen_port_transmitting (line 784) | int
  function pktgen_port_stats (line 854) | int
  function pktgen_update_display (line 924) | void
  function pktgen_clear_display (line 942) | void
  function pktgen_force_update (line 968) | void
  function pktgen_set_page_size (line 989) | void
  function pktgen_screen (line 1013) | void
  function pktgen_set_port_number (line 1048) | void
  function enable_icmp_echo (line 1069) | void
  function enable_mac_from_arp (line 1090) | void
  function enable_rnd_s_ip (line 1115) | void
  function enable_rnd_s_pt (line 1139) | void
  function enable_random (line 1160) | void
  function enable_clock_gettime (line 1170) | void
  function debug_tx_rate (line 1183) | void
  function __mempool_dump (line 1196) | static void
  function debug_mempool_dump (line 1216) | void
  function pktgen_start_transmitting (line 1261) | void
  function pktgen_stop_transmitting (line 1287) | void
  function pktgen_set_receive_state (line 1294) | static void
  function pktgen_start_stop_latency_sampler (line 1314) | void
  function pktgen_start_latency_sampler (line 1335) | void
  function pktgen_stop_latency_sampler (line 1389) | void
  function pktgen_prime_ports (line 1446) | void
  function single_set_proto (line 1466) | void
  function range_set_proto (line 1493) | void
  function enable_pcap (line 1519) | void
  function pcap_filter (line 1548) | void
  function debug_blink (line 1571) | void
  function enable_process (line 1594) | void
  function enable_capture (line 1615) | void
  function enable_bonding (line 1634) | void
  function show_states (line 1678) | static void
  function show_bonding_mode (line 1692) | void
  function range_set_pkt_type (line 1818) | void
  function single_set_pkt_type (line 1847) | void
  function enable_vxlan (line 1887) | void
  function enable_vlan (line 1910) | void
  function single_set_vlan_id (line 1932) | void
  function single_set_cos (line 1952) | void
  function single_set_tos (line 1972) | void
  function single_set_vxlan (line 1992) | void
  function single_set_latsampler_params (line 2016) | void
  function enable_mpls (line 2071) | void
  function range_set_mpls_entry (line 2094) | void
  function enable_qinq (line 2114) | void
  function single_set_qinqids (line 2138) | void
  function range_set_qinqids (line 2159) | void
  function enable_gre (line 2180) | void
  function enable_gre_eth (line 2203) | void
  function range_set_gre_key (line 2226) | void
  function pktgen_clear_stats (line 2246) | void
  function pktgen_port_defaults (line 2279) | void
  function pktgen_seq_defaults (line 2315) | void
  function pktgen_ping4 (line 2376) | void
  function pktgen_ping6 (line 2398) | void
  function pktgen_reset (line 2420) | void
  function pktgen_port_restart (line 2466) | void
  function single_set_tx_count (line 2506) | void
  function pktgen_set_port_seqCnt (line 2524) | void
  function pktgen_set_port_prime (line 2552) | void
  function debug_set_port_dump (line 2575) | void
  function single_set_tx_burst (line 2609) | void
  function single_set_rx_burst (line 2634) | void
  function debug_set_tx_cycles (line 2658) | void
  function single_set_pkt_size (line 2676) | void
  function single_set_port_value (line 2710) | void
  function single_set_tx_rate (line 2732) | void
  function single_set_ipaddr (line 2759) | void
  function tcp_flags_from_str (line 2791) | uint16_t
  function tcp_str_from_flags (line 2819) | int
  function single_set_tcp_flags (line 2867) | void
  function range_set_tcp_flags (line 2885) | void
  function seq_set_tcp_flags (line 2904) | void
  function single_set_tcp_seq (line 2922) | void
  function single_set_tcp_ack (line 2940) | void
  function range_set_tcp_seq (line 2958) | void
  function range_set_tcp_ack (line 2984) | void
  function single_set_mac (line 3010) | void
  function single_set_dst_mac (line 3034) | void
  function single_set_src_mac (line 3053) | void
  function single_set_ttl_value (line 3072) | void
  function enable_range (line 3091) | void
  function enable_latency (line 3121) | void
  function single_set_jitter (line 3144) | void
  function pattern_set_type (line 3168) | void
  function pattern_set_user_pattern (line 3193) | void
  function range_set_dest_mac (line 3222) | void
  function range_set_src_mac (line 3250) | void
  function range_set_src_ip (line 3278) | void
  function range_set_dst_ip (line 3314) | void
  function range_set_src_port (line 3350) | void
  function range_set_gtpu_teid (line 3379) | void
  function range_set_dst_port (line 3409) | void
  function range_set_ttl (line 3438) | void
  function range_set_hop_limits (line 3463) | void
  function range_set_vlan_id (line 3488) | void
  function range_set_tos_id (line 3520) | void
  function range_set_traffic_class (line 3548) | void
  function range_set_cos_id (line 3576) | void
  function range_set_pkt_size (line 3604) | void
  function pktgen_send_arp_requests (line 3643) | void
  function pktgen_set_page (line 3663) | void
  function pktgen_set_seq (line 3748) | void
  function pktgen_set_cos_tos_seq (line 3782) | void
  function pktgen_set_vxlan_seq (line 3793) | void
  function pktgen_quit (line 3816) | void
  function _pcap_file_close (line 3822) | static void
  function _pcap_file_open (line 3829) | static void
  function pktgen_pcap_handler (line 3837) | void

FILE: app/pktgen-cmds.h
  type pg_ipaddr (line 163) | struct pg_ipaddr
  type pg_ipaddr (line 175) | struct pg_ipaddr
  type rte_ether_addr (line 203) | struct rte_ether_addr
  type rte_ether_addr (line 206) | struct rte_ether_addr
  type rte_ether_addr (line 209) | struct rte_ether_addr
  type rte_ether_addr (line 370) | struct rte_ether_addr
  type rte_ether_addr (line 373) | struct rte_ether_addr
  type pg_ipaddr (line 376) | struct pg_ipaddr
  type pg_ipaddr (line 379) | struct pg_ipaddr
  type rte_ether_addr (line 456) | struct rte_ether_addr
  type rte_ether_addr (line 457) | struct rte_ether_addr
  type pg_ipaddr (line 457) | struct pg_ipaddr
  type pg_ipaddr (line 458) | struct pg_ipaddr

FILE: app/pktgen-cpu.c
  function save_uname (line 19) | static int
  function pktgen_page_cpu (line 37) | void
  function pktgen_cpu_init (line 94) | void

FILE: app/pktgen-cpu.h
  function sct (line 46) | static inline uint16_t

FILE: app/pktgen-display.c
  type string_color_map_t (line 21) | typedef struct string_color_map_s {
  type string_attr_map_t (line 47) | typedef struct string_attr_map_s {
  type theme_color_map_t (line 68) | typedef struct theme_color_map_s {
  function display_topline (line 146) | void
  function display_dashline (line 165) | void
  function pktgen_display_get_geometry (line 191) | void
  function theme_color_map_t (line 205) | static theme_color_map_t *
  function pktgen_display_set_color (line 226) | void
  function __set_prompt (line 244) | void
  function scrn_color_e (line 292) | static scrn_color_e
  function scrn_attr_e (line 303) | static scrn_attr_e
  function pktgen_theme_show (line 314) | void
  function pktgen_theme_state (line 337) | void
  function pktgen_set_theme_item (line 349) | void
  function pktgen_theme_save (line 377) | void
  function pktgen_print_div (line 400) | void

FILE: app/pktgen-dump.c
  function pktgen_packet_dump (line 27) | void
  function pktgen_packet_dump_bulk (line 62) | void
  function pktgen_print_packet_dump (line 98) | void

FILE: app/pktgen-dump.h
  type rte_mbuf (line 34) | struct rte_mbuf
  type rte_mbuf (line 46) | struct rte_mbuf

FILE: app/pktgen-ether.c
  type rte_ether_hdr (line 29) | struct rte_ether_hdr
  type rte_vlan_hdr (line 43) | struct rte_vlan_hdr
  type rte_vlan_hdr (line 43) | struct rte_vlan_hdr
  type rte_ether_hdr (line 49) | struct rte_ether_hdr
  type rte_vlan_hdr (line 49) | struct rte_vlan_hdr
  type rte_ether_hdr (line 66) | struct rte_ether_hdr
  type rte_ether_hdr (line 84) | struct rte_ether_hdr
  type rte_ether_hdr (line 90) | struct rte_ether_hdr
  type rte_ether_hdr (line 95) | struct rte_ether_hdr

FILE: app/pktgen-ether.h
  type port_info_s (line 25) | struct port_info_s
  type port_info_s (line 41) | struct port_info_s

FILE: app/pktgen-gre.c
  type rte_ipv4_hdr (line 35) | struct rte_ipv4_hdr
  type rte_ipv4_hdr (line 113) | struct rte_ipv4_hdr
  type rte_ether_hdr (line 166) | struct rte_ether_hdr
  type rte_ether_hdr (line 167) | struct rte_ether_hdr

FILE: app/pktgen-gtpu.c
  function pktgen_gtpu_hdr_ctor (line 28) | void

FILE: app/pktgen-ipv4.c
  function pktgen_ipv4_ctor (line 32) | void
  function pktgen_send_ping4 (line 73) | void
  function pktgen_process_ping4 (line 112) | void

FILE: app/pktgen-ipv4.h
  type rte_mbuf (line 58) | struct rte_mbuf

FILE: app/pktgen-ipv6.c
  function pktgen_ipv6_ctor (line 28) | void
  function pktgen_process_ping6 (line 61) | void

FILE: app/pktgen-ipv6.h
  type rte_mbuf (line 46) | struct rte_mbuf

FILE: app/pktgen-latency.c
  function latency_set_rate (line 21) | void
  function latency_set_entropy (line 35) | void
  function pktgen_print_static_data (line 55) | static void
  function cmp_uint64_asc (line 202) | static int
  function latency_ring_percentile (line 214) | static uint64_t
  function cycles_to_us (line 238) | static inline double
  function pktgen_page_latency (line 256) | void
  function pktgen_latency_setup (line 396) | void

FILE: app/pktgen-log.c
  type log_msg_t (line 29) | typedef struct log_msg_s {
  type log_t (line 39) | typedef struct log_s {
  function pktgen_init_log (line 58) | void
  function pktgen_log_set_screen_level (line 68) | void
  function pktgen_log (line 75) | void __attribute__((format(printf, 5, 6)))
  function pktgen_log_set_file (line 132) | void
  function pktgen_page_log (line 161) | void

FILE: app/pktgen-main.c
  function pktgen_usage (line 63) | static void
  function pktgen_parse_args (line 136) | static int
  function sig_handler (line 293) | static void
  function pktgen_lua_dofile (line 337) | static int
  function main (line 359) | int
  function pktgen_stop_running (line 555) | void

FILE: app/pktgen-pcap.c
  function pktgen_pcap_info (line 21) | void
  function pcap_convert (line 37) | static __inline__ void
  function pcap_rewind (line 48) | static void
  function pcap_get_info (line 58) | static void
  function mbuf_iterate_cb (line 114) | static __inline__ void
  function pktgen_pcap_add (line 140) | int
  function pktgen_pcap_open (line 166) | int
  function pktgen_pcap_close (line 217) | void
  function FILE (line 237) | FILE *
  function pktgen_close_pcap_file (line 264) | void
  function pktgen_write_mbuf_to_pcap_file (line 271) | int

FILE: app/pktgen-pcap.h
  type pcap_hdr_t (line 31) | typedef struct pcap_hdr_s {
  type pcap_record_hdr_t (line 42) | typedef struct pcap_record_hdr_s {
  type pcap_info_t (line 50) | typedef struct pcap_info_s {
  type rte_mbuf (line 119) | struct rte_mbuf

FILE: app/pktgen-port-cfg.c
  type rte_eth_conf (line 44) | struct rte_eth_conf
  function dump_device_info (line 71) | static void
  function is_cksum_phdr_required (line 120) | bool
  function eth_dev_get_overhead_len (line 135) | static uint32_t
  function port_info_t (line 148) | static port_info_t *
  function _latency_defaults (line 251) | static void
  function _fill_pattern_defaults (line 267) | static void
  function _mtu_defaults (line 276) | static void
  function _rx_offload_defaults (line 317) | static void
  function _tx_offload_defaults (line 335) | static void
  function _device_configuration (line 362) | static void
  function _rxtx_descriptors (line 377) | static void
  function _src_mac_address (line 391) | static void
  function _device_ptypes (line 405) | static void
  function _device_mtu (line 415) | static void
  function _rx_queues (line 437) | static void
  function _tx_queues (line 468) | static void
  function _promiscuous_mode (line 498) | static void
  function _debug_output (line 509) | static void
  function _device_start (line 519) | static void
  function _port_defaults (line 531) | static void
  function port_info_t (line 539) | static port_info_t *
  function pktgen_config_ports (line 588) | void

FILE: app/pktgen-port-cfg.h
  type fill_t (line 103) | typedef enum {
  type port_info_s (line 111) | struct port_info_s
  type latency_ring_t (line 116) | typedef struct {
  type latsamp_stats_t (line 123) | typedef struct {
  type latency_t (line 132) | typedef struct {
  type per_queue_t (line 156) | typedef struct per_queue_s {
  type port_info_t (line 162) | typedef struct port_info_s {
  type vxlan (line 229) | struct vxlan {
  type rte_mbuf (line 255) | struct rte_mbuf
  function pkt_atomic64_tx_count (line 267) | static inline uint64_t
  function rte_eth_rxconf_dump (line 293) | static inline void
  function rte_eth_txconf_dump (line 316) | static inline void
  function rte_eth_desc_lim_dump (line 341) | static inline void
  function rte_eth_dev_portconf_dump (line 364) | static inline void
  function rte_eth_switch_info_dump (line 383) | static inline void
  function rte_get_rx_capa_list (line 404) | static inline int
  function rte_get_tx_capa_list (line 464) | static inline int
  function rte_eth_dev_info_dump (line 525) | static inline void

FILE: app/pktgen-random.c
  function pktgen_rnd_bits_init (line 42) | void
  function pktgen_set_random_bitfield (line 75) | uint32_t
  function pktgen_rnd_bits_apply (line 176) | void
  function pktgen_page_random_bitfields (line 236) | void
  function pktgen_init_default_rnd (line 294) | static void
  function rnd_func_t (line 327) | rnd_func_t

FILE: app/pktgen-random.h
  type port_info_s (line 38) | struct port_info_s
  type bf_spec_t (line 43) | typedef struct bf_spec_s {
  type rnd_bits_t (line 54) | typedef struct rnd_bits_s {
  type rnd_bits_s (line 67) | struct rnd_bits_s
  type rnd_bits_s (line 84) | struct rnd_bits_s
  type port_info_s (line 99) | struct port_info_s
  type rte_mbuf (line 99) | struct rte_mbuf
  type rnd_bits_s (line 100) | struct rnd_bits_s
  type rnd_bits_s (line 112) | struct rnd_bits_s
  function pktgen_default_rnd_func (line 120) | static __inline__ uint32_t
  type BITFIELD_T (line 128) | typedef BITFIELD_T (*rnd_func_t)(void);

FILE: app/pktgen-range.c
  function pktgen_range_ctor (line 26) | void
  function pktgen_print_range (line 454) | static void
  function pktgen_page_range (line 693) | void
  function pktgen_range_setup (line 712) | void

FILE: app/pktgen-range.h
  type range_info_t (line 29) | typedef struct range_info_s {
  type port_info_s (line 183) | struct port_info_s
  type port_info_s (line 204) | struct port_info_s

FILE: app/pktgen-seq.c
  function pktgen_send_seq_pkt (line 13) | void
  function pktgen_page_seq (line 32) | void

FILE: app/pktgen-seq.h
  type __rte_cache_aligned (line 35) | typedef struct pkt_seq_s {
  type port_info_s (line 85) | struct port_info_s
  type port_info_s (line 93) | struct port_info_s

FILE: app/pktgen-stats.c
  function pktgen_print_static_data (line 34) | static void
  function pktgen_get_link_status (line 222) | void
  function pktgen_page_stats (line 269) | void
  function process_xstats (line 419) | static void
  function pktgen_process_stats (line 497) | void
  function pktgen_page_qstats (line 571) | void
  function _xstats_display (line 661) | static void
  function pktgen_page_xstats (line 710) | void

FILE: app/pktgen-stats.h
  type qstats_t (line 29) | typedef struct qstats_s {
  type size_stats_t (line 36) | typedef struct size_stats_s {
  type xstats_t (line 51) | typedef struct xstats_s {
  type port_stats_t (line 59) | typedef struct port_stats_s {
  type port_info_s (line 73) | struct port_info_s
  type port_info_s (line 76) | struct port_info_s

FILE: app/pktgen-sys.c
  function pktgen_page_system (line 28) | void

FILE: app/pktgen-tcp.c
  type rte_ipv4_hdr (line 34) | struct rte_ipv4_hdr
  type rte_ipv4_hdr (line 34) | struct rte_ipv4_hdr
  type rte_tcp_hdr (line 35) | struct rte_tcp_hdr
  type rte_tcp_hdr (line 35) | struct rte_tcp_hdr
  type rte_ipv4_hdr (line 41) | struct rte_ipv4_hdr
  type rte_tcp_hdr (line 51) | struct rte_tcp_hdr
  type rte_ipv6_hdr (line 63) | struct rte_ipv6_hdr
  type rte_ipv6_hdr (line 63) | struct rte_ipv6_hdr
  type rte_tcp_hdr (line 64) | struct rte_tcp_hdr
  type rte_tcp_hdr (line 64) | struct rte_tcp_hdr
  type rte_ipv6_addr (line 67) | struct rte_ipv6_addr
  type rte_ipv6_addr (line 68) | struct rte_ipv6_addr
  type rte_ipv6_addr (line 69) | struct rte_ipv6_addr
  type rte_ipv6_addr (line 70) | struct rte_ipv6_addr
  type rte_ipv6_hdr (line 72) | struct rte_ipv6_hdr
  type rte_tcp_hdr (line 81) | struct rte_tcp_hdr

FILE: app/pktgen-txbuff.h
  type rte_mbuf (line 32) | struct rte_mbuf
  type eth_tx_buffer (line 37) | struct eth_tx_buffer {
  function tx_buffer_flush (line 65) | static inline uint16_t
  function __rte_always_inline (line 109) | static __rte_always_inline uint16_t
  function __rte_always_inline (line 144) | static __rte_always_inline uint16_t
  function tx_buffer_init (line 169) | static __inline__ int

FILE: app/pktgen-udp.c
  type rte_ipv4_hdr (line 34) | struct rte_ipv4_hdr
  type rte_udp_hdr (line 35) | struct rte_udp_hdr
  type rte_udp_hdr (line 35) | struct rte_udp_hdr
  type rte_ipv4_hdr (line 41) | struct rte_ipv4_hdr
  type rte_ipv4_hdr (line 46) | struct rte_ipv4_hdr
  type vxlan (line 52) | struct vxlan
  type vxlan (line 52) | struct vxlan
  type rte_ipv6_hdr (line 68) | struct rte_ipv6_hdr
  type rte_udp_hdr (line 69) | struct rte_udp_hdr
  type rte_udp_hdr (line 69) | struct rte_udp_hdr
  type rte_ipv6_addr (line 72) | struct rte_ipv6_addr
  type rte_ipv6_addr (line 73) | struct rte_ipv6_addr
  type rte_ipv6_addr (line 74) | struct rte_ipv6_addr
  type rte_ipv6_addr (line 75) | struct rte_ipv6_addr
  type rte_ipv6_hdr (line 77) | struct rte_ipv6_hdr

FILE: app/pktgen-vlan.c
  function pktgen_process_vlan (line 29) | void

FILE: app/pktgen-vlan.h
  type rte_mbuf (line 35) | struct rte_mbuf

FILE: app/pktgen.c
  function next_poisson_time (line 42) | static inline double
  function pktgen_wire_size (line 59) | static uint64_t
  function pktgen_packet_rate (line 90) | void
  function pktgen_fill_pattern (line 132) | static inline void
  function pktgen_find_matching_ipsrc (line 170) | int
  function pktgen_find_matching_ipdst (line 206) | int
  function tstamp_t (line 231) | static inline tstamp_t *
  function pktgen_tstamp_inject (line 244) | static inline void
  function tx_send_packets (line 283) | void
  function latency_ring_insert (line 306) | static inline void
  function pktgen_tstamp_check (line 315) | static inline void
  function pktgen_tx_flush (line 391) | static inline void
  function pktgen_exit_cleanup (line 408) | static inline void
  function pktgen_packet_ctor (line 424) | void
  function pktType_e (line 657) | static inline pktType_e
  function pktgen_packet_classify (line 682) | static inline void
  function pktgen_packet_classify_bulk (line 722) | static inline void
  function pktgen_send_special (line 755) | static void
  type pkt_setup_s (line 792) | struct pkt_setup_s {
  function mempool_setup_cb (line 797) | static inline void
  function pktgen_setup_packets (line 880) | void
  function pktgen_send_pkts (line 927) | void
  function pktgen_main_transmit (line 959) | static inline void
  function pktgen_main_receive (line 990) | static inline void
  function pktgen_main_rxtx_loop (line 1038) | static void
  function pktgen_main_tx_loop (line 1103) | static void
  function pktgen_main_rx_loop (line 1161) | static void
  function pktgen_launch_one_lcore (line 1197) | int
  function _page_display (line 1223) | static void
  function pktgen_page_display (line 1273) | void
  function pktgen_timer_setup (line 1352) | void

FILE: app/pktgen.h
  type pktType_e (line 184) | typedef enum {
  type rte_mbuf_t (line 274) | typedef struct rte_mbuf rte_mbuf_t;
  type ethaddr_t (line 277) | typedef union {
  type pktgen_t (line 283) | typedef struct pktgen_s {
  function pktgen_get_time (line 443) | static inline uint64_t
  function pktgen_get_timer_hz (line 463) | static inline uint64_t
  type tstamp_t (line 474) | typedef struct {
  function pktgen_set_port_flags (line 488) | static __inline__ void
  function pktgen_clr_port_flags (line 504) | static __inline__ void
  function pktgen_tst_port_flags (line 523) | static __inline__ int
  function estate (line 539) | static __inline__ uint32_t
  function do_command (line 599) | static __inline__ int

FILE: app/xorshift64star.h
  function xorshift64star (line 40) | static inline uint64_t

FILE: docs/source/conf.py
  class CustomLatexFormatter (line 80) | class CustomLatexFormatter(LatexFormatter):
    method __init__ (line 81) | def __init__(self, **options):

FILE: examples/pktperf/parse.c
  type option (line 42) | struct option
  function usage (line 65) | void
  type rte_mempool (line 92) | struct rte_mempool
  type rte_mempool (line 96) | struct rte_mempool
  function parse_cores (line 111) | static int
  function parse_mapping (line 212) | static int
  function validate_args (line 273) | static void
  function parse_args (line 332) | static int
  function parse_configuration (line 447) | int

FILE: examples/pktperf/pktperf.c
  function mbuf_iterate_cb (line 29) | static __inline__ void
  function do_rx_process (line 51) | static __inline__ void
  function do_tx_process (line 73) | static __inline__ void
  function rx_loop (line 119) | static void
  function tx_loop (line 138) | static void
  function rxtx_loop (line 177) | static void
  function txpkts_launch_one_lcore (line 219) | static int
  function signal_handler (line 249) | static void
  function initialize_dpdk (line 258) | static int
  function launch_lcore_threads (line 283) | static int
  function txpkts_info_t (line 319) | static txpkts_info_t *
  function main (line 342) | int

FILE: examples/pktperf/pktperf.h
  type __rte_cache_aligned (line 130) | typedef struct qstats_s {
  type pq_t (line 143) | typedef struct pq_s { /* Port/Queue structure */
  type l2p_port_t (line 149) | typedef struct l2p_port_s {
  type l2p_lport_t (line 171) | typedef struct l2p_lport_s { /* Each lcore has one port/queue attached */
  type txpkts_info_t (line 179) | typedef struct {
  function pg_socket_id (line 217) | static __inline__ int
  function pg_eth_dev_socket_id (line 225) | static __inline__ int

FILE: examples/pktperf/port.c
  type rte_eth_conf (line 33) | struct rte_eth_conf
  function is_cksum_phdr_required (line 66) | bool
  function eth_dev_get_overhead_len (line 81) | static uint32_t
  function port_setup (line 94) | int

FILE: examples/pktperf/stats.c
  function print_stats (line 43) | void

FILE: examples/pktperf/utils.c
  function packet_rate (line 37) | void
  function get_rand (line 77) | static __inline__ long
  function packet_constructor (line 92) | void

FILE: lib/cli/cli.c
  type cli_node_chunk (line 31) | struct cli_node_chunk {
  type cli (line 37) | struct cli
  function cli_register_cmd_map (line 39) | int
  function cli_register_cmd_maps (line 99) | int
  type cli_map (line 156) | struct cli_map
  type cli (line 159) | struct cli
  function cli_nodes_unlimited (line 172) | int
  type cli_node (line 181) | struct cli_node
  type cli (line 184) | struct cli
  type cli_node (line 185) | struct cli_node
  type cli_node (line 187) | struct cli_node
  type cli_node_chunk (line 191) | struct cli_node_chunk
  type cli_node (line 192) | struct cli_node
  type cli_node (line 213) | struct cli_node
  function cli_free (line 222) | static inline void
  function cli_add_bin (line 229) | int
  function cli_del_bin (line 264) | int
  function cli_add_bin_path (line 288) | int
  function cli_remove_node (line 303) | int
  type cli_node (line 343) | struct cli_node
  type cli_node (line 344) | struct cli_node
  type cli_node (line 347) | struct cli_node
  type cli_node (line 415) | struct cli_node
  type cli_node (line 416) | struct cli_node
  type cli (line 418) | struct cli
  type cli_node (line 422) | struct cli_node
  type cli_node (line 487) | struct cli_node
  type cli_node (line 488) | struct cli_node
  type cli_node (line 497) | struct cli_node
  type cli_node (line 498) | struct cli_node
  type cli_node (line 500) | struct cli_node
  type cli_node (line 511) | struct cli_node
  type cli_node (line 512) | struct cli_node
  function cli_add_str (line 521) | int
  function cli_add_tree (line 528) | int
  function cli_execute (line 604) | int
  function cli_start (line 734) | void
  type cli_node (line 756) | struct cli_node
  type cli_node (line 759) | struct cli_node
  function __default_prompt (line 778) | static int
  function cli_init (line 798) | int
  function cli_create (line 900) | int
  function cli_create_with_defaults (line 906) | int
  function cli_destroy (line 915) | void
  function cli_setup (line 954) | int
  function cli_setup_with_defaults (line 972) | int
  function cli_setup_with_tree (line 979) | int
  function cli_prompt_t (line 986) | cli_prompt_t
  function cli_set_lua_callback (line 1004) | void
  function cli_execute_cmdfile (line 1014) | int
  function cli_execute_cmdfiles (line 1054) | int
  function cli_num_cmdfiles (line 1077) | int

FILE: lib/cli/cli.h
  type node_type_t (line 66) | typedef enum {
  type cli (line 84) | struct cli
  type cli_node (line 85) | struct cli_node
  type cli_node_chunk (line 86) | struct cli_node_chunk
  type cli_cmd_map_t (line 88) | typedef struct {
  type cli_node (line 95) | struct cli_node
  type cli_node (line 103) | struct cli_node {
  type cli_files_t (line 127) | typedef struct {
  type cli (line 132) | struct cli {
  type cli_map (line 190) | struct cli_map
  type cli_map (line 204) | struct cli_map
  type cli_map (line 214) | struct cli_map
  type cli (line 216) | struct cli
  function cli_set_flag (line 236) | static inline void
  function cli_clr_flag (line 248) | static inline void
  function cli_tst_flag (line 262) | static inline int
  type cli_funcs_t (line 268) | typedef union {
  type cli_dir (line 274) | struct cli_dir {
  type cli_cmd (line 279) | struct cli_cmd {
  type cli_alias (line 285) | struct cli_alias {
  type cli_file (line 291) | struct cli_file {
  type cli_str (line 297) | struct cli_str {
  type cli_tree (line 303) | struct cli_tree {
  function cli_set_user_state (line 343) | static inline void
  type cli_node (line 357) | struct cli_node
  type cli_node (line 372) | struct cli_node
  function set_cwd (line 389) | static inline void
  function is_cli_valid (line 402) | static inline int
  function is_match (line 418) | static inline int
  function is_node (line 442) | static inline int
  function is_command (line 456) | static inline int
  function is_alias (line 470) | static inline int
  function is_file (line 484) | static inline int
  function is_directory (line 498) | static inline int
  function is_executable (line 512) | static inline int
  function cli_usage (line 526) | static inline int
  type cli_node (line 546) | struct cli_node
  type cli_node (line 579) | struct cli_node
  function cli_pwd (line 622) | static inline void
  function cli_set_history_size (line 638) | static inline int
  function cli_get_history_size (line 652) | static inline uint32_t
  function cli_history_list (line 666) | static inline void
  type cli_node (line 678) | struct cli_node
  type cli_node (line 765) | struct cli_node
  type cli_node (line 819) | struct cli_node
  type cli_node (line 831) | struct cli_node
  type cli_node (line 857) | struct cli_node
  type cli_node (line 857) | struct cli_node
  type cli_node (line 875) | struct cli_node
  type cli_node (line 875) | struct cli_node
  type cli_node (line 894) | struct cli_node
  type cli_node (line 894) | struct cli_node
  type cli_node (line 913) | struct cli_node
  type cli_node (line 913) | struct cli_node
  type cli_node (line 946) | struct cli_node
  type cli_tree (line 946) | struct cli_tree
  function cli_add_cmdfile (line 956) | static inline int
  type cli_node (line 1007) | struct cli_node
  function cli_quit (line 1023) | static inline void

FILE: lib/cli/cli_auto_complete.c
  function _gb_peek_prev (line 29) | static inline char
  function _ac_hash_line (line 50) | static uint32_t
  function _str_list_add_unique (line 71) | static int
  function _str_list_free (line 95) | static void
  function _print_strings (line 105) | static void
  function _is_placeholder (line 138) | static int
  function _is_choice_token (line 144) | static int
  function _choice_token_contains (line 150) | static int
  function _tok_all_digits (line 169) | static int
  function _tok_all_hex_with_seps (line 185) | static int
  function _tok_looks_like_ipv4 (line 198) | static int
  function _tok_looks_like_ipv6 (line 215) | static int
  function _map_tok_compatible_with_user_tok (line 232) | static int
  function _is_hint_candidate (line 337) | static int
  function _env_collect_var_candidates (line 349) | static int
  function _portlist_collect_candidates (line 389) | static int
  function _map_collect_placeholder_candidates (line 409) | static int
  function _map_collect_candidates (line 441) | static int
  function _map_next_is_user_value (line 526) | static int
  function _map_current_is_user_value (line 572) | static int
  function _map_has_tokens_after (line 618) | static int
  function _column_count (line 658) | static uint32_t
  function _print_nodes (line 677) | static int
  function qsort_compare (line 721) | static int
  function complete_args (line 732) | static int
  function cli_auto_complete (line 842) | void

FILE: lib/cli/cli_cmap.c
  function as_int (line 49) | static unsigned
  function lcore_t (line 55) | static lcore_t *
  function lcore_t (line 66) | static lcore_t *
  function lcore_t (line 74) | static lcore_t *
  function lcore_t (line 81) | static lcore_t *
  function get_next_thread_id (line 89) | static unsigned
  function lcore_t (line 99) | static lcore_t *
  function lcore_t (line 107) | static lcore_t *
  function do_line_fn (line 114) | static do_line_fn
  function remap (line 140) | static void
  function lcore_t (line 155) | static lcore_t *
  function zero_base (line 172) | static void
  function get_and_free_lcore_info (line 184) | static void
  function count_cores (line 194) | static inline int
  function my_getline (line 206) | static int
  type cmap (line 236) | struct cmap
  type cmap (line 241) | struct cmap
  type cmap (line 248) | struct cmap
  function cmap_free (line 282) | void

FILE: lib/cli/cli_cmap.h
  type lc_info_t (line 23) | typedef union {
  type lcore_t (line 34) | typedef struct lcore {
  type cmap (line 40) | struct cmap {
  type lcore_t (line 49) | typedef lcore_t *(*do_line_fn)(const char *line, lcore_t *);
  type action_t (line 53) | typedef struct action {
  type cmap (line 64) | struct cmap
  type cmap (line 80) | struct cmap
  function cmap_socket_id (line 90) | static inline unsigned int
  function cmap_set_socket_id (line 106) | static inline void
  function cmap_core_id (line 120) | static inline unsigned int
  function cmap_set_core_id (line 136) | static inline void
  function cmap_thread_id (line 150) | static inline unsigned int
  function cmap_cnt (line 169) | static inline unsigned int

FILE: lib/cli/cli_cmds.c
  function __print_help (line 26) | static int
  function chelp_cmd (line 50) | static int
  function cd_cmd (line 105) | static int
  function pwd_cmd (line 126) | static int
  function __list_long_dir (line 144) | static int
  function __list_dir (line 168) | static int
  function ls_cmd (line 204) | static int
  function scrn_cmd (line 252) | static int
  function quit_cmd (line 259) | static int
  function hist_cmd (line 266) | static int
  function more_cmd (line 276) | static int
  function sct (line 342) | static __inline__ uint8_t
  function core_cmd (line 355) | static int
  function huge_cmd (line 390) | static int
  function sizes_cmd (line 399) | static int
  function path_cmd (line 424) | static int
  function copyright_file (line 480) | static int
  function version_file (line 495) | static int
  function sleep_cmd (line 511) | static int
  function delay_cmd (line 527) | static int
  function mkdir_cmd (line 542) | static int
  function rm_cmd (line 555) | static int
  type cli_map (line 579) | struct cli_map
  function env_cmd (line 591) | static int
  function script_cmd (line 619) | static int
  function echo_cmd (line 631) | static int
  function version_cmd (line 640) | static int
  type cli_tree (line 648) | struct cli_tree
  function cli_default_tree_init (line 684) | int

FILE: lib/cli/cli_common.h
  function cli_printf (line 48) | static inline int __attribute__((format(printf, 1, 2)))

FILE: lib/cli/cli_env.c
  function env_free (line 15) | static int
  type cli_env (line 31) | struct cli_env
  type cli_env (line 34) | struct cli_env
  type cli_env (line 36) | struct cli_env
  type cli_env (line 36) | struct cli_env
  type cli_env (line 39) | struct cli_env
  function cli_env_destroy (line 46) | void
  type env_node (line 61) | struct env_node
  type cli_env (line 62) | struct cli_env
  type env_node (line 64) | struct env_node
  type env_node (line 73) | struct env_node
  type cli_env (line 74) | struct cli_env
  type env_node (line 76) | struct env_node
  type env_node (line 96) | struct env_node
  type env_node (line 96) | struct env_node
  function cli_env_set (line 115) | int
  function cli_env_string (line 121) | int
  type cli_env (line 134) | struct cli_env
  type env_node (line 136) | struct env_node
  function cli_env_del (line 145) | int
  function cli_env_substitution (line 152) | void
  function cli_env_get_all (line 213) | int
  function cli_env_show (line 231) | void

FILE: lib/cli/cli_env.h
  type cli (line 22) | struct cli
  type env_node (line 27) | struct env_node {
  type cli_env (line 34) | struct cli_env {
  type cli_env (line 45) | struct cli_env
  type cli_env (line 53) | struct cli_env
  type cli_env (line 69) | struct cli_env
  type cli_env (line 87) | struct cli_env
  type cli_env (line 99) | struct cli_env
  type cli_env (line 111) | struct cli_env
  type cli_env (line 127) | struct cli_env
  function cli_env_count (line 137) | static inline int
  type cli_env (line 153) | struct cli_env
  type env_node (line 153) | struct env_node
  type cli_env (line 161) | struct cli_env

FILE: lib/cli/cli_file.c
  type cli_node (line 9) | struct cli_node
  type cli_node (line 12) | struct cli_node
  function cli_file_close (line 42) | int
  function cli_file_read (line 52) | int
  function cli_file_write (line 62) | int
  function cli_file_seek (line 74) | int
  function cli_readline (line 91) | int
  function cli_file_handler (line 111) | int
  type cli_node (line 219) | struct cli_node
  type cli_node (line 222) | struct cli_node
  function cli_system (line 259) | int

FILE: lib/cli/cli_file.h
  function is_file_set (line 54) | static inline int
  function is_file_rd (line 61) | static inline int
  function is_file_wr (line 68) | static inline int
  function is_file_append (line 75) | static inline int
  function is_file_open (line 82) | static inline int
  function is_file_close (line 89) | static inline int
  function is_file_create (line 96) | static inline int
  function is_data_rdonly (line 103) | static inline int
  function is_file_eq (line 110) | static inline int
  function is_seek_set (line 117) | static inline int
  function is_seek_cur (line 124) | static inline int
  function is_seek_end (line 131) | static inline int
  type cli_node (line 147) | struct cli_node
  type cli_node (line 157) | struct cli_node
  type cli_node (line 171) | struct cli_node
  type cli_node (line 185) | struct cli_node
  type cli_node (line 199) | struct cli_node
  type cli_node (line 216) | struct cli_node
  type cli_node (line 228) | struct cli_node
  type cli_node (line 244) | struct cli_node

FILE: lib/cli/cli_gapbuf.c
  function gb_copy_to_buf (line 11) | uint32_t
  function gb_reset_buf (line 53) | int
  function gb_init_buf (line 72) | int
  type gapbuf (line 89) | struct gapbuf
  type gapbuf (line 92) | struct gapbuf
  type gapbuf (line 94) | struct gapbuf
  type gapbuf (line 98) | struct gapbuf
  function gb_destroy (line 106) | void
  function gb_dump (line 116) | void

FILE: lib/cli/cli_gapbuf.h
  type gapbuf (line 26) | struct gapbuf {
  type gapbuf (line 40) | struct gapbuf
  type gapbuf (line 50) | struct gapbuf
  type gapbuf (line 62) | struct gapbuf
  type gapbuf (line 72) | struct gapbuf
  type gapbuf (line 86) | struct gapbuf
  type gapbuf (line 98) | struct gapbuf
  function gb_buf_size (line 110) | static inline uint32_t
  function gb_gap_size (line 124) | static inline uint32_t
  function gb_data_size (line 138) | static inline uint32_t
  type gapbuf (line 153) | struct gapbuf
  type gapbuf (line 167) | struct gapbuf
  type gapbuf (line 181) | struct gapbuf
  type gapbuf (line 195) | struct gapbuf
  type gapbuf (line 209) | struct gapbuf
  function gb_point_at_start (line 222) | static inline int
  function gb_point_at_end (line 236) | static inline int
  function gb_point_at_gap (line 250) | static inline int
  function gb_set_point (line 266) | static inline void
  function gb_point_offset (line 286) | static inline int
  function gb_eof (line 303) | static inline int
  function gb_move_gap_to_point (line 319) | static inline void
  function gb_expand_buf (line 361) | static inline void
  function gb_expand_gap (line 402) | static inline void
  function gb_get (line 425) | static inline char
  function gb_get_prev (line 442) | static inline char
  function gb_get_next (line 466) | static inline char
  function gb_put (line 488) | static inline void
  function gb_getc (line 510) | static inline char
  function gb_getc_prev (line 531) | static inline char
  function gb_putc (line 550) | static inline void
  function gb_insert (line 573) | static inline void
  function gb_del (line 595) | static inline void
  function gb_str_insert (line 616) | static inline uint32_t
  function gb_left_data_size (line 649) | static inline uint32_t
  function gb_right_data_size (line 663) | static inline uint32_t
  function gb_move_right (line 679) | static inline void
  function gb_move_left (line 695) | static inline void

FILE: lib/cli/cli_help.c
  function cli_help_add (line 10) | int
  function _show_help_lines (line 39) | static int
  function _cli_help_title (line 60) | static void
  function cli_help_show_all (line 70) | int
  function cli_help_foreach (line 86) | void
  type help_node (line 96) | struct help_node
  type help_node (line 99) | struct help_node
  function cli_help_show_group (line 109) | int
  function cli_cmd_error (line 121) | int

FILE: lib/cli/cli_help.h
  type help_node (line 33) | struct help_node {
  type help_node (line 50) | struct help_node
  type cli_map (line 87) | struct cli_map
  function is_help (line 99) | static inline int

FILE: lib/cli/cli_history.c
  type cli_hist (line 7) | struct cli_hist
  type cli (line 10) | struct cli
  type cli_hist (line 11) | struct cli_hist
  type cli_hist (line 17) | struct cli_hist
  function cli_hist_free (line 23) | void
  function cli_history_add (line 38) | void
  function cli_history_del (line 66) | void
  type cli (line 84) | struct cli
  type cli_hist (line 85) | struct cli_hist
  type cli (line 103) | struct cli
  type cli_hist (line 109) | struct cli_hist
  type cli (line 130) | struct cli
  type cli_hist (line 136) | struct cli_hist
  function cli_history_clear (line 152) | void
  function cli_history_delete (line 168) | void
  function cli_set_history (line 183) | int
  function cli_history_reset (line 222) | void
  function cli_history_dump (line 228) | void

FILE: lib/cli/cli_history.h
  type cli_hist (line 26) | struct cli_hist {
  type cli (line 31) | struct cli
  type cli_hist (line 41) | struct cli_hist
  type cli_hist (line 53) | struct cli_hist

FILE: lib/cli/cli_input.c
  function cli_yield_io (line 26) | int
  function cli_write (line 35) | int
  function cli_read (line 41) | int
  function handle_input_display (line 47) | static void
  function cli_input (line 66) | void
  function cli_poll (line 86) | int
  function cli_pause (line 111) | char

FILE: lib/cli/cli_input.h
  function cli_get_cursor (line 66) | static inline void
  function cli_cursor_left (line 109) | static inline void
  function cli_cursor_right (line 123) | static inline void
  function cli_save_cursor (line 137) | static inline void
  function cli_restore_cursor (line 151) | static inline void
  function cli_display_left (line 165) | static inline void
  function cli_display_right (line 180) | static inline void
  function cli_clear_screen (line 195) | static inline void
  function cli_clear_to_eol (line 209) | static inline void
  function cli_clear_line (line 225) | static inline void
  function cli_move_cursor_up (line 246) | static inline void
  function cli_display_prompt (line 264) | static inline void
  function cli_display_line (line 281) | static inline void
  function cli_redisplay_line (line 341) | static inline void

FILE: lib/cli/cli_map.c
  function cli_map_list_search (line 19) | int
  function is_map_valid (line 44) | static int
  type cli_map (line 142) | struct cli_map
  type cli_map (line 143) | struct cli_map
  function decode_map (line 185) | static void
  function cli_map_show (line 268) | void
  function cli_maps_show (line 289) | void
  function cli_map_dump (line 313) | void

FILE: lib/cli/cli_map.h
  type cli_map (line 25) | struct cli_map {
  type cli_map (line 56) | struct cli_map
  type cli_map (line 56) | struct cli_map
  type cli_map (line 66) | struct cli_map
  type cli_map (line 76) | struct cli_map
  type cli_map (line 90) | struct cli_map

FILE: lib/cli/cli_scrn.c
  type cli_scrn (line 23) | struct cli_scrn
  function scrn_printf (line 26) | void __attribute__((format(printf, 3, 4)))
  function scrn_cprintf (line 45) | void __attribute__((format(printf, 3, 4)))
  function scrn_fprintf (line 62) | void __attribute__((format(printf, 4, 5)))
  function scrn_set_io (line 75) | static void
  function scrn_stdin_setup (line 92) | static int
  function scrn_stdin_restore (line 113) | static void
  function handle_winch (line 125) | static void
  function scrn_create (line 143) | int
  function scrn_create_with_defaults (line 192) | int
  function scrn_destroy (line 200) | void
  function RTE_INIT (line 211) | RTE_INIT(scrn_constructor)

FILE: lib/cli/cli_scrn.h
  type vt100_parse_state (line 113) | enum vt100_parse_state {
  type cli_vt100 (line 122) | struct cli_vt100 {
  type vt100_cmds (line 128) | struct vt100_cmds {
  type cli_scrn (line 141) | struct cli_scrn {
  type scrn_rgb_t (line 155) | typedef uint8_t scrn_rgb_t;
  type cli_scrn (line 157) | struct cli_scrn
  type scrn_color_e (line 167) | typedef enum {
  type scrn_attr_e (line 184) | typedef enum {
  type cli_rgb_t (line 214) | typedef uint8_t cli_rgb_t;
  function scrn_write (line 216) | static inline int
  function scrn_read (line 228) | static inline int
  function scrn_puts (line 242) | static inline void __attribute__((format(printf, 1, 2)))
  function scrn_clr_line (line 364) | static __inline__ void
  function scrn_eol_pos (line 372) | static __inline__ void
  function scrn_pause (line 382) | static __inline__ void
  function scrn_resume (line 392) | static __inline__ void
  function scrn_is_paused (line 400) | static __inline__ int
  function scrn_center_col (line 407) | static __inline__ int
  function scrn_erase (line 418) | static __inline__ void
  function scrn_repeat (line 426) | static __inline__ void
  function scrn_col_repeat (line 438) | static __inline__ void
  function scrn_fgcolor (line 450) | static __inline__ void
  function scrn_bgcolor (line 457) | static __inline__ void
  function scrn_fgbgcolor (line 465) | static __inline__ void
  function scrn_color (line 473) | static __inline__ void
  function scrn_rgb (line 487) | static __inline__ void
  function scrn_fgcolor_str (line 494) | static __inline__ int
  function scrn_bgcolor_str (line 501) | static __inline__ int
  function scrn_fgbgcolor_str (line 508) | static __inline__ int
  function scrn_color_str (line 518) | static __inline__ int
  function scrn_rgb_str (line 532) | static __inline__ int
  type cli_vt100 (line 572) | struct cli_vt100
  type cli_vt100 (line 580) | struct cli_vt100
  type cli_vt100 (line 594) | struct cli_vt100
  type vt100_cmds (line 610) | struct vt100_cmds

FILE: lib/cli/cli_search.c
  function __count_nodes (line 10) | static int
  function cli_dir_item_count (line 19) | uint32_t
  function cli_path_item_count (line 34) | uint32_t
  function cli_path_cmd_count (line 46) | uint32_t
  function node_list_with_type (line 52) | static uint32_t
  function dir_list_with_type (line 88) | static uint32_t
  function cli_node_list_with_type (line 110) | uint32_t
  function cli_node_list_free (line 119) | void
  function cli_scan_directory (line 125) | int
  function cli_scan_path (line 147) | int
  type cli_node (line 158) | struct cli_node
  type cli_node (line 159) | struct cli_node
  type cli_node (line 161) | struct cli_node
  function cli_find_node (line 185) | int
  type cli_node (line 234) | struct cli_node
  type cli_node (line 237) | struct cli_node
  type cli_node (line 280) | struct cli_node
  type cli_node (line 283) | struct cli_node

FILE: lib/cli/cli_search.h
  type arg_u (line 29) | typedef union {
  type args_t (line 38) | typedef struct {
  type cli (line 45) | struct cli
  type cli_node (line 46) | struct cli_node
  type cli_node (line 49) | struct cli_node
  type cli_node (line 67) | struct cli_node
  type cli_node (line 81) | struct cli_node
  type cli_node (line 93) | struct cli_node
  type cli_node (line 105) | struct cli_node
  type cli_node (line 131) | struct cli_node
  type cli_node (line 167) | struct cli_node
  type cli_node (line 183) | struct cli_node
  type cli_node (line 183) | struct cli_node

FILE: lib/cli/cli_vt100.c
  function key_up_arr (line 10) | static inline void
  function key_down_arr (line 24) | static inline void
  function key_right_arr (line 38) | static inline void
  function key_left_arr (line 49) | static inline void
  function key_backspace (line 60) | static inline void
  function key_return (line 76) | static inline void
  function key_ctrl_a (line 92) | static inline void
  function key_ctrl_e (line 99) | static inline void
  function key_ctrl_k (line 106) | static inline void
  function key_ctrl_y (line 119) | static inline void
  function key_ctrl_c (line 132) | static inline void
  function key_ctrl_f (line 141) | static inline void
  function key_ctrl_b (line 147) | static inline void
  function key_suppr (line 155) | static inline void
  function key_tab (line 171) | static inline void
  function key_ctrl_d (line 177) | static inline void
  function key_ctrl_l (line 183) | static inline void
  function key_return2 (line 191) | static inline void
  function key_meta_backspace (line 197) | static inline void
  function key_word_left (line 203) | static inline void
  function key_word_right (line 213) | static inline void
  function key_ctrl_w (line 223) | static inline void
  function key_ctrl_p (line 229) | static inline void
  function key_ctrl_n (line 235) | static inline void
  function key_meta_d (line 241) | static inline void
  function key_ctrl_x (line 246) | static inline void
  function key_invalid (line 252) | static inline void
  type vt100_cmds (line 258) | struct vt100_cmds
  function vt100_do_cmd (line 288) | void
  type vt100_cmds (line 295) | struct vt100_cmds
  function vt100_find_cmd (line 301) | static int
  function vt100_parse_input (line 317) | int
  type cli_vt100 (line 366) | struct cli_vt100
  type cli_vt100 (line 369) | struct cli_vt100
  type cli_vt100 (line 371) | struct cli_vt100
  function vt100_free (line 380) | void

FILE: lib/common/cksum.c
  function cksum (line 95) | uint16_t
  function cksumUpdate (line 121) | uint32_t
  function cksumDone (line 173) | uint16_t
  function pseudoChecksum (line 203) | uint32_t
  function pseudoIPv6Checksum (line 231) | uint32_t

FILE: lib/common/cmdline_parse_args.c
  type cmdline_token_ops (line 24) | struct cmdline_token_ops
  function cmdline_args_free (line 33) | void
  function cmdline_parse_args (line 46) | int
  function cmdline_get_help_args (line 92) | int

FILE: lib/common/cmdline_parse_args.h
  type cmdline_args_t (line 18) | typedef struct cmdline_args {
  type cmdline_token_args (line 24) | struct cmdline_token_args {
  type cmdline_parse_token_args_t (line 29) | typedef struct cmdline_token_args cmdline_parse_token_args_t;
  type cmdline_token_ops (line 31) | struct cmdline_token_ops

FILE: lib/common/copyright_info.c
  function print_copyright (line 42) | void

FILE: lib/common/coreinfo.c
  type lcore_t (line 34) | typedef struct {
  type coreinfo_data_t (line 40) | typedef struct {
  function set_lcore_id (line 71) | static void
  function set_socket_id (line 77) | static void
  function set_max_socket_id (line 83) | static void
  function set_core_id (line 93) | static void
  function set_model_name (line 99) | static void
  function set_siblings (line 106) | static void
  function set_cpu_cores (line 115) | static void
  function lcore_terminator (line 124) | static void
  function ignore_line (line 163) | static void
  function do_line_fn (line 168) | static do_line_fn
  function coreinfo_t (line 196) | coreinfo_t *
  function coreinfo_create (line 215) | static int
  function coreinfo_cnt (line 270) | static uint16_t
  function coreinfo_lcore_cnt (line 299) | uint16_t
  function coreinfo_core_cnt (line 305) | uint16_t
  function coreinfo_socket_cnt (line 311) | uint16_t
  function coreinfo_thread_cnt (line 317) | uint16_t
  function coreinfo_siblings_cnt (line 323) | uint16_t
  function coreinfo_cpu_cores_cnt (line 329) | uint16_t
  function RTE_INIT (line 335) | RTE_INIT(coreinfo_init)

FILE: lib/common/coreinfo.h
  type ci_type_t (line 21) | typedef enum {
  type coreinfo_t (line 31) | typedef struct coreinfo_s {

FILE: lib/common/lscpu.c
  function num_cpus (line 20) | static __inline__ void
  function threads_per_core (line 26) | static __inline__ void
  function cores_per_socket (line 32) | static __inline__ void
  function numa_nodes (line 38) | static __inline__ void
  function cpu_mhz (line 44) | static __inline__ void
  function numa_nodeX_cpus (line 53) | static void
  function cache_size (line 78) | static __inline__ void
  function model_name (line 87) | static __inline__ void
  function cpu_flags (line 96) | static __inline__ void
  function action_t (line 105) | static action_t *
  function action_t (line 127) | static action_t *
  function lscpu_info_get (line 143) | static void
  function cpu_proc_info (line 172) | static void
  function lscpu_t (line 201) | lscpu_t *

FILE: lib/common/lscpu.h
  type action_t (line 16) | typedef struct action_s {
  type lscpu_t (line 27) | typedef struct {

FILE: lib/common/pg_compat.h
  function pg_socket_id (line 32) | static __inline__ int
  function pg_eth_dev_socket_id (line 40) | static __inline__ int

FILE: lib/common/pg_inet.h
  type pg_ipaddr (line 43) | struct pg_ipaddr {
  type gtpuHdr_t (line 122) | typedef struct gtpuHdr_s {
  type ipOverlay_t (line 133) | typedef struct ipOverlay_s {
  type ipv6Overlay_t (line 142) | typedef struct ipv6Overlay_s {
  type seq_t (line 151) | typedef unsigned int seq_t;
  type udpip_t (line 154) | typedef struct udpip_s {
  type gtpuUdpIp_t (line 160) | typedef struct gtpuUdpIp_s {
  type udpipv6_t (line 167) | typedef struct udpipv6_s {
  type tcp_flags_t (line 172) | typedef struct tcp_flags_s {
  type tcpip_t (line 206) | typedef struct tcpip_s {
  type gtpuTcpIp_t (line 212) | typedef struct gtpuTcpIp_s {
  type tcpipv6_t (line 219) | typedef struct tcpipv6_s {
  type mplsHdr_t (line 327) | typedef struct mplsHdr_s {
  type qinqHdr_t (line 348) | typedef struct qinqHdr_s {
  type greHdr_t (line 387) | typedef struct greHdr_s {
  type greIp_t (line 401) | typedef struct greIp_s {
  type greEther_t (line 407) | typedef struct greEther_s {
  type mac_e (line 431) | typedef union {
  type ip4_e (line 436) | typedef union {
  type pkt_hdr_t (line 441) | typedef struct pkt_hdr_s {
  type ipv4_5tuple_t (line 456) | typedef struct ipv4_5tuple {
  type l3_4route_t (line 464) | typedef struct l3_4route_s {
  type ipv6_5tuple_t (line 469) | typedef struct ipv6_5tuple_s {
  type l3_6route_t (line 477) | typedef struct l3_6route_s {
  function rte_hash6_crc (line 495) | static inline uint32_t
  function ethAddrCopy (line 509) | static __inline__ void
  function uint16Swap (line 521) | static __inline__ void
  function ethAddrSwap (line 534) | static __inline__ void
  function inetAddrCopy (line 546) | static __inline__ void
  function inetAddrSwap (line 556) | static __inline__ void
  function inet6AddrIsUnspecified (line 569) | static __inline__ int
  function inet6AddrAdd (line 577) | static __inline__ void
  function mask_size (line 595) | static __inline__ int
  function size_to_mask (line 619) | static __inline__ uint32_t
  type rte_ether_addr (line 698) | struct rte_ether_addr
  function inet_mtoh64 (line 708) | static __inline__ uint64_t
  type rte_ether_addr (line 718) | struct rte_ether_addr
  type rte_ether_addr (line 719) | struct rte_ether_addr

FILE: lib/common/pg_strings.c
  function pg_strtok (line 30) | int
  function pg_strqtok (line 47) | int
  function pg_stropt (line 133) | int
  function pg_parse_corelist (line 164) | int

FILE: lib/common/pg_strings.h
  function pg_strmatch (line 121) | static inline int
  function pg_strcnt (line 147) | static inline int
  type rte_ether_addr (line 165) | struct rte_ether_addr
  type rte_ether_addr (line 166) | struct rte_ether_addr
  type rte_ether_addr (line 171) | struct rte_ether_addr
  type rte_ether_addr (line 216) | struct rte_ether_addr
  function mask_size (line 228) | static __inline__ int

FILE: lib/common/port_config.c
  function get_portdesc (line 44) | uint32_t
  function free_portdesc (line 112) | void
  function create_blocklist (line 136) | uint32_t

FILE: lib/common/port_config.h
  type rte_pci_addr (line 18) | struct rte_pci_addr

FILE: lib/common/utils.c
  function pg_strparse (line 74) | uint32_t
  function skip_lst (line 97) | static uint32_t

FILE: lib/hmap/hmap.c
  function hmap_set_funcs (line 36) | int
  function hmap_funcs_t (line 64) | hmap_funcs_t *
  function hmap_t (line 71) | hmap_t *
  function hmap_destroy (line 136) | int
  function hmap_destroy_by_name (line 169) | int
  function hmap_kvp_update (line 182) | int
  function __add_value (line 206) | static inline int
  function _hmap_update_capacity (line 244) | static int
  function hmap_add (line 289) | int
  function hmap_update (line 310) | int
  function hmap_kvp_t (line 337) | hmap_kvp_t *
  function hmap_lookup (line 360) | int
  function hmap_del (line 385) | int
  function hmap_iterate (line 398) | int
  function kvp_cmp (line 420) | static int
  function _print_kvp (line 443) | static void
  function hmap_list (line 568) | void
  function hmap_list_names (line 613) | void
  function hmap_list_by_name (line 626) | void
  function hmap_list_all (line 640) | void
  function hmap_get_global_alloc_stats (line 661) | void
  function hmap_reset_global_alloc_stats (line 681) | void

FILE: lib/hmap/hmap.h
  type hmap (line 50) | struct hmap
  type hmap_type_t (line 54) | typedef enum {
  type hmap_val_t (line 87) | typedef union {
  type hmap_kvp_t (line 96) | typedef struct hmap_kvp { /**< Key/value pair (implementation-defined si...
  type hmap_funcs_t (line 108) | typedef struct hmap_funcs {
  type hmap_t (line 117) | typedef struct hmap {
  function hmap_get_alloc_count (line 153) | static inline uint64_t
  function _hmap_add_string (line 283) | static inline int
  function _hmap_update_string (line 299) | static inline int
  function _hmap_update_u64 (line 308) | static inline int
  function _hmap_update_u32 (line 317) | static inline int
  function _hmap_update_u16 (line 326) | static inline int
  function _hmap_update_u8 (line 335) | static inline int
  function _hmap_update_i64 (line 344) | static inline int
  function _hmap_update_i32 (line 353) | static inline int
  function _hmap_update_i16 (line 362) | static inline int
  function _hmap_update_i8 (line 371) | static inline int
  function _hmap_update_double (line 380) | static inline int
  function _hmap_update_pointer (line 389) | static inline int
  function _hmap_update_string_array (line 398) | static inline int
  function _hmap_update_u64_array (line 414) | static inline int
  function _hmap_update_u32_array (line 430) | static inline int
  function _hmap_update_u16_array (line 446) | static inline int
  function _hmap_update_u8_array (line 462) | static inline int
  function _hmap_update_i64_array (line 478) | static inline int
  function _hmap_update_i32_array (line 494) | static inline int
  function _hmap_update_i16_array (line 510) | static inline int
  function _hmap_update_i8_array (line 526) | static inline int
  function _hmap_update_double_array (line 542) | static inline int
  function _hmap_update_pointer_array (line 558) | static inline int
  function _hmap_add_u64 (line 574) | static inline int
  function _hmap_add_u32 (line 583) | static inline int
  function _hmap_add_u16 (line 592) | static inline int
  function _hmap_add_u8 (line 601) | static inline int
  function _hmap_add_i64 (line 610) | static inline int
  function _hmap_add_i32 (line 619) | static inline int
  function _hmap_add_i16 (line 628) | static inline int
  function _hmap_add_i8 (line 637) | static inline int
  function _hmap_add_double (line 646) | static inline int
  function _hmap_add_pointer (line 655) | static inline int
  function _hmap_add_string_array (line 664) | static inline int
  function _hmap_add_u64_array (line 680) | static inline int
  function _hmap_add_u32_array (line 696) | static inline int
  function _hmap_add_u16_array (line 712) | static inline int
  function _hmap_add_u8_array (line 746) | static inline int
  function _hmap_add_i64_array (line 761) | static inline int
  function _hmap_add_i32_array (line 776) | static inline int
  function _hmap_add_i16_array (line 791) | static inline int
  function _hmap_add_i8_array (line 806) | static inline int
  function _hmap_add_double_array (line 821) | static inline int
  function _hmap_add_pointer_array (line 837) | static inline int
  function hmap_capacity (line 908) | static inline uint32_t
  function hmap_count (line 922) | static inline uint32_t
  function hmap_kvp_t (line 964) | static inline hmap_kvp_t *
  function _hmap_get_u64 (line 995) | static inline int
  function _hmap_get_u32 (line 1023) | static inline int
  function _hmap_get_u16 (line 1051) | static inline int
  function _hmap_get_u8 (line 1082) | static inline int
  function _hmap_get_i64 (line 1110) | static inline int
  function _hmap_get_i32 (line 1138) | static inline int
  function _hmap_get_i16 (line 1166) | static inline int
  function _hmap_get_i8 (line 1194) | static inline int
  function _hmap_get_double (line 1209) | static inline int
  function _hmap_get_string (line 1237) | static inline int
  function _hmap_get_pointer (line 1265) | static inline int
  function _hmap_get_string_array (line 1293) | static inline int
  function _hmap_get_u64_array (line 1308) | static inline int
  function _hmap_get_u32_array (line 1323) | static inline int
  function _hmap_get_u16_array (line 1338) | static inline int
  function _hmap_get_u8_array (line 1368) | static inline int
  function _hmap_get_i64_array (line 1383) | static inline int
  function _hmap_get_i32_array (line 1398) | static inline int
  function _hmap_get_i16_array (line 1413) | static inline int
  function _hmap_get_i8_array (line 1428) | static inline int
  function _hmap_get_double_array (line 1443) | static inline int
  function _hmap_get_pointer_array (line 1458) | static inline int

FILE: lib/hmap/hmap_helper.h
  function hmap_mutex_create (line 39) | static inline int
  function hmap_mutex_destroy (line 86) | static inline int
  function hmap_list_lock (line 103) | static inline void
  function hmap_list_unlock (line 117) | static inline void
  function hmap_lock (line 132) | static inline void
  function hmap_unlock (line 147) | static inline void
  function _hmap_hash (line 169) | static uint32_t
  function _hmap_cmp (line 214) | static inline int
  function _hmap_free (line 235) | static void
  function hmap_get_hash (line 270) | static inline uint32_t
  function hmap_compare (line 290) | static inline int
  function hmap_free_kvp (line 304) | static inline void

FILE: lib/lua/lua_config.c
  type rte_tailq_elem (line 40) | struct rte_tailq_elem
  type newlib_info (line 48) | struct newlib_info {
  function lua_set_progname (line 61) | void
  function lua_newlib_add (line 67) | int
  function cmp_libs (line 79) | static int
  function lua_newlibs_init (line 88) | void
  function handle_luainit (line 102) | static int
  function luaData_t (line 125) | luaData_t *
  function lua_destroy_instance (line 187) | void
  function luaData_t (line 214) | luaData_t *
  function msghandler (line 244) | static int
  function _k (line 262) | static int
  function lua_docall (line 271) | int
  function lua_dofile (line 287) | int
  function lua_dostring (line 302) | int
  function lua_dolibrary (line 315) | int
  function lua_execute_string (line 330) | int
  function lua_execute_close (line 350) | void
  function lua_execute_close (line 357) | void

FILE: lib/lua/lua_config.h
  type luaData_t (line 75) | typedef struct luaData {

FILE: lib/lua/lua_dapi.c
  function _create (line 33) | static int
  function _destroy (line 59) | static int
  function _get (line 73) | static int
  function _put (line 81) | static int
  function _tostring (line 89) | static int
  function _gc (line 112) | static int
  type luaL_Reg (line 118) | struct luaL_Reg
  type luaL_Reg (line 120) | struct luaL_Reg
  function luaopen_dapi (line 123) | int

FILE: lib/lua/lua_dapi.h
  type dapi_t (line 32) | typedef struct dapi dapi_t;

FILE: lib/lua/lua_dpdk.c
  function __delay (line 40) | static __inline__ void
  function dpdk_delay (line 52) | static int
  function dpdk_pause (line 62) | static int
  function dpdk_continue (line 80) | static int
  function dpdk_input (line 102) | static int
  function dpdk_sleep (line 129) | static int
  function link_state (line 138) | static void
  function dpdk_linkState (line 161) | static int
  function port_stats (line 182) | static void
  function dpdk_portStats (line 204) | static int
  function dpdk_compile (line 224) | static int
  function decompile_pkt (line 232) | static void
  function dpdk_decompile (line 268) | static int
  function dpdk_tx_burst (line 288) | static int
  function dpdk_portCount (line 310) | static int
  function dpdk_totalPorts (line 320) | static int
  function dpdk_rx_burst (line 330) | static int
  function dpdk_version (line 351) | static int
  function luaopen_dpdk (line 385) | static int
  function luaopen_dapi (line 408) | __attribute__((__weak__)) int
  function dpdk_lua_openlib (line 414) | static void
  function RTE_INIT (line 434) | RTE_INIT(dpdk_lua_init)

FILE: lib/lua/lua_dpdk.h
  type pkt_data (line 84) | struct pkt_data {
  type pktmbuf_t (line 104) | typedef struct rte_mempool pktmbuf_t;
  type mempool_t (line 105) | typedef struct rte_mempool mempool_t;
  type vec_t (line 106) | typedef struct vec vec_t;
  function setf_integer (line 115) | static __inline__ void
  function setf_function (line 129) | static __inline__ void
  function setf_string (line 143) | static __inline__ void
  function setf_stringLen (line 158) | static __inline__ void
  function setf_udata (line 172) | static __inline__ void
  function getf_integer (line 186) | static __inline__ uint32_t

FILE: lib/lua/lua_pktmbuf.c
  function _new (line 31) | static int
  function _destroy (line 67) | static int
  function _get (line 81) | static int
  function _put (line 97) | static int
  function _tostring (line 111) | static int
  function _gc (line 135) | static int
  type luaL_Reg (line 141) | struct luaL_Reg
  type luaL_Reg (line 143) | struct luaL_Reg
  function luaopen_pktmbuf (line 145) | int

FILE: lib/lua/lua_pktmbuf.h
  type pktmbuf_t (line 30) | typedef struct rte_mempool pktmbuf_t;

FILE: lib/lua/lua_socket.c
  function server_startup (line 28) | static int
  function _socket_open (line 76) | static void
  function _socket_close (line 86) | static void
  function incomplete (line 105) | static int
  function pushline (line 123) | static int
  function addreturn (line 148) | static int
  function multiline (line 166) | static int
  function loadline (line 191) | static int
  function l_print (line 214) | static void
  function doREPL (line 232) | static void
  function handle_server_requests (line 254) | static void
  function lua_start_socket (line 304) | int

FILE: lib/lua/lua_stdio.c
  type luaL_Stream (line 28) | typedef luaL_Stream LStream;
  function lua_signal_set_stdfiles (line 57) | void
  function lua_signal_reset_stdfiles (line 64) | void
  function lua_set_stdfiles (line 71) | void
  function lua_reset_stdfiles (line 89) | void
  function io_noclose (line 108) | static int
  function LStream (line 118) | static LStream *
  function lua_create_stdfile (line 127) | void

FILE: lib/lua/lua_utils.h
  function lua_putstring (line 53) | static inline void
  function l_message (line 84) | static inline void
  function report (line 102) | static inline int

FILE: lib/lua/lua_vec.c
  function vec_new (line 30) | static int
  function lvec_add1 (line 53) | static int
  function vec_tostring (line 70) | static int
  function vec_gc (line 89) | static int
  type luaL_Reg (line 110) | struct luaL_Reg
  type luaL_Reg (line 112) | struct luaL_Reg
  function luaopen_vec (line 114) | int

FILE: lib/plugin/plugin.c
  type plugin (line 33) | struct plugin
  type plugin (line 38) | struct plugin
  function plugin_add_inst (line 46) | static int
  function plugin_del_inst (line 66) | static int
  function plugin_find_inst (line 96) | static int
  function plugin_open (line 125) | static int
  function plugin_get_symbol (line 151) | int
  function plugin_create (line 177) | int
  function plugin_destroy (line 257) | int
  function plugin_start (line 265) | int
  function plugin_stop (line 284) | int
  function plugin_find_by_name (line 303) | int
  function plugin_find_by_id (line 322) | int
  function _plugin_dump (line 342) | static void
  function plugin_dump (line 357) | void
  function RTE_INIT (line 378) | RTE_INIT(libplugin_init_log)

FILE: lib/plugin/plugin.h
  type plugin_info (line 42) | struct plugin_info {
  type plugin (line 60) | struct plugin {
  type plugin (line 124) | struct plugin
  type plugin (line 163) | struct plugin
  function plugin_get_id (line 181) | static inline int
  function plugin_get_version (line 202) | static inline uint32_t
  type plugin_info (line 221) | struct plugin_info
  type plugin (line 224) | struct plugin
  type plugin (line 243) | struct plugin

FILE: lib/utils/_atoip.c
  function isblank2 (line 9) | static int
  function isendofline (line 17) | static int
  function iscomment (line 25) | static int
  function rte_isendoftoken (line 33) | static int
  function inet_ipton4 (line 50) | static int
  function inet_ipton6 (line 101) | static int
  function inet_ipton (line 204) | static int
  function _atoip (line 219) | int

FILE: lib/utils/_atoip.h
  type rte_ipaddr (line 32) | struct rte_ipaddr {

FILE: lib/utils/heap.c
  function heap_t (line 11) | heap_t *
  function heap_destroy (line 46) | int
  function heap_free (line 56) | int
  function heap_mfree (line 215) | int
  function heap_dump (line 243) | void

FILE: lib/utils/heap.h
  type heap_entry_t (line 32) | typedef struct heap_entry {
  type heap_t (line 37) | typedef struct heap {

FILE: lib/utils/inet_pton.c
  function inet_pton (line 55) | int
  function inet_pton4 (line 79) | static int
  function inet_pton6 (line 133) | static int

FILE: lib/utils/parson_json.c
  type JSON_Value_Value (line 78) | typedef union json_value_value {
  type json_value_t (line 89) | struct json_value_t {
  type json_object_t (line 95) | struct json_object_t {
  type json_array_t (line 103) | struct json_array_t {
  function hex_char_to_int (line 187) | static int
  function parse_utf16_hex (line 200) | static int
  function num_bytes_in_utf8_sequence (line 219) | static int
  function verify_utf8_sequence (line 236) | static int
  function is_valid_utf8 (line 275) | static int
  function is_decimal (line 290) | static int
  function remove_comments (line 342) | static void
  function JSON_Object (line 374) | static JSON_Object *
  function JSON_Status (line 390) | static JSON_Status
  function JSON_Status (line 399) | static JSON_Status
  function JSON_Status (line 426) | static JSON_Status
  function JSON_Value (line 457) | static JSON_Value *
  function JSON_Status (line 472) | static JSON_Status
  function JSON_Status (line 496) | static JSON_Status
  function json_object_free (line 514) | static void
  function JSON_Array (line 529) | static JSON_Array *
  function JSON_Status (line 544) | static JSON_Status
  function JSON_Status (line 558) | static JSON_Status
  function json_array_free (line 578) | static void
  function JSON_Value (line 590) | static JSON_Value *
  function JSON_Status (line 605) | static JSON_Status
  function parse_utf16 (line 626) | static int
  function JSON_Value (line 766) | static JSON_Value *
  function JSON_Value (line 815) | static JSON_Value *
  function JSON_Value (line 879) | static JSON_Value *
  function JSON_Value (line 927) | static JSON_Value *
  function JSON_Value (line 944) | static JSON_Value *
  function JSON_Value (line 960) | static JSON_Value *
  function JSON_Value (line 975) | static JSON_Value *
  function JSON_Value (line 990) | static JSON_Value *
  function JSON_Value (line 1005) | static JSON_Value *
  function json_serialize_to_buffer_r (line 1042) | static int
  function json_serialize_string (line 1197) | static int
  function append_indent (line 1331) | static int
  function append_string (line 1342) | static int
  function JSON_Value (line 1355) | JSON_Value *
  function JSON_Value (line 1369) | JSON_Value *
  function JSON_Value (line 1383) | JSON_Value *
  function JSON_Value (line 1394) | JSON_Value *
  function JSON_Value (line 1413) | JSON_Value *
  function json_object_get_number (line 1428) | double
  function json_object_get_uint64 (line 1434) | uint64_t
  function json_object_get_integer (line 1440) | int
  function JSON_Object (line 1446) | JSON_Object *
  function JSON_Array (line 1452) | JSON_Array *
  function json_object_get_boolean (line 1458) | int
  function json_object_at_get_number (line 1472) | double
  function json_object_at_get_uint64 (line 1478) | uint64_t
  function json_object_at_get_integer (line 1484) | int
  function JSON_Object (line 1490) | JSON_Object *
  function JSON_Array (line 1496) | JSON_Array *
  function json_object_at_get_boolean (line 1502) | int
  function JSON_Value (line 1508) | JSON_Value *
  function json_object_dotget_number (line 1526) | double
  function json_object_dotget_uint64 (line 1532) | uint64_t
  function json_object_dotget_integer (line 1538) | int
  function JSON_Object (line 1544) | JSON_Object *
  function JSON_Array (line 1550) | JSON_Array *
  function json_object_dotget_boolean (line 1556) | int
  function json_object_get_boolean_by_name (line 1562) | int
  function json_object_get_count (line 1573) | size_t
  function JSON_Value (line 1588) | JSON_Value *
  function JSON_Value (line 1597) | JSON_Value *
  function json_object_has_value (line 1603) | int
  function json_object_has_value_of_type (line 1609) | int
  function json_object_dothas_value (line 1617) | int
  function json_object_dothas_value_of_type (line 1623) | int
  function JSON_Value (line 1632) | JSON_Value *
  function json_array_get_number (line 1647) | double
  function json_array_get_uint64 (line 1653) | uint64_t
  function json_array_get_integer (line 1659) | int
  function JSON_Object (line 1665) | JSON_Object *
  function JSON_Array (line 1671) | JSON_Array *
  function json_array_get_boolean (line 1677) | int
  function json_array_get_count (line 1683) | size_t
  function JSON_Value (line 1689) | JSON_Value *
  function JSON_Value_Type (line 1696) | JSON_Value_Type
  function JSON_Object (line 1702) | JSON_Object *
  function JSON_Array (line 1708) | JSON_Array *
  function json_value_get_number (line 1720) | double
  function json_value_get_uint64 (line 1726) | uint64_t
  function json_value_get_integer (line 1732) | int
  function json_value_get_boolean (line 1738) | int
  function JSON_Value (line 1744) | JSON_Value *
  function json_value_free (line 1750) | void
  function JSON_Value (line 1772) | JSON_Value *
  function JSON_Value (line 1790) | JSON_Value *
  function JSON_Value (line 1808) | JSON_Value *
  function JSON_Value (line 1832) | JSON_Value *
  function JSON_Value (line 1850) | JSON_Value *
  function JSON_Value (line 1865) | JSON_Value *
  function JSON_Value (line 1880) | JSON_Value *
  function JSON_Value (line 1894) | JSON_Value *
  function JSON_Value (line 1907) | JSON_Value *
  function json_serialization_size (line 2000) | size_t
  function JSON_Status (line 2010) | JSON_Status
  function JSON_Status (line 2026) | JSON_Status
  function json_serialization_size_pretty (line 2071) | size_t
  function JSON_Status (line 2081) | JSON_Status
  function JSON_Status (line 2097) | JSON_Status
  function json_free_serialized_string (line 2142) | void
  function JSON_Status (line 2148) | JSON_Status
  function JSON_Status (line 2163) | JSON_Status
  function JSON_Status (line 2176) | JSON_Status
  function JSON_Status (line 2191) | JSON_Status
  function JSON_Status (line 2206) | JSON_Status
  function JSON_Status (line 2221) | JSON_Status
  function JSON_Status (line 2236) | JSON_Status
  function JSON_Status (line 2251) | JSON_Status
  function JSON_Status (line 2266) | JSON_Status
  function JSON_Status (line 2280) | JSON_Status
  function JSON_Status (line 2289) | JSON_Status
  function JSON_Status (line 2304) | JSON_Status
  function JSON_Status (line 2319) | JSON_Status
  function JSON_Status (line 2334) | JSON_Status
  function JSON_Status (line 2349) | JSON_Status
  function JSON_Status (line 2364) | JSON_Status
  function JSON_Status (line 2379) | JSON_Status
  function JSON_Status (line 2402) | JSON_Status
  function JSON_Status (line 2408) | JSON_Status
  function JSON_Status (line 2414) | JSON_Status
  function JSON_Status (line 2420) | JSON_Status
  function JSON_Status (line 2426) | JSON_Status
  function JSON_Status (line 2432) | JSON_Status
  function JSON_Status (line 2438) | JSON_Status
  function JSON_Status (line 2484) | JSON_Status
  function JSON_Status (line 2499) | JSON_Status
  function JSON_Status (line 2514) | JSON_Status
  function JSON_Status (line 2529) | JSON_Status
  function JSON_Status (line 2544) | JSON_Status
  function JSON_Status (line 2559) | JSON_Status
  function JSON_Status (line 2574) | JSON_Status
  function JSON_Status (line 2580) | JSON_Status
  function JSON_Status (line 2586) | JSON_Status
  function JSON_Status (line 2602) | JSON_Status
  function json_value_equals (line 2670) | int
  function JSON_Value_Type (line 2748) | JSON_Value_Type
  function JSON_Object (line 2754) | JSON_Object *
  function JSON_Array (line 2760) | JSON_Array *
  function json_get_number (line 2772) | double
  function json_get_uint64 (line 2778) | uint64_t
  function json_get_integer (line 2784) | int
  function json_get_boolean (line 2790) | int
  function json_set_allocation_functions (line 2796) | void

FILE: lib/utils/parson_json.h
  type JSON_Object (line 35) | typedef struct json_object_t JSON_Object;
  type JSON_Array (line 36) | typedef struct json_array_t JSON_Array;
  type JSON_Value (line 37) | typedef struct json_value_t JSON_Value;
  type json_value_type (line 39) | enum json_value_type {
  type JSON_Value_Type (line 50) | typedef int JSON_Value_Type;
  type json_result_t (line 52) | enum json_result_t { JSONSuccess = 0, JSONFailure = -1 }
  type JSON_Status (line 53) | typedef int JSON_Status;

FILE: lib/utils/portlist.c
  function portmask_parse (line 8) | int
  function set_portlist_bits (line 28) | static inline void
  function portlist_parse (line 38) | int

FILE: lib/utils/portlist.h
  type portlist_t (line 24) | typedef uint64_t portlist_t;

FILE: lib/vec/vec.c
  function vec_obj_init (line 13) | static void
  type rte_mempool (line 21) | struct rte_mempool
  type rte_mempool (line 24) | struct rte_mempool
  function vec_destroy_pool (line 35) | void
  type vec (line 41) | struct vec
  type vec (line 44) | struct vec
  function vec_destroy (line 59) | void
  function vec_to_data (line 65) | int
  function vec_print (line 98) | void

FILE: lib/vec/vec.h
  type vec (line 28) | struct vec {
  function vec_init (line 69) | static inline void
  function vec_calc_size (line 88) | static inline unsigned int
  function vec_calc_count (line 108) | static inline uint32_t
  function vec_set_free (line 119) | static inline void
  function vec_is_free (line 126) | static inline int
  function vec_is_dont_free (line 133) | static inline int
  function vec_set_dont_free (line 140) | static inline void
  function vec_clr_dont_free (line 147) | static inline void
  function __rte_always_inline (line 154) | static __rte_always_inline uint16_t
  function __rte_always_inline (line 161) | static __rte_always_inline int
  function __rte_always_inline (line 168) | static __rte_always_inline void
  function __rte_always_inline (line 175) | static __rte_always_inline void
  function __rte_always_inline (line 182) | static __rte_always_inline void
  function __rte_always_inline (line 189) | static __rte_always_inline void
  function __rte_always_inline (line 196) | static __rte_always_inline uint16_t
  function rte_mbuf (line 203) | rte_mbuf **
  function __rte_always_inline (line 219) | static __rte_always_inline int
  function __rte_always_inline (line 237) | static __rte_always_inline int
  function __rte_always_inline (line 254) | static __rte_always_inline void *
  function __rte_always_inline (line 269) | static __rte_always_inline void
  function rte_mbuf (line 283) | rte_mbuf **
  function rte_mbuf (line 295) | rte_mbuf **
  function __rte_always_inline (line 307) | static __rte_always_inline int
  function __rte_always_inline (line 319) | static __rte_always_inline int
  function vec_reset (line 333) | static inline void
  function vec_find_index (line 351) | static inline int
  type vec (line 369) | struct vec
  type rte_mempool (line 370) | struct rte_mempool
  type vec (line 372) | struct vec
  function vec_free (line 388) | static inline void
  function vec_alloc_bulk (line 429) | static inline int
  function vec_free_bulk (line 469) | static inline void
  function vec_free_mbufs (line 486) | static inline void
  function vec_clr_at_index (line 527) | static inline void
  function vec_compact (line 542) | static inline void
  function vec_find_delete (line 583) | static inline void
  function vec_pop (line 601) | static inline int
  function vec_free_mbuf_at_index (line 623) | static inline void
  function vec_move_at_index (line 652) | static inline int
  function vec_copy_at_index (line 673) | static inline void
  function vec_move_mbuf (line 689) | static inline void
  type rte_mbuf (line 703) | struct rte_mbuf
  type vec (line 704) | struct vec
  type rte_mbuf (line 706) | struct rte_mbuf
  type vec (line 722) | struct vec
  type vec (line 729) | struct vec
  type rte_mempool (line 740) | struct rte_mempool
  type rte_mempool (line 748) | struct rte_mempool
  type vec (line 758) | struct vec
  type vec (line 767) | struct vec

FILE: tools/run.py
  function usage (line 18) | def usage():
  function err_exit (line 63) | def err_exit(str):
  function find_file (line 68) | def find_file(fn, t):
  function mk_tuple (line 79) | def mk_tuple(lst, s):
  function add_ld_options (line 97) | def add_ld_options(s, arg_list):
  function add_run_options (line 106) | def add_run_options(s, arg_list, p):
  function add_setup_options (line 116) | def add_setup_options(s, arg_list):
  function file_list (line 122) | def file_list(directory, file_extension):
  function load_cfg (line 129) | def load_cfg(fname):
  function show_configs (line 152) | def show_configs():
  function run_cfg (line 178) | def run_cfg(cfg_file):
  function num_sockets (line 252) | def num_sockets(hpath):
  function setup_cfg (line 262) | def setup_cfg(cfg_file):
  function parse_args (line 373) | def parse_args():
  function main (line 427) | def main():
Condensed preview — 305 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,865K chars).
[
  {
    "path": ".clang-format",
    "chars": 4024,
    "preview": "---\nLanguage:        Cpp\n# BasedOnStyle:  LLVM\nAccessModifierOffset: 0\nAlignAfterOpenBracket: Align\nAlignConsecutiveMacr"
  },
  {
    "path": ".claude/settings.local.json",
    "chars": 454,
    "preview": "{\n  \"permissions\": {\n    \"allow\": [\n      \"Bash(ninja:*)\",\n      \"Bash(wc:*)\",\n      \"Bash(ls:*)\",\n      \"Read(//work/pr"
  },
  {
    "path": ".editorconfig",
    "chars": 510,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright 2019 6WIND S.A.\n# See https://editorconfig.org/ for syntax reference"
  },
  {
    "path": ".githooks/pre-commit",
    "chars": 1783,
    "preview": "#!/usr/bin/env bash\n# Pre-commit hook for Markdown linting and optional auto-fix.\n# Usage: ln -sf ../../.githooks/pre-co"
  },
  {
    "path": ".github/workflows/clang-format.yml",
    "chars": 2041,
    "preview": "name: clang-format Check\non:\n  push:\n    branches: [main]\n  pull_request:\n\njobs:\n  formatting-check:\n    name: Formattin"
  },
  {
    "path": ".github/workflows/doc.yml",
    "chars": 880,
    "preview": "name: Doc Deploy\n\non:\n  push:\n    branches: [main]\n\n# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub"
  },
  {
    "path": ".github/workflows/markdownlint.yml",
    "chars": 1080,
    "preview": "name: Markdown Lint\n\non:\n  pull_request:\n    paths:\n      - '**/*.md'\n      - '.markdownlint.yml'\n  push:\n    branches: "
  },
  {
    "path": ".gitignore",
    "chars": 209,
    "preview": "*.o\n*.a\n*.d\n*~\n_install\n_postinstall\n_preinstall\n_postbuild\n_postclean\nlib/common/common/\ndocs/build/\n.project\n.pydevpro"
  },
  {
    "path": ".markdownlint.yml",
    "chars": 1221,
    "preview": "# Markdownlint configuration\n# Adjusted for Pktgen project documentation style.\n# Rule references: https://github.com/Da"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 2282,
    "preview": "# Pre-commit configuration for FastIPC\n# See https://pre-commit.com for more information\n# See https://pre-commit.com/ho"
  },
  {
    "path": ".readthedocs.yaml",
    "chars": 584,
    "preview": "# .readthedocs.yaml\n# Read the Docs configuration file\n# See https://docs.readthedocs.io/en/stable/config-file/v2.html f"
  },
  {
    "path": "2-ports",
    "chars": 5595,
    "preview": "#\n# Pktgen 25.08.2\n# Copyright(c) <2010-2025>, Intel Corporation. All rights reserved., Powered by DPDK 26.03.0-rc0\n\n# C"
  },
  {
    "path": "2-vf-ports",
    "chars": 5617,
    "preview": "#\n# Pktgen 25.07.1\n# Copyright(c) <2010-2025>, Intel Corporation. All rights reserved., Powered by DPDK 25.07.0\n\n# Comma"
  },
  {
    "path": "CLAUDE.md",
    "chars": 9376,
    "preview": "# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n---"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 2398,
    "preview": "# Code of Conduct\n\nWe are committed to fostering a welcoming, respectful, and productive environment for all contributor"
  },
  {
    "path": "CONTRIBUTING.TXT",
    "chars": 1334,
    "preview": "Contributors Guide\n==================\n\nThis document outlines how to contribute code to the PKTGEN project.\n\nGetting the"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 3538,
    "preview": "# Contributing to Pktgen-DPDK\n\nThank you for your interest in improving Pktgen-DPDK. This short guide complements the ma"
  },
  {
    "path": "INSTALL.md",
    "chars": 8721,
    "preview": "# Pktgen - Traffic Generator powered by DPDK\n\n---\nPktgen is a traffic generator powered by DPDK at wire rate traffic wit"
  },
  {
    "path": "LICENSE",
    "chars": 1724,
    "preview": "#   BSD LICENSE\n#\n#   Copyright(c) <2010-2025> Intel Corporation. All rights reserved.\n#\n#   Redistribution and use in s"
  },
  {
    "path": "Makefile",
    "chars": 833,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright(c) <2019-2025> Intel Corporation\n\n#\n# Head Makefile for compiling Pk"
  },
  {
    "path": "Pktgen.lua",
    "chars": 7296,
    "preview": "-- SPDX-License-Identifier: BSD-3-Clause\n\n-- Create some short cuts to the real functions.\ngsub\t    = string.gsub\ngmatch"
  },
  {
    "path": "README.md",
    "chars": 9609,
    "preview": "# Pktgen — DPDK Traffic Generator\n\nHigh‑performance, scriptable packet generator capable of wire‑rate transmission with "
  },
  {
    "path": "VERSION",
    "chars": 8,
    "preview": "26.03.0\n"
  },
  {
    "path": "app/.gitignore",
    "chars": 63,
    "preview": "pktgen\nt/libtap/libtap.a\nt/libtap/tap.o\nbuild/\nt/*.t\n!t/*.pl.t\n"
  },
  {
    "path": "app/cli-functions.c",
    "chars": 74961,
    "preview": "/*-\n * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/cli-functions.h",
    "chars": 713,
    "preview": "/*-\n * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/l2p.c",
    "chars": 10990,
    "preview": "/*-\n * Copyright(c) <2012-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/l2p.h",
    "chars": 14895,
    "preview": "/*-\n * Copyright(c) <2012-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/lpktgenlib.c",
    "chars": 93316,
    "preview": "/*-\n * Copyright(c) <2011-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/lpktgenlib.h",
    "chars": 1345,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/meson.build",
    "chars": 1500,
    "preview": "sources = files(\n\t'cli-functions.c',\n    'l2p.c',\n\t'pktgen-arp.c',\n\t'pktgen-capture.c',\n\t'pktgen-cmds.c',\n\t'pktgen-cpu.c"
  },
  {
    "path": "app/pktgen-arp.c",
    "chars": 6871,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-arp.h",
    "chars": 1386,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-capture.c",
    "chars": 9478,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-capture.h",
    "chars": 2354,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-cmds.c",
    "chars": 113531,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-cmds.h",
    "chars": 17298,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-constants.h",
    "chars": 1465,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-cpu.c",
    "chars": 2241,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-cpu.h",
    "chars": 1292,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-display.c",
    "chars": 12145,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-display.h",
    "chars": 3569,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-dump.c",
    "chars": 3971,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-dump.h",
    "chars": 1256,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-ether.c",
    "chars": 3143,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-ether.h",
    "chars": 1040,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-gre.c",
    "chars": 6327,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-gre.h",
    "chars": 1446,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-gtpu.c",
    "chars": 3034,
    "preview": "/*-\n * Copyright(c) <2015-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-gtpu.h",
    "chars": 1214,
    "preview": "/*-\n * Copyright(c) <2015-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-ipv4.c",
    "chars": 5515,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-ipv4.h",
    "chars": 1552,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-ipv6.c",
    "chars": 3861,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-ipv6.h",
    "chars": 1178,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-latency.c",
    "chars": 15787,
    "preview": "/*-\n * Copyright(c) <2016-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-latency.h",
    "chars": 2102,
    "preview": "/*-\n * Copyright(c) <2016-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-log.c",
    "chars": 11787,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-log.h",
    "chars": 4598,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-main.c",
    "chars": 16467,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-main.h",
    "chars": 960,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-pcap.c",
    "chars": 8704,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-pcap.h",
    "chars": 3938,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-port-cfg.c",
    "chars": 20813,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-port-cfg.h",
    "chars": 23400,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-random.c",
    "chars": 9551,
    "preview": "/*-\n * Copyright(c) <2016-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-random.h",
    "chars": 3967,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-range.c",
    "chars": 30631,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-range.h",
    "chars": 6699,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-seq.c",
    "chars": 4131,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-seq.h",
    "chars": 3399,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-stats.c",
    "chars": 27356,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-stats.h",
    "chars": 3463,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-sys.c",
    "chars": 2690,
    "preview": "/*-\n * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-sys.h",
    "chars": 483,
    "preview": "/*-\n * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-tcp.c",
    "chars": 3171,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-tcp.h",
    "chars": 1227,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-txbuff.h",
    "chars": 5671,
    "preview": "/*-\n * Copyright(c) <2023-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-udp.c",
    "chars": 3123,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-udp.h",
    "chars": 1319,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-version.h",
    "chars": 469,
    "preview": "/*-\n * Copyright(c) <2020-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-vlan.c",
    "chars": 1263,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen-vlan.h",
    "chars": 758,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen.c",
    "chars": 40736,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/pktgen.h",
    "chars": 24238,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "app/xorshift64star.c",
    "chars": 158,
    "preview": "#include \"xorshift64star.h\"\n\n// The state of the \"randomization engine\".\n// Defined here so that it can be shared betwee"
  },
  {
    "path": "app/xorshift64star.h",
    "chars": 1286,
    "preview": "/*\n * Marsaglia, George (July 2003). \"Xorshift RNGs\".\n * Journal of Statistical Software.\n *\n * SPDX-License-Identifier:"
  },
  {
    "path": "cfg/2-ports.cfg",
    "chars": 984,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/2-vf-ports.cfg",
    "chars": 973,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/bond.cfg",
    "chars": 1236,
    "preview": "description = 'Pktgen setup to use the bonding PMD driver, 2 bonds, 4 ports per bond.'\n\n# Setup configuration\nsetup = {\n"
  },
  {
    "path": "cfg/client_memif.cfg",
    "chars": 1003,
    "preview": "description = 'Client side of the MEMIF PMD'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'sudo',\n\n        ),\n"
  },
  {
    "path": "cfg/client_mif.cfg",
    "chars": 1045,
    "preview": "description = 'Client side of the MIF PMD'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'sudo',\n\n        ),\n\t'"
  },
  {
    "path": "cfg/cnet-fwd-2.cfg",
    "chars": 958,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/cnet-fwd.cfg",
    "chars": 1096,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/dapi-l3fwd.cfg",
    "chars": 961,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'sudo',\n\n  "
  },
  {
    "path": "cfg/default-100G.cfg",
    "chars": 957,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/default-gui.cfg",
    "chars": 885,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/default.cfg",
    "chars": 1118,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/dfs.cfg",
    "chars": 1078,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n\t'exec': (\n\t'sudo',\n\t\t),\n\n\t'devic"
  },
  {
    "path": "cfg/dnet-echo.cfg",
    "chars": 1129,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/four-ports.cfg",
    "chars": 1113,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/half-bond.cfg",
    "chars": 1144,
    "preview": "description = 'Setup to use the bonding driver, but only one bond connected to non-bonded ports'\n\n# Setup configuration\n"
  },
  {
    "path": "cfg/hs-fwd.cfg",
    "chars": 997,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/ioat.cfg",
    "chars": 978,
    "preview": "description = 'Slave configuration for two Pktgen\\'s running'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'su"
  },
  {
    "path": "cfg/lat.cfg",
    "chars": 1035,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/lb-fwd.cfg",
    "chars": 999,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/many-cores.cfg",
    "chars": 938,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'sudo',\n\n  "
  },
  {
    "path": "cfg/multi-port.cfg",
    "chars": 1188,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/one-port.cfg",
    "chars": 912,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/pcap.cfg",
    "chars": 1211,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/pdump.cfg",
    "chars": 967,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/pktgen-1.cfg",
    "chars": 998,
    "preview": "description = 'The initial side of two Pktgen\\'s running in the same system'\n\n# Setup configuration\nsetup = {\n    'exec'"
  },
  {
    "path": "cfg/pktgen-2.cfg",
    "chars": 982,
    "preview": "description = 'Slave configuration for two Pktgen\\'s running'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'su"
  },
  {
    "path": "cfg/server_memif.cfg",
    "chars": 1024,
    "preview": "description = 'Using the MEMIF PMD this is the initial side'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'sud"
  },
  {
    "path": "cfg/server_mif.cfg",
    "chars": 1021,
    "preview": "description = 'Using the MIF PMD this is the initial side'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'sudo'"
  },
  {
    "path": "cfg/socket.cfg",
    "chars": 990,
    "preview": "description = 'Slave configuration for two Pktgen\\'s running'\n\n# Setup configuration\nsetup = {\n    'exec': (\n        'su"
  },
  {
    "path": "cfg/two-ports-shared.cfg",
    "chars": 1186,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/two-ports.cfg",
    "chars": 1124,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/tx_perf.cfg",
    "chars": 962,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/vfio-fwd.cfg",
    "chars": 952,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/xdp-100.cfg",
    "chars": 940,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/xdp-40.cfg",
    "chars": 991,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "cfg/xl710.cfg",
    "chars": 979,
    "preview": "description = 'A Pktgen default simple configuration'\n\n# Setup configuration\nsetup = {\n    'exec': (\n\t'sudo',\n        ),"
  },
  {
    "path": "docs/LUA_API.md",
    "chars": 4417,
    "preview": "# Pktgen Lua API (selected)\n\nThis document describes the Lua functions exported by the `pktgen` module that were recentl"
  },
  {
    "path": "docs/QUICKSTART.md",
    "chars": 3366,
    "preview": "# Pktgen Quick Start\n\nThis guide provides a concise path from a clean system to generating traffic with Pktgen.\n\n## 1. P"
  },
  {
    "path": "docs/STYLE.md",
    "chars": 4475,
    "preview": "# Documentation & Markdown Style Guide\n\nThis guide summarizes the conventions enforced (and encouraged) for all Markdown"
  },
  {
    "path": "docs/api/doxy-api-index.md",
    "chars": 7198,
    "preview": "API\n===\n\n<!--\n  SPDX-License-Identifier: BSD-3-Clause\n  Copyright(c) 2013-2017 6WIND S.A.\n-->\n\nThe public API headers ar"
  },
  {
    "path": "docs/api/doxy-api.conf.in",
    "chars": 1609,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright 2019-2020 Intel Corperation Inc.\n\nPROJECT_NAME            = Pktgen-D"
  },
  {
    "path": "docs/api/doxy-html-custom.sh",
    "chars": 183,
    "preview": "#! /bin/sh -e\n# SPDX-License-Identifier: BSD-3-Clause\n# Copyright 2013 6WIND S.A.\n\nCSS=$1\n\n# space between item and its "
  },
  {
    "path": "docs/api/generate_doxygen.sh",
    "chars": 392,
    "preview": "#! /bin/sh -e\n# SPDX-License-Identifier: BSD-3-Clause\n# Copyright 2018 Luca Boccassi <bluca@debian.org>\n\nDOXYCONF=$1\nOUT"
  },
  {
    "path": "docs/api/generate_examples.sh",
    "chars": 597,
    "preview": "#! /bin/sh -e\n# SPDX-License-Identifier: BSD-3-Clause\n# Copyright 2018 Luca Boccassi <bluca@debian.org>\n\nEXAMPLES_DIR=$1"
  },
  {
    "path": "docs/api/meson.build",
    "chars": 2148,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>\n\ndoxygen = find_program('do"
  },
  {
    "path": "docs/meson.build",
    "chars": 391,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright(c) <2019-2026> Intel Corporation\n\ndoc_targets = []\ndoc_target_names "
  },
  {
    "path": "docs/source/changes.rst",
    "chars": 467,
    "preview": ":tocdepth: 1\n\n.. _changes:\n\nChanges in Pktgen\n=================\n\nThis section previously embedded the raw `changelog.txt"
  },
  {
    "path": "docs/source/cli_design.rst",
    "chars": 1370,
    "preview": "CLI design notes (lib/cli)\n==========================\n\nThis page documents the design and usage of the CLI library shipp"
  },
  {
    "path": "docs/source/commands.rst",
    "chars": 36173,
    "preview": ".. _commands:\n\n``*** Pktgen ***``\nCopyright &copy \\<2015-2026\\>, Intel Corporation.\n\nREADME for setting up Pktgen with D"
  },
  {
    "path": "docs/source/conf.py",
    "chars": 1838,
    "preview": "# -*- coding: utf-8 -*-\n\nfrom sphinx.highlighting import PygmentsBridge\nfrom pygments.formatters.latex import LatexForma"
  },
  {
    "path": "docs/source/contents.rst",
    "chars": 1244,
    "preview": "\nThe Pktgen Application\n======================\n\n**Pktgen**, (*Packet* *Gen*-erator) is a software based traffic generato"
  },
  {
    "path": "docs/source/copyright.rst",
    "chars": 1674,
    "preview": ".. _copyright:\n\nCopyright and License\n=====================\n\n**Copyright(c) <2010-2026>, Intel Corporation All rights re"
  },
  {
    "path": "docs/source/custom.css",
    "chars": 208,
    "preview": "/* Override readthedocs theme */\n\n/* Spacing before a list item must be bigger than spacing inside the item.\n * Complex "
  },
  {
    "path": "docs/source/getting_started.rst",
    "chars": 9029,
    "preview": ".. _getting_started:\n\nGetting Started with Pktgen\n===========================\n\nThis section contains instructions on how"
  },
  {
    "path": "docs/source/index.rst",
    "chars": 1267,
    "preview": "\nThe Pktgen Application\n======================\n\n**Pktgen**, (*Packet* *Gen*-erator) is a software based traffic generato"
  },
  {
    "path": "docs/source/license.rst",
    "chars": 4396,
    "preview": ".. _license:\n\nThird Party License Notices\n===========================\n\nThis document contains third party intellectual p"
  },
  {
    "path": "docs/source/lua.rst",
    "chars": 1429,
    "preview": ".. _lua:\n\nUsing Lua with Pktgen\n=====================\n\nLua is a high level dynamic programming language. It is small and"
  },
  {
    "path": "docs/source/meson.build",
    "chars": 723,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright(c) <2018-2026> Intel Corporation\n\nsphinx = find_program('sphinx-buil"
  },
  {
    "path": "docs/source/running.rst",
    "chars": 8886,
    "preview": ".. _running:\n\nRunning Pktgen\n==============\n\n\nA sample commandline to start a ``pktgen`` instance would look something l"
  },
  {
    "path": "docs/source/scripts.rst",
    "chars": 1068,
    "preview": ".. _scripts:\n\n\nRunning Script Files\n====================\n\nPktgen can read and run files with default values and configur"
  },
  {
    "path": "docs/source/socket.rst",
    "chars": 2082,
    "preview": ".. _socket:\n\nSocket Support for Pktgen\n=========================\n\nPktgen provides a TCP socket connection to allow you t"
  },
  {
    "path": "docs/source/usage_eal.rst",
    "chars": 3962,
    "preview": ".. _usage_eal:\n\n\nEAL Commandline Options\n=======================\n\nPktgen, like other DPDK applications splits commandlin"
  },
  {
    "path": "docs/source/usage_pktgen.rst",
    "chars": 7631,
    "preview": ".. _usage_pktgen:\n\nPktgen Commandline Options\n==========================\n\nThe Pktgen commandline usage is::\n\n   ./app/ap"
  },
  {
    "path": "examples/meson.build",
    "chars": 192,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright(c) <2023-2026> Intel Corporation\n\nif fgen_dep.found()\n    subdirs =["
  },
  {
    "path": "examples/pktperf/README.md",
    "chars": 6448,
    "preview": "## PKTPERF example application to verify Rx/Tx performance with multiple cores\n\nThe `pktperf` example application is use"
  },
  {
    "path": "examples/pktperf/meson.build",
    "chars": 792,
    "preview": "sources = files('pktperf.c', 'parse.c', 'port.c', 'stats.c', 'utils.c')\n\ncflags = []\n\ndeps = [dpdk, common, utils, fgen_"
  },
  {
    "path": "examples/pktperf/parse.c",
    "chars": 16566,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2023-2026 Intel Corporation\n */\n\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "examples/pktperf/pktperf.c",
    "chars": 10124,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2023-2026 Intel Corporation\n */\n\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "examples/pktperf/pktperf.h",
    "chars": 11193,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2023-2026 Intel Corporation\n */\n\n#ifdef __cplusplus\nextern \"C\" "
  },
  {
    "path": "examples/pktperf/port.c",
    "chars": 9526,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2023-2026 Intel Corporation\n */\n\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "examples/pktperf/stats.c",
    "chars": 5924,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2023-2026 Intel Corporation\n */\n\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "examples/pktperf/utils.c",
    "chars": 5505,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2023-2026 Intel Corporation\n */\n\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "lib/cli/DESIGN.md",
    "chars": 5730,
    "preview": "# CLI library (lib/cli) — design and usage\n\nThis directory contains Pktgen’s interactive CLI library (a DPDK-style “cmdl"
  },
  {
    "path": "lib/cli/README",
    "chars": 118,
    "preview": "The cli directory is a simple command line interface.\n\nPlease read the cli.rst and libcli.rst files for more details.\n"
  },
  {
    "path": "lib/cli/cli.c",
    "chars": 27030,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n/* Created by Keith Wiles @"
  },
  {
    "path": "lib/cli/cli.h",
    "chars": 25175,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n/* Created by Keith Wiles @"
  },
  {
    "path": "lib/cli/cli.rst",
    "chars": 24206,
    "preview": "..  BSD LICENSE\n   Copyright(c) <2016-2026>, Intel Corporation. All rights reserved.\n\n   Redistribution and use in sourc"
  },
  {
    "path": "lib/cli/cli_auto_complete.c",
    "chars": 31151,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/**\n * @file\n * CLI tab co"
  },
  {
    "path": "lib/cli/cli_auto_complete.h",
    "chars": 729,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_AUTO_COMPLETE"
  },
  {
    "path": "lib/cli/cli_cmap.c",
    "chars": 6035,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2013-2026>, Intel Corporation.\n */\n\n/*\n * Prints a CPU core ma"
  },
  {
    "path": "lib/cli/cli_cmap.h",
    "chars": 4167,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/**\n * @file\n * CPU core m"
  },
  {
    "path": "lib/cli/cli_cmds.c",
    "chars": 19242,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#include <stdio.h>\n\n#inclu"
  },
  {
    "path": "lib/cli/cli_cmds.h",
    "chars": 596,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_CMDS_H_\n#defi"
  },
  {
    "path": "lib/cli/cli_common.h",
    "chars": 1274,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_COMMON_H_\n#de"
  },
  {
    "path": "lib/cli/cli_env.c",
    "chars": 4710,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n/* Created by: Keith Wiles "
  },
  {
    "path": "lib/cli/cli_env.h",
    "chars": 3781,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n/* Created by Keith Wiles @"
  },
  {
    "path": "lib/cli/cli_file.c",
    "chars": 6751,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#include \"cli.h\"\n#include "
  },
  {
    "path": "lib/cli/cli_file.h",
    "chars": 6269,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_FILE_H_\n#defi"
  },
  {
    "path": "lib/cli/cli_gapbuf.c",
    "chars": 3761,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n/* inspired by an email/cod"
  },
  {
    "path": "lib/cli/cli_gapbuf.h",
    "chars": 13278,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n/* inspired by an email/cod"
  },
  {
    "path": "lib/cli/cli_help.c",
    "chars": 2618,
    "preview": "/*-\n * Copyright(c) <2016-2026> Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n"
  },
  {
    "path": "lib/cli/cli_help.h",
    "chars": 3329,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_HELP_H_\n#defi"
  },
  {
    "path": "lib/cli/cli_history.c",
    "chars": 4668,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#include \"cli.h\"\n\nstruct c"
  },
  {
    "path": "lib/cli/cli_history.h",
    "chars": 2989,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_HISTORY_H_\n#d"
  },
  {
    "path": "lib/cli/cli_input.c",
    "chars": 2854,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/**\n * @file\n * CLI input "
  },
  {
    "path": "lib/cli/cli_input.h",
    "chars": 8489,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_INPUT_H_\n#def"
  },
  {
    "path": "lib/cli/cli_lib.rst",
    "chars": 25907,
    "preview": "..  BSD LICENSE\n   Copyright(c) <2016-2026>, Intel Corporation. All rights reserved.\n\n   Redistribution and use in sourc"
  },
  {
    "path": "lib/cli/cli_map.c",
    "chars": 8039,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/**\n * @file\n * CLI map (c"
  },
  {
    "path": "lib/cli/cli_map.h",
    "chars": 2794,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/**\n * @file\n * CLI argume"
  },
  {
    "path": "lib/cli/cli_scrn.c",
    "chars": 4731,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/* Created by Keith Wiles "
  },
  {
    "path": "lib/cli/cli_scrn.h",
    "chars": 16884,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n/* Created by Keith Wiles "
  },
  {
    "path": "lib/cli/cli_search.c",
    "chars": 6298,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#include <rte_string_fns.h"
  },
  {
    "path": "lib/cli/cli_search.h",
    "chars": 5161,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#ifndef _CLI_SEARCH_H_\n#de"
  },
  {
    "path": "lib/cli/cli_vt100.c",
    "chars": 8121,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) <2016-2026>, Intel Corporation.\n */\n\n#include \"cli.h\"\n#include "
  },
  {
    "path": "lib/cli/meson.build",
    "chars": 487,
    "preview": "# SPDX-License-Identifier: BSD-3-Clause\n# Copyright(c) <2020-2026> Intel Corporation\n\nsources = files(\n\t'cli_auto_comple"
  },
  {
    "path": "lib/common/cksum.c",
    "chars": 6282,
    "preview": "/*-\n *   Copyright(c) <2014-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n "
  },
  {
    "path": "lib/common/cksum.h",
    "chars": 696,
    "preview": "/*-\n *   Copyright(c) <2014-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n "
  },
  {
    "path": "lib/common/cmdline_parse_args.c",
    "chars": 2190,
    "preview": "/*-\n *   Copyright(c) <2015-2026>-2016 Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clau"
  },
  {
    "path": "lib/common/cmdline_parse_args.h",
    "chars": 1522,
    "preview": "/*-\n *   Copyright(c) <2015-2026>-2016 Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clau"
  },
  {
    "path": "lib/common/copyright_info.c",
    "chars": 1526,
    "preview": "/*-\n * Copyright(c) <2010-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "lib/common/copyright_info.h",
    "chars": 904,
    "preview": "/*-\n *   Copyright(c) <2014-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n "
  },
  {
    "path": "lib/common/coreinfo.c",
    "chars": 8587,
    "preview": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright (c) 2023-2026 Intel Corporation\n */\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "lib/common/coreinfo.h",
    "chars": 1191,
    "preview": "/*-\n * Copyright(c) <2014-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */"
  },
  {
    "path": "lib/common/lscpu.c",
    "chars": 5431,
    "preview": "/*-\n *   Copyright(c) <2014-2026>, Intel Corporation. All rights reserved.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n "
  }
]

// ... and 105 more files (download for full content)

About this extraction

This page contains the full source code of the pktgen/Pktgen-DPDK GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 305 files (1.7 MB), approximately 503.9k tokens, and a symbol index with 1714 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!