Skip to content

Commit d1cb14a

Browse files
committed
1/ Add eni mode VM/FNIC 2/ Add trusted vni
1 parent dc168b9 commit d1cb14a

File tree

8 files changed

+193
-7
lines changed

8 files changed

+193
-7
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: 19 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_AND_SET
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
@@ -1946,3 +1959,9 @@ sai_apis:
19461959
bitwidth: 16
19471960
ip_is_v6_field_id: 0
19481961
skipattr: null
1962+
SAI_ENI_ATTR_DASH_ENI_MODE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaActionParam
1963+
id: 44
1964+
field: s32
1965+
bitwidth: 8
1966+
ip_is_v6_field_id: 0
1967+
skipattr: null
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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: trusted_vni_entry
8+
description: trusted VNI entry
9+
is_object: false
10+
enums:
11+
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
12+
name: sai_trusted_vni_entry_action_t
13+
description: 'Attribute data for #SAI_TRUSTED_VNI_ENTRY_ATTR_ACTION'
14+
members:
15+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
16+
name: SAI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
17+
description: ''
18+
value: '0'
19+
structs:
20+
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
21+
name: sai_trusted_vni_entry_t
22+
description: Entry for 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: eni_id
32+
description: Exact matched key eni_id
33+
type: sai_object_id_t
34+
objects: SAI_OBJECT_TYPE_ENI
35+
valid_only: null
36+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
37+
name: vni_range
38+
description: Range matched key vni_range
39+
type: sai_u32_range_t
40+
objects: null
41+
valid_only: null
42+
attributes:
43+
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
44+
name: SAI_TRUSTED_VNI_ENTRY_ATTR_ACTION
45+
description: Action
46+
type: sai_trusted_vni_entry_action_t
47+
attr_value_field: null
48+
default: SAI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
49+
isresourcetype: false
50+
flags: CREATE_AND_SET
51+
object_name: null
52+
allow_null: false
53+
valid_only: null
54+
is_vlan: false
55+
deprecated: false
56+
stats: []
57+
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
58+
tables:
59+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
60+
id: 38326132
61+
single_match_priority: true
62+
stage: null
63+
keys:
64+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
65+
name: eni_id
66+
id: 1
67+
match_type: exact
68+
field: u16
69+
bitwidth: 16
70+
ip_is_v6_field_id: 0
71+
is_object_key: false
72+
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaKey
73+
name: vni_range
74+
id: 2
75+
match_type: range
76+
field: u32range
77+
bitwidth: 24
78+
ip_is_v6_field_id: 0
79+
is_object_key: false
80+
actions:
81+
SAI_TRUSTED_VNI_ENTRY_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
82+
name: SAI_TRUSTED_VNI_ENTRY_ACTION_PERMIT
83+
id: 24633826
84+
attr_params: {}

dash-pipeline/SAI/specs/sai_spec.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ api_types:
1515
- SAI_API_DASH_TUNNEL
1616
- SAI_API_DASH_FLOW
1717
- SAI_API_DASH_APPLIANCE
18+
- SAI_API_DASH_TRUSTED_VNI
1819
object_types:
1920
- SAI_OBJECT_TYPE_DASH_ACL_GROUP
2021
- SAI_OBJECT_TYPE_DASH_ACL_RULE
@@ -43,6 +44,7 @@ object_types:
4344
- SAI_OBJECT_TYPE_DASH_APPLIANCE
4445
- SAI_OBJECT_TYPE_DASH_TUNNEL_MEMBER
4546
- SAI_OBJECT_TYPE_DASH_TUNNEL_NEXT_HOP
47+
- SAI_OBJECT_TYPE_TRUSTED_VNI_ENTRY
4648
object_entries:
4749
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
4850
name: direction_lookup_entry
@@ -104,6 +106,12 @@ object_entries:
104106
type: sai_meter_bucket_entry_t
105107
objects: null
106108
valid_only: object_type == SAI_OBJECT_TYPE_METER_BUCKET_ENTRY,
109+
- !!python/object:utils.sai_spec.sai_struct_entry.SaiStructEntry
110+
name: trusted_vni_entry
111+
description: Object entry for DASH API trusted_vni_entry
112+
type: sai_trusted_vni_entry_t
113+
objects: null
114+
valid_only: object_type == SAI_OBJECT_TYPE_TRUSTED_VNI_ENTRY,
107115
enums:
108116
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
109117
name: sai_dash_direction_t
@@ -469,6 +477,18 @@ enums:
469477
name: FLOW_PENDING_RESIMULATION
470478
description: ''
471479
value: '4'
480+
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
481+
name: sai_dash_eni_mode_t
482+
description: ''
483+
members:
484+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
485+
name: VM
486+
description: ''
487+
value: '0'
488+
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
489+
name: FNIC
490+
description: ''
491+
value: '1'
472492
port_extenstion: !!python/object:utils.sai_spec.sai_api_extension.SaiApiExtension
473493
attributes: []
474494
stats:
@@ -566,3 +586,4 @@ api_groups:
566586
- !inc 'dash_tunnel.yaml'
567587
- !inc 'dash_flow.yaml'
568588
- !inc 'dash_appliance.yaml'
589+
- !inc 'dash_trusted_vni.yaml'

