drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / drivers / net / ethernet / sfc / mae.h
blobdb79912c86d8cef6db43de825430b1428a528490
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.
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.
12 #ifndef EF100_MAE_H
13 #define EF100_MAE_H
14 /* MCDI interface for the ef100 Match-Action Engine */
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 */
21 int efx_mae_allocate_mport(struct efx_nic *efx, u32 *id, u32 *label);
22 int efx_mae_free_mport(struct efx_nic *efx, u32 id);
24 void efx_mae_mport_wire(struct efx_nic *efx, u32 *out);
25 void efx_mae_mport_uplink(struct efx_nic *efx, u32 *out);
26 void efx_mae_mport_mport(struct efx_nic *efx, u32 mport_id, u32 *out);
28 int efx_mae_lookup_mport(struct efx_nic *efx, u32 selector, u32 *id);
30 struct mae_mport_desc {
31 u32 mport_id;
32 u32 flags;
33 u32 caller_flags; /* enum mae_mport_desc_caller_flags */
34 u32 mport_type; /* MAE_MPORT_DESC_MPORT_TYPE_* */
35 union {
36 u32 port_idx; /* for mport_type == NET_PORT */
37 u32 alias_mport_id; /* for mport_type == ALIAS */
38 struct { /* for mport_type == VNIC */
39 u32 vnic_client_type; /* MAE_MPORT_DESC_VNIC_CLIENT_TYPE_* */
40 u32 interface_idx;
41 u16 pf_idx;
42 u16 vf_idx;
45 struct rhash_head linkage;
46 struct devlink_port dl_port;
49 int efx_mae_enumerate_mports(struct efx_nic *efx);
50 struct mae_mport_desc *efx_mae_get_mport(struct efx_nic *efx, u32 mport_id);
51 void efx_mae_put_mport(struct efx_nic *efx, struct mae_mport_desc *desc);
53 /**
54 * struct efx_mae - MAE information
56 * @efx: The associated NIC
57 * @mports_ht: m-port descriptions from MC_CMD_MAE_MPORT_READ_JOURNAL
59 struct efx_mae {
60 struct efx_nic *efx;
61 struct rhashtable mports_ht;
64 int efx_mae_start_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue);
65 int efx_mae_stop_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue);
66 void efx_mae_counters_grant_credits(struct work_struct *work);
68 int efx_mae_get_tables(struct efx_nic *efx);
69 void efx_mae_free_tables(struct efx_nic *efx);
71 #define MAE_NUM_FIELDS (MAE_FIELD_ENC_VNET_ID + 1)
73 struct mae_caps {
74 u32 match_field_count;
75 u32 encap_types;
76 u32 action_prios;
77 u8 action_rule_fields[MAE_NUM_FIELDS];
78 u8 outer_rule_fields[MAE_NUM_FIELDS];
81 int efx_mae_get_caps(struct efx_nic *efx, struct mae_caps *caps);
83 int efx_mae_match_check_caps(struct efx_nic *efx,
84 const struct efx_tc_match_fields *mask,
85 struct netlink_ext_ack *extack);
86 int efx_mae_match_check_caps_lhs(struct efx_nic *efx,
87 const struct efx_tc_match_fields *mask,
88 struct netlink_ext_ack *extack);
89 int efx_mae_check_encap_match_caps(struct efx_nic *efx, bool ipv6,
90 u8 ip_tos_mask, __be16 udp_sport_mask,
91 struct netlink_ext_ack *extack);
92 int efx_mae_check_encap_type_supported(struct efx_nic *efx,
93 enum efx_encap_type typ);
95 int efx_mae_allocate_counter(struct efx_nic *efx, struct efx_tc_counter *cnt);
96 int efx_mae_free_counter(struct efx_nic *efx, struct efx_tc_counter *cnt);
98 int efx_mae_allocate_encap_md(struct efx_nic *efx,
99 struct efx_tc_encap_action *encap);
100 int efx_mae_update_encap_md(struct efx_nic *efx,
101 struct efx_tc_encap_action *encap);
102 int efx_mae_free_encap_md(struct efx_nic *efx,
103 struct efx_tc_encap_action *encap);
105 int efx_mae_allocate_pedit_mac(struct efx_nic *efx,
106 struct efx_tc_mac_pedit_action *ped);
107 void efx_mae_free_pedit_mac(struct efx_nic *efx,
108 struct efx_tc_mac_pedit_action *ped);
109 int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act);
110 int efx_mae_free_action_set(struct efx_nic *efx, u32 fw_id);
112 int efx_mae_alloc_action_set_list(struct efx_nic *efx,
113 struct efx_tc_action_set_list *acts);
114 int efx_mae_free_action_set_list(struct efx_nic *efx,
115 struct efx_tc_action_set_list *acts);
117 int efx_mae_register_encap_match(struct efx_nic *efx,
118 struct efx_tc_encap_match *encap);
119 int efx_mae_unregister_encap_match(struct efx_nic *efx,
120 struct efx_tc_encap_match *encap);
121 int efx_mae_insert_lhs_rule(struct efx_nic *efx, struct efx_tc_lhs_rule *rule,
122 u32 prio);
123 int efx_mae_remove_lhs_rule(struct efx_nic *efx, struct efx_tc_lhs_rule *rule);
124 struct efx_tc_ct_entry; /* see tc_conntrack.h */
125 int efx_mae_insert_ct(struct efx_nic *efx, struct efx_tc_ct_entry *conn);
126 int efx_mae_remove_ct(struct efx_nic *efx, struct efx_tc_ct_entry *conn);
128 int efx_mae_insert_rule(struct efx_nic *efx, const struct efx_tc_match *match,
129 u32 prio, u32 acts_id, u32 *id);
130 int efx_mae_update_rule(struct efx_nic *efx, u32 acts_id, u32 id);
131 int efx_mae_delete_rule(struct efx_nic *efx, u32 id);
133 int efx_init_mae(struct efx_nic *efx);
134 void efx_fini_mae(struct efx_nic *efx);
135 void efx_mae_remove_mport(void *desc, void *arg);
136 int efx_mae_fw_lookup_mport(struct efx_nic *efx, u32 selector, u32 *id);
137 int efx_mae_lookup_mport(struct efx_nic *efx, u32 vf, u32 *id);
138 #endif /* EF100_MAE_H */