Commit 8e10490b authored by Steen Hegelund's avatar Steen Hegelund Committed by David S. Miller

net: microchip: sparx5: Adding basic rule management in VCAP API

This provides most of the rule handling needed to add a new rule to a VCAP.
To add a rule a client must follow these steps:

1) Allocate a new rule (provide an id or get one automatically assigned)
2) Add keys to the rule
3) Add actions to the rule
4) Optionally set a keyset on the rule
5) Optionally set an actionset on the rule
6) Validate the rule (this will add keyset and actionset if not specified
   in the previous steps)
7) Add the rule (if the validation was successful)
8) Free the rule instance (a copy has been added to the VCAP)

The validation step will fail if there are no keysets with the requested
keys, or there are no actionsets with the requested actions.
The validation will also fail if the keyset is not configured for the port
for the requested protocol).
Signed-off-by: default avatarSteen Hegelund <steen.hegelund@microchip.com>
Tested-by: default avatarCasper Andersson <casper.casan@gmail.com>
Reviewed-by: default avatarCasper Andersson <casper.casan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46be056e
...@@ -519,6 +519,7 @@ void sparx5_vcap_destroy(struct sparx5 *sparx5) ...@@ -519,6 +519,7 @@ void sparx5_vcap_destroy(struct sparx5 *sparx5)
list_for_each_entry_safe(admin, admin_next, &ctrl->list, list) { list_for_each_entry_safe(admin, admin_next, &ctrl->list, list) {
sparx5_vcap_port_key_deselection(sparx5, admin); sparx5_vcap_port_key_deselection(sparx5, admin);
vcap_del_rules(ctrl, admin);
list_del(&admin->list); list_del(&admin->list);
sparx5_vcap_admin_free(admin); sparx5_vcap_admin_free(admin);
} }
......
...@@ -196,4 +196,7 @@ void vcap_netbytes_copy(u8 *dst, u8 *src, int count); ...@@ -196,4 +196,7 @@ void vcap_netbytes_copy(u8 *dst, u8 *src, int count);
/* Convert validation error code into tc extact error message */ /* Convert validation error code into tc extact error message */
void vcap_set_tc_exterr(struct flow_cls_offload *fco, struct vcap_rule *vrule); void vcap_set_tc_exterr(struct flow_cls_offload *fco, struct vcap_rule *vrule);
/* Cleanup a VCAP instance */
int vcap_del_rules(struct vcap_control *vctrl, struct vcap_admin *admin);
#endif /* __VCAP_API_CLIENT__ */ #endif /* __VCAP_API_CLIENT__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment