net/ice/base: add ACL module

Add all ACL related code.

Signed-off-by: Real Valiquette <real.valiquette@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
This commit is contained in:
Qi Zhang 2020-03-23 15:17:48 +08:00 committed by Ferruh Yigit
parent ac882a0eda
commit f3202a097f
13 changed files with 3620 additions and 19 deletions

View File

@ -51,6 +51,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_flex_pipe.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcb.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_fdir.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_acl.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_acl_ctrl.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_rxtx.c

View File

@ -0,0 +1,629 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2001-2020
*/
#include "ice_acl.h"
#include "ice_adminq_cmd.h"
/**
* ice_aq_alloc_acl_tbl - allocate ACL table
* @hw: pointer to the HW struct
* @tbl: pointer to ice_acl_alloc_tbl struct
* @cd: pointer to command details structure or NULL
*
* Allocate ACL table (indirect 0x0C10)
*/
enum ice_status
ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl,
struct ice_sq_cd *cd)
{
struct ice_aqc_acl_alloc_table *cmd;
struct ice_aq_desc desc;
if (!tbl->act_pairs_per_entry)
return ICE_ERR_PARAM;
if (tbl->act_pairs_per_entry > ICE_AQC_MAX_ACTION_MEMORIES)
return ICE_ERR_MAX_LIMIT;
/* If this is concurrent table, then buffer shall be valid and
* contain DependentAllocIDs, 'num_dependent_alloc_ids' should be valid
* and within limit
*/
if (tbl->concurr) {
if (!tbl->num_dependent_alloc_ids)
return ICE_ERR_PARAM;
if (tbl->num_dependent_alloc_ids >
ICE_AQC_MAX_CONCURRENT_ACL_TBL)
return ICE_ERR_INVAL_SIZE;
}
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_alloc_acl_tbl);
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
cmd = &desc.params.alloc_table;
cmd->table_width = CPU_TO_LE16(tbl->width * BITS_PER_BYTE);
cmd->table_depth = CPU_TO_LE16(tbl->depth);
cmd->act_pairs_per_entry = tbl->act_pairs_per_entry;
if (tbl->concurr)
cmd->table_type = tbl->num_dependent_alloc_ids;
return ice_aq_send_cmd(hw, &desc, &tbl->buf, sizeof(tbl->buf), cd);
}
/**
* ice_aq_dealloc_acl_tbl - deallocate ACL table
* @hw: pointer to the HW struct
* @alloc_id: allocation ID of the table being released
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Deallocate ACL table (indirect 0x0C11)
*
* NOTE: This command has no buffer format for command itself but response
* format is 'struct ice_aqc_acl_generic', pass ptr to that struct
* as 'buf' and its size as 'buf_size'
*/
enum ice_status
ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
{
struct ice_aqc_acl_tbl_actpair *cmd;
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_dealloc_acl_tbl);
cmd = &desc.params.tbl_actpair;
cmd->alloc_id = CPU_TO_LE16(alloc_id);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
static enum ice_status
ice_aq_acl_entry(struct ice_hw *hw, u16 opcode, u8 tcam_idx, u16 entry_idx,
struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
{
struct ice_aqc_acl_entry *cmd;
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, opcode);
if (opcode == ice_aqc_opc_program_acl_entry)
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
cmd = &desc.params.program_query_entry;
cmd->tcam_index = tcam_idx;
cmd->entry_index = CPU_TO_LE16(entry_idx);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_aq_program_acl_entry - program ACL entry
* @hw: pointer to the HW struct
* @tcam_idx: Updated TCAM block index
* @entry_idx: updated entry index
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Program ACL entry (direct 0x0C20)
*/
enum ice_status
ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
{
return ice_aq_acl_entry(hw, ice_aqc_opc_program_acl_entry, tcam_idx,
entry_idx, buf, cd);
}
/**
* ice_aq_query_acl_entry - query ACL entry
* @hw: pointer to the HW struct
* @tcam_idx: Updated TCAM block index
* @entry_idx: updated entry index
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Query ACL entry (direct 0x0C24)
*
* NOTE: Caller of this API to parse 'buf' appropriately since it contains
* response (key and key invert)
*/
enum ice_status
ice_aq_query_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
{
return ice_aq_acl_entry(hw, ice_aqc_opc_query_acl_entry, tcam_idx,
entry_idx, buf, cd);
}
/* Helper function to alloc/dealloc ACL action pair */
static enum ice_status
ice_aq_actpair_a_d(struct ice_hw *hw, u16 opcode, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
{
struct ice_aqc_acl_tbl_actpair *cmd;
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, opcode);
cmd = &desc.params.tbl_actpair;
cmd->alloc_id = CPU_TO_LE16(alloc_id);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_aq_alloc_actpair - allocate actionpair for specified ACL table
* @hw: pointer to the HW struct
* @alloc_id: allocation ID of the table being associated with the actionpair
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Allocate ACL actionpair (direct 0x0C12)
*
* This command doesn't need and doesn't have its own command buffer
* but for response format is as specified in 'struct ice_aqc_acl_generic'
*/
enum ice_status
ice_aq_alloc_actpair(struct ice_hw *hw, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
{
return ice_aq_actpair_a_d(hw, ice_aqc_opc_alloc_acl_actpair, alloc_id,
buf, cd);
}
/**
* ice_aq_dealloc_actpair - dealloc actionpair for specified ACL table
* @hw: pointer to the HW struct
* @alloc_id: allocation ID of the table being associated with the actionpair
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Deallocate ACL actionpair (direct 0x0C13)
*/
enum ice_status
ice_aq_dealloc_actpair(struct ice_hw *hw, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
{
return ice_aq_actpair_a_d(hw, ice_aqc_opc_dealloc_acl_actpair, alloc_id,
buf, cd);
}
/* Helper function to program/query ACL action pair */
static enum ice_status
ice_aq_actpair_p_q(struct ice_hw *hw, u16 opcode, u8 act_mem_idx,
u16 act_entry_idx, struct ice_aqc_actpair *buf,
struct ice_sq_cd *cd)
{
struct ice_aqc_acl_actpair *cmd;
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, opcode);
if (opcode == ice_aqc_opc_program_acl_actpair)
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
cmd = &desc.params.program_query_actpair;
cmd->act_mem_index = act_mem_idx;
cmd->act_entry_index = CPU_TO_LE16(act_entry_idx);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_aq_program_actpair - program ACL actionpair
* @hw: pointer to the HW struct
* @act_mem_idx: action memory index to program/update/query
* @act_entry_idx: the entry index in action memory to be programmed/updated
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Program action entries (indirect 0x0C1C)
*/
enum ice_status
ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
struct ice_aqc_actpair *buf, struct ice_sq_cd *cd)
{
return ice_aq_actpair_p_q(hw, ice_aqc_opc_program_acl_actpair,
act_mem_idx, act_entry_idx, buf, cd);
}
/**
* ice_aq_query_actpair - query ACL actionpair
* @hw: pointer to the HW struct
* @act_mem_idx: action memory index to program/update/query
* @act_entry_idx: the entry index in action memory to be programmed/updated
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Query ACL actionpair (indirect 0x0C25)
*/
enum ice_status
ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
struct ice_aqc_actpair *buf, struct ice_sq_cd *cd)
{
return ice_aq_actpair_p_q(hw, ice_aqc_opc_query_acl_actpair,
act_mem_idx, act_entry_idx, buf, cd);
}
/**
* ice_aq_dealloc_acl_res - deallocate ACL resources
* @hw: pointer to the HW struct
* @cd: pointer to command details structure or NULL
*
* ACL - de-allocate (direct 0x0C1A) resources. Used by SW to release all the
* resources allocated for it using a single command
*/
enum ice_status ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
{
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_dealloc_acl_res);
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
}
/**
* ice_acl_prof_aq_send - sending acl profile aq commands
* @hw: pointer to the HW struct
* @opc: command opcode
* @prof_id: profile ID
* @buf: ptr to buffer
* @cd: pointer to command details structure or NULL
*
* This function sends ACL profile commands
*/
static enum ice_status
ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,
struct ice_aqc_acl_prof_generic_frmt *buf,
struct ice_sq_cd *cd)
{
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, opc);
desc.params.profile.profile_id = prof_id;
if (opc == ice_aqc_opc_program_acl_prof_extraction ||
opc == ice_aqc_opc_program_acl_prof_ranges)
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_prgm_acl_prof_extrt - program ACL profile extraction sequence
* @hw: pointer to the HW struct
* @prof_id: profile ID
* @buf: ptr to buffer
* @cd: pointer to command details structure or NULL
*
* ACL - program ACL profile extraction (indirect 0x0C1D)
*/
enum ice_status
ice_prgm_acl_prof_extrt(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_prof_generic_frmt *buf,
struct ice_sq_cd *cd)
{
return ice_acl_prof_aq_send(hw, ice_aqc_opc_program_acl_prof_extraction,
prof_id, buf, cd);
}
/**
* ice_query_acl_prof - query ACL profile
* @hw: pointer to the HW struct
* @prof_id: profile ID
* @buf: ptr to buffer (which will contain response of this command)
* @cd: pointer to command details structure or NULL
*
* ACL - query ACL profile (indirect 0x0C21)
*/
enum ice_status
ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_prof_generic_frmt *buf,
struct ice_sq_cd *cd)
{
return ice_acl_prof_aq_send(hw, ice_aqc_opc_query_acl_prof, prof_id,
buf, cd);
}
/**
* ice_aq_acl_cntrs_chk_params - Checks ACL counter parameters
* @cntrs: ptr to buffer describing input and output params
*
* This function checks the counter bank range for counter type and returns
* success or failure.
*/
static enum ice_status ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
{
enum ice_status status = ICE_SUCCESS;
if (!cntrs || !cntrs->amount)
return ICE_ERR_PARAM;
switch (cntrs->type) {
case ICE_AQC_ACL_CNT_TYPE_SINGLE:
/* Single counter type - configured to count either bytes
* or packets, the valid values for byte or packet counters
* shall be 0-3.
*/
if (cntrs->bank > ICE_AQC_ACL_MAX_CNT_SINGLE)
status = ICE_ERR_OUT_OF_RANGE;
break;
case ICE_AQC_ACL_CNT_TYPE_DUAL:
/* Pair counter type - counts number of bytes and packets
* The valid values for byte/packet counter duals shall be 0-1
*/
if (cntrs->bank > ICE_AQC_ACL_MAX_CNT_DUAL)
status = ICE_ERR_OUT_OF_RANGE;
break;
default:
/* Unspecified counter type - Invalid or error*/
status = ICE_ERR_PARAM;
}
return status;
}
/**
* ice_aq_alloc_acl_cntrs - allocate ACL counters
* @hw: pointer to the HW struct
* @cntrs: ptr to buffer describing input and output params
* @cd: pointer to command details structure or NULL
*
* ACL - allocate (indirect 0x0C16) counters. This function attempts to
* allocate a contiguous block of counters. In case of failures, caller can
* attempt to allocate a smaller chunk. The allocation is considered
* unsuccessful if returned counter value is invalid. In this case it returns
* an error otherwise success.
*/
enum ice_status
ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
struct ice_sq_cd *cd)
{
struct ice_aqc_acl_alloc_counters *cmd;
u16 first_cntr, last_cntr;
struct ice_aq_desc desc;
enum ice_status status;
/* check for invalid params */
status = ice_aq_acl_cntrs_chk_params(cntrs);
if (status)
return status;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_alloc_acl_counters);
cmd = &desc.params.alloc_counters;
cmd->counter_amount = cntrs->amount;
cmd->counters_type = cntrs->type;
cmd->bank_alloc = cntrs->bank;
status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
if (!status) {
first_cntr = LE16_TO_CPU(cmd->ops.resp.first_counter);
last_cntr = LE16_TO_CPU(cmd->ops.resp.last_counter);
if (first_cntr == ICE_AQC_ACL_ALLOC_CNT_INVAL ||
last_cntr == ICE_AQC_ACL_ALLOC_CNT_INVAL)
return ICE_ERR_OUT_OF_RANGE;
cntrs->first_cntr = first_cntr;
cntrs->last_cntr = last_cntr;
}
return status;
}
/**
* ice_aq_dealloc_acl_cntrs - deallocate ACL counters
* @hw: pointer to the HW struct
* @cntrs: ptr to buffer describing input and output params
* @cd: pointer to command details structure or NULL
*
* ACL - de-allocate (direct 0x0C17) counters.
* This function deallocate ACL counters.
*/
enum ice_status
ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
struct ice_sq_cd *cd)
{
struct ice_aqc_acl_dealloc_counters *cmd;
struct ice_aq_desc desc;
enum ice_status status;
/* check for invalid params */
status = ice_aq_acl_cntrs_chk_params(cntrs);
if (status)
return status;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_dealloc_acl_counters);
cmd = &desc.params.dealloc_counters;
cmd->first_counter = CPU_TO_LE16(cntrs->first_cntr);
cmd->last_counter = CPU_TO_LE16(cntrs->last_cntr);
cmd->counters_type = cntrs->type;
cmd->bank_alloc = cntrs->bank;
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
}
/**
* ice_aq_query_acl_cntrs - query ACL counter
* @hw: pointer to the HW struct
* @bank: queries counter bank
* @index: queried counter index
* @cntr_val: pointer to counter or packet counter value
* @cd: pointer to command details structure or NULL
*
* ACL - query ACL counter (direct 0x0C27)
*/
enum ice_status
ice_aq_query_acl_cntrs(struct ice_hw *hw, u8 bank, u16 index, u64 *cntr_val,
struct ice_sq_cd *cd)
{
struct ice_aqc_acl_query_counter *cmd;
struct ice_aq_desc desc;
enum ice_status status;
if (!cntr_val)
return ICE_ERR_PARAM;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_query_acl_counter);
cmd = &desc.params.query_counter;
cmd->counter_index = CPU_TO_LE16(index);
cmd->counter_bank = bank;
status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
if (!status) {
__le64 resp_val = 0;
ice_memcpy(&resp_val, cmd->ops.resp.val,
sizeof(cmd->ops.resp.val), ICE_NONDMA_TO_NONDMA);
*cntr_val = LE64_TO_CPU(resp_val);
}
return status;
}
/**
* ice_prog_acl_prof_ranges - program ACL profile ranges
* @hw: pointer to the HW struct
* @prof_id: programmed or updated profile ID
* @buf: pointer to input buffer
* @cd: pointer to command details structure or NULL
*
* ACL - program ACL profile ranges (indirect 0x0C1E)
*/
enum ice_status
ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_profile_ranges *buf,
struct ice_sq_cd *cd)
{
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc,
ice_aqc_opc_program_acl_prof_ranges);
desc.params.profile.profile_id = prof_id;
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_query_acl_prof_ranges - query ACL profile ranges
* @hw: pointer to the HW struct
* @prof_id: programmed or updated profile ID
* @buf: pointer to response buffer
* @cd: pointer to command details structure or NULL
*
* ACL - query ACL profile ranges (indirect 0x0C22)
*/
enum ice_status
ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_profile_ranges *buf,
struct ice_sq_cd *cd)
{
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc,
ice_aqc_opc_query_acl_prof_ranges);
desc.params.profile.profile_id = prof_id;
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_aq_alloc_acl_scen - allocate ACL scenario
* @hw: pointer to the HW struct
* @scen_id: memory location to receive allocated scenario ID
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Allocate ACL scenario (indirect 0x0C14)
*/
enum ice_status
ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
{
struct ice_aqc_acl_alloc_scen *cmd;
struct ice_aq_desc desc;
enum ice_status status;
if (!scen_id)
return ICE_ERR_PARAM;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_alloc_acl_scen);
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
cmd = &desc.params.alloc_scen;
status = ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
if (!status)
*scen_id = LE16_TO_CPU(cmd->ops.resp.scen_id);
return status;
}
/**
* ice_aq_dealloc_acl_scen - deallocate ACL scenario
* @hw: pointer to the HW struct
* @scen_id: scen_id to be deallocated (input and output field)
* @cd: pointer to command details structure or NULL
*
* Deallocate ACL scenario (direct 0x0C15)
*/
enum ice_status
ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_sq_cd *cd)
{
struct ice_aqc_acl_dealloc_scen *cmd;
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_dealloc_acl_scen);
cmd = &desc.params.dealloc_scen;
cmd->scen_id = CPU_TO_LE16(scen_id);
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
}
/**
* ice_aq_update_query_scen - update or query ACL scenario
* @hw: pointer to the HW struct
* @opcode: aq command opcode for either query or update scenario
* @scen_id: scen_id to be updated or queried
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Calls update or query ACL scenario
*/
static enum ice_status
ice_aq_update_query_scen(struct ice_hw *hw, u16 opcode, u16 scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
{
struct ice_aqc_acl_update_query_scen *cmd;
struct ice_aq_desc desc;
ice_fill_dflt_direct_cmd_desc(&desc, opcode);
if (opcode == ice_aqc_opc_update_acl_scen)
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
cmd = &desc.params.update_query_scen;
cmd->scen_id = CPU_TO_LE16(scen_id);
return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
}
/**
* ice_aq_update_acl_scen - update ACL scenario
* @hw: pointer to the HW struct
* @scen_id: scen_id to be updated
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Update ACL scenario (indirect 0x0C1B)
*/
enum ice_status
ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
{
return ice_aq_update_query_scen(hw, ice_aqc_opc_update_acl_scen,
scen_id, buf, cd);
}
/**
* ice_aq_query_acl_scen - query ACL scenario
* @hw: pointer to the HW struct
* @scen_id: scen_id to be queried
* @buf: address of indirect data buffer
* @cd: pointer to command details structure or NULL
*
* Query ACL scenario (indirect 0x0C23)
*/
enum ice_status
ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
{
return ice_aq_update_query_scen(hw, ice_aqc_opc_query_acl_scen,
scen_id, buf, cd);
}

View File

@ -0,0 +1,206 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2001-2020
*/
#ifndef _ICE_ACL_H_
#define _ICE_ACL_H_
#include "ice_common.h"
#include "ice_adminq_cmd.h"
struct ice_acl_tbl_params {
u16 width; /* Select/match bytes */
u16 depth; /* Number of entries */
#define ICE_ACL_TBL_MAX_DEP_TBLS 15
u16 dep_tbls[ICE_ACL_TBL_MAX_DEP_TBLS];
u8 entry_act_pairs; /* Action pairs per entry */
u8 concurr; /* Concurrent table lookup enable */
};
struct ice_acl_act_mem {
u8 act_mem;
#define ICE_ACL_ACT_PAIR_MEM_INVAL 0xff
u8 member_of_tcam;
};
struct ice_acl_tbl {
/* TCAM configuration */
u8 first_tcam; /* Index of the first TCAM block */
u8 last_tcam; /* Index of the last TCAM block */
/* Index of the first entry in the first TCAM */
u16 first_entry;
/* Index of the last entry in the last TCAM */
u16 last_entry;
/* List of active scenarios */
struct LIST_HEAD_TYPE scens;
struct ice_acl_tbl_params info;
struct ice_acl_act_mem act_mems[ICE_AQC_MAX_ACTION_MEMORIES];
/* Keep track of available 64-entry chunks in TCAMs */
ice_declare_bitmap(avail, ICE_AQC_ACL_ALLOC_UNITS);
u16 id;
};
#define ICE_MAX_ACL_TCAM_ENTRY (ICE_AQC_ACL_TCAM_DEPTH * ICE_AQC_ACL_SLICES)
enum ice_acl_entry_prior {
ICE_LOW = 0,
ICE_NORMAL,
ICE_HIGH,
ICE_MAX_PRIOR
};
/* Scenario structure
* A scenario is a logical partition within an ACL table. It can span more
* than one TCAM in cascade mode to support select/mask key widths larger.
* than the width of a TCAM. It can also span more than one TCAM in stacked
* mode to support larger number of entries than what a TCAM can hold. It is
* used to select values from selection bases (field vectors holding extract
* protocol header fields) to form lookup keys, and to associate action memory
* banks to the TCAMs used.
*/
struct ice_acl_scen {
struct LIST_ENTRY_TYPE list_entry;
/* If nth bit of act_mem_bitmap is set, then nth action memory will
* participate in this scenario
*/
ice_declare_bitmap(act_mem_bitmap, ICE_AQC_MAX_ACTION_MEMORIES);
/* If nth bit of entry_bitmap is set, then nth entry will
* be available in this scenario
*/
ice_declare_bitmap(entry_bitmap, ICE_MAX_ACL_TCAM_ENTRY);
u16 first_idx[ICE_MAX_PRIOR];
u16 last_idx[ICE_MAX_PRIOR];
u16 id;
u16 start; /* Number of entry from the start of the parent table */
#define ICE_ACL_SCEN_MIN_WIDTH 0x3
u16 width; /* Number of select/mask bytes */
u16 num_entry; /* Number of scenario entry */
u16 end; /* Last addressable entry from start of table */
u8 eff_width; /* Available width in bytes to match */
#define ICE_ACL_SCEN_PKT_DIR_IDX_IN_TCAM 0x2
#define ICE_ACL_SCEN_PID_IDX_IN_TCAM 0x3
#define ICE_ACL_SCEN_RNG_CHK_IDX_IN_TCAM 0x4
u8 pid_idx; /* Byte index used to match profile ID */
u8 rng_chk_idx; /* Byte index used to match range checkers result */
u8 pkt_dir_idx; /* Byte index used to match packet direction */
};
/* This structure represents input fields needed to allocate ACL table */
struct ice_acl_alloc_tbl {
/* Table's width in number of bytes matched */
u16 width;
/* Table's depth in number of entries. */
u16 depth;
u8 num_dependent_alloc_ids; /* number of depdendent alloc IDs */
u8 concurr; /* true for concurrent table type */
/* Amount of action pairs per table entry. Minimal valid
* value for this field is 1 (e.g. single pair of actions)
*/
u8 act_pairs_per_entry;
union {
struct ice_aqc_acl_alloc_table_data data_buf;
struct ice_aqc_acl_generic resp_buf;
} buf;
};
/* This structure is used to communicate input and output params for
* [de]allocate_acl_counters
*/
struct ice_acl_cntrs {
u8 amount;
u8 type;
u8 bank;
/* Next 2 variables are used for output in case of alloc_acl_counters
* and input in case of deallocate_acl_counters
*/
u16 first_cntr;
u16 last_cntr;
};
enum ice_status
ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params);
enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw);
enum ice_status
ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,
u16 *scen_id);
enum ice_status ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id);
enum ice_status
ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl,
struct ice_sq_cd *cd);
enum ice_status
ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_query_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_alloc_actpair(struct ice_hw *hw, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_dealloc_actpair(struct ice_hw *hw, u16 alloc_id,
struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
struct ice_aqc_actpair *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
struct ice_aqc_actpair *buf, struct ice_sq_cd *cd);
enum ice_status ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd);
enum ice_status
ice_prgm_acl_prof_extrt(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_prof_generic_frmt *buf,
struct ice_sq_cd *cd);
enum ice_status
ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_prof_generic_frmt *buf,
struct ice_sq_cd *cd);
enum ice_status
ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
struct ice_sq_cd *cd);
enum ice_status
ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
struct ice_sq_cd *cd);
enum ice_status
ice_aq_query_acl_cntrs(struct ice_hw *hw, u8 bank, u16 index, u64 *cntr_val,
struct ice_sq_cd *cd);
enum ice_status
ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_profile_ranges *buf,
struct ice_sq_cd *cd);
enum ice_status
ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
struct ice_aqc_acl_profile_ranges *buf,
struct ice_sq_cd *cd);
enum ice_status
ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_sq_cd *cd);
enum ice_status
ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);
enum ice_status
ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id,
struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);
enum ice_status
ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
enum ice_acl_entry_prior prior, u8 *keys, u8 *inverts,
struct ice_acl_act_entry *acts, u8 acts_cnt, u16 *entry_idx);
enum ice_status
ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
struct ice_acl_act_entry *acts, u8 acts_cnt, u16 entry_idx);
enum ice_status
ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx);
#endif /* _ICE_ACL_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -419,6 +419,7 @@ struct ice_aqc_vsi_props {
#define ICE_AQ_VSI_PROP_RXQ_MAP_VALID BIT(6)
#define ICE_AQ_VSI_PROP_Q_OPT_VALID BIT(7)
#define ICE_AQ_VSI_PROP_OUTER_UP_VALID BIT(8)
#define ICE_AQ_VSI_PROP_ACL_VALID BIT(10)
#define ICE_AQ_VSI_PROP_FLOW_DIR_VALID BIT(11)
#define ICE_AQ_VSI_PROP_PASID_VALID BIT(12)
/* switch section */
@ -534,8 +535,16 @@ struct ice_aqc_vsi_props {
u8 q_opt_reserved[3];
/* outer up section */
__le32 outer_up_table; /* same structure and defines as ingress tbl */
/* section 10 */
__le16 sect_10_reserved;
/* acl section */
__le16 acl_def_act;
#define ICE_AQ_VSI_ACL_DEF_RX_PROF_S 0
#define ICE_AQ_VSI_ACL_DEF_RX_PROF_M (0xF << ICE_AQ_VSI_ACL_DEF_RX_PROF_S)
#define ICE_AQ_VSI_ACL_DEF_RX_TABLE_S 4
#define ICE_AQ_VSI_ACL_DEF_RX_TABLE_M (0xF << ICE_AQ_VSI_ACL_DEF_RX_TABLE_S)
#define ICE_AQ_VSI_ACL_DEF_TX_PROF_S 8
#define ICE_AQ_VSI_ACL_DEF_TX_PROF_M (0xF << ICE_AQ_VSI_ACL_DEF_TX_PROF_S)
#define ICE_AQ_VSI_ACL_DEF_TX_TABLE_S 12
#define ICE_AQ_VSI_ACL_DEF_TX_TABLE_M (0xF << ICE_AQ_VSI_ACL_DEF_TX_TABLE_S)
/* flow director section */
__le16 fd_options;
#define ICE_AQ_VSI_FD_ENABLE BIT(0)
@ -1694,6 +1703,7 @@ struct ice_aqc_nvm {
#define ICE_AQC_NVM_ACTIV_SEL_OROM BIT(4)
#define ICE_AQC_NVM_ACTIV_SEL_NETLIST BIT(5)
#define ICE_AQC_NVM_SPECIAL_UPDATE BIT(6)
#define ICE_AQC_NVM_REVERT_LAST_ACTIV BIT(6) /* Write Activate only */
#define ICE_AQC_NVM_ACTIV_SEL_MASK MAKEMASK(0x7, 3)
#define ICE_AQC_NVM_FLASH_ONLY BIT(7)
__le16 module_typeid;
@ -2010,6 +2020,418 @@ struct ice_aqc_clear_fd_table {
u8 reserved[12];
};
/* ACL - allocate (indirect 0x0C10) table */
#define ICE_AQC_ACL_KEY_WIDTH 40
#define ICE_AQC_ACL_KEY_WIDTH_BYTES 5
#define ICE_AQC_ACL_TCAM_DEPTH 512
#define ICE_ACL_ENTRY_ALLOC_UNIT 64
#define ICE_AQC_MAX_CONCURRENT_ACL_TBL 15
#define ICE_AQC_MAX_ACTION_MEMORIES 20
#define ICE_AQC_MAX_ACTION_ENTRIES 512
#define ICE_AQC_ACL_SLICES 16
#define ICE_AQC_ALLOC_ID_LESS_THAN_4K 0x1000
/* The ACL block supports up to 8 actions per a single output. */
#define ICE_AQC_TBL_MAX_ACTION_PAIRS 4
#define ICE_AQC_MAX_TCAM_ALLOC_UNITS (ICE_AQC_ACL_TCAM_DEPTH / \
ICE_ACL_ENTRY_ALLOC_UNIT)
#define ICE_AQC_ACL_ALLOC_UNITS (ICE_AQC_ACL_SLICES * \
ICE_AQC_MAX_TCAM_ALLOC_UNITS)
struct ice_aqc_acl_alloc_table {
__le16 table_width;
__le16 table_depth;
u8 act_pairs_per_entry;
/* For non-concurrent table allocation, this field needs
* to be set to zero(0) otherwise it shall specify the
* amount of concurrent tables whose AllocIDs are
* specified in buffer. Thus the newly allocated table
* is concurrent with table IDs specified in AllocIDs.
*/
#define ICE_AQC_ACL_ALLOC_TABLE_TYPE_NONCONCURR 0
u8 table_type;
__le16 reserved;
__le32 addr_high;
__le32 addr_low;
};
/* Allocate ACL table command buffer format */
struct ice_aqc_acl_alloc_table_data {
/* Dependent table AllocIDs. Each word in this 15 word array specifies
* a dependent table AllocID according to the amount specified in the
* "table_type" field. All unused words shall be set to 0xFFFF
*/
#define ICE_AQC_CONCURR_ID_INVALID 0xffff
__le16 alloc_ids[ICE_AQC_MAX_CONCURRENT_ACL_TBL];
};
/* ACL - deallocate (indirect 0x0C11) table
* ACL - allocate (indirect 0x0C12) action-pair
* ACL - deallocate (indirect 0x0C13) action-pair
*/
/* Following structure is common and used in case of deallocation
* of ACL table and action-pair
*/
struct ice_aqc_acl_tbl_actpair {
/* Alloc ID of the table being released */
__le16 alloc_id;
u8 reserved[6];
__le32 addr_high;
__le32 addr_low;
};
/* This response structure is same in case of alloc/dealloc table,
* alloc/dealloc action-pair
*/
struct ice_aqc_acl_generic {
/* if alloc_id is below 0x1000 then alllocation failed due to
* unavailable resources, else this is set by FW to identify
* table allocation
*/
__le16 alloc_id;
union {
/* to be used only in case of alloc/dealloc table */
struct {
/* Index of the first TCAM block, otherwise set to 0xFF
* for a failed allocation
*/
u8 first_tcam;
/* Index of the last TCAM block. This index shall be
* set to the value of first_tcam for single TCAM block
* allocation, otherwise set to 0xFF for a failed
* allocation
*/
u8 last_tcam;
} table;
/* reserved in case of alloc/dealloc action-pair */
struct {
__le16 reserved;
} act_pair;
} ops;
/* index of first entry (in both TCAM and action memories),
* otherwise set to 0xFF for a failed allocation
*/
__le16 first_entry;
/* index of last entry (in both TCAM and action memories),
* otherwise set to 0xFF for a failed allocation
*/
__le16 last_entry;
/* Each act_mem element specifies the order of the memory
* otherwise 0xFF
*/
u8 act_mem[ICE_AQC_MAX_ACTION_MEMORIES];
};
/* ACL - allocate (indirect 0x0C14) scenario. This command doesn't have separate
* response buffer since original command buffer gets updated with
* 'scen_id' in case of success
*/
struct ice_aqc_acl_alloc_scen {
union {
struct {
u8 reserved[8];
} cmd;
struct {
__le16 scen_id;
u8 reserved[6];
} resp;
} ops;
__le32 addr_high;
__le32 addr_low;
};
/* ACL - de-allocate (direct 0x0C15) scenario. This command doesn't need
* separate response buffer since nothing to be returned as a response
* except status.
*/
struct ice_aqc_acl_dealloc_scen {
__le16 scen_id;
u8 reserved[14];
};
/* ACL - update (direct 0x0C1B) scenario */
/* ACL - query (direct 0x0C23) scenario */
struct ice_aqc_acl_update_query_scen {
__le16 scen_id;
u8 reserved[6];
__le32 addr_high;
__le32 addr_low;
};
/* Input buffer format in case allocate/update ACL scenario and same format
* is used for response buffer in case of query ACL scenario.
* NOTE: de-allocate ACL scenario is direct command and doesn't require
* "buffer", hence no buffer format.
*/
struct ice_aqc_acl_scen {
struct {
/* Byte [x] selection for the TCAM key. This value must be set
* set to 0x0 for unusued TCAM.
* Only Bit 6..0 is used in each byte and MSB is reserved
*/
#define ICE_AQC_ACL_ALLOC_SCE_SELECT_M 0x7F
#define ICE_AQC_ACL_BYTE_SEL_BASE 0x20
#define ICE_AQC_ACL_BYTE_SEL_BASE_PID 0x3E
#define ICE_AQC_ACL_BYTE_SEL_BASE_PKT_DIR ICE_AQC_ACL_BYTE_SEL_BASE
#define ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK 0x3F
u8 tcam_select[5];
/* TCAM Block entry masking. This value should be set to 0x0 for
* unused TCAM
*/
u8 chnk_msk;
/* Bit 0 : masks TCAM entries 0-63
* Bit 1 : masks TCAM entries 64-127
* Bit 2 to 7 : follow the pattern of bit 0 and 1
*/
#define ICE_AQC_ACL_ALLOC_SCE_START_CMP BIT(0)
#define ICE_AQC_ACL_ALLOC_SCE_START_SET BIT(1)
u8 start_cmp_set;
} tcam_cfg[ICE_AQC_ACL_SLICES];
/* Each byte, Bit 6..0: Action memory association to a TCAM block,
* otherwise it shall be set to 0x0 for disabled memory action.
* Bit 7 : Action memory enable for this scenario
*/
#define ICE_AQC_ACL_SCE_ACT_MEM_TCAM_ASSOC_M 0x7F
#define ICE_AQC_ACL_SCE_ACT_MEM_EN BIT(7)
u8 act_mem_cfg[ICE_AQC_MAX_ACTION_MEMORIES];
};
/* ACL - allocate (indirect 0x0C16) counters */
struct ice_aqc_acl_alloc_counters {
/* Amount of contiguous counters requested. Min value is 1 and
* max value is 255
*/
#define ICE_AQC_ACL_ALLOC_CNT_MIN_AMT 0x1
#define ICE_AQC_ACL_ALLOC_CNT_MAX_AMT 0xFF
u8 counter_amount;
/* Counter type: 'single counter' which can be configured to count
* either bytes or packets
*/
#define ICE_AQC_ACL_CNT_TYPE_SINGLE 0x0
/* Counter type: 'counter pair' which counts number of bytes and number
* of packets.
*/
#define ICE_AQC_ACL_CNT_TYPE_DUAL 0x1
/* requested counter type, single/dual */
u8 counters_type;
/* counter bank allocation shall be 0-3 for 'byte or packet counter' */
#define ICE_AQC_ACL_MAX_CNT_SINGLE 0x3
/* counter bank allocation shall be 0-1 for 'byte and packet counter dual' */
#define ICE_AQC_ACL_MAX_CNT_DUAL 0x1
/* requested counter bank allocation */
u8 bank_alloc;
u8 reserved;
union {
/* Applicable only in case of command */
struct {
u8 reserved[12];
} cmd;
/* Applicable only in case of response */
#define ICE_AQC_ACL_ALLOC_CNT_INVAL 0xFFFF
struct {
/* Index of first allocated counter. 0xFFFF in case
* of unsuccessful allocation
*/
__le16 first_counter;
/* Index of last allocated counter. 0xFFFF in case
* of unsuccessful allocation
*/
__le16 last_counter;
u8 rsvd[8];
} resp;
} ops;
};
/* ACL - de-allocate (direct 0x0C17) counters */
struct ice_aqc_acl_dealloc_counters {
/* first counter being released */
__le16 first_counter;
/* last counter being released */
__le16 last_counter;
/* requested counter type, single/dual */
u8 counters_type;
/* requested counter bank allocation */
u8 bank_alloc;
u8 reserved[10];
};
/* ACL - de-allocate (direct 0x0C1A) resources. Used by SW to release all the
* resources allocated for it using a single command
*/
struct ice_aqc_acl_dealloc_res {
u8 reserved[16];
};
/* ACL - program actionpair (indirect 0x0C1C) */
/* ACL - query actionpair (indirect 0x0C25) */
struct ice_aqc_acl_actpair {
/* action mem index to program/update */
u8 act_mem_index;
u8 reserved;
/* The entry index in action memory to be programmed/updated */
__le16 act_entry_index;
__le32 reserved2;
__le32 addr_high;
__le32 addr_low;
};
/* Input buffer format for program/query action-pair admin command */
struct ice_acl_act_entry {
/* Action priority, values must be between 0..7 */
#define ICE_AQC_ACT_PRIO_VALID_MAX 7
#define ICE_AQC_ACT_PRIO_MSK MAKEMASK(0xff, 0)
u8 prio;
/* Action meta-data identifier. This field should be set to 0x0
* for a NOP action
*/
#define ICE_AQC_ACT_MDID_S 8
#define ICE_AQC_ACT_MDID_MSK MAKEMASK(0xff00, ICE_AQC_ACT_MDID_S)
u8 mdid;
/* Action value */
#define ICE_AQC_ACT_VALUE_S 16
#define ICE_AQC_ACT_VALUE_MSK MAKEMASK(0xffff0000, 16)
__le16 value;
};
#define ICE_ACL_NUM_ACT_PER_ACT_PAIR 2
struct ice_aqc_actpair {
struct ice_acl_act_entry act[ICE_ACL_NUM_ACT_PER_ACT_PAIR];
};
/* Generic format used to describe either input or response buffer
* for admin commands related to ACL profile
*/
struct ice_aqc_acl_prof_generic_frmt {
/* The first byte of the byte selection base is reserved to keep the
* first byte of the field vector where the packet direction info is
* available. Thus we should start at index 1 of the field vector to
* map its entries to the byte selection base.
*/
#define ICE_AQC_ACL_PROF_BYTE_SEL_START_IDX 1
/* In each byte:
* Bit 0..5 = Byte selection for the byte selection base from the
* extracted fields (expressed as byte offset in extracted fields).
* Applicable values are 0..63
* Bit 6..7 = Reserved
*/
#define ICE_AQC_ACL_PROF_BYTE_SEL_ELEMS 30
u8 byte_selection[ICE_AQC_ACL_PROF_BYTE_SEL_ELEMS];
/* In each byte:
* Bit 0..4 = Word selection for the word selection base from the
* extracted fields (expressed as word offset in extracted fields).
* Applicable values are 0..31
* Bit 5..7 = Reserved
*/
#define ICE_AQC_ACL_PROF_WORD_SEL_ELEMS 32
u8 word_selection[ICE_AQC_ACL_PROF_WORD_SEL_ELEMS];
/* In each byte:
* Bit 0..3 = Double word selection for the double-word selection base
* from the extracted fields (expressed as double-word offset in
* extracted fields).
* Applicable values are 0..15
* Bit 4..7 = Reserved
*/
#define ICE_AQC_ACL_PROF_DWORD_SEL_ELEMS 15
u8 dword_selection[ICE_AQC_ACL_PROF_DWORD_SEL_ELEMS];
/* Scenario numbers for individual Physical Function's */
#define ICE_AQC_ACL_PROF_PF_SCEN_NUM_ELEMS 8
u8 pf_scenario_num[ICE_AQC_ACL_PROF_PF_SCEN_NUM_ELEMS];
};
/* ACL - program ACL profile extraction (indirect 0x0C1D) */
/* ACL - program ACL profile ranges (indirect 0x0C1E) */
/* ACL - query ACL profile (indirect 0x0C21) */
/* ACL - query ACL profile ranges (indirect 0x0C22) */
struct ice_aqc_acl_profile {
u8 profile_id; /* Programmed/Updated profile ID */
u8 reserved[7];
__le32 addr_high;
__le32 addr_low;
};
/* Input buffer format for program profile extraction admin command and
* response buffer format for query profile admin command is as defined
* in struct ice_aqc_acl_prof_generic_frmt
*/
/* Input buffer format for program profile ranges and query profile ranges
* admin commands. Same format is used for response buffer in case of query
* profile ranges command
*/
struct ice_acl_rng_data {
/* The range checker output shall be sent when the value
* related to this range checker is lower than low boundary
*/
__be16 low_boundary;
/* The range checker output shall be sent when the value
* related to this range checker is higher than high boundary
*/
__be16 high_boundary;
/* A value of '0' in bit shall clear the relevant bit input
* to the range checker
*/
__be16 mask;
};
struct ice_aqc_acl_profile_ranges {
#define ICE_AQC_ACL_PROF_RANGES_NUM_CFG 8
struct ice_acl_rng_data checker_cfg[ICE_AQC_ACL_PROF_RANGES_NUM_CFG];
};
/* ACL - program ACL entry (indirect 0x0C20) */
/* ACL - query ACL entry (indirect 0x0C24) */
struct ice_aqc_acl_entry {
u8 tcam_index; /* Updated TCAM block index */
u8 reserved;
__le16 entry_index; /* Updated entry index */
__le32 reserved2;
__le32 addr_high;
__le32 addr_low;
};
/* Input buffer format in case of program ACL entry and response buffer format
* in case of query ACL entry
*/
struct ice_aqc_acl_data {
/* Entry key and entry key invert are 40 bits wide.
* Byte 0..4 : entry key and Byte 5..7 are reserved
* Byte 8..12: entry key invert and Byte 13..15 are reserved
*/
struct {
u8 val[5];
u8 reserved[3];
} entry_key, entry_key_invert;
};
/* ACL - query ACL counter (direct 0x0C27) */
struct ice_aqc_acl_query_counter {
/* Queried counter index */
__le16 counter_index;
/* Queried counter bank */
u8 counter_bank;
union {
struct {
u8 reserved[13];
} cmd;
struct {
/* Holds counter value/packet counter value */
u8 val[5];
u8 reserved[8];
} resp;
} ops;
};
/* Add Tx LAN Queues (indirect 0x0C30) */
struct ice_aqc_add_txqs {
u8 num_qgrps;
@ -2277,6 +2699,18 @@ struct ice_aq_desc {
struct ice_aqc_get_set_rss_lut get_set_rss_lut;
struct ice_aqc_get_set_rss_key get_set_rss_key;
struct ice_aqc_clear_fd_table clear_fd_table;
struct ice_aqc_acl_alloc_table alloc_table;
struct ice_aqc_acl_tbl_actpair tbl_actpair;
struct ice_aqc_acl_alloc_scen alloc_scen;
struct ice_aqc_acl_dealloc_scen dealloc_scen;
struct ice_aqc_acl_update_query_scen update_query_scen;
struct ice_aqc_acl_alloc_counters alloc_counters;
struct ice_aqc_acl_dealloc_counters dealloc_counters;
struct ice_aqc_acl_dealloc_res dealloc_res;
struct ice_aqc_acl_entry program_query_entry;
struct ice_aqc_acl_actpair program_query_actpair;
struct ice_aqc_acl_profile profile;
struct ice_aqc_acl_query_counter query_counter;
struct ice_aqc_add_txqs add_txqs;
struct ice_aqc_dis_txqs dis_txqs;
struct ice_aqc_move_txqs move_txqs;
@ -2496,6 +2930,27 @@ enum ice_adminq_opc {
ice_aqc_opc_get_rss_key = 0x0B04,
ice_aqc_opc_get_rss_lut = 0x0B05,
ice_aqc_opc_clear_fd_table = 0x0B06,
/* ACL commands */
ice_aqc_opc_alloc_acl_tbl = 0x0C10,
ice_aqc_opc_dealloc_acl_tbl = 0x0C11,
ice_aqc_opc_alloc_acl_actpair = 0x0C12,
ice_aqc_opc_dealloc_acl_actpair = 0x0C13,
ice_aqc_opc_alloc_acl_scen = 0x0C14,
ice_aqc_opc_dealloc_acl_scen = 0x0C15,
ice_aqc_opc_alloc_acl_counters = 0x0C16,
ice_aqc_opc_dealloc_acl_counters = 0x0C17,
ice_aqc_opc_dealloc_acl_res = 0x0C1A,
ice_aqc_opc_update_acl_scen = 0x0C1B,
ice_aqc_opc_program_acl_actpair = 0x0C1C,
ice_aqc_opc_program_acl_prof_extraction = 0x0C1D,
ice_aqc_opc_program_acl_prof_ranges = 0x0C1E,
ice_aqc_opc_program_acl_entry = 0x0C20,
ice_aqc_opc_query_acl_prof = 0x0C21,
ice_aqc_opc_query_acl_prof_ranges = 0x0C22,
ice_aqc_opc_query_acl_scen = 0x0C23,
ice_aqc_opc_query_acl_entry = 0x0C24,
ice_aqc_opc_query_acl_actpair = 0x0C25,
ice_aqc_opc_query_acl_counter = 0x0C27,
/* Tx queue handling commands/events */
ice_aqc_opc_add_txqs = 0x0C30,

View File

@ -956,19 +956,25 @@ void ice_fdir_list_add_fltr(struct ice_hw *hw, struct ice_fdir_fltr *fltr)
* ice_fdir_update_cntrs - increment / decrement filter counter
* @hw: pointer to hardware structure
* @flow: filter flow type
* @acl_fltr: true indicates an ACL filter
* @add: true implies filters added
*/
void
ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow, bool add)
ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow,
bool acl_fltr, bool add)
{
int incr;
incr = (add) ? 1 : -1;
hw->fdir_active_fltr += incr;
if (flow == ICE_FLTR_PTYPE_NONF_NONE || flow >= ICE_FLTR_PTYPE_MAX)
if (flow == ICE_FLTR_PTYPE_NONF_NONE || flow >= ICE_FLTR_PTYPE_MAX) {
ice_debug(hw, ICE_DBG_SW, "Unknown filter type %d\n", flow);
else
hw->fdir_fltr_cnt[flow] += incr;
} else {
if (acl_fltr)
hw->acl_fltr_cnt[flow] += incr;
else
hw->fdir_fltr_cnt[flow] += incr;
}
}
/**

View File

@ -204,6 +204,8 @@ struct ice_fdir_fltr {
u16 cnt_index;
u8 fdid_prio;
u32 fltr_id;
/* Set to true for an ACL filter */
bool acl_fltr;
};
/* Dummy packet filter definition structure. */
@ -234,6 +236,7 @@ bool ice_fdir_has_frag(enum ice_fltr_ptype flow);
struct ice_fdir_fltr *
ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx);
void
ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow, bool add);
ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow,
bool acl_fltr, bool add);
void ice_fdir_list_add_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input);
#endif /* _ICE_FDIR_H_ */

