app/testpmd: support integrity flow item
The integrity item allows the application to match on the integrity of a packet. Usage example: match that packet integrity checks are OK. The checks depend on packet layers. For example ICMP packet will not check L4 level. flow create 0 ingress pattern integrity value mask 0x01 value spec 0x01 Match that L4 packet is OK - check L2 & L3 & L4 layers: flow create 0 ingress pattern integrity value mask 0xfe value spec 0xfe Signed-off-by: Ori Kam <orika@nvidia.com> Signed-off-by: Gregory Etelson <getelson@nvidia.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
parent
b10a421a1f
commit
0797fa6ccf
@ -293,6 +293,9 @@ enum index {
|
||||
ITEM_GENEVE_OPT_TYPE,
|
||||
ITEM_GENEVE_OPT_LENGTH,
|
||||
ITEM_GENEVE_OPT_DATA,
|
||||
ITEM_INTEGRITY,
|
||||
ITEM_INTEGRITY_LEVEL,
|
||||
ITEM_INTEGRITY_VALUE,
|
||||
|
||||
/* Validate/create actions. */
|
||||
ACTIONS,
|
||||
@ -968,6 +971,7 @@ static const enum index next_item[] = {
|
||||
ITEM_PFCP,
|
||||
ITEM_ECPRI,
|
||||
ITEM_GENEVE_OPT,
|
||||
ITEM_INTEGRITY,
|
||||
END_SET,
|
||||
ZERO,
|
||||
};
|
||||
@ -1319,6 +1323,19 @@ static const enum index item_geneve_opt[] = {
|
||||
ZERO,
|
||||
};
|
||||
|
||||
static const enum index item_integrity[] = {
|
||||
ITEM_INTEGRITY_LEVEL,
|
||||
ITEM_INTEGRITY_VALUE,
|
||||
ZERO,
|
||||
};
|
||||
|
||||
static const enum index item_integrity_lv[] = {
|
||||
ITEM_INTEGRITY_LEVEL,
|
||||
ITEM_INTEGRITY_VALUE,
|
||||
ITEM_NEXT,
|
||||
ZERO,
|
||||
};
|
||||
|
||||
static const enum index next_action[] = {
|
||||
ACTION_END,
|
||||
ACTION_VOID,
|
||||
@ -3400,6 +3417,28 @@ static const struct token token_list[] = {
|
||||
(sizeof(struct rte_flow_item_geneve_opt),
|
||||
ITEM_GENEVE_OPT_DATA_SIZE)),
|
||||
},
|
||||
[ITEM_INTEGRITY] = {
|
||||
.name = "integrity",
|
||||
.help = "match packet integrity",
|
||||
.priv = PRIV_ITEM(INTEGRITY,
|
||||
sizeof(struct rte_flow_item_integrity)),
|
||||
.next = NEXT(item_integrity),
|
||||
.call = parse_vc,
|
||||
},
|
||||
[ITEM_INTEGRITY_LEVEL] = {
|
||||
.name = "level",
|
||||
.help = "integrity level",
|
||||
.next = NEXT(item_integrity_lv, NEXT_ENTRY(UNSIGNED),
|
||||
item_param),
|
||||
.args = ARGS(ARGS_ENTRY(struct rte_flow_item_integrity, level)),
|
||||
},
|
||||
[ITEM_INTEGRITY_VALUE] = {
|
||||
.name = "value",
|
||||
.help = "integrity value",
|
||||
.next = NEXT(item_integrity_lv, NEXT_ENTRY(UNSIGNED),
|
||||
item_param),
|
||||
.args = ARGS(ARGS_ENTRY(struct rte_flow_item_integrity, value)),
|
||||
},
|
||||
/* Validate/create actions. */
|
||||
[ACTIONS] = {
|
||||
.name = "actions",
|
||||
|
@ -3789,6 +3789,13 @@ This section lists supported pattern items and their attributes, if any.
|
||||
- ``s_field {unsigned}``: S field.
|
||||
- ``seid {unsigned}``: session endpoint identifier.
|
||||
|
||||
- ``integrity``: match packet integrity.
|
||||
|
||||
- ``level {unsigned}``: Packet encapsulation level the item should
|
||||
apply to. See rte_flow_action_rss for details.
|
||||
- ``value {unsigned}``: A bitmask that specify what packet elements
|
||||
must be matched for integrity.
|
||||
|
||||
Actions list
|
||||
^^^^^^^^^^^^
|
||||
|
||||
@ -4927,6 +4934,27 @@ NVGRE encapsulation header and sent to port id 0.
|
||||
testpmd> flow create 0 ingress transfer pattern eth / end actions
|
||||
sample ratio 1 index 0 / port_id id 2 / end
|
||||
|
||||
Sample integrity rules
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Integrity rules can be created by the following commands:
|
||||
|
||||
Integrity rule that forwards valid TCP packets to group 1.
|
||||
TCP packet integrity is matched with the ``l4_ok`` bit 3.
|
||||
|
||||
::
|
||||
|
||||
testpmd> flow create 0 ingress
|
||||
pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end
|
||||
actions jump group 1 / end
|
||||
|
||||
Integrity rule that forwards invalid packets to application.
|
||||
General packet integrity is matched with the ``packet_ok`` bit 0.
|
||||
|
||||
::
|
||||
|
||||
testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end
|
||||
|
||||
BPF Functions
|
||||
--------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user