[P4-dev] HLIR and p4_action

hemant at mnkcg.com hemant at mnkcg.com
Thu Nov 3 08:05:34 EDT 2016


I am playing with stateful.p4 included in the tests directory with the
p4-hlir.  The stateful.p4 source code contains only two actions shown below.

 

action hop(ttl, egress_spec) {

    add_to_field(ttl, -1);

    modify_field(standard_metadata.egress_spec, egress_spec, 0xFFFFFFFF);

}

 

action hop_ipv4(egress_spec) {

    hop(ipv4.ttl, egress_spec);

}

 

I am using the p4-shell to inspect hlir info.   The h.p4_actions includes a
kitchen sink of actions followed by the two actions implemented in the
stateful.p4 source code.  What if a user of the HLIR would like to see
his/her defined methods only?

 

>>> h.p4_actions.items()

[('subtract', p4_action.subtract), ('no_op', p4_action.no_op),
('remove_header', p4_action.remove_header),
('modify_field_with_hash_based_offset',
p4_action.modify_field_with_hash_based_offset), ('add_header',
p4_action.add_header), ('execute_meter', p4_action.execute_meter),
('bit_and', p4_action.bit_and), ('subtract_from_field',
p4_action.subtract_from_field), ('register_write',
p4_action.register_write), ('add', p4_action.add), ('modify_field',
p4_action.modify_field), ('count', p4_action.count), ('truncate',
p4_action.truncate), ('clone_egress_pkt_to_egress',
p4_action.clone_egress_pkt_to_egress), ('bit_or', p4_action.bit_or), ('pop',
p4_action.pop), ('register_read', p4_action.register_read), ('bit_xor',
p4_action.bit_xor), ('recirculate', p4_action.recirculate), ('resubmit',
p4_action.resubmit), ('add_to_field', p4_action.add_to_field), ('drop',
p4_action.drop), ('copy_header', p4_action.copy_header), ('generate_digest',
p4_action.generate_digest), ('push', p4_action.push),
('clone_ingress_pkt_to_egress', p4_action.clone_ingress_pkt_to_egress),
('hop', p4_action.hop), ('hop_ipv4', p4_action.hop_ipv4), ('drop_pkt',
p4_action.drop_pkt)]

 

Thanks,

 

Hemant

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161103/cee49eca/attachment-0002.html>


More information about the P4-dev mailing list