Skip to contentSkip to conversation

tc: act_ife: handle IEEE IFE ethertype as default

PATCH Applied Alexander Aring 4 participants 9 messages Aug 28, 2017 – Aug 30, 2017

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

cover tc: act_ife: handle IEEE IFE ethertype as default

Hi,

this patch series will introduce the IFE ethertype which is registered by IEEE. If the netlink act_ife type netlink attribute is not given it will use this value by default now.
At least it will introduce some UAPI testcases to check if the default type is used if not specified and vice versa.

- Alex

Alexander Aring (3):
if_ether: add forces ife lfb type
act_ife: use registered ife_type as fallback
tc-testing: add test for testing ife type

 include/uapi/linux/if_ether.h                      |  1 +
 net/sched/act_ife.c                                | 17 ++------
 .../tc-testing/tc-tests/actions/tests.json         | 50 ++++++++++++++++++++++
 3 files changed, 54 insertions(+), 14 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 if_ether: add forces ife lfb type

This patch adds the forces IFE lfb type according to IEEE registered ethertypes. See http://standards-oui.ieee.org/ethertype/eth.txt for more information. Since there exists the IFE subsystem it can be used there.

This patch also use the correct word "ForCES" instead of "FoRCES" which is a spelling error inside the IEEE ethertype specification.

---
 include/uapi/linux/if_ether.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/if_ether.h +1 -0
index 5bc9bfd816b7..22bf8effefef 100644
@@ -103,6 +103,7 @@
 #define ETH_P_QINQ2	0x9200		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_QINQ3	0x9300		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_EDSA	0xDADA		/* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
+#define ETH_P_IFE	0xED3E		/* ForCES inter-FE LFB type */
 #define ETH_P_AF_IUCV   0xFBFB		/* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
 
 #define ETH_P_802_3_MIN	0x0600		/* If the value in the ethernet type is less than this value
Signature · 1 line
2.11.0
maintainer Acked-by on v1 1/3
#2 lore raw

Re: [PATCH net-next 1/3] if_ether: add forces ife lfb type

Quoted 8 lines · Alexander Aring

This patch adds the forces IFE lfb type according to IEEE registered ethertypes. See http://standards-oui.ieee.org/ethertype/eth.txt for more information. Since there exists the IFE subsystem it can be used there.

This patch also use the correct word "ForCES" instead of "FoRCES" which is a spelling error inside the IEEE ethertype specification.

cheers,
jamal

#3 lore raw

PATCH 2/3 act_ife: use registered ife_type as fallback

In reply to Alexander Aring

This patch handles a default IFE type if it's not given by user space netlink api. The default IFE type will be the registered ethertype by IEEE for IFE ForCES.

---
 net/sched/act_ife.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
net/sched/act_ife.c +3 -14
index c5dec308b8b1..7ed1be80ee86 100644
@@ -435,8 +435,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 	struct nlattr *tb[TCA_IFE_MAX + 1];
 	struct nlattr *tb2[IFE_META_MAX + 1];
 	struct tcf_ife_info *ife;
+	u16 ife_type = ETH_P_IFE;
 	struct tc_ife *parm;
-	u16 ife_type = 0;
 	u8 *daddr = NULL;
 	u8 *saddr = NULL;
 	bool exists = false;
@@ -456,18 +456,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 	if (exists && bind)
 		return 0;
 
