#include <linux/types.h>
#include "vcap_api_private.h"
static int keyfield_size_table[] = …;
static int actionfield_size_table[] = …;
struct vcap_rule_move { … };
struct vcap_enabled_port { … };
void vcap_iter_set(struct vcap_stream_iter *itr, int sw_width,
const struct vcap_typegroup *tg, u32 offset)
{ … }
static void vcap_iter_skip_tg(struct vcap_stream_iter *itr)
{ … }
void vcap_iter_update(struct vcap_stream_iter *itr)
{ … }
void vcap_iter_init(struct vcap_stream_iter *itr, int sw_width,
const struct vcap_typegroup *tg, u32 offset)
{ … }
void vcap_iter_next(struct vcap_stream_iter *itr)
{ … }
static void vcap_set_bit(u32 *stream, struct vcap_stream_iter *itr, bool value)
{ … }
static void vcap_encode_bit(u32 *stream, struct vcap_stream_iter *itr, bool val)
{ … }
static void vcap_encode_field(u32 *stream, struct vcap_stream_iter *itr,
int width, const u8 *value)
{ … }
static void vcap_encode_typegroups(u32 *stream, int sw_width,
const struct vcap_typegroup *tg,
bool mask)
{ … }
static bool vcap_bitarray_zero(int width, u8 *value)
{ … }
static bool vcap_get_bit(u32 *stream, struct vcap_stream_iter *itr)
{ … }
static void vcap_decode_field(u32 *stream, struct vcap_stream_iter *itr,
int width, u8 *value)
{ … }
static bool vcap_verify_keystream_keyset(struct vcap_control *vctrl,
enum vcap_type vt,
u32 *keystream,
u32 *mskstream,
enum vcap_keyfield_set keyset)
{ … }
static int vcap_verify_typegroups(u32 *stream, int sw_width,
const struct vcap_typegroup *tgt, bool mask,
int sw_max)
{ … }
static int vcap_find_keystream_typegroup_sw(struct vcap_control *vctrl,
enum vcap_type vt, u32 *stream,
bool mask, int sw_max)
{ … }
int
vcap_find_keystream_keysets(struct vcap_control *vctrl,
enum vcap_type vt,
u32 *keystream,
u32 *mskstream,
bool mask, int sw_max,
struct vcap_keyset_list *kslist)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_addr_keysets(struct vcap_control *vctrl,
struct net_device *ndev,
struct vcap_admin *admin,
int addr,
struct vcap_keyset_list *kslist)
{ … }
EXPORT_SYMBOL_GPL(…);
const struct vcap_field *vcap_keyfields(struct vcap_control *vctrl,
enum vcap_type vt,
enum vcap_keyfield_set keyset)
{ … }
const struct vcap_set *vcap_keyfieldset(struct vcap_control *vctrl,
enum vcap_type vt,
enum vcap_keyfield_set keyset)
{ … }
EXPORT_SYMBOL_GPL(…);
const struct vcap_typegroup *
vcap_keyfield_typegroup(struct vcap_control *vctrl,
enum vcap_type vt, enum vcap_keyfield_set keyset)
{ … }
int vcap_keyfield_count(struct vcap_control *vctrl,
enum vcap_type vt, enum vcap_keyfield_set keyset)
{ … }
static void vcap_encode_keyfield(struct vcap_rule_internal *ri,
const struct vcap_client_keyfield *kf,
const struct vcap_field *rf,
const struct vcap_typegroup *tgt)
{ … }
static void vcap_encode_keyfield_typegroups(struct vcap_control *vctrl,
struct vcap_rule_internal *ri,
const struct vcap_typegroup *tgt)
{ … }
static void vcap_copy_to_w32be(u8 *dst, const u8 *src, int size)
{ … }
static void
vcap_copy_from_client_keyfield(struct vcap_rule *rule,
struct vcap_client_keyfield *dst,
const struct vcap_client_keyfield *src)
{ … }
static void
vcap_copy_from_client_actionfield(struct vcap_rule *rule,
struct vcap_client_actionfield *dst,
const struct vcap_client_actionfield *src)
{ … }
static int vcap_encode_rule_keyset(struct vcap_rule_internal *ri)
{ … }
const struct vcap_field *
vcap_actionfields(struct vcap_control *vctrl,
enum vcap_type vt, enum vcap_actionfield_set actionset)
{ … }
const struct vcap_set *
vcap_actionfieldset(struct vcap_control *vctrl,
enum vcap_type vt, enum vcap_actionfield_set actionset)
{ … }
const struct vcap_typegroup *
vcap_actionfield_typegroup(struct vcap_control *vctrl,
enum vcap_type vt, enum vcap_actionfield_set actionset)
{ … }
int vcap_actionfield_count(struct vcap_control *vctrl,
enum vcap_type vt,
enum vcap_actionfield_set actionset)
{ … }
static void vcap_encode_actionfield(struct vcap_rule_internal *ri,
const struct vcap_client_actionfield *af,
const struct vcap_field *rf,
const struct vcap_typegroup *tgt)
{ … }
static void vcap_encode_actionfield_typegroups(struct vcap_rule_internal *ri,
const struct vcap_typegroup *tgt)
{ … }
static int vcap_encode_rule_actionset(struct vcap_rule_internal *ri)
{ … }
static int vcap_encode_rule(struct vcap_rule_internal *ri)
{ … }
int vcap_api_check(struct vcap_control *ctrl)
{ … }
void vcap_erase_cache(struct vcap_rule_internal *ri)
{ … }
int vcap_set_rule_set_keyset(struct vcap_rule *rule,
enum vcap_keyfield_set keyset)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_set_rule_set_actionset(struct vcap_rule *rule,
enum vcap_actionfield_set actionset)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool vcap_rule_exists(struct vcap_control *vctrl, u32 id)
{ … }
static struct vcap_rule_internal *
vcap_get_locked_rule(struct vcap_control *vctrl, u32 id)
{ … }
int vcap_lookup_rule_by_cookie(struct vcap_control *vctrl, u64 cookie)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_admin_rule_count(struct vcap_admin *admin, int cid)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct vcap_rule_internal *vcap_dup_rule(struct vcap_rule_internal *ri,
bool full)
{ … }
static void vcap_apply_width(u8 *dst, int width, int bytes)
{ … }
static void vcap_copy_from_w32be(u8 *dst, u8 *src, int size, int width)
{ … }
static void vcap_copy_action_bit_field(struct vcap_u1_action *field, u8 *value)
{ … }
static void vcap_copy_limited_actionfield(u8 *dstvalue, u8 *srcvalue,
int width, int bytes)
{ … }
static void vcap_copy_to_client_actionfield(struct vcap_rule_internal *ri,
struct vcap_client_actionfield *field,
u8 *value, u16 width)
{ … }
static void vcap_copy_key_bit_field(struct vcap_u1_key *field,
u8 *value, u8 *mask)
{ … }
static void vcap_copy_limited_keyfield(u8 *dstvalue, u8 *dstmask,
u8 *srcvalue, u8 *srcmask,
int width, int bytes)
{ … }
static void vcap_copy_to_client_keyfield(struct vcap_rule_internal *ri,
struct vcap_client_keyfield *field,
u8 *value, u8 *mask, u16 width)
{ … }
static void vcap_rule_alloc_keyfield(struct vcap_rule_internal *ri,
const struct vcap_field *keyfield,
enum vcap_key_field key,
u8 *value, u8 *mask)
{ … }
static bool
vcap_verify_actionstream_actionset(struct vcap_control *vctrl,
enum vcap_type vt,
u32 *actionstream,
enum vcap_actionfield_set actionset)
{ … }
static int vcap_find_actionstream_typegroup_sw(struct vcap_control *vctrl,
enum vcap_type vt, u32 *stream,
int sw_max)
{ … }
static enum vcap_actionfield_set
vcap_find_actionstream_actionset(struct vcap_control *vctrl,
enum vcap_type vt,
u32 *stream,
int sw_max)
{ … }
static void vcap_rule_alloc_actionfield(struct vcap_rule_internal *ri,
const struct vcap_field *actionfield,
enum vcap_action_field action,
u8 *value)
{ … }
static int vcap_decode_actionset(struct vcap_rule_internal *ri)
{ … }
static int vcap_decode_keyset(struct vcap_rule_internal *ri)
{ … }
static int vcap_read_rule(struct vcap_rule_internal *ri)
{ … }
static int vcap_write_rule(struct vcap_rule_internal *ri)
{ … }
static int vcap_write_counter(struct vcap_rule_internal *ri,
struct vcap_counter *ctr)
{ … }
int vcap_chain_id_to_lookup(struct vcap_admin *admin, int cur_cid)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vcap_admin *vcap_find_admin(struct vcap_control *vctrl, int cid)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool vcap_admin_is_last(struct vcap_control *vctrl,
struct vcap_admin *admin,
bool ingress)
{ … }
int vcap_chain_offset(struct vcap_control *vctrl, int from_cid, int to_cid)
{ … }
EXPORT_SYMBOL_GPL(…);
bool vcap_is_next_lookup(struct vcap_control *vctrl, int src_cid, int dst_cid)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_rule_space(struct vcap_admin *admin, int size)
{ … }
static int vcap_add_type_keyfield(struct vcap_rule *rule)
{ … }
static int vcap_add_type_actionfield(struct vcap_rule *rule)
{ … }
bool vcap_keyset_list_add(struct vcap_keyset_list *keysetlist,
enum vcap_keyfield_set keyset)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool vcap_actionset_list_add(struct vcap_actionset_list *actionsetlist,
enum vcap_actionfield_set actionset)
{ … }
const char *vcap_keyset_name(struct vcap_control *vctrl,
enum vcap_keyfield_set keyset)
{ … }
EXPORT_SYMBOL_GPL(…);
const char *vcap_keyfield_name(struct vcap_control *vctrl,
enum vcap_key_field key)
{ … }
EXPORT_SYMBOL_GPL(…);
const char *vcap_actionset_name(struct vcap_control *vctrl,
enum vcap_actionfield_set actionset)
{ … }
const char *vcap_actionfield_name(struct vcap_control *vctrl,
enum vcap_action_field action)
{ … }
static const struct vcap_field *
vcap_find_keyset_keyfield(struct vcap_control *vctrl,
enum vcap_type vtype,
enum vcap_keyfield_set keyset,
enum vcap_key_field key)
{ … }
static bool _vcap_rule_find_keysets(struct vcap_rule_internal *ri,
struct vcap_keyset_list *matches)
{ … }
bool vcap_rule_find_keysets(struct vcap_rule *rule,
struct vcap_keyset_list *matches)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct vcap_field *
vcap_find_actionset_actionfield(struct vcap_control *vctrl,
enum vcap_type vtype,
enum vcap_actionfield_set actionset,
enum vcap_action_field action)
{ … }
static bool vcap_rule_find_actionsets(struct vcap_rule_internal *ri,
struct vcap_actionset_list *matches)
{ … }
int vcap_val_rule(struct vcap_rule *rule, u16 l3_proto)
{ … }
EXPORT_SYMBOL_GPL(…);
static u32 vcap_sort_key(u32 max_size, u32 size, u8 user, u16 prio)
{ … }
static u32 vcap_next_rule_addr(u32 addr, struct vcap_rule_internal *ri)
{ … }
static u32 vcap_set_rule_id(struct vcap_rule_internal *ri)
{ … }
static int vcap_insert_rule(struct vcap_rule_internal *ri,
struct vcap_rule_move *move)
{ … }
static void vcap_move_rules(struct vcap_rule_internal *ri,
struct vcap_rule_move *move)
{ … }
static bool vcap_is_chain_used(struct vcap_control *vctrl,
struct net_device *ndev, int src_cid)
{ … }
static int vcap_get_next_chain(struct vcap_control *vctrl,
struct net_device *ndev,
int dst_cid)
{ … }
static bool vcap_path_exist(struct vcap_control *vctrl, struct net_device *ndev,
int dst_cid)
{ … }
static void vcap_rule_set_state(struct vcap_rule_internal *ri)
{ … }
int vcap_add_rule(struct vcap_rule *rule)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vcap_rule *vcap_alloc_rule(struct vcap_control *vctrl,
struct net_device *ndev, int vcap_chain_id,
enum vcap_user user, u16 priority,
u32 id)
{ … }
EXPORT_SYMBOL_GPL(…);
void vcap_free_rule(struct vcap_rule *rule)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vcap_rule *vcap_decode_rule(struct vcap_rule_internal *elem)
{ … }
struct vcap_rule *vcap_get_rule(struct vcap_control *vctrl, u32 id)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_mod_rule(struct vcap_rule *rule)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_valid_rule_move(struct vcap_rule_internal *el, int offset)
{ … }
static void vcap_adjust_rule_addr(struct vcap_rule_internal *el, int offset)
{ … }
static int vcap_fill_rule_gap(struct vcap_rule_internal *ri)
{ … }
int vcap_del_rule(struct vcap_control *vctrl, struct net_device *ndev, u32 id)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_del_rules(struct vcap_control *vctrl, struct vcap_admin *admin)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct vcap_client_keyfield *
vcap_find_keyfield(struct vcap_rule *rule, enum vcap_key_field key)
{ … }
const struct vcap_field *vcap_lookup_keyfield(struct vcap_rule *rule,
enum vcap_key_field key)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool vcap_keyfield_unique(struct vcap_rule *rule,
enum vcap_key_field key)
{ … }
static bool vcap_keyfield_match_keyset(struct vcap_rule *rule,
enum vcap_key_field key)
{ … }
static int vcap_rule_add_key(struct vcap_rule *rule,
enum vcap_key_field key,
enum vcap_field_type ftype,
struct vcap_client_keyfield_data *data)
{ … }
static void vcap_rule_set_key_bitsize(struct vcap_u1_key *u1, enum vcap_bit val)
{ … }
int vcap_rule_add_key_bit(struct vcap_rule *rule, enum vcap_key_field key,
enum vcap_bit val)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_add_key_u32(struct vcap_rule *rule, enum vcap_key_field key,
u32 value, u32 mask)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_add_key_u48(struct vcap_rule *rule, enum vcap_key_field key,
struct vcap_u48_key *fieldval)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_add_key_u72(struct vcap_rule *rule, enum vcap_key_field key,
struct vcap_u72_key *fieldval)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_add_key_u128(struct vcap_rule *rule, enum vcap_key_field key,
struct vcap_u128_key *fieldval)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_get_key_u32(struct vcap_rule *rule, enum vcap_key_field key,
u32 *value, u32 *mask)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vcap_client_actionfield *
vcap_find_actionfield(struct vcap_rule *rule, enum vcap_action_field act)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool vcap_actionfield_unique(struct vcap_rule *rule,
enum vcap_action_field act)
{ … }
static bool vcap_actionfield_match_actionset(struct vcap_rule *rule,
enum vcap_action_field action)
{ … }
static int vcap_rule_add_action(struct vcap_rule *rule,
enum vcap_action_field action,
enum vcap_field_type ftype,
struct vcap_client_actionfield_data *data)
{ … }
static void vcap_rule_set_action_bitsize(struct vcap_u1_action *u1,
enum vcap_bit val)
{ … }
int vcap_rule_add_action_bit(struct vcap_rule *rule,
enum vcap_action_field action,
enum vcap_bit val)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_add_action_u32(struct vcap_rule *rule,
enum vcap_action_field action,
u32 value)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_add_action_u72(struct vcap_rule *rule,
enum vcap_action_field action,
struct vcap_u72_action *fieldval)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_read_counter(struct vcap_rule_internal *ri,
struct vcap_counter *ctr)
{ … }
void vcap_netbytes_copy(u8 *dst, u8 *src, int count)
{ … }
EXPORT_SYMBOL_GPL(…);
void vcap_set_tc_exterr(struct flow_cls_offload *fco, struct vcap_rule *vrule)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_enable_rule(struct vcap_rule_internal *ri)
{ … }
static int vcap_enable_rules(struct vcap_control *vctrl,
struct net_device *ndev, int chain)
{ … }
static int vcap_disable_rule(struct vcap_rule_internal *ri)
{ … }
static int vcap_disable_rules(struct vcap_control *vctrl,
struct net_device *ndev, int chain)
{ … }
static bool vcap_is_enabled(struct vcap_control *vctrl, struct net_device *ndev,
int dst_cid)
{ … }
static int vcap_enable(struct vcap_control *vctrl, struct net_device *ndev,
unsigned long cookie, int src_cid, int dst_cid)
{ … }
static int vcap_disable(struct vcap_control *vctrl, struct net_device *ndev,
unsigned long cookie)
{ … }
int vcap_enable_lookups(struct vcap_control *vctrl, struct net_device *ndev,
int src_cid, int dst_cid, unsigned long cookie,
bool enable)
{ … }
EXPORT_SYMBOL_GPL(…);
bool vcap_is_last_chain(struct vcap_control *vctrl, int cid, bool ingress)
{ … }
EXPORT_SYMBOL_GPL(…);
void vcap_rule_set_counter_id(struct vcap_rule *rule, u32 counter_id)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_set_counter(struct vcap_rule *rule, struct vcap_counter *ctr)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_get_counter(struct vcap_rule *rule, struct vcap_counter *ctr)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_rule_get_key(struct vcap_rule *rule,
enum vcap_key_field key,
struct vcap_client_keyfield *ckf)
{ … }
static int vcap_rule_get_untyped_keyset(struct vcap_rule_internal *ri,
struct vcap_keyset_list *matches)
{ … }
int vcap_rule_get_keysets(struct vcap_rule_internal *ri,
struct vcap_keyset_list *matches)
{ … }
int vcap_get_rule_count_by_cookie(struct vcap_control *vctrl,
struct vcap_counter *ctr, u64 cookie)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_rule_mod_key(struct vcap_rule *rule,
enum vcap_key_field key,
enum vcap_field_type ftype,
struct vcap_client_keyfield_data *data)
{ … }
int vcap_rule_mod_key_u32(struct vcap_rule *rule, enum vcap_key_field key,
u32 value, u32 mask)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_rule_rem_key(struct vcap_rule *rule, enum vcap_key_field key)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vcap_rule_mod_action(struct vcap_rule *rule,
enum vcap_action_field action,
enum vcap_field_type ftype,
struct vcap_client_actionfield_data *data)
{ … }
int vcap_rule_mod_action_u32(struct vcap_rule *rule,
enum vcap_action_field action,
u32 value)
{ … }
EXPORT_SYMBOL_GPL(…);
int vcap_filter_rule_keys(struct vcap_rule *rule,
enum vcap_key_field keylist[], int length,
bool drop_unsupported)
{ … }
EXPORT_SYMBOL_GPL(…);
enum vcap_keyfield_set
vcap_select_min_rule_keyset(struct vcap_control *vctrl,
enum vcap_type vtype,
struct vcap_keyset_list *kslist)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vcap_rule *vcap_copy_rule(struct vcap_rule *erule)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_VCAP_KUNIT_TEST
#include "vcap_api_kunit.c"
#endif