drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c- Extension
.c- Size
- 10801 bytes
- Lines
- 365
- 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/etherdevice.hlinux/skbuff.hmlxbf_gige.hmlxbf_gige_regs.h
Detected Declarations
function Copyrightfunction mlxbf_gige_disable_multicast_rxfunction mlxbf_gige_enable_mac_rx_filterfunction mlxbf_gige_disable_mac_rx_filterfunction mlxbf_gige_set_mac_rx_filterfunction mlxbf_gige_get_mac_rx_filterfunction mlxbf_gige_enable_promiscfunction mlxbf_gige_disable_promiscfunction pointerfunction mlxbf_gige_rx_initfunction mlxbf_gige_rx_packetfunction mlxbf_gige_pollfunction napi_complete_done
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
/* Packet receive logic for Mellanox Gigabit Ethernet driver
*
* Copyright (C) 2020-2021 NVIDIA CORPORATION & AFFILIATES
*/
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include "mlxbf_gige.h"
#include "mlxbf_gige_regs.h"
void mlxbf_gige_enable_multicast_rx(struct mlxbf_gige *priv)
{
void __iomem *base = priv->base;
u64 data;
data = readq(base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL);
data |= MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST;
writeq(data, base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL);
}
void mlxbf_gige_disable_multicast_rx(struct mlxbf_gige *priv)
{
void __iomem *base = priv->base;
u64 data;
data = readq(base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL);
data &= ~MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST;
writeq(data, base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL);
}
void mlxbf_gige_enable_mac_rx_filter(struct mlxbf_gige *priv,
unsigned int index)
{
void __iomem *base = priv->base;
u64 control;
/* Enable MAC receive filter mask for specified index */
control = readq(base + MLXBF_GIGE_CONTROL);
control |= (MLXBF_GIGE_CONTROL_EN_SPECIFIC_MAC << index);
writeq(control, base + MLXBF_GIGE_CONTROL);
}
void mlxbf_gige_disable_mac_rx_filter(struct mlxbf_gige *priv,
unsigned int index)
{
void __iomem *base = priv->base;
u64 control;
/* Disable MAC receive filter mask for specified index */
control = readq(base + MLXBF_GIGE_CONTROL);
control &= ~(MLXBF_GIGE_CONTROL_EN_SPECIFIC_MAC << index);
writeq(control, base + MLXBF_GIGE_CONTROL);
}
void mlxbf_gige_set_mac_rx_filter(struct mlxbf_gige *priv,
unsigned int index, u64 dmac)
{
void __iomem *base = priv->base;
/* Write destination MAC to specified MAC RX filter */
writeq(dmac, base + MLXBF_GIGE_RX_MAC_FILTER +
(index * MLXBF_GIGE_RX_MAC_FILTER_STRIDE));
}
void mlxbf_gige_get_mac_rx_filter(struct mlxbf_gige *priv,
unsigned int index, u64 *dmac)
{
void __iomem *base = priv->base;
/* Read destination MAC from specified MAC RX filter */
*dmac = readq(base + MLXBF_GIGE_RX_MAC_FILTER +
(index * MLXBF_GIGE_RX_MAC_FILTER_STRIDE));
}
void mlxbf_gige_enable_promisc(struct mlxbf_gige *priv)
{
void __iomem *base = priv->base;
u64 control;
u64 end_mac;
/* Enable MAC_ID_RANGE match functionality */
control = readq(base + MLXBF_GIGE_CONTROL);
control |= MLXBF_GIGE_CONTROL_MAC_ID_RANGE_EN;
writeq(control, base + MLXBF_GIGE_CONTROL);
/* Set start of destination MAC range check to 0 */
writeq(0, base + MLXBF_GIGE_RX_MAC_FILTER_DMAC_RANGE_START);
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/skbuff.h`, `mlxbf_gige.h`, `mlxbf_gige_regs.h`.
- Detected declarations: `function Copyright`, `function mlxbf_gige_disable_multicast_rx`, `function mlxbf_gige_enable_mac_rx_filter`, `function mlxbf_gige_disable_mac_rx_filter`, `function mlxbf_gige_set_mac_rx_filter`, `function mlxbf_gige_get_mac_rx_filter`, `function mlxbf_gige_enable_promisc`, `function mlxbf_gige_disable_promisc`, `function pointer`, `function mlxbf_gige_rx_init`.
- 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.