Skip to contentSkip to conversation

f_flower: add cfm support

PATCH Applied Zahari Doychev 2 participants 2 messages Jun 21, 2023 – Jun 23, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 f_flower: add cfm support

From: Zahari Doychev <[email protected]>

Add support for matching on CFM Maintenance Domain level and opcode.

  # tc filter add dev ens6 ingress pref 1 proto cfm \
       flower cfm op 1 mdl 5 action ok
  # tc filter show dev ens6 ingress
    filter protocol cfm pref 1 flower chain 0
    filter protocol cfm pref 1 flower chain 0 handle 0x1
      eth_type 8902
      cfm mdl 5 op 1
      not_in_hw
            action order 1: gact action pass
             random type none pass val 0
             index 1 ref 1 bind 1
  # tc -j -p filter show dev ens6 ingress
    [ {
            "protocol": "cfm",
            "pref": 1,
            "kind": "flower",
            "chain": 0
        },{
            "protocol": "cfm",
            "pref": 1,
            "kind": "flower",
            "chain": 0,
            "options": {
                "handle": 1,
                "keys": {
                    "eth_type": "8902",
                    "cfm": {
                        "mdl": 5,
                        "op": 1
                    }
                },
                "not_in_hw": true,
                "actions": [ {
                        "order": 1,
                        "kind": "gact",
                        "control_action": {
                            "type": "pass"
                        },
                        "prob": {
                            "random_type": "none",
                            "control_action": {
                                "type": "pass"
                            },
                            "val": 0
                        },
                        "index": 1,
                        "ref": 1,
                        "bind": 1
                    } ]
            }
        } ]

---

v1->v2:
- replace matches with strcmp
v2->v3
- don't change uapi header file
- remove empty lines

 lib/ll_proto.c       |  1 +
 man/man8/tc-flower.8 | 29 ++++++++++++-
 tc/f_flower.c        | 96 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 124 insertions(+), 2 deletions(-)
lib/ll_proto.c +1 -0
index 526e582f..5aacb5b4 100644
@@ -78,6 +78,7 @@ __PF(8021AD,802.1ad)
 __PF(MPLS_UC,mpls_uc)
 __PF(MPLS_MC,mpls_mc)
 __PF(TEB,teb)
+__PF(CFM,cfm)
 
 { 0x8100, "802.1Q" },
 { 0x88cc, "LLDP" },
man/man8/tc-flower.8 +28 -1
index cd997450..83245813 100644
@@ -102,7 +102,9 @@ flower \- flow based traffic control filter
 .BR ip_flags
 .IR IP_FLAGS " | "
 .B l2_miss
-.IR L2_MISS " }"
+.IR L2_MISS " | "
+.BR cfm
+.IR CFM_OPTIONS " }"
 
 .ti -8
 .IR LSE_LIST " := [ " LSE_LIST " ] " LSE
@@ -120,6 +122,13 @@ flower \- flow based traffic control filter
 .B ttl
 .IR TTL " }"
 
+.ti -8
+.IR CFM " := "
+.B cfm mdl
+.IR LEVEL " | "
+.B op
+.IR OPCODE "
+
 .SH DESCRIPTION
 The
 .B flower
@@ -496,11 +505,29 @@ fragmented packet. firstfrag can be used to indicate the first fragmented
 packet. nofirstfrag can be used to indicates subsequent fragmented packets
 or non-fragmented packets.
 .TP
+
 .BI l2_miss " L2_MISS"
 Match on layer 2 miss in the bridge driver's FDB / MDB. \fIL2_MISS\fR may be 0
 or 1. When 1, match on packets that encountered a layer 2 miss. When 0, match
 on packets that were forwarded using an FDB / MDB entry. Note that broadcast
 packets do not encounter a miss since a lookup is not performed for them.
+.TP
+
+.BI cfm " CFM_OPTIONS"
+Match on Connectivity Fault Management (CFM) fields.
+.I CFM_OPTIONS
+is a list of options that describe the properties of the CFM information
+fields to match.
+.RS
+.TP
+.BI mdl " LEVEL "
+Match on the Maintenance Domain (MD) level field.
+\fILEVEL\fR is an unsigned 3 bit value in decimal format.
+.TP
+.BI op " OPCODE "
+Match on the CFM opcode field. \fIOPCODE\fR is an unsigned 8 bit value in
+decimal format.
+
 .SH NOTES
 As stated above where applicable, matches of a certain layer implicitly depend
 on the matches of the next lower layer. Precisely, layer one and two matches
tc/f_flower.c +95 -1

131 lines not on this page · raw message

Signature · 1 line
2.41.0
#1 lore raw
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 8 lines · On Wed, 21 Jun 2023 22:55:45 +0200 you wrote:

From: Zahari Doychev <[email protected]>

Add support for matching on CFM Maintenance Domain level and opcode.

  # tc filter add dev ens6 ingress pref 1 proto cfm \
       flower cfm op 1 mdl 5 action ok

[...]

Here is the summary with links:
- [iproute2-next,v3] f_flower: add cfm support

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=5295b8f38e31

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html