Commit 6009b61f authored by Horatiu Vultur's avatar Horatiu Vultur Committed by Paolo Abeni

net: microchip: vcap: Add vcap_rule_get_key_u32

Add the function vcap_rule_get_key_u32 which allows to get the value and
the mask of a key that exist on the rule. If the key doesn't exist,
it would return error.
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 2662b3f9
...@@ -2338,6 +2338,22 @@ int vcap_rule_add_key_u128(struct vcap_rule *rule, enum vcap_key_field key, ...@@ -2338,6 +2338,22 @@ int vcap_rule_add_key_u128(struct vcap_rule *rule, enum vcap_key_field key,
} }
EXPORT_SYMBOL_GPL(vcap_rule_add_key_u128); EXPORT_SYMBOL_GPL(vcap_rule_add_key_u128);
int vcap_rule_get_key_u32(struct vcap_rule *rule, enum vcap_key_field key,
u32 *value, u32 *mask)
{
struct vcap_client_keyfield *ckf;
ckf = vcap_find_keyfield(rule, key);
if (!ckf)
return -ENOENT;
*value = ckf->data.u32.value;
*mask = ckf->data.u32.mask;
return 0;
}
EXPORT_SYMBOL_GPL(vcap_rule_get_key_u32);
/* Find a client action field in a rule */ /* Find a client action field in a rule */
static struct vcap_client_actionfield * static struct vcap_client_actionfield *
vcap_find_actionfield(struct vcap_rule *rule, enum vcap_action_field act) vcap_find_actionfield(struct vcap_rule *rule, enum vcap_action_field act)
......
...@@ -258,4 +258,8 @@ int vcap_rule_mod_action_u32(struct vcap_rule *rule, ...@@ -258,4 +258,8 @@ int vcap_rule_mod_action_u32(struct vcap_rule *rule,
enum vcap_action_field action, enum vcap_action_field action,
u32 value); u32 value);
/* Get a 32 bit key field value and mask from the rule */
int vcap_rule_get_key_u32(struct vcap_rule *rule, enum vcap_key_field key,
u32 *value, u32 *mask);
#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