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 20 int efx_mae_allocate_mport(struct efx_nic *efx, u32 *id, u32 *label); 21 int efx_mae_free_mport(struct efx_nic *efx, u32 id); 22 23 void efx_mae_mport_wire(struct efx_nic *efx, u32 *out); 24 void efx_mae_mport_uplink(struct efx_nic *efx, u32 *out); 25 void efx_mae_mport_vf(struct efx_nic *efx, u32 vf_id, u32 *out); 26 void efx_mae_mport_mport(struct efx_nic *efx, u32 mport_id, u32 *out); 27 28 int efx_mae_lookup_mport(struct efx_nic *efx, u32 selector, u32 *id); 29 30 int efx_mae_start_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue); 31 int efx_mae_stop_counters(struct efx_nic *efx, struct efx_rx_queue *rx_queue); 32 void efx_mae_counters_grant_credits(struct work_struct *work); 33 34 #define MAE_NUM_FIELDS (MAE_FIELD_ENC_VNET_ID + 1) 35 36 struct mae_caps { 37 u32 match_field_count; 38 u32 action_prios; 39 u8 action_rule_fields[MAE_NUM_FIELDS]; 40 }; 41 42 int efx_mae_get_caps(struct efx_nic *efx, struct mae_caps *caps); 43 44 int efx_mae_match_check_caps(struct efx_nic *efx, 45 const struct efx_tc_match_fields *mask, 46 struct netlink_ext_ack *extack); 47 48 int efx_mae_allocate_counter(struct efx_nic *efx, struct efx_tc_counter *cnt); 49 int efx_mae_free_counter(struct efx_nic *efx, struct efx_tc_counter *cnt); 50 51 int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act); 52 int efx_mae_free_action_set(struct efx_nic *efx, u32 fw_id); 53 54 int efx_mae_alloc_action_set_list(struct efx_nic *efx, 55 struct efx_tc_action_set_list *acts); 56 int efx_mae_free_action_set_list(struct efx_nic *efx, 57 struct efx_tc_action_set_list *acts); 58 59 int efx_mae_insert_rule(struct efx_nic *efx, const struct efx_tc_match *match, 60 u32 prio, u32 acts_id, u32 *id); 61 int efx_mae_delete_rule(struct efx_nic *efx, u32 id); 62 63 #endif /* EF100_MAE_H */ 64