drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c- Extension
.c- Size
- 19721 bytes
- Lines
- 764
- 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.
- 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/bitfield.hlinux/ethtool.hlinux/if_ether.hlinux/kernel.hlinux/module.hnfp.hnfp_nsp.hnfp6000/nfp6000.h
Detected Declarations
enum nfp_eth_rawenum nfp_eth_ratefunction nfp_eth_rate2speedfunction nfp_eth_speed2ratefunction nfp_eth_copy_mac_reversefunction nfp_eth_port_translatefunction nfp_eth_calc_port_geometryfunction nfp_eth_calc_port_typefunction nfp_eth_read_mediafunction nfp_eth_read_portsfunction __nfp_eth_read_portsfunction nfp_eth_config_cleanup_endfunction nfp_eth_config_commit_endfunction nfp_eth_set_mod_enablefunction nfp_eth_set_configuredfunction nfp_eth_set_bit_configfunction nfp_eth_set_idmodefunction __nfp_eth_set_anegfunction __nfp_eth_set_fecfunction nfp_eth_set_fecfunction __nfp_eth_set_txpausefunction __nfp_eth_set_rxpausefunction nfp_eth_set_pauseparamfunction __nfp_eth_set_speedfunction __nfp_eth_set_split
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (C) 2015-2017 Netronome Systems, Inc. */
/* Authors: David Brunecz <david.brunecz@netronome.com>
* Jakub Kicinski <jakub.kicinski@netronome.com>
* Jason Mcmullan <jason.mcmullan@netronome.com>
*/
#include <linux/bitfield.h>
#include <linux/ethtool.h>
#include <linux/if_ether.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include "nfp.h"
#include "nfp_nsp.h"
#include "nfp6000/nfp6000.h"
#define NSP_ETH_NBI_PORT_COUNT 24
#define NSP_ETH_MAX_COUNT (2 * NSP_ETH_NBI_PORT_COUNT)
#define NSP_ETH_TABLE_SIZE (NSP_ETH_MAX_COUNT * \
sizeof(union eth_table_entry))
#define NSP_ETH_PORT_LANES GENMASK_ULL(3, 0)
#define NSP_ETH_PORT_INDEX GENMASK_ULL(15, 8)
#define NSP_ETH_PORT_LABEL GENMASK_ULL(53, 48)
#define NSP_ETH_PORT_PHYLABEL GENMASK_ULL(59, 54)
#define NSP_ETH_PORT_FEC_SUPP_BASER BIT_ULL(60)
#define NSP_ETH_PORT_FEC_SUPP_RS BIT_ULL(61)
#define NSP_ETH_PORT_SUPP_ANEG BIT_ULL(63)
#define NSP_ETH_PORT_LANES_MASK cpu_to_le64(NSP_ETH_PORT_LANES)
#define NSP_ETH_STATE_CONFIGURED BIT_ULL(0)
#define NSP_ETH_STATE_ENABLED BIT_ULL(1)
#define NSP_ETH_STATE_TX_ENABLED BIT_ULL(2)
#define NSP_ETH_STATE_RX_ENABLED BIT_ULL(3)
#define NSP_ETH_STATE_RATE GENMASK_ULL(11, 8)
#define NSP_ETH_STATE_INTERFACE GENMASK_ULL(19, 12)
#define NSP_ETH_STATE_MEDIA GENMASK_ULL(21, 20)
#define NSP_ETH_STATE_OVRD_CHNG BIT_ULL(22)
#define NSP_ETH_STATE_ANEG GENMASK_ULL(25, 23)
#define NSP_ETH_STATE_FEC GENMASK_ULL(27, 26)
#define NSP_ETH_STATE_ACT_FEC GENMASK_ULL(29, 28)
#define NSP_ETH_STATE_TX_PAUSE BIT_ULL(31)
#define NSP_ETH_STATE_RX_PAUSE BIT_ULL(32)
#define NSP_ETH_CTRL_CONFIGURED BIT_ULL(0)
#define NSP_ETH_CTRL_ENABLED BIT_ULL(1)
#define NSP_ETH_CTRL_TX_ENABLED BIT_ULL(2)
#define NSP_ETH_CTRL_RX_ENABLED BIT_ULL(3)
#define NSP_ETH_CTRL_SET_RATE BIT_ULL(4)
#define NSP_ETH_CTRL_SET_LANES BIT_ULL(5)
#define NSP_ETH_CTRL_SET_ANEG BIT_ULL(6)
#define NSP_ETH_CTRL_SET_FEC BIT_ULL(7)
#define NSP_ETH_CTRL_SET_IDMODE BIT_ULL(8)
#define NSP_ETH_CTRL_SET_TX_PAUSE BIT_ULL(10)
#define NSP_ETH_CTRL_SET_RX_PAUSE BIT_ULL(11)
enum nfp_eth_raw {
NSP_ETH_RAW_PORT = 0,
NSP_ETH_RAW_STATE,
NSP_ETH_RAW_MAC,
NSP_ETH_RAW_CONTROL,
NSP_ETH_NUM_RAW
};
enum nfp_eth_rate {
RATE_INVALID = 0,
RATE_10M,
RATE_100M,
RATE_1G,
RATE_10G,
RATE_25G,
};
union eth_table_entry {
struct {
__le64 port;
__le64 state;
u8 mac_addr[6];
u8 resv[2];
__le64 control;
};
__le64 raw[NSP_ETH_NUM_RAW];
};
static const struct {
enum nfp_eth_rate rate;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/ethtool.h`, `linux/if_ether.h`, `linux/kernel.h`, `linux/module.h`, `nfp.h`, `nfp_nsp.h`, `nfp6000/nfp6000.h`.
- Detected declarations: `enum nfp_eth_raw`, `enum nfp_eth_rate`, `function nfp_eth_rate2speed`, `function nfp_eth_speed2rate`, `function nfp_eth_copy_mac_reverse`, `function nfp_eth_port_translate`, `function nfp_eth_calc_port_geometry`, `function nfp_eth_calc_port_type`, `function nfp_eth_read_media`, `function nfp_eth_read_ports`.
- 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.