drivers/net/ethernet/mscc/ocelot.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mscc/ocelot.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mscc/ocelot.h- Extension
.h- Size
- 3913 bytes
- Lines
- 127
- 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
linux/bitops.hlinux/etherdevice.hlinux/if_vlan.hlinux/net_tstamp.hlinux/phylink.hlinux/platform_device.hlinux/regmap.hsoc/mscc/ocelot_qsys.hsoc/mscc/ocelot_sys.hsoc/mscc/ocelot_dev.hsoc/mscc/ocelot_ana.hsoc/mscc/ocelot_ptp.hsoc/mscc/ocelot_vcap.hsoc/mscc/ocelot.hocelot_rew.hocelot_qs.h
Detected Declarations
struct ocelot_port_tcstruct ocelot_port_privatestruct ocelot_pgidstruct ocelot_multicastfunction ocelot_reg_to_target_addr
Annotated Snippet
struct ocelot_port_tc {
bool block_shared;
unsigned long offload_cnt;
unsigned long ingress_mirred_id;
unsigned long egress_mirred_id;
unsigned long police_id;
};
struct ocelot_port_private {
struct ocelot_port port;
struct net_device *dev;
struct phylink *phylink;
struct phylink_config phylink_config;
struct ocelot_port_tc tc;
};
/* A (PGID) port mask structure, encoding the 2^ocelot->num_phys_ports
* possibilities of egress port masks for L2 multicast traffic.
* For a switch with 9 user ports, there are 512 possible port masks, but the
* hardware only has 46 individual PGIDs that it can forward multicast traffic
* to. So we need a structure that maps the limited PGID indices to the port
* destinations requested by the user for L2 multicast.
*/
struct ocelot_pgid {
unsigned long ports;
int index;
refcount_t refcount;
struct list_head list;
};
struct ocelot_multicast {
struct list_head list;
enum macaccess_entry_type entry_type;
unsigned char addr[ETH_ALEN];
u16 vid;
u16 ports;
struct ocelot_pgid *pgid;
};
static inline void ocelot_reg_to_target_addr(struct ocelot *ocelot,
enum ocelot_reg reg,
enum ocelot_target *target,
u32 *addr)
{
*target = reg >> TARGET_OFFSET;
*addr = ocelot->map[*target][reg & REG_MASK];
}
int ocelot_bridge_num_find(struct ocelot *ocelot,
const struct net_device *bridge);
int ocelot_mact_learn(struct ocelot *ocelot, int port,
const unsigned char mac[ETH_ALEN],
unsigned int vid, enum macaccess_entry_type type);
int ocelot_mact_forget(struct ocelot *ocelot,
const unsigned char mac[ETH_ALEN], unsigned int vid);
struct net_device *ocelot_port_to_netdev(struct ocelot *ocelot, int port);
int ocelot_netdev_to_port(struct ocelot *ocelot, struct net_device *dev);
int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
struct device_node *portnp);
void ocelot_release_port(struct ocelot_port *ocelot_port);
int ocelot_port_devlink_init(struct ocelot *ocelot, int port,
enum devlink_port_flavour flavour);
void ocelot_port_devlink_teardown(struct ocelot *ocelot, int port);
int ocelot_trap_add(struct ocelot *ocelot, int port,
unsigned long cookie, bool take_ts,
void (*populate)(struct ocelot_vcap_filter *f));
int ocelot_trap_del(struct ocelot *ocelot, int port, unsigned long cookie);
struct ocelot_mirror *ocelot_mirror_get(struct ocelot *ocelot, int to,
struct netlink_ext_ack *extack);
void ocelot_mirror_put(struct ocelot *ocelot);
int ocelot_stats_init(struct ocelot *ocelot);
void ocelot_stats_deinit(struct ocelot *ocelot);
int ocelot_mm_init(struct ocelot *ocelot);
void ocelot_port_change_fp(struct ocelot *ocelot, int port,
unsigned long preemptible_tcs);
void ocelot_port_update_active_preemptible_tcs(struct ocelot *ocelot, int port);
extern struct notifier_block ocelot_netdevice_nb;
extern struct notifier_block ocelot_switchdev_nb;
extern struct notifier_block ocelot_switchdev_blocking_nb;
extern const struct devlink_ops ocelot_devlink_ops;
#endif
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/etherdevice.h`, `linux/if_vlan.h`, `linux/net_tstamp.h`, `linux/phylink.h`, `linux/platform_device.h`, `linux/regmap.h`, `soc/mscc/ocelot_qsys.h`.
- Detected declarations: `struct ocelot_port_tc`, `struct ocelot_port_private`, `struct ocelot_pgid`, `struct ocelot_multicast`, `function ocelot_reg_to_target_addr`.
- 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.