dash-pipeline/bmv2/dash_metadata.p4

Lines changed: 6 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 meter_context_t {

dash-pipeline/bmv2/dash_pipeline.p4

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "stages/ha.p4"
1717
#include "stages/routing_action_apply.p4"
1818
#include "stages/metering_update.p4"
19+
#include "stages/trusted_vni.p4"
1920
#include "underlay.p4"
2021

2122
control dash_eni_stage(
@@ -67,7 +68,8 @@ control dash_eni_stage(
6768
bit<1> enable_reverse_tunnel_learning,
6869
@SaiVal[type="sai_ip_address_t"] IPv4Address reverse_tunnel_sip,
6970
bit<1> is_ha_flow_owner,
70-
@SaiVal[type="sai_object_id_t"] bit<16> flow_table_id)
71+
@SaiVal[type="sai_object_id_t"] bit<16> flow_table_id,
72+
@SaiVal[type="sai_dash_eni_mode_t"] dash_eni_mode_t dash_eni_mode)
7173
{
7274
meta.eni_data.cps = cps;
7375
meta.eni_data.pps = pps;
@@ -76,6 +78,7 @@ control dash_eni_stage(
7678
meta.eni_data.pl_sip = pl_sip;
7779
meta.eni_data.pl_sip_mask = pl_sip_mask;
7880
meta.eni_data.pl_underlay_sip = pl_underlay_sip;
81+
meta.eni_data.eni_mode = dash_eni_mode;
7982
meta.u0_encap_data.underlay_dip = vm_underlay_dip;
8083
meta.eni_data.outbound_routing_group_data.outbound_routing_group_id = outbound_routing_group_id;
8184
if (dash_tunnel_dscp_mode == dash_tunnel_dscp_mode_t.PIPE_MODEL) {
@@ -134,6 +137,9 @@ control dash_eni_stage(
134137
if (!eni.apply().hit) {
135138
UPDATE_COUNTER(eni_miss_drop, 0);
136139
}
140+
else if (meta.eni_data.eni_mode == dash_eni_mode_t.FNIC) {
141+
trusted_vni_stage.apply(hdr, meta);
142+
}
137143
}
138144
}
139145

dash-pipeline/bmv2/stages/direction_lookup.p4

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ control direction_lookup_stage(
2525
set_eni_mac_type(dash_eni_mac_type_t.SRC_MAC, dash_eni_mac_override_type);
2626
}
2727

28-
action set_inbound_direction() {
28+
action set_inbound_direction(
29+
@SaiVal[type="sai_dash_eni_mac_override_type_t"] dash_eni_mac_override_type_t dash_eni_mac_override_type
30+
) {
2931
meta.direction = dash_direction_t.INBOUND;
30-
meta.eni_mac_type = dash_eni_mac_type_t.DST_MAC;
32+
set_eni_mac_type(dash_eni_mac_type_t.DST_MAC, dash_eni_mac_override_type);
3133
}
3234

3335
@SaiTable[name = "direction_lookup", api = "dash_direction_lookup"]
@@ -38,10 +40,10 @@ control direction_lookup_stage(
3840

3941
actions = {
4042
set_outbound_direction;
41-
@defaultonly set_inbound_direction;
43+
set_inbound_direction;
4244
}
4345

44-
const default_action = set_inbound_direction;
46+
const default_action = set_inbound_direction(dash_eni_mac_override_type_t.NONE);
4547
}
4648

4749
apply {
@@ -50,4 +52,4 @@ control direction_lookup_stage(
5052
}
5153
}
5254

53-
#endif /* _DASH_STAGE_DIRECTION_LOOKUP_P4_ */
55+
#endif /* _DASH_STAGE_DIRECTION_LOOKUP_P4_ */
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef _DASH_STAGE_TRUSTED_VNI_P4_
2+
#define _DASH_STAGE_TRUSTED_VNI_P4_
3+
4+
control trusted_vni_stage(
5+
inout headers_t hdr,
6+
inout metadata_t meta)
7+
{
8+
action permit() {}
9+
10+
action deny() {
11+
meta.dropped = true;
12+
}
13+
14+
@SaiTable[single_match_priority = "true", api = "dash_trusted_vni"]
15+
table trusted_vni {
16+
key = {
17+
meta.eni_id : exact @SaiVal[type="sai_object_id_t"];
18+
meta.rx_encap.vni: range @SaiVal[name = "vni_range"];
19+
}
20+
21+
actions = {
22+
permit;
23+
@defaultonly deny;
24+
}
25+
const default_action = deny;
26+
}
27+
28+
apply {
29+
trusted_vni.apply();
30+
}
31+
}
32+
33+
#endif /* _DASH_STAGE_TRUSTED_VNI_P4_ */

0 commit comments

Comments
 (0)