Skip to content

Commit

Permalink
Merge branch 'ife-ethertype'
Browse files Browse the repository at this point in the history
Alexander Aring says:

====================
tc: act_ife: handle IEEE IFE ethertype as default

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

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 29, 2017
2 parents c965584 + 1d51f65 commit 13a6fad
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 14 deletions.
1 change: 1 addition & 0 deletions include/uapi/linux/if_ether.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,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
Expand Down
17 changes: 3 additions & 14 deletions net/sched/act_ife.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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])
Expand Down
50 changes: 50 additions & 0 deletions tools/testing/selftests/tc-testing/tc-tests/actions/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]

0 comments on commit 13a6fad

Please sign in to comment.