Skip to content

Commit

Permalink
Update P4 and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Feb 14, 2024
1 parent 79067ba commit 08efc7d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
20 changes: 18 additions & 2 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ control dash_ingress(
action accept() {
}

#ifdef TARGET_BMV2_V1MODEL
@SaiCounter[name="lb_fast_path_icmp_in", attr_type="stats"]
counter(1, CounterType.packets_and_bytes) port_lb_fast_path_icmp_in_counter;
@SaiCounter[name="lb_fast_path_eni_miss", attr_type="stats"]
counter(1, CounterType.packets_and_bytes) port_lb_fast_path_eni_miss_counter;
#endif

@SaiTable[name = "vip", api = "dash_vip"]
table vip {
Expand Down Expand Up @@ -113,8 +115,10 @@ control dash_ingress(
meta.stage4_dash_acl_group_id = ## prefix ##_stage4_dash_acl_group_id; \
meta.stage5_dash_acl_group_id = ## prefix ##_stage5_dash_acl_group_id;

@SaiCounter[name="lb_fast_path_icmp_in", attr_type="stats"]
#ifdef TARGET_BMV2_V1MODEL
@SaiCounter[name="lb_fast_path_icmp_in", attr_type="stats", action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.packets_and_bytes) eni_lb_fast_path_icmp_in_counter;
#endif

action set_eni_attrs(bit<32> cps,
bit<32> pps,
Expand Down Expand Up @@ -163,7 +167,6 @@ control dash_ingress(
}

meta.fast_path_icmp_flow_redirection_disabled = disable_fast_path_icmp_flow_redirection;
eni_lb_fast_path_icmp_in_counter.count((bit<32>)meta.eni_id);
}

@SaiTable[name = "eni", api = "dash_eni", order=1, isobject="true"]
Expand Down Expand Up @@ -377,7 +380,9 @@ control dash_ingress(
#endif // TARGET_DPDK_PNA

if (meta.is_fast_path_icmp_flow_redirection_packet) {
#ifdef TARGET_BMV2_V1MODEL
port_lb_fast_path_icmp_in_counter.count(0);
#endif
}

if (vip.apply().hit) {
Expand All @@ -386,7 +391,9 @@ control dash_ingress(
meta.encap_data.underlay_sip = hdr.u0_ipv4.dst_addr;
} else {
if (meta.is_fast_path_icmp_flow_redirection_packet) {
#ifdef TARGET_BMV2_V1MODEL
port_lb_fast_path_eni_miss_counter.count(0);
#endif
}
}

Expand All @@ -404,7 +411,9 @@ control dash_ingress(

if (!eni_ether_address_map.apply().hit) {
if (meta.is_fast_path_icmp_flow_redirection_packet) {
#ifdef TARGET_BMV2_V1MODEL
port_lb_fast_path_eni_miss_counter.count(0);
#endif
}
}

Expand Down Expand Up @@ -448,6 +457,13 @@ control dash_ingress(
if (meta.eni_data.admin_state == 0) {
deny();
}

if (meta.is_fast_path_icmp_flow_redirection_packet) {
#ifdef TARGET_BMV2_V1MODEL
eni_lb_fast_path_icmp_in_counter.count((bit<32>)meta.eni_id);
#endif
}

acl_group.apply();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def test_sai_thrift_create_eni(saithrift_client):
outbound_v6_stage2_dash_acl_group_id = 0,
outbound_v6_stage3_dash_acl_group_id = 0,
outbound_v6_stage4_dash_acl_group_id = 0,
outbound_v6_stage5_dash_acl_group_id = 0)
outbound_v6_stage5_dash_acl_group_id = 0,
disable_fast_path_icmp_flow_redirection = 0)
assert (eni != SAI_NULL_OBJECT_ID);

eam = sai_thrift_eni_ether_address_map_entry_t(switch_id=switch_id, address = eth_addr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,21 @@ Port level counter will be added as port stats extensions following the [SAI ext

| Attribute name | Description |
| -------------- | ----------- |
| SAI_PORT_ATTR_LB_FAST_PATH_ICMP_IN_PKTS | The number of fast path packets received |
| SAI_PORT_ATTR_LB_FAST_PATH_ICMP_IN_BYTES | The total bytes of fast path packets received |
| SAI_PORT_ATTR_LB_FAST_PATH_ENI_MISS_PKTS | The number of fast path packet received but could not find corresponding ENI to process |
| SAI_PORT_ATTR_LB_FAST_PATH_ENI_MISS_BYTES | The total bytes of fast path packet received but could not find corresponding ENI to process |
| SAI_PORT_STAT_LB_FAST_PATH_ICMP_IN_PACKETS | The number of fast path packets received |
| SAI_PORT_STAT_LB_FAST_PATH_ICMP_IN_BYTES | The total bytes of fast path packets received |
| SAI_PORT_STAT_LB_FAST_PATH_ENI_MISS_PACKETS | The number of fast path packet received but could not find corresponding ENI to process |
| SAI_PORT_STAT_LB_FAST_PATH_ENI_MISS_BYTES | The total bytes of fast path packet received but could not find corresponding ENI to process |

#### ENI stats attributes

| Attribute name | Description |
| -------------- | ----------- |
| SAI_ENI_ATTR_LB_FAST_PATH_ICMP_IN_PKTS | The number of fast path packets received |
| SAI_ENI_ATTR_LB_FAST_PATH_ICMP_IN_BYTES | The total bytes of fast path packets received |
| SAI_ENI_STAT_LB_FAST_PATH_ICMP_IN_PACKETS | The number of fast path packets received |
| SAI_ENI_STAT_LB_FAST_PATH_ICMP_IN_BYTES | The total bytes of fast path packets received |

#### Flow table stats attributes

| Attribute name | Description |
| -------------- | ----------- |
| SAI_ENI_ATTR_LB_FAST_PATH_FLOW_REDIRECTED_COUNT | The number of flows that redirected due to fast path packet received |
| SAI_ENI_ATTR_LB_FAST_PATH_FLOW_MISS_COUNT | The number of flows that is missing when trying to redirected by fast path packets |
| SAI_ENI_STAT_LB_FAST_PATH_FLOW_REDIRECTED_COUNT | The number of flows that redirected due to fast path packet received |
| SAI_ENI_STAT_LB_FAST_PATH_FLOW_MISS_COUNT | The number of flows that is missing when trying to redirected by fast path packets |
3 changes: 2 additions & 1 deletion test/test-cases/functional/ptf/sai_dash_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def eni_create(self, **kwargs):
"outbound_v6_stage2_dash_acl_group_id": 0,
"outbound_v6_stage3_dash_acl_group_id": 0,
"outbound_v6_stage4_dash_acl_group_id": 0,
"outbound_v6_stage5_dash_acl_group_id": 0
"outbound_v6_stage5_dash_acl_group_id": 0,
"disable_fast_path_icmp_flow_redirection": 0,
}
default_kwargs.update(kwargs)

Expand Down
3 changes: 2 additions & 1 deletion test/test-cases/functional/ptf/saidashacl.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def setUpSwitch(self):
outbound_v6_stage2_dash_acl_group_id=self.out_v6_stage2_acl_group_id,
outbound_v6_stage3_dash_acl_group_id=self.out_v6_stage3_acl_group_id,
outbound_v6_stage4_dash_acl_group_id=0,
outbound_v6_stage5_dash_acl_group_id=0)
outbound_v6_stage5_dash_acl_group_id=0,
disable_fast_path_icmp_flow_redirection=0)

self.eam = sai_thrift_eni_ether_address_map_entry_t(
switch_id=self.switch_id, address=self.eni_mac)
Expand Down
3 changes: 2 additions & 1 deletion test/test-cases/functional/ptf/saidashvnet_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def configureVnet(self):
outbound_v6_stage2_dash_acl_group_id = 0,
outbound_v6_stage3_dash_acl_group_id = 0,
outbound_v6_stage4_dash_acl_group_id = 0,
outbound_v6_stage5_dash_acl_group_id = 0)
outbound_v6_stage5_dash_acl_group_id = 0,
disable_fast_path_icmp_flow_redirection = 0)

self.eam = sai_thrift_eni_ether_address_map_entry_t(switch_id=self.switch_id, address = self.eni_mac)
status = sai_thrift_create_eni_ether_address_map_entry(self.client,
Expand Down

0 comments on commit 08efc7d

Please sign in to comment.