]> Gentwo Git Trees - linux/.git/commit
ynl: samples: add tc filter example
authorZahari Doychev <zahari.doychev@linux.com>
Wed, 19 Nov 2025 20:36:18 +0000 (21:36 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 21 Nov 2025 02:20:40 +0000 (18:20 -0800)
commit8b4e023d79b760d217dd1c462848c4a27fcc7677
tree9f9c66cc99eacb97e52ea82c5d6e6ad5b59abcfc
parentb64ea1c5f4b7a5a8fcd223255ac0b748492cdb9f
ynl: samples: add tc filter example

Add a sample tool demonstrating how to add, dump, and delete a
flower filter with two VLAN push actions. The example can be
invoked as:

  # samples/tc-filter-add p2

    flower pref 1 proto: 0x8100
    flower:
      vlan_id: 100
      vlan_prio: 5
      num_of_vlans: 3
    action order: 1 vlan push id 200 protocol 0x8100 priority 0
    action order: 2 vlan push id 300 protocol 0x8100 priority 0

This verifies correct handling of tc action attributes for multiple
VLAN push actions. The tc action indexed arrays start from index 1,
and the index defines the action order. This behavior differs from
the YNL specification, which expects arrays to be zero-based. To
accommodate this, the example adds a dummy action at index 0, which
is ignored by the kernel.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Link: https://patch.msgid.link/20251119203618.263780-2-zahari.doychev@linux.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/samples/.gitignore
tools/net/ynl/samples/Makefile
tools/net/ynl/samples/tc-filter-add.c [new file with mode: 0644]