drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_actions.c- Extension
.c- Size
- 9028 bytes
- Lines
- 319
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
spectrum_acl_flex_actions.hcore_acl_flex_actions.hspectrum_span.h
Detected Declarations
function mlxsw_sp_act_kvdl_set_addfunction mlxsw_sp1_act_kvdl_set_addfunction mlxsw_sp2_act_kvdl_set_addfunction mlxsw_sp_act_kvdl_set_delfunction mlxsw_sp1_act_kvdl_set_activity_getfunction mlxsw_sp2_act_kvdl_set_activity_getfunction mlxsw_sp_act_kvdl_fwd_entry_addfunction mlxsw_sp_act_kvdl_fwd_entry_delfunction mlxsw_sp_act_counter_index_getfunction mlxsw_sp_act_counter_index_putfunction mlxsw_sp_act_mirror_addfunction mlxsw_sp_act_mirror_delfunction mlxsw_sp_act_policer_addfunction mlxsw_sp_act_policer_delfunction mlxsw_sp1_act_sampler_addfunction mlxsw_sp1_act_sampler_delfunction mlxsw_sp2_act_sampler_addfunction mlxsw_sp2_act_sampler_delfunction mlxsw_sp_afa_initfunction mlxsw_sp_afa_fini
Annotated Snippet
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2017-2018 Mellanox Technologies. All rights reserved */
#include "spectrum_acl_flex_actions.h"
#include "core_acl_flex_actions.h"
#include "spectrum_span.h"
static int mlxsw_sp_act_kvdl_set_add(void *priv, u32 *p_kvdl_index,
char *enc_actions, bool is_first, bool ca)
{
struct mlxsw_sp *mlxsw_sp = priv;
char pefa_pl[MLXSW_REG_PEFA_LEN];
u32 kvdl_index;
int err;
/* The first action set of a TCAM entry is stored directly in TCAM,
* not KVD linear area.
*/
if (is_first)
return 0;
err = mlxsw_sp_kvdl_alloc(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET,
1, &kvdl_index);
if (err)
return err;
mlxsw_reg_pefa_pack(pefa_pl, kvdl_index, ca, enc_actions);
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pefa), pefa_pl);
if (err)
goto err_pefa_write;
*p_kvdl_index = kvdl_index;
return 0;
err_pefa_write:
mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET,
1, kvdl_index);
return err;
}
static int mlxsw_sp1_act_kvdl_set_add(void *priv, u32 *p_kvdl_index,
char *enc_actions, bool is_first)
{
return mlxsw_sp_act_kvdl_set_add(priv, p_kvdl_index, enc_actions,
is_first, false);
}
static int mlxsw_sp2_act_kvdl_set_add(void *priv, u32 *p_kvdl_index,
char *enc_actions, bool is_first)
{
return mlxsw_sp_act_kvdl_set_add(priv, p_kvdl_index, enc_actions,
is_first, true);
}
static void mlxsw_sp_act_kvdl_set_del(void *priv, u32 kvdl_index,
bool is_first)
{
struct mlxsw_sp *mlxsw_sp = priv;
if (is_first)
return;
mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET,
1, kvdl_index);
}
static int mlxsw_sp1_act_kvdl_set_activity_get(void *priv, u32 kvdl_index,
bool *activity)
{
return -EOPNOTSUPP;
}
static int mlxsw_sp2_act_kvdl_set_activity_get(void *priv, u32 kvdl_index,
bool *activity)
{
struct mlxsw_sp *mlxsw_sp = priv;
char pefa_pl[MLXSW_REG_PEFA_LEN];
int err;
mlxsw_reg_pefa_pack(pefa_pl, kvdl_index, true, NULL);
err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(pefa), pefa_pl);
if (err)
return err;
mlxsw_reg_pefa_unpack(pefa_pl, activity);
return 0;
}
static int mlxsw_sp_act_kvdl_fwd_entry_add(void *priv, u32 *p_kvdl_index,
u16 local_port)
{
struct mlxsw_sp *mlxsw_sp = priv;
char ppbs_pl[MLXSW_REG_PPBS_LEN];
u32 kvdl_index;
Annotation
- Immediate include surface: `spectrum_acl_flex_actions.h`, `core_acl_flex_actions.h`, `spectrum_span.h`.
- Detected declarations: `function mlxsw_sp_act_kvdl_set_add`, `function mlxsw_sp1_act_kvdl_set_add`, `function mlxsw_sp2_act_kvdl_set_add`, `function mlxsw_sp_act_kvdl_set_del`, `function mlxsw_sp1_act_kvdl_set_activity_get`, `function mlxsw_sp2_act_kvdl_set_activity_get`, `function mlxsw_sp_act_kvdl_fwd_entry_add`, `function mlxsw_sp_act_kvdl_fwd_entry_del`, `function mlxsw_sp_act_counter_index_get`, `function mlxsw_sp_act_counter_index_put`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.