Linux Audio

Check our new training course

Loading...
v6.8
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/****************************************************************************
  3 * Driver for Solarflare network controllers and boards
  4 * Copyright 2019 Solarflare Communications Inc.
  5 * Copyright 2020-2022 Xilinx Inc.
  6 *
  7 * This program is free software; you can redistribute it and/or modify it
  8 * under the terms of the GNU General Public License version 2 as published
  9 * by the Free Software Foundation, incorporated herein by reference.
 10 */
 11
 12#ifndef EF100_MAE_H
 13#define EF100_MAE_H
 14/* MCDI interface for the ef100 Match-Action Engine */
 15
 16#include <net/devlink.h>
 17#include "net_driver.h"
 18#include "tc.h"
 19#include "mcdi_pcol.h" /* needed for various MC_CMD_MAE_*_NULL defines */
 20
 21int efx_mae_allocate_mport(struct efx_nic *efx, u32 *id, u32 *label);
 22int efx_mae_free_mport(struct efx_nic *efx, u32 id);
 23
 24void efx_mae_mport_wire(struct efx_nic *efx, u32 *out);
 25void efx_mae_mport_uplink(struct efx_nic *efx, u32 *out);
 26void efx_mae_mport_vf(struct efx_nic *efx, u32 vf_id, u32 *out);
 27void efx_mae_mport_mport(struct efx_nic *efx, u32 mport_id, u32 *out);
 28
 29int efx_mae_lookup_mport(struct efx_nic *efx, u32 selector, u32 *id);
 30
 31struct mae_mport_desc {
 32	u32 mport_id;
 33	u32 flags;
 34	u32 caller_flags; /* enum mae_mport_desc_caller_flags */
 35	u32 mport_type; /* MAE_MPORT_DESC_MPORT_TYPE_* */
 36	union {
 37		u32 port_idx; /* for mport_type == NET_PORT */
 38		u32 alias_mport_id; /* for mport_type == ALIAS */
 39		struct { /* for mport_type == VNIC */
 40			u32 vnic_client_type; /* MAE_MPORT_DESC_VNIC_CLIENT_TYPE_* */
 41			u32 interface_idx;
 42			u16 pf_idx;
 43			u16 vf_idx;
 44		};
 45	};
 46	struct rhash_head linkage;
 47	struct devlink_port dl_port;
 48};
 49
 50int efx_mae_enumerate_mports(struct efx_nic *efx);
 51struct mae_mport_desc *efx_mae_get_mport(struct efx_nic *efx, u32 mport_id);
 52void efx_mae_put_mport(struct efx_nic *efx, struct mae_mport_desc *desc);
 53
 54/**
 55 * struct efx_mae - MAE information
 56 *
 57 * @efx: The associated NIC
 58 * @mports_ht: m-port descriptions from MC_CMD_MAE_MPORT_READ_JOURNAL
 59 */
 60struct efx_mae {
 61	struct efx_nic *efx;
 62	struct rhashtable mports_ht;
 63};
 64
 65int efx_mae_start_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue);
 66int efx_mae_stop_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue);
 67void efx_mae_counters_grant_credits(struct work_struct *work);
 68
 69int efx_mae_get_tables(struct efx_nic *efx);
 70void efx_mae_free_tables(struct efx_nic *efx);
 71
 72#define MAE_NUM_FIELDS	(MAE_FIELD_ENC_VNET_ID + 1)
 73
 74struct mae_caps {
 75	u32 match_field_count;
 76	u32 encap_types;
 77	u32 action_prios;
 78	u8 action_rule_fields[MAE_NUM_FIELDS];
 79	u8 outer_rule_fields[MAE_NUM_FIELDS];
 80};
 81
 82int efx_mae_get_caps(struct efx_nic *efx, struct mae_caps *caps);
 83
 84int efx_mae_match_check_caps(struct efx_nic *efx,
 85			     const struct efx_tc_match_fields *mask,
 86			     struct netlink_ext_ack *extack);
 87int efx_mae_match_check_caps_lhs(struct efx_nic *efx,
 88				 const struct efx_tc_match_fields *mask,
 89				 struct netlink_ext_ack *extack);
 90int efx_mae_check_encap_match_caps(struct efx_nic *efx, bool ipv6,
 91				   u8 ip_tos_mask, __be16 udp_sport_mask,
 92				   struct netlink_ext_ack *extack);
 93int efx_mae_check_encap_type_supported(struct efx_nic *efx,
 94				       enum efx_encap_type typ);
 95
 96int efx_mae_allocate_counter(struct efx_nic *efx, struct efx_tc_counter *cnt);
 97int efx_mae_free_counter(struct efx_nic *efx, struct efx_tc_counter *cnt);
 98
 99int efx_mae_allocate_encap_md(struct efx_nic *efx,
100			      struct efx_tc_encap_action *encap);
101int efx_mae_update_encap_md(struct efx_nic *efx,
102			    struct efx_tc_encap_action *encap);
103int efx_mae_free_encap_md(struct efx_nic *efx,
104			  struct efx_tc_encap_action *encap);
105
106int efx_mae_allocate_pedit_mac(struct efx_nic *efx,
107			       struct efx_tc_mac_pedit_action *ped);
108void efx_mae_free_pedit_mac(struct efx_nic *efx,
109			    struct efx_tc_mac_pedit_action *ped);
110int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act);
111int efx_mae_free_action_set(struct efx_nic *efx, u32 fw_id);
112
113int efx_mae_alloc_action_set_list(struct efx_nic *efx,
114				  struct efx_tc_action_set_list *acts);
115int efx_mae_free_action_set_list(struct efx_nic *efx,
116				 struct efx_tc_action_set_list *acts);
117
118int efx_mae_register_encap_match(struct efx_nic *efx,
119				 struct efx_tc_encap_match *encap);
120int efx_mae_unregister_encap_match(struct efx_nic *efx,
121				   struct efx_tc_encap_match *encap);
122int efx_mae_insert_lhs_rule(struct efx_nic *efx, struct efx_tc_lhs_rule *rule,
123			    u32 prio);
124int efx_mae_remove_lhs_rule(struct efx_nic *efx, struct efx_tc_lhs_rule *rule);
125struct efx_tc_ct_entry; /* see tc_conntrack.h */
126int efx_mae_insert_ct(struct efx_nic *efx, struct efx_tc_ct_entry *conn);
127int efx_mae_remove_ct(struct efx_nic *efx, struct efx_tc_ct_entry *conn);
128
129int efx_mae_insert_rule(struct efx_nic *efx, const struct efx_tc_match *match,
130			u32 prio, u32 acts_id, u32 *id);
131int efx_mae_update_rule(struct efx_nic *efx, u32 acts_id, u32 id);
132int efx_mae_delete_rule(struct efx_nic *efx, u32 id);
133
134int efx_init_mae(struct efx_nic *efx);
135void efx_fini_mae(struct efx_nic *efx);
136void efx_mae_remove_mport(void *desc, void *arg);
137int efx_mae_fw_lookup_mport(struct efx_nic *efx, u32 selector, u32 *id);
138int efx_mae_lookup_mport(struct efx_nic *efx, u32 vf, u32 *id);
139#endif /* EF100_MAE_H */
v6.2
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/****************************************************************************
 3 * Driver for Solarflare network controllers and boards
 4 * Copyright 2019 Solarflare Communications Inc.
 5 * Copyright 2020-2022 Xilinx Inc.
 6 *
 7 * This program is free software; you can redistribute it and/or modify it
 8 * under the terms of the GNU General Public License version 2 as published
 9 * by the Free Software Foundation, incorporated herein by reference.
10 */
11
12#ifndef EF100_MAE_H
13#define EF100_MAE_H
14/* MCDI interface for the ef100 Match-Action Engine */
15
 
