Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ENI attribute PPS to BW to reflect the actual BW limitation in bytes #526

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ enum bit<16> dash_tunnel_dscp_mode_t {

struct eni_data_t {
bit<32> cps;
bit<32> pps;
bit<32> bw;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although bw is the one we use in the HLD, I wonder if we like to get the unit clear, such as bw_in_kbps.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@r12f good idea. At least PPS is unambiguous. The item name should include the units to make it clear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All BW throughout SAI is in Mb/s

Copy link
Collaborator

@mgheorghe mgheorghe Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not keep it bw and bw can accept values like 978, 1K, 1M, 15G, 2T, (if we don't want to type too many zeroes) and the last char if letter detonates the unit this way we don't end up with 20 api names, like bw_in_3_and_a_half_bytes_increments (exaggeration to make the point),

take it further and in the value you can add last 2 letters as 1000Kb or 1000KB, or have convention that uppercase means bytes lowercase bits so we need only 1 letter( if K is bytes if k is in bits ... seen this way of handling it in many apps)

bit<32> flows;
bit<1> admin_state;
IPv6Address pl_sip;
Expand Down
4 changes: 2 additions & 2 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ control dash_ingress(
DEFINE_COUNTER(eni_lb_fast_path_icmp_in_counter, MAX_ENI, name="lb_fast_path_icmp_in", attr_type="stats", action_names="set_eni_attrs", order=0)

action set_eni_attrs(bit<32> cps,
bit<32> pps,
bit<32> bw,
bit<32> flows,
bit<1> admin_state,
@SaiVal[type="sai_object_id_t"] bit<16> ha_scope_id,
Expand All @@ -120,7 +120,7 @@ control dash_ingress(
ACL_GROUPS_PARAM(outbound_v6),
bit<1> disable_fast_path_icmp_flow_redirection) {
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
meta.eni_data.bw = bw;
meta.eni_data.flows = flows;
meta.eni_data.admin_state = admin_state;
meta.eni_data.pl_sip = pl_sip;
Expand Down
2 changes: 1 addition & 1 deletion dash-pipeline/tests/libsai/vnet_out/vnet_out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int main(int argc, char **argv)
attr.value.u32 = 10000;
attrs.push_back(attr);

attr.id = SAI_ENI_ATTR_PPS;
attr.id = SAI_ENI_ATTR_BW;
attr.value.u32 = 100000;
attrs.push_back(attr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_sai_thrift_create_eni(saithrift_client):
pl_underlay_sip = sai_thrift_ip_address_t(addr_family=SAI_IP_ADDR_FAMILY_IPV4,
addr=sai_thrift_ip_addr_t(ip4="10.0.0.18"))
eni = sai_thrift_create_eni(saithrift_client, cps=10000,
pps=100000, flows=100000,
bw=100000, flows=100000,
admin_state=True,
ha_scope_id=0,
vm_underlay_dip=vm_underlay_dip,
Expand Down
2 changes: 1 addition & 1 deletion documentation/general/dash-sonic-hld.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ addresses = list of addresses used for validating underlay source
| DASH_QOS_TABLE | | | | |
| | qos_name | | | |
| | | qos_id | | |
| | | bw | SAI_ENI_ATTR_PPS | |
| | | bw | SAI_ENI_ATTR_BW | |
| | | cps | SAI_ENI_ATTR_CPS | |
| | | flows | SAI_ENI_ATTR_FLOWS | |
| DASH_ENI_TABLE | | | *SAI_OBJECT_TYPE_ENI* | |
Expand Down
2 changes: 1 addition & 1 deletion test/test-cases/functional/ptf/sai_dash_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def eni_create(self, **kwargs):

default_kwargs = {
"cps": 10000,
"pps": 100000,
"bw": 100000,
"flows": 100000,
"admin_state": True,
"ha_scope_id": 0,
Expand Down
2 changes: 1 addition & 1 deletion test/test-cases/functional/ptf/saidashacl.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def setUpSwitch(self):
pl_underlay_sip = sai_thrift_ip_address_t(addr_family=SAI_IP_ADDR_FAMILY_IPV4,
addr=sai_thrift_ip_addr_t(ip4="10.0.0.18"))
self.eni = self.create_obj(sai_thrift_create_eni, sai_thrift_remove_eni, cps=10000,
pps=100000, flows=100000,
bw=100000, flows=100000,
admin_state=True,
ha_scope_id=0,
vm_underlay_dip=vm_underlay_dip,
Expand Down
28 changes: 14 additions & 14 deletions test/test-cases/functional/ptf/saidasheni.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def setUp(self):
super(CreateDeleteEniTest, self).setUp()

self.cps = 10000 # ENI connections per second
self.pps = 100000 # ENI packets per seconds
self.bw = 1000 # ENI BW
self.flows = 100000 # ENI flows
self.admin_state = True # ENI admin state
self.vm_vni = 10 # ENI VM VNI
Expand Down Expand Up @@ -123,7 +123,7 @@ def createEniTest(self):
"""

self.eni = self.eni_create(cps=self.cps,
pps=self.pps,
bw=self.bw,
flows=self.flows,
admin_state=self.admin_state,
vm_underlay_dip=self.vm_underlay_dip,
Expand Down Expand Up @@ -314,7 +314,7 @@ def eniGetAttributesTest(self):
attr = sai_thrift_get_eni_attribute(self.client,
self.eni,
cps=True,
pps=True,
bw=True,
flows=True,
admin_state=True,
vm_underlay_dip=True,
Expand Down Expand Up @@ -343,7 +343,7 @@ def eniGetAttributesTest(self):
self.assertEqual(self.status(), SAI_STATUS_SUCCESS)

self.assertEqual(attr['cps'], self.cps)
self.assertEqual(attr['pps'], self.pps)
self.assertEqual(attr['bw'], self.bw)
self.assertEqual(attr['flows'], self.flows)
self.assertEqual(attr['admin_state'], self.admin_state)
self.assertEqual(attr['vm_underlay_dip'].addr.ip4, self.vm_underlay_dip.addr.ip4)
Expand Down Expand Up @@ -378,7 +378,7 @@ def eniSetAndGetAttributesTest(self):
"""

test_cps = self.cps * 2
test_pps = self.pps * 2
test_bw = self.bw * 2
test_flows = self.flows * 2
test_admin_state = False
test_vm_vni = 5
Expand All @@ -398,12 +398,12 @@ def eniSetAndGetAttributesTest(self):
attr = sai_thrift_get_eni_attribute(self.client, self.eni, cps=True)
self.assertEqual(attr['cps'], test_cps)

# set and verify new pps value
sai_thrift_set_eni_attribute(self.client, self.eni, pps=test_pps)
# set and verify new bw value
sai_thrift_set_eni_attribute(self.client, self.eni, bw=test_bw)
self.assertEqual(self.status(), SAI_STATUS_SUCCESS)

attr = sai_thrift_get_eni_attribute(self.client, self.eni, pps=True)
self.assertEqual(attr['pps'], test_pps)
attr = sai_thrift_get_eni_attribute(self.client, self.eni, bw=True)
self.assertEqual(attr['bw'], test_bw)

# set and verify new flow value
sai_thrift_set_eni_attribute(self.client, self.eni, flows=test_flows)
Expand Down Expand Up @@ -593,7 +593,7 @@ def eniSetAndGetAttributesTest(self):
finally:
# set ENI attributes to the original values
sai_thrift_set_eni_attribute(self.client, self.eni, cps=self.cps)
sai_thrift_set_eni_attribute(self.client, self.eni, pps=self.pps)
sai_thrift_set_eni_attribute(self.client, self.eni, bw=self.bw)
sai_thrift_set_eni_attribute(self.client, self.eni, flows=self.flows)
sai_thrift_set_eni_attribute(self.client, self.eni, admin_state=self.admin_state)
sai_thrift_set_eni_attribute(self.client, self.eni, vm_underlay_dip=self.vm_underlay_dip)
Expand Down Expand Up @@ -633,7 +633,7 @@ def eniSetAndGetAttributesTest(self):
attr = sai_thrift_get_eni_attribute(self.client,
self.eni,
cps=True,
pps=True,
bw=True,
flows=True,
admin_state=True,
vm_underlay_dip=True,
Expand Down Expand Up @@ -662,7 +662,7 @@ def eniSetAndGetAttributesTest(self):
self.assertEqual(self.status(), SAI_STATUS_SUCCESS)

self.assertEqual(attr['cps'], self.cps)
self.assertEqual(attr['pps'], self.pps)
self.assertEqual(attr['bw'], self.bw)
self.assertEqual(attr['flows'], self.flows)
self.assertEqual(attr['admin_state'], self.admin_state)
self.assertEqual(attr['vm_underlay_dip'].addr.ip4, self.vm_underlay_dip.addr.ip4)
Expand Down Expand Up @@ -705,12 +705,12 @@ def eniEtherAddressMapAttributesTest(self):
try:
# create test eni to verify set method
test_cps = 500
test_pps = 500
test_bw = 500
test_flows = 500
test_vm_underlay_ip = sai_ipaddress('172.0.15.15')

test_eni = self.eni_create(cps=test_cps,
pps=test_pps,
bw=test_bw,
flows=test_flows,
admin_state=True,
vm_underlay_dip=test_vm_underlay_ip,
Expand Down
2 changes: 1 addition & 1 deletion test/test-cases/functional/ptf/saidashvnet_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def configureVnet(self):
pl_underlay_sip = sai_thrift_ip_address_t(addr_family=SAI_IP_ADDR_FAMILY_IPV4,
addr=sai_thrift_ip_addr_t(ip4="10.0.0.18"))
self.eni = sai_thrift_create_eni(self.client, cps=10000,
pps=100000, flows=100000,
bw=100000, flows=100000,
admin_state=True,
ha_scope_id=0,
vm_underlay_dip=vm_underlay_dip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
###############################################################

TOTALPACKETS = 1000
PPS = 100
BW = 100
PACKET_LENGTH = 128
ENI_IP = "1.1.0.1"
NETWORK_IP1 = "1.128.0.1"
Expand Down Expand Up @@ -92,7 +92,7 @@
"type": "SAI_OBJECT_TYPE_ENI",
"attributes": [
"SAI_ENI_ATTR_CPS", "10000",
"SAI_ENI_ATTR_PPS", "100000",
"SAI_ENI_ATTR_BW", "100000",
"SAI_ENI_ATTR_FLOWS", "100000",
"SAI_ENI_ATTR_ADMIN_STATE", "True",
"SAI_ENI_ATTR_HA_SCOPE_ID", "0",
Expand Down Expand Up @@ -135,7 +135,7 @@
"type": "SAI_OBJECT_TYPE_ENI",
"attributes": [
"SAI_ENI_ATTR_CPS", "10000",
"SAI_ENI_ATTR_PPS", "100000",
"SAI_ENI_ATTR_BW", "100000",
"SAI_ENI_ATTR_FLOWS", "100000",
"SAI_ENI_ATTR_ADMIN_STATE", "True",
"SAI_ENI_ATTR_HA_SCOPE_ID", "0",
Expand Down Expand Up @@ -178,7 +178,7 @@
"type": "SAI_OBJECT_TYPE_ENI",
"attributes": [
"SAI_ENI_ATTR_CPS", "10000",
"SAI_ENI_ATTR_PPS", "100000",
"SAI_ENI_ATTR_BW", "100000",
"SAI_ENI_ATTR_FLOWS", "100000",
"SAI_ENI_ATTR_ADMIN_STATE", "True",
"SAI_ENI_ATTR_HA_SCOPE_ID", "0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
###############################################################

TOTALPACKETS = 1000
PPS = 100
BW = 100
PACKET_LENGTH = 128
ENI_IP = "1.1.0.1"
NETWORK_IP1 = "1.128.0.1"
Expand Down Expand Up @@ -97,7 +97,7 @@
"attributes": [
"SAI_ENI_ATTR_CPS",
"10000",
"SAI_ENI_ATTR_PPS",
"SAI_ENI_ATTR_BW",
"100000",
"SAI_ENI_ATTR_FLOWS",
"100000",
Expand Down Expand Up @@ -176,7 +176,7 @@
"attributes": [
"SAI_ENI_ATTR_CPS",
"10000",
"SAI_ENI_ATTR_PPS",
"SAI_ENI_ATTR_BW",
"100000",
"SAI_ENI_ATTR_FLOWS",
"100000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"type": "SAI_OBJECT_TYPE_ENI",
"attributes": [
"SAI_ENI_ATTR_CPS", "10000",
"SAI_ENI_ATTR_PPS", "100000",
"SAI_ENI_ATTR_BW", "100000",
"SAI_ENI_ATTR_FLOWS", "100000",
"SAI_ENI_ATTR_ADMIN_STATE", "True",
"SAI_ENI_ATTR_HA_SCOPE_ID", "0",
Expand Down Expand Up @@ -109,7 +109,7 @@
"type": "SAI_OBJECT_TYPE_ENI",
"attributes": [
"SAI_ENI_ATTR_CPS", "10000",
"SAI_ENI_ATTR_PPS", "100000",
"SAI_ENI_ATTR_BW", "100000",
"SAI_ENI_ATTR_FLOWS", "100000",
"SAI_ENI_ATTR_ADMIN_STATE", "True",
"SAI_ENI_ATTR_HA_SCOPE_ID", "0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_vnet_eni_create(self, dpu):
"attributes": [
"SAI_ENI_ATTR_CPS",
"10000",
"SAI_ENI_ATTR_PPS",
"SAI_ENI_ATTR_BW",
"100000",
"SAI_ENI_ATTR_FLOWS",
"100000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_vnet_inbound_routing_entry_create_setup(self, dpu):
"attributes": [
"SAI_ENI_ATTR_CPS",
"10000",
"SAI_ENI_ATTR_PPS",
"SAI_ENI_ATTR_BW",
"100000",
"SAI_ENI_ATTR_FLOWS",
"100000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_vnet_outbound_routing_entry_create(self, dpu):
"attributes": [
"SAI_ENI_ATTR_CPS",
"10000",
"SAI_ENI_ATTR_PPS",
"SAI_ENI_ATTR_BW",
"100000",
"SAI_ENI_ATTR_FLOWS",
"100000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_vm_to_vm_commn_acl_inbound(self, dataplane):
# send n packets and stop
f2.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f2.rate.pps = PPS
f2.rate.bw = BW
f2.metrics.enable = True

outer_eth, ip, udp, vxlan, inner_eth, inner_ip , inner_udp= (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
###############################################################

TOTALPACKETS = 1000
PPS = 100
TRAFFIC_SLEEP_TIME = (TOTALPACKETS / PPS) + 2
BW = 100
TRAFFIC_SLEEP_TIME = (TOTALPACKETS / BW) + 2
PACKET_LENGTH = 128
ENI_IP = "1.1.0.1"
NETWORK_IP2 = "1.128.0.2"
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_vm_to_vm_commn_acl_outbound(self, dataplane):
# send n packets and stop
f1.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f1.rate.pps = PPS
f1.rate.bw = BW
f1.metrics.enable = True

outer_eth1, ip1, udp1, vxlan1, inner_eth1, inner_ip1, inner_udp1= (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_vm_to_vm_commn_udp_bidir(self, dataplane):
# send n packets and stop
f1.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f1.rate.pps = PPS
f1.rate.bw = BW
f1.metrics.enable = True

outer_eth1, ip1, udp1, vxlan1, inner_eth1, inner_ip1, inner_udp1= (
Expand Down Expand Up @@ -110,7 +110,7 @@ def test_vm_to_vm_commn_udp_bidir(self, dataplane):
# send n packets and stop
f2.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f2.rate.pps = PPS
f2.rate.bw = BW
f2.metrics.enable = True

outer_eth, ip, udp, vxlan, inner_eth, inner_ip , inner_udp= (
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_vm_to_vm_commn_udp_bidir(self, dataplane):
# send n packets and stop
f3.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f3.rate.pps = PPS
f3.rate.bw = BW
f3.metrics.enable = True

outer_eth, ip, udp, vxlan, inner_eth, inner_ip , inner_udp= (
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_vm_to_vm_commn_udp_bidir(self, dataplane):
# send n packets and stop
f4.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f4.rate.pps = PPS
f4.rate.bw = BW
f4.metrics.enable = True

outer_eth, ip, udp, vxlan, inner_eth, inner_ip , inner_udp= (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_vm_to_vm_commn_udp_inbound(self, dataplane):
# send n packets and stop
f1.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f1.rate.pps = PPS
f1.rate.bw = BW
f1.metrics.enable = True

outer_eth1, ip1, udp1, vxlan1, inner_eth1, inner_ip1, inner_udp1= (
Expand Down Expand Up @@ -101,7 +101,7 @@ def test_vm_to_vm_commn_udp_inbound(self, dataplane):
# send n packets and stop
f2.duration.fixed_packets.packets = TOTALPACKETS
# send n packets per second
f2.rate.pps = PPS
f2.rate.bw = BW
f2.metrics.enable = True

outer_eth, ip, udp, vxlan, inner_eth, inner_ip , inner_udp= (
Expand Down
Loading
Loading