drivers/net/dsa/mv88e6xxx/global1_vtu.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/mv88e6xxx/global1_vtu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/mv88e6xxx/global1_vtu.c- Extension
.c- Size
- 14659 bytes
- Lines
- 684
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/interrupt.hlinux/irqdomain.hchip.hglobal1.htrace.h
Detected Declarations
function Copyrightfunction mv88e6xxx_g1_vtu_fid_writefunction mv88e6xxx_g1_vtu_sid_readfunction mv88e6xxx_g1_vtu_sid_writefunction mv88e6xxx_g1_vtu_op_waitfunction mv88e6xxx_g1_vtu_opfunction mv88e6xxx_g1_vtu_vid_readfunction mv88e6xxx_g1_vtu_vid_writefunction mv88e6185_g1_vtu_stu_data_readfunction mv88e6185_g1_vtu_data_readfunction mv88e6185_g1_vtu_data_writefunction mv88e6390_g1_vtu_data_readfunction mv88e6390_g1_vtu_data_writefunction mv88e6xxx_g1_vtu_getnextfunction mv88e6185_g1_vtu_getnextfunction mv88e6352_g1_vtu_getnextfunction mv88e6390_g1_vtu_getnextfunction mv88e6185_g1_vtu_loadpurgefunction mv88e6352_g1_vtu_loadpurgefunction mv88e6390_g1_vtu_loadpurgefunction mv88e6xxx_g1_vtu_flushfunction mv88e6xxx_g1_stu_getnextfunction mv88e6352_g1_stu_getnextfunction mv88e6390_g1_stu_getnextfunction mv88e6352_g1_stu_loadpurgefunction mv88e6390_g1_stu_loadpurgefunction mv88e6xxx_g1_vtu_prob_irq_thread_fnfunction mv88e6xxx_g1_vtu_prob_irq_setupfunction mv88e6xxx_g1_vtu_prob_irq_free
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Marvell 88E6xxx VLAN [Spanning Tree] Translation Unit (VTU [STU]) support
*
* Copyright (c) 2008 Marvell Semiconductor
* Copyright (c) 2015 CMC Electronics, Inc.
* Copyright (c) 2017 Savoir-faire Linux, Inc.
*/
#include <linux/bitfield.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include "chip.h"
#include "global1.h"
#include "trace.h"
/* Offset 0x02: VTU FID Register */
static int mv88e6xxx_g1_vtu_fid_read(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry)
{
u16 val;
int err;
err = mv88e6xxx_g1_read(chip, MV88E6352_G1_VTU_FID, &val);
if (err)
return err;
entry->fid = val & MV88E6352_G1_VTU_FID_MASK;
entry->policy = !!(val & MV88E6352_G1_VTU_FID_VID_POLICY);
return 0;
}
static int mv88e6xxx_g1_vtu_fid_write(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry)
{
u16 val = entry->fid & MV88E6352_G1_VTU_FID_MASK;
if (entry->policy)
val |= MV88E6352_G1_VTU_FID_VID_POLICY;
return mv88e6xxx_g1_write(chip, MV88E6352_G1_VTU_FID, val);
}
/* Offset 0x03: VTU SID Register */
static int mv88e6xxx_g1_vtu_sid_read(struct mv88e6xxx_chip *chip, u8 *sid)
{
u16 val;
int err;
err = mv88e6xxx_g1_read(chip, MV88E6352_G1_VTU_SID, &val);
if (err)
return err;
*sid = val & MV88E6352_G1_VTU_SID_MASK;
return 0;
}
static int mv88e6xxx_g1_vtu_sid_write(struct mv88e6xxx_chip *chip, u8 sid)
{
u16 val = sid & MV88E6352_G1_VTU_SID_MASK;
return mv88e6xxx_g1_write(chip, MV88E6352_G1_VTU_SID, val);
}
/* Offset 0x05: VTU Operation Register */
static int mv88e6xxx_g1_vtu_op_wait(struct mv88e6xxx_chip *chip)
{
int bit = __bf_shf(MV88E6XXX_G1_VTU_OP_BUSY);
return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_VTU_OP, bit, 0);
}
static int mv88e6xxx_g1_vtu_op(struct mv88e6xxx_chip *chip, u16 op)
{
int err;
err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_VTU_OP,
MV88E6XXX_G1_VTU_OP_BUSY | op);
if (err)
return err;
return mv88e6xxx_g1_vtu_op_wait(chip);
}
/* Offset 0x06: VTU VID Register */
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `chip.h`, `global1.h`, `trace.h`.
- Detected declarations: `function Copyright`, `function mv88e6xxx_g1_vtu_fid_write`, `function mv88e6xxx_g1_vtu_sid_read`, `function mv88e6xxx_g1_vtu_sid_write`, `function mv88e6xxx_g1_vtu_op_wait`, `function mv88e6xxx_g1_vtu_op`, `function mv88e6xxx_g1_vtu_vid_read`, `function mv88e6xxx_g1_vtu_vid_write`, `function mv88e6185_g1_vtu_stu_data_read`, `function mv88e6185_g1_vtu_data_read`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.