16#include "net_driver.h"
17#include "tc.h"
18#include "mcdi_pcol.h" /* needed for various MC_CMD_MAE_*_NULL defines */
19
20int efx_mae_allocate_mport(struct efx_nic *efx, u32 *id, u32 *label);
21int efx_mae_free_mport(struct efx_nic *efx, u32 id);
22
23void efx_mae_mport_wire(struct efx_nic *efx, u32 *out);
24void efx_mae_mport_uplink(struct efx_nic *efx, u32 *out);
25void efx_mae_mport_vf(struct efx_nic *efx, u32 vf_id, u32 *out);
26void efx_mae_mport_mport(struct efx_nic *efx, u32 mport_id, u32 *out);
27
28int efx_mae_lookup_mport(struct efx_nic *efx, u32 selector, u32 *id);
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30int efx_mae_start_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue);
31int efx_mae_stop_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue);
32void efx_mae_counters_grant_credits(struct work_struct *work);
33
 
 
 
34#define MAE_NUM_FIELDS	(MAE_FIELD_ENC_VNET_ID + 1)
35
36struct mae_caps {
37	u32 match_field_count;
 
38	u32 action_prios;
39	u8 action_rule_fields[MAE_NUM_FIELDS];
 
40};
41
42int efx_mae_get_caps(struct efx_nic *efx, struct mae_caps *caps);
43
44int efx_mae_match_check_caps(struct efx_nic *efx,
45			     const struct efx_tc_match_fields *mask,
46			     struct netlink_ext_ack *extack);
 
 
 
 
 
 
 
 
47
48int efx_mae_allocate_counter(struct efx_nic *efx, struct efx_tc_counter *cnt);
49int efx_mae_free_counter(struct efx_nic *efx, struct efx_tc_counter *cnt);
50
 
 
 
 
 
 
 
 
 
 
 
51int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act);
52int efx_mae_free_action_set(struct efx_nic *efx, u32 fw_id);
53
54int efx_mae_alloc_action_set_list(struct efx_nic *efx,
55				  struct efx_tc_action_set_list *acts);
56int efx_mae_free_action_set_list(struct efx_nic *efx,
57				 struct efx_tc_action_set_list *acts);
58
 
 
 
 
 
 
 
 
 
 
 
59int efx_mae_insert_rule(struct efx_nic *efx, const struct efx_tc_match *match,
60			u32 prio, u32 acts_id, u32 *id);
 
61int efx_mae_delete_rule(struct efx_nic *efx, u32 id);
62
 
 
 
 
 
63#endif /* EF100_MAE_H */