drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_intr.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_intr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_intr.c- Extension
.c- Size
- 3534 bytes
- Lines
- 134
- 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/interrupt.hmlxbf_gige.hmlxbf_gige_regs.h
Detected Declarations
function Copyrightfunction mlxbf_gige_rx_intrfunction mlxbf_gige_llu_plu_intrfunction mlxbf_gige_request_irqsfunction mlxbf_gige_free_irqs
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
/* Interrupt related logic for Mellanox Gigabit Ethernet driver
*
* Copyright (C) 2020-2021 NVIDIA CORPORATION & AFFILIATES
*/
#include <linux/interrupt.h>
#include "mlxbf_gige.h"
#include "mlxbf_gige_regs.h"
static irqreturn_t mlxbf_gige_error_intr(int irq, void *dev_id)
{
struct mlxbf_gige *priv;
u64 int_status;
priv = dev_id;
int_status = readq(priv->base + MLXBF_GIGE_INT_STATUS);
if (int_status & MLXBF_GIGE_INT_STATUS_HW_ACCESS_ERROR)
priv->stats.hw_access_errors++;
if (int_status & MLXBF_GIGE_INT_STATUS_TX_CHECKSUM_INPUTS) {
priv->stats.tx_invalid_checksums++;
/* This error condition is latched into MLXBF_GIGE_INT_STATUS
* when the GigE silicon operates on the offending
* TX WQE. The write to MLXBF_GIGE_INT_STATUS at the bottom
* of this routine clears this error condition.
*/
}
if (int_status & MLXBF_GIGE_INT_STATUS_TX_SMALL_FRAME_SIZE) {
priv->stats.tx_small_frames++;
/* This condition happens when the networking stack invokes
* this driver's "start_xmit()" method with a packet whose
* size < 60 bytes. The GigE silicon will automatically pad
* this small frame up to a minimum-sized frame before it is
* sent. The "tx_small_frame" condition is latched into the
* MLXBF_GIGE_INT_STATUS register when the GigE silicon
* operates on the offending TX WQE. The write to
* MLXBF_GIGE_INT_STATUS at the bottom of this routine
* clears this condition.
*/
}
if (int_status & MLXBF_GIGE_INT_STATUS_TX_PI_CI_EXCEED_WQ_SIZE)
priv->stats.tx_index_errors++;
if (int_status & MLXBF_GIGE_INT_STATUS_SW_CONFIG_ERROR)
priv->stats.sw_config_errors++;
if (int_status & MLXBF_GIGE_INT_STATUS_SW_ACCESS_ERROR)
priv->stats.sw_access_errors++;
/* Clear all error interrupts by writing '1' back to
* all the asserted bits in INT_STATUS. Do not write
* '1' back to 'receive packet' bit, since that is
* managed separately.
*/
int_status &= ~MLXBF_GIGE_INT_STATUS_RX_RECEIVE_PACKET;
writeq(int_status, priv->base + MLXBF_GIGE_INT_STATUS);
return IRQ_HANDLED;
}
static irqreturn_t mlxbf_gige_rx_intr(int irq, void *dev_id)
{
struct mlxbf_gige *priv;
priv = dev_id;
/* NOTE: GigE silicon automatically disables "packet rx" interrupt by
* setting MLXBF_GIGE_INT_MASK bit0 upon triggering the interrupt
* to the ARM cores. Software needs to re-enable "packet rx"
* interrupts by clearing MLXBF_GIGE_INT_MASK bit0.
*/
napi_schedule(&priv->napi);
return IRQ_HANDLED;
}
static irqreturn_t mlxbf_gige_llu_plu_intr(int irq, void *dev_id)
{
return IRQ_HANDLED;
}
Annotation
- Immediate include surface: `linux/interrupt.h`, `mlxbf_gige.h`, `mlxbf_gige_regs.h`.
- Detected declarations: `function Copyright`, `function mlxbf_gige_rx_intr`, `function mlxbf_gige_llu_plu_intr`, `function mlxbf_gige_request_irqs`, `function mlxbf_gige_free_irqs`.
- 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.