-	if (parm->flags & IFE_ENCODE) {
-		/* Until we get issued the ethertype, we cant have
-		 * a default..
-		**/
-		if (!tb[TCA_IFE_TYPE]) {
-			if (exists)
-				tcf_hash_release(*a, bind);
-			pr_info("You MUST pass etherype for encoding\n");
-			return -EINVAL;
-		}
-	}
-
 	if (!exists) {
 		ret = tcf_hash_create(tn, parm->index, est, a, &act_ife_ops,
 				      bind, false);
@@ -484,7 +472,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 	ife->flags = parm->flags;
 
 	if (parm->flags & IFE_ENCODE) {
-		ife_type = nla_get_u16(tb[TCA_IFE_TYPE]);
+		if (tb[TCA_IFE_TYPE])
+			ife_type = nla_get_u16(tb[TCA_IFE_TYPE]);
 		if (tb[TCA_IFE_DMAC])
 			daddr = nla_data(tb[TCA_IFE_DMAC]);
 		if (tb[TCA_IFE_SMAC])
Signature · 1 line
2.11.0
#5 lore raw

PATCH 3/3 tc-testing: add test for testing ife type

In reply to Alexander Aring

This patch adds a new testcase for the IFE type setting in tc. In case of user specified the type it will check if the ife is correctly configured to react on it. If it's not specified the default IFE type should be used.

---
 .../tc-testing/tc-tests/actions/tests.json         | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
tools/testing/selftests/tc-testing/tc-tests/actions/tests.json +50 -0
index af519bc97a8e..6973bdc5b5bf 100644
@@ -1111,5 +1111,55 @@
         "teardown": [
             "$TC actions flush action gact"
         ]
+    },
+    {
+        "id": "a568",
+        "name": "Add action with ife type",
+        "category": [
+            "actions",
+            "ife"
+        ],
+        "setup": [
+            [
+                "$TC actions flush action ife",
+                0,
+                1,
+                255
+            ],
+            "$TC actions add action ife encode type 0xDEAD index 1"
+        ],
+        "cmdUnderTest": "$TC actions get action ife index 1",
+        "expExitCode": "0",
+        "verifyCmd": "$TC actions get action ife index 1",
+        "matchPattern": "type 0xDEAD",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action ife"
+        ]
+    },
+    {
+        "id": "b983",
+        "name": "Add action without ife type",
+        "category": [
+            "actions",
+            "ife"
+        ],
+        "setup": [
+            [
+                "$TC actions flush action ife",
+                0,
+                1,
+                255
+            ],
+            "$TC actions add action ife encode index 1"
+        ],
+        "cmdUnderTest": "$TC actions get action ife index 1",
+        "expExitCode": "0",
+        "verifyCmd": "$TC actions get action ife index 1",
+        "matchPattern": "type 0xED3E",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action ife"
+        ]
     }
 ]
\ No newline at end of file
Signature · 1 line
2.11.0
maintainer Acked-by on v1 3/3
#6 lore raw

Re: [PATCH net-next 3/3] tc-testing: add test for testing ife type

Quoted 6 lines · Alexander Aring

This patch adds a new testcase for the IFE type setting in tc. In case of user specified the type it will check if the ife is correctly configured to react on it. If it's not specified the default IFE type should be used.

We should add the tests which do filter binding as well (both auto-binding and late binding)

cheers,
jamal

maintainer
#7 lore raw
In reply to Alexander Aring

From: Alexander Aring <[email protected]>
Date: Mon, 28 Aug 2017 15:03:12 -0400

Quoted 5 lines

this patch series will introduce the IFE ethertype which is registered by IEEE. If the netlink act_ife type netlink attribute is not given it will use this value by default now.
At least it will introduce some UAPI testcases to check if the default type is used if not specified and vice versa.

Series applied, thank you.

#8 lore raw
In reply to Alexander Aring
Quoted 15 lines · On Mon, 28 Aug 2017 15:03:12 -0400 Alexander Aring <[email protected]> wrote:

Hi,

this patch series will introduce the IFE ethertype which is registered by IEEE. If the netlink act_ife type netlink attribute is not given it will use this value by default now.
At least it will introduce some UAPI testcases to check if the default type is used if not specified and vice versa.

- Alex

Alexander Aring (3):
if_ether: add forces ife lfb type
act_ife: use registered ife_type as fallback
tc-testing: add test for testing ife type

Quoted 5 lines
 include/uapi/linux/if_ether.h                      |  1 +
 net/sched/act_ife.c                                | 17 ++------
 .../tc-testing/tc-tests/actions/tests.json         | 50 ++++++++++++++++++++++
 3 files changed, 54 insertions(+), 14 deletions(-)

Applied to net-next