drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c- Extension
.c- Size
- 21619 bytes
- Lines
- 933
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/device.hlinux/module.hlinux/pci.hmcs.hrvu.hmcs_reg.hlmac_common.h
Detected Declarations
function rvu_mcs_ptp_cfgfunction rvu_mbox_handler_mcs_set_lmac_modefunction mcs_add_intr_wq_entryfunction mcs_notify_pfvffunction mcs_intr_handler_taskfunction rvu_mbox_handler_mcs_intr_cfgfunction rvu_mbox_handler_mcs_get_hw_infofunction rvu_mbox_handler_mcs_port_resetfunction rvu_mbox_handler_mcs_clear_statsfunction rvu_mbox_handler_mcs_get_flowid_statsfunction rvu_mbox_handler_mcs_get_secy_statsfunction rvu_mbox_handler_mcs_get_sc_statsfunction rvu_mbox_handler_mcs_get_sa_statsfunction rvu_mbox_handler_mcs_get_port_statsfunction rvu_mbox_handler_mcs_set_active_lmacfunction rvu_mbox_handler_mcs_port_cfg_setfunction rvu_mbox_handler_mcs_port_cfg_getfunction rvu_mbox_handler_mcs_custom_tag_cfg_getfunction rvu_mcs_flr_handlerfunction rvu_mbox_handler_mcs_flowid_ena_entryfunction rvu_mbox_handler_mcs_pn_table_writefunction rvu_mbox_handler_mcs_set_pn_thresholdfunction rvu_mbox_handler_mcs_rx_sc_sa_map_writefunction rvu_mbox_handler_mcs_tx_sc_sa_map_writefunction rvu_mbox_handler_mcs_sa_plcy_writefunction rvu_mbox_handler_mcs_rx_sc_cam_writefunction rvu_mbox_handler_mcs_secy_plcy_writefunction rvu_mbox_handler_mcs_flowid_entry_writefunction rvu_mbox_handler_mcs_free_resourcesfunction rvu_mbox_handler_mcs_alloc_resourcesfunction rvu_mbox_handler_mcs_alloc_ctrl_pkt_rulefunction rvu_mbox_handler_mcs_free_ctrl_pkt_rulefunction rvu_mbox_handler_mcs_ctrl_pkt_rule_writefunction rvu_mcs_set_lmac_bmapfunction rvu_mcs_initfunction rvu_mcs_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Marvell CN10K MCS driver
*
* Copyright (C) 2022 Marvell.
*/
#include <linux/types.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/pci.h>
#include "mcs.h"
#include "rvu.h"
#include "mcs_reg.h"
#include "lmac_common.h"
#define M(_name, _id, _fn_name, _req_type, _rsp_type) \
static struct _req_type __maybe_unused \
*otx2_mbox_alloc_msg_ ## _fn_name(struct rvu *rvu, int devid) \
{ \
struct _req_type *req; \
\
req = (struct _req_type *)otx2_mbox_alloc_msg_rsp( \
&rvu->afpf_wq_info.mbox_up, devid, sizeof(struct _req_type), \
sizeof(struct _rsp_type)); \
if (!req) \
return NULL; \
req->hdr.sig = OTX2_MBOX_REQ_SIG; \
req->hdr.id = _id; \
return req; \
}
MBOX_UP_MCS_MESSAGES
#undef M
void rvu_mcs_ptp_cfg(struct rvu *rvu, u8 rpm_id, u8 lmac_id, bool ena)
{
struct mcs *mcs;
u64 cfg;
u8 port;
if (!rvu->mcs_blk_cnt)
return;
/* When ptp is enabled, RPM appends 8B header for all
* RX packets. MCS PEX need to configure to skip 8B
* during packet parsing.
*/
/* CNF10K-B */
if (rvu->mcs_blk_cnt > 1) {
mcs = mcs_get_pdata(rpm_id);
cfg = mcs_reg_read(mcs, MCSX_PEX_RX_SLAVE_PEX_CONFIGURATION);
if (ena)
cfg |= BIT_ULL(lmac_id);
else
cfg &= ~BIT_ULL(lmac_id);
mcs_reg_write(mcs, MCSX_PEX_RX_SLAVE_PEX_CONFIGURATION, cfg);
return;
}
/* CN10KB */
mcs = mcs_get_pdata(0);
port = (rpm_id * rvu->hw->lmac_per_cgx) + lmac_id;
cfg = mcs_reg_read(mcs, MCSX_PEX_RX_SLAVE_PORT_CFGX(port));
if (ena)
cfg |= BIT_ULL(0);
else
cfg &= ~BIT_ULL(0);
mcs_reg_write(mcs, MCSX_PEX_RX_SLAVE_PORT_CFGX(port), cfg);
}
int rvu_mbox_handler_mcs_set_lmac_mode(struct rvu *rvu,
struct mcs_set_lmac_mode *req,
struct msg_rsp *rsp)
{
struct mcs *mcs;
if (req->mcs_id >= rvu->mcs_blk_cnt)
return MCS_AF_ERR_INVALID_MCSID;
mcs = mcs_get_pdata(req->mcs_id);
if (BIT_ULL(req->lmac_id) & mcs->hw->lmac_bmap)
mcs_set_lmac_mode(mcs, req->lmac_id, req->mode);
return 0;
}
int mcs_add_intr_wq_entry(struct mcs *mcs, struct mcs_intr_event *event)
{
Annotation
- Immediate include surface: `linux/types.h`, `linux/device.h`, `linux/module.h`, `linux/pci.h`, `mcs.h`, `rvu.h`, `mcs_reg.h`, `lmac_common.h`.
- Detected declarations: `function rvu_mcs_ptp_cfg`, `function rvu_mbox_handler_mcs_set_lmac_mode`, `function mcs_add_intr_wq_entry`, `function mcs_notify_pfvf`, `function mcs_intr_handler_task`, `function rvu_mbox_handler_mcs_intr_cfg`, `function rvu_mbox_handler_mcs_get_hw_info`, `function rvu_mbox_handler_mcs_port_reset`, `function rvu_mbox_handler_mcs_clear_stats`, `function rvu_mbox_handler_mcs_get_flowid_stats`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.