View File

@ -3528,7 +3528,8 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx)
LIST_FOR_EACH_ENTRY_SAFE(e, t, &p->entries,
ice_flow_entry, l_entry)
ice_flow_rem_entry(hw, ICE_FLOW_ENTRY_HNDL(e));
ice_flow_rem_entry(hw, (enum ice_block)blk_idx,
ICE_FLOW_ENTRY_HNDL(e));
LIST_DEL(&p->l_entry);
if (p->acts)

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
#define _ICE_FLOW_H_
#include "ice_flex_type.h"
#include "ice_acl.h"
#define ICE_IPV4_MAKE_PREFIX_MASK(prefix) ((u32)(~0) << (32 - (prefix)))
#define ICE_FLOW_PROF_ID_INVAL 0xfffffffffffffffful
#define ICE_FLOW_PROF_ID_BYPASS 0
@ -308,9 +309,14 @@ struct ice_flow_entry {
struct ice_flow_action *acts;
/* Flow entry's content */
void *entry;
/* Range buffer (For ACL only) */
struct ice_aqc_acl_profile_ranges *range_buf;
enum ice_flow_priority priority;
u16 vsi_handle;
u16 entry_sz;
/* Entry index in the ACL's scenario */
u16 scen_entry_idx;
#define ICE_FLOW_ACL_MAX_NUM_ACT 2
u8 acts_cnt;
};
@ -336,6 +342,7 @@ struct ice_flow_prof {
union {
/* struct sw_recipe */
struct ice_acl_scen *scen;
/* struct fd */
u32 data;
/* Symmetric Hash for RSS */
@ -381,6 +388,7 @@ enum ice_flow_action_type {
struct ice_flow_action {
enum ice_flow_action_type type;
union {
struct ice_acl_act_entry acl_act;
u32 dummy;
} data;
};
@ -408,7 +416,8 @@ ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
u64 entry_id, u16 vsi, enum ice_flow_priority prio,
void *data, struct ice_flow_action *acts, u8 acts_cnt,
u64 *entry_h);
enum ice_status ice_flow_rem_entry(struct ice_hw *hw, u64 entry_h);
enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,
u64 entry_h);
void
ice_flow_set_fld(struct ice_flow_seg_info *seg, enum ice_flow_field fld,
u16 val_loc, u16 mask_loc, u16 last_loc, bool range);

View File

@ -99,6 +99,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
#define ICE_HI_DWORD(x) ((u32)((((x) >> 16) >> 16) & 0xFFFFFFFF))
#define ICE_LO_DWORD(x) ((u32)((x) & 0xFFFFFFFF))
#define ICE_HI_WORD(x) ((u16)(((x) >> 16) & 0xFFFF))
#define ICE_LO_WORD(x) ((u16)((x) & 0xFFFF))
/* debug masks - set these bits in hw->debug_mask to control output */
#define ICE_DBG_TRACE BIT_ULL(0) /* for function-trace only */
@ -119,6 +120,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
#define ICE_DBG_PKG BIT_ULL(16)
#define ICE_DBG_RES BIT_ULL(17)
#define ICE_DBG_ACL BIT_ULL(18)
#define ICE_DBG_AQ_MSG BIT_ULL(24)
#define ICE_DBG_AQ_DESC BIT_ULL(25)
#define ICE_DBG_AQ_DESC_BUF BIT_ULL(26)
@ -389,6 +391,8 @@ struct ice_hw_common_caps {
u8 apm_wol_support;
u8 acpi_prog_mthd;
u8 proxy_support;
bool nvm_unified_update;
#define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3)
};
/* Function specific capabilities */
@ -879,6 +883,9 @@ struct ice_hw {
/* tunneling info */
struct ice_tunnel_table tnl;
struct ice_acl_tbl *acl_tbl;
struct ice_fd_hw_prof **acl_prof;
u16 acl_fltr_cnt[ICE_FLTR_PTYPE_MAX];
/* HW block tables */
struct ice_blk_info blk[ICE_BLK_COUNT];
struct ice_lock fl_profs_locks[ICE_BLK_COUNT]; /* lock fltr profiles */

View File

@ -11,6 +11,8 @@ sources = [
'ice_flow.c',
'ice_dcb.c',
'ice_fdir.c',
'ice_acl.c',
'ice_acl_ctrl.c',
]
error_cflags = ['-Wno-unused-value',

View File

@ -584,7 +584,7 @@ ice_fdir_prof_rm(struct ice_pf *pf, enum ice_fltr_ptype ptype, bool is_tunnel)
hw_prof->vsi_h[i]);
ice_rem_prof_id_flow(hw, ICE_BLK_FD,
vsi_num, ptype);
ice_flow_rem_entry(hw,
ice_flow_rem_entry(hw, ICE_BLK_FD,
hw_prof->entry_h[i][is_tunnel]);
hw_prof->entry_h[i][is_tunnel] = 0;
}
@ -876,7 +876,7 @@ ice_fdir_hw_tbl_conf(struct ice_pf *pf, struct ice_vsi *vsi,
err_add_entry:
vsi_num = ice_get_hw_vsi_num(hw, vsi->idx);
ice_rem_prof_id_flow(hw, ICE_BLK_FD, vsi_num, prof_id);
ice_flow_rem_entry(hw, entry_1);
ice_flow_rem_entry(hw, ICE_BLK_FD, entry_1);
err_add_prof:
ice_flow_rem_prof(hw, ICE_BLK_FD, prof_id);