Skip to content

Commit

Permalink
Add ENI admin state (sonic-net#133)
Browse files Browse the repository at this point in the history
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
  • Loading branch information
marian-pritsak authored Jun 27, 2022
1 parent 9f8d1c8 commit 7b5ce5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct eni_data_t {
bit<32> cps;
bit<32> pps;
bit<32> flows;
bit<1> admin_state;
}

struct metadata_t {
Expand Down
14 changes: 10 additions & 4 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ control dash_ingress(inout headers_t hdr,

action set_eni_attrs(bit<32> cps,
bit<32> pps,
bit<32> flows) {
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
meta.eni_data.flows = flows;
bit<32> flows,
bit<1> admin_state) {
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
meta.eni_data.flows = flows;
meta.eni_data.admin_state = admin_state;
}

@name("eni|dash")
Expand Down Expand Up @@ -208,6 +210,10 @@ control dash_ingress(inout headers_t hdr,
hdr.ethernet.dst_addr;
eni_ether_address_map.apply();
eni.apply();
if (meta.eni_data.admin_state == 0) {
deny();
return;
}

if (meta.direction == direction_t.OUTBOUND) {
outbound.apply(hdr, meta, standard_metadata);
Expand Down

0 comments on commit 7b5ce5e

Please sign in to comment.