Skip to content

Commit 30d4ead

Browse files
authored
[dash-p4] Add ENI mode and trusted vni stage (#672)
Referring to sonic-net/SONiC#1911 and #665, to support FNIC pipeline, this PR adds the followings: - ENI mode VM, FNIC - ENI drop counter `eni_trusted_vni_entry_miss_drop` - Action `set_inbound_direction` is not defaultonly at table `direction_lookup` - table `global_trusted_vni` and `eni_trusted_vni` --------- Signed-off-by: Junhua Zhai <[email protected]>
1 parent 52bb1c7 commit 30d4ead

File tree

15 files changed

+388
-25
lines changed

15 files changed

+388
-25
lines changed

dash-pipeline/SAI/specs/dash_direction_lookup.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ sai_apis:
1616
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION
1717
description: ''
1818
value: '0'
19+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
20+
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION
21+
description: ''
22+
value: '1'
1923
structs:
2024
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
2125
name: sai_direction_lookup_entry_t
@@ -57,7 +61,8 @@ sai_apis:
5761
flags: CREATE_AND_SET
5862
object_name: null
5963
allow_null: false
60-
valid_only: null
64+
valid_only: SAI_DIRECTION_LOOKUP_ENTRY_ATTR_ACTION == SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION
65+
or SAI_DIRECTION_LOOKUP_ENTRY_ATTR_ACTION == SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION
6166
is_vlan: false
6267
deprecated: false
6368
stats: []
@@ -87,3 +92,13 @@ sai_apis:
8792
bitwidth: 8
8893
ip_is_v6_field_id: 0
8994
skipattr: null
95+
SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
96+
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_INBOUND_DIRECTION
97+
id: 30583207
98+
attr_params:
99+
SAI_DIRECTION_LOOKUP_ENTRY_ATTR_DASH_ENI_MAC_OVERRIDE_TYPE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaActionParam
100+
id: 1
101+
field: s32
102+
bitwidth: 8
103+
ip_is_v6_field_id: 0
104+
skipattr: null

dash-pipeline/SAI/specs/dash_eni.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,19 @@ sai_apis:
653653
valid_only: null
654654
is_vlan: false
655655
deprecated: false
656+
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
657+
name: SAI_ENI_ATTR_DASH_ENI_MODE
658+
description: Action parameter DASH ENI mode
659+
type: sai_dash_eni_mode_t
660+
attr_value_field: s32
661+
default: SAI_DASH_ENI_MODE_VM
662+
isresourcetype: false
663+
flags: CREATE_ONLY
664+
object_name: null
665+
allow_null: false
666+
valid_only: null
667+
is_vlan: false
668+
deprecated: false
656669
stats:
657670
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
658671
name: SAI_ENI_STAT_RX_BYTES
@@ -1695,6 +1708,19 @@ sai_apis:
16951708
valid_only: null
16961709
is_vlan: false
16971710
deprecated: false
1711+
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
1712+
name: SAI_ENI_STAT_ENI_TRUSTED_VNI_ENTRY_MISS_DROP_PACKETS
1713+
description: DASH ENI ENI_TRUSTED_VNI_ENTRY_MISS_DROP_PACKETS stat count
1714+
type: sai_uint64_t
1715+
attr_value_field: u64
1716+
default: null
1717+
isresourcetype: false
1718+
flags: READ_ONLY
1719+
object_name: null
1720+
allow_null: false
1721+
valid_only: null
1722+
is_vlan: false
1723+
deprecated: false
16981724
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
16991725
tables:
17001726
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
@@ -1973,3 +1999,9 @@ sai_apis:
19731999
bitwidth: 16
19742000
ip_is_v6_field_id: 0
19752001
skipattr: null
2002+
SAI_ENI_ATTR_DASH_ENI_MODE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaActionParam
2003+
id: 44
2004+
field: s32
2005+
bitwidth: 8
2006+
ip_is_v6_field_id: 0
2007+
skipattr: null
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
2+
name: dash_trusted_vni
3+
description: DASH trusted VNI
4+
api_type: overlay
5+
sai_apis:
6+
- !!python/object:utils.sai_spec.sai_api.SaiApi
7+
name: global_trusted_vni_entry
8+
description: global trusted VNI entry
9+
is_object: false
10+
enums:
11+
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
12+
name: sai_global_trusted_vni_entry_action_t
13+
description: 'Attribute data for #SAI_GLOBAL_TRUSTED_VNI_ENTRY_ATTR_ACTION'
14+
members:
15+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
16+
name: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT
17+
description: ''
18+
value: '0'
19+
structs:
20+
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
21+
name: sai_global_trusted_vni_entry_t
22+
description: Entry for global_trusted_vni_entry
23+
members:
24+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
25+
name: switch_id
26+
description: Switch ID
27+
type: sai_object_id_t
28+
objects: SAI_OBJECT_TYPE_SWITCH
29+
valid_only: null
30+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
31+
name: vni_range
32+
description: Range matched key vni_range
33+
type: sai_u32_range_t
34+
objects: null
35+
valid_only: null
36+
attributes:
37+
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
38+
name: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ATTR_ACTION
39+
description: Action
40+
type: sai_global_trusted_vni_entry_action_t
41+
attr_value_field: null
42+
default: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT
43+
isresourcetype: false
44+
flags: CREATE_AND_SET
45+
object_name: null
46+
allow_null: false
47+
valid_only: null
48+
is_vlan: false
49+
deprecated: false
50+
stats: []
51+
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
52+
tables:
53+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
54+
id: 45800410
55+
single_match_priority: true
56+
stage: null
57+
keys:
58+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
59+
name: vni_range
60+
id: 1
61+
match_type: range
62+
field: u32range
63+
bitwidth: 24
64+
ip_is_v6_field_id: 0
65+
is_object_key: false
66+
actions:
67+
SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
68+
name: SAI_GLOBAL_TRUSTED_VNI_ENTRY_ACTION_PERMIT
69+
id: 29028174
70+
attr_params: {}
71+
- !!python/object:utils.sai_spec.sai_api.SaiApi
72+
name: eni_trusted_vni_entry
73+
description: ENI trusted VNI entry
74+
is_object: false
75+
enums:
76+
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
77+
name: sai_eni_trusted_vni_entry_action_t
78+
description: 'Attribute data for #SAI_ENI_TRUSTED_VNI_ENTRY_ATTR_ACTION'
79+
members:
80+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
81+
name: SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
82+
description: ''
83+
value: '0'
84+
structs:
85+
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
86+
name: sai_eni_trusted_vni_entry_t
87+
description: Entry for eni_trusted_vni_entry
88+
members:
89+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
90+
name: switch_id
91+
description: Switch ID
92+
type: sai_object_id_t
93+
objects: SAI_OBJECT_TYPE_SWITCH
94+
valid_only: null
95+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
96+
name: eni_id
97+
description: Exact matched key eni_id
98+
type: sai_object_id_t
99+
objects: SAI_OBJECT_TYPE_ENI
100+
valid_only: null
101+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
102+
name: vni_range
103+
description: Range matched key vni_range
104+
type: sai_u32_range_t
105+
objects: null
106+
valid_only: null
107+
attributes:
108+
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
109+
name: SAI_ENI_TRUSTED_VNI_ENTRY_ATTR_ACTION
110+
description: Action
111+
type: sai_eni_trusted_vni_entry_action_t
112+
attr_value_field: null
113+
default: SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
114+
isresourcetype: false
115+
flags: CREATE_AND_SET
116+
object_name: null
117+
allow_null: false
118+
valid_only: null
119+
is_vlan: false
120+
deprecated: false
121+
stats: []
122+
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
123+
tables:
124+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
125+
id: 49840895
126+
single_match_priority: true
127+
stage: null
128+
keys:
129+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
130+
name: eni_id
131+
id: 1
132+
match_type: exact
133+
field: u16
134+
bitwidth: 16
135+
ip_is_v6_field_id: 0
136+
is_object_key: false
137+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
138+
name: vni_range
139+
id: 2
140+
match_type: range
141+
field: u32range
142+
bitwidth: 24
143+
ip_is_v6_field_id: 0
144+
is_object_key: false
145+
actions:
146+
SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
147+
name: SAI_ENI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
148+
id: 29028174
149+
attr_params: {}

dash-pipeline/SAI/specs/sai_spec.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ api_types:
1616
- SAI_API_DASH_FLOW
1717
- SAI_API_DASH_APPLIANCE
1818
- SAI_API_DASH_OUTBOUND_PORT_MAP
19+
- SAI_API_DASH_TRUSTED_VNI
1920
object_types:
2021
- SAI_OBJECT_TYPE_DASH_ACL_GROUP
2122
- SAI_OBJECT_TYPE_DASH_ACL_RULE
@@ -46,6 +47,8 @@ object_types:
4647
- SAI_OBJECT_TYPE_DASH_TUNNEL_NEXT_HOP
4748
- SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP
4849
- SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY
50+
- SAI_OBJECT_TYPE_GLOBAL_TRUSTED_VNI_ENTRY
51+
- SAI_OBJECT_TYPE_ENI_TRUSTED_VNI_ENTRY
4952
object_entries:
5053
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
5154
name: direction_lookup_entry
@@ -113,6 +116,18 @@ object_entries:
113116
type: sai_outbound_port_map_port_range_entry_t
114117
objects: null
115118
valid_only: object_type == SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY,
119+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
120+
name: global_trusted_vni_entry
121+
description: Object entry for DASH API global_trusted_vni_entry
122+
type: sai_global_trusted_vni_entry_t
123+
objects: null
124+
valid_only: object_type == SAI_OBJECT_TYPE_GLOBAL_TRUSTED_VNI_ENTRY,
125+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
126+
name: eni_trusted_vni_entry
127+
description: Object entry for DASH API eni_trusted_vni_entry
128+
type: sai_eni_trusted_vni_entry_t
129+
objects: null
130+
valid_only: object_type == SAI_OBJECT_TYPE_ENI_TRUSTED_VNI_ENTRY,
116131
enums:
117132
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
118133
name: sai_dash_direction_t
@@ -478,6 +493,18 @@ enums:
478493
name: FLOW_PENDING_RESIMULATION
479494
description: ''
480495
value: '4'
496+
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
497+
name: sai_dash_eni_mode_t
498+
description: ''
499+
members:
500+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
501+
name: VM
502+
description: ''
503+
value: '0'
504+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
505+
name: FNIC
506+
description: ''
507+
value: '1'
481508
port_extenstion: !!python/object:utils.sai_spec.sai_api_extension.SaiApiExtension
482509
attributes: []
483510
stats:
@@ -576,3 +603,4 @@ api_groups:
576603
- !inc 'dash_flow.yaml'
577604
- !inc 'dash_appliance.yaml'
578605
- !inc 'dash_outbound_port_map.yaml'
606+
- !inc 'dash_trusted_vni.yaml'

dash-pipeline/bmv2/dash_counters.p4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,6 @@ DEFINE_ENI_PACKET_COUNTER(outbound_routing_group_miss_drop)
104104
DEFINE_ENI_PACKET_COUNTER(outbound_routing_group_disabled_drop)
105105
DEFINE_ENI_PACKET_COUNTER(outbound_port_map_miss_drop)
106106
DEFINE_ENI_PACKET_COUNTER(outbound_port_map_port_range_entry_miss_drop)
107+
DEFINE_ENI_PACKET_COUNTER(eni_trusted_vni_entry_miss_drop)
107108

108109
#endif // __DASH_COUNTERS__

dash-pipeline/bmv2/dash_metadata.p4

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ enum bit<8> dash_eni_mac_type_t {
3737
DST_MAC = 1
3838
};
3939

40+
enum bit<8> dash_eni_mode_t {
41+
VM = 0,
42+
FNIC = 1
43+
};
44+
4045
struct conntrack_data_t {
4146
bool allow_in;
4247
bool allow_out;
@@ -64,6 +69,7 @@ struct eni_data_t {
6469
dash_tunnel_dscp_mode_t dscp_mode;
6570
outbound_routing_group_data_t outbound_routing_group_data;
6671
IPv4Address vip;
72+
dash_eni_mode_t eni_mode;
6773
}
6874

6975
struct port_map_context_t {
@@ -257,4 +263,8 @@ struct metadata_t {
257263
EthernetAddress cpu_mac;
258264
}
259265

266+
action deny(inout metadata_t meta) {
267+
meta.dropped = true;
268+
}
269+
260270
#endif /* _SIRIUS_METADATA_P4_ */

0 commit comments

Comments
 (0)