forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: qos: introduce a frer action to implement 802.1CB
This patch introduce a frer action to implement frame replication and elimination for reliability, which is defined in IEEE P802.1CB. There are two modes for frer action: generate and push the tag, recover and pop the tag. frer tag has three types: RTAG, HSR, and PRP. This patch only supports RTAG now. User can push the tag on egress port of the talker device, recover and pop the tag on ingress port of the listener device. When it's a relay system, push the tag on ingress port, or set individual recover on ingress port. Set the sequence recover on egress port. Use action "mirred" to do split function, and use "vlan-modify" to do active stream identification function on relay system. Below is the setting example in user space: push rtag on relay system: > tc qdisc add dev swp0 clsact > tc filter add dev swp0 ingress protocol 802.1Q flower \ skip_hw dst_mac 00:01:02:03:04:05 vlan_id 1 \ action frer rtag tag-action tag-push split stream: > tc filter add dev swp0 ingress protocol 802.1Q flower \ skip_hw dst_mac 00:01:02:03:04:05 vlan_id 1 \ action mirred egress mirror dev swp1 individual recover: > tc filter add dev swp0 ingress protocol 802.1Q flower skip_hw dst_mac 00:01:02:03:04:06 vlan_id 1 \ action frer rtag recover \ alg vector history-length 32 reset-time 10000 recover and pop rtag: > tc filter add dev swp0 egress protocol 802.1Q flower skip_hw dst_mac 00:01:02:03:04:06 vlan_id 1 \ action frer rtag recover \ alg vector history-length 32 reset-time 10000 \ tag-action tag-pop Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
- Loading branch information
1 parent
a17aafa
commit a48cfe8
Showing
9 changed files
with
833 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
/* Copyright 2021 NXP */ | ||
|
||
#ifndef __NET_TC_FRER_H | ||
#define __NET_TC_FRER_H | ||
|
||
#include <net/act_api.h> | ||
#include <linux/tc_act/tc_frer.h> | ||
|
||
struct tcf_frer; | ||
|
||
struct tcf_frer_proto_ops { | ||
int (*encode)(struct sk_buff *skb, struct tcf_frer *frer_act); | ||
int (*decode)(struct sk_buff *skb); | ||
void (*tag_pop)(struct sk_buff *skb, struct tcf_frer *frer_act); | ||
}; | ||
|
||
struct tcf_frer { | ||
struct tc_action common; | ||
u8 tag_type; | ||
u8 tag_action; | ||
u8 recover; | ||
u8 rcvy_alg; | ||
u8 rcvy_history_len; | ||
u64 rcvy_reset_msec; | ||
u32 gen_seq_num; | ||
u32 rcvy_seq_num; | ||
u64 seq_space; | ||
u32 seq_history; | ||
bool take_any; | ||
bool rcvy_take_noseq; | ||
u32 cps_seq_rcvy_lost_pkts; | ||
u32 cps_seq_rcvy_tagless_pkts; | ||
u32 cps_seq_rcvy_out_of_order_pkts; | ||
u32 cps_seq_rcvy_rogue_pkts; | ||
u32 cps_seq_rcvy_resets; | ||
struct hrtimer hrtimer; | ||
const struct tcf_frer_proto_ops *proto_ops; | ||
}; | ||
|
||
#define to_frer(a) ((struct tcf_frer *)a) | ||
|
||
static inline bool is_tcf_frer(const struct tc_action *a) | ||
{ | ||
#ifdef CONFIG_NET_CLS_ACT | ||
if (a->ops && a->ops->id == TCA_ID_FRER) | ||
return true; | ||
#endif | ||
return false; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ | ||
/* Copyright 2021 NXP */ | ||
|
||
#ifndef __LINUX_TC_FRER_H | ||
#define __LINUX_TC_FRER_H | ||
|
||
#include <linux/pkt_cls.h> | ||
|
||
struct tc_frer { | ||
tc_gen; | ||
}; | ||
|
||
enum { | ||
TCA_FRER_UNSPEC, | ||
TCA_FRER_TM, | ||
TCA_FRER_PARMS, | ||
TCA_FRER_PAD, | ||
TCA_FRER_TAG_TYPE, | ||
TCA_FRER_TAG_ACTION, | ||
TCA_FRER_RECOVER, | ||
TCA_FRER_RECOVER_ALG, | ||
TCA_FRER_RECOVER_HISTORY_LEN, | ||
TCA_FRER_RECOVER_RESET_TM, | ||
TCA_FRER_RECOVER_TAGLESS_PKTS, | ||
TCA_FRER_RECOVER_OUT_OF_ORDER_PKTS, | ||
TCA_FRER_RECOVER_ROGUE_PKTS, | ||
TCA_FRER_RECOVER_LOST_PKTS, | ||
TCA_FRER_RECOVER_RESETS, | ||
__TCA_FRER_MAX, | ||
}; | ||
#define TCA_FRER_MAX (__TCA_FRER_MAX - 1) | ||
|
||
enum tc_frer_tag_action { | ||
TCA_FRER_TAG_NULL, | ||
TCA_FRER_TAG_PUSH, | ||
TCA_FRER_TAG_POP, | ||
}; | ||
|
||
enum tc_frer_tag_type { | ||
TCA_FRER_TAG_RTAG, | ||
TCA_FRER_TAG_HSR, | ||
TCA_FRER_TAG_PRP, | ||
}; | ||
|
||
enum tc_frer_rcvy_alg { | ||
TCA_FRER_RCVY_VECTOR_ALG, | ||
TCA_FRER_RCVY_MATCH_ALG, | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.