drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c- Extension
.c- Size
- 50209 bytes
- Lines
- 1825
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/kernel.hlinux/pci.hlinux/device.hlinux/module.hlinux/types.hlinux/errno.hlinux/interrupt.hlinux/etherdevice.hlinux/netdevice.hlinux/if_vlan.hlinux/ethtool.hlinux/vmalloc.hlinux/sfp.hhinic_hw_qp.hhinic_hw_dev.hhinic_port.hhinic_tx.hhinic_rx.hhinic_dev.h
Detected Declarations
struct hw2ethtool_link_modestruct cmd_link_settingsenum diag_test_indexfunction set_link_speedfunction hinic_get_link_mode_indexfunction hinic_add_ethtool_link_modefunction hinic_link_port_typefunction hinic_get_link_ksettingsfunction hinic_ethtool_to_hw_speed_levelfunction hinic_is_support_speedfunction hinic_is_speed_legalfunction get_link_settings_typefunction set_link_settings_separate_cmdfunction hinic_set_settings_to_hwfunction set_link_settingsfunction hinic_set_link_ksettingsfunction hinic_get_drvinfofunction hinic_get_ringparamfunction check_ringparam_validfunction hinic_set_ringparamfunction __hinic_get_coalescefunction is_coalesce_exceed_limitfunction set_queue_coalescefunction __set_hw_coal_paramfunction __hinic_set_coalescefunction hinic_get_coalescefunction hinic_set_coalescefunction hinic_get_per_queue_coalescefunction hinic_set_per_queue_coalescefunction hinic_get_pauseparamfunction hinic_set_pauseparamfunction hinic_get_channelsfunction hinic_set_channelsfunction hinic_get_rxfh_fieldsfunction set_l4_rss_hash_opsfunction hinic_set_rxfh_fieldsfunction __set_rss_rxfhfunction hinic_get_rx_ring_countfunction hinic_get_rxfhfunction hinic_set_rxfhfunction hinic_get_rxfh_key_sizefunction hinic_get_rxfh_indir_sizefunction get_drv_queue_statsfunction hinic_get_ethtool_statsfunction hinic_get_sset_countfunction hinic_get_stringsfunction hinic_run_lp_testfunction do_lp_test
Annotated Snippet
struct hw2ethtool_link_mode {
enum ethtool_link_mode_bit_indices link_mode_bit;
u32 speed;
enum hinic_link_mode hw_link_mode;
};
struct cmd_link_settings {
u64 supported;
u64 advertising;
u32 speed;
u8 duplex;
u8 port;
u8 autoneg;
};
static u32 hw_to_ethtool_speed[LINK_SPEED_LEVELS] = {
SPEED_10, SPEED_100,
SPEED_1000, SPEED_10000,
SPEED_25000, SPEED_40000,
SPEED_100000
};
static struct hw2ethtool_link_mode
hw_to_ethtool_link_mode_table[HINIC_LINK_MODE_NUMBERS] = {
{
.link_mode_bit = ETHTOOL_LINK_MODE_10000baseKR_Full_BIT,
.speed = SPEED_10000,
.hw_link_mode = HINIC_10GE_BASE_KR,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT,
.speed = SPEED_40000,
.hw_link_mode = HINIC_40GE_BASE_KR4,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT,
.speed = SPEED_40000,
.hw_link_mode = HINIC_40GE_BASE_CR4,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT,
.speed = SPEED_100000,
.hw_link_mode = HINIC_100GE_BASE_KR4,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT,
.speed = SPEED_100000,
.hw_link_mode = HINIC_100GE_BASE_CR4,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT,
.speed = SPEED_25000,
.hw_link_mode = HINIC_25GE_BASE_KR_S,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT,
.speed = SPEED_25000,
.hw_link_mode = HINIC_25GE_BASE_CR_S,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT,
.speed = SPEED_25000,
.hw_link_mode = HINIC_25GE_BASE_KR,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT,
.speed = SPEED_25000,
.hw_link_mode = HINIC_25GE_BASE_CR,
},
{
.link_mode_bit = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT,
.speed = SPEED_1000,
.hw_link_mode = HINIC_GE_BASE_KX,
},
};
#define LP_DEFAULT_TIME 5 /* seconds */
#define LP_PKT_LEN 1514
#define PORT_DOWN_ERR_IDX 0
enum diag_test_index {
INTERNAL_LP_TEST = 0,
EXTERNAL_LP_TEST = 1,
DIAG_TEST_MAX = 2,
};
static void set_link_speed(struct ethtool_link_ksettings *link_ksettings,
enum hinic_speed speed)
{
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pci.h`, `linux/device.h`, `linux/module.h`, `linux/types.h`, `linux/errno.h`, `linux/interrupt.h`, `linux/etherdevice.h`.
- Detected declarations: `struct hw2ethtool_link_mode`, `struct cmd_link_settings`, `enum diag_test_index`, `function set_link_speed`, `function hinic_get_link_mode_index`, `function hinic_add_ethtool_link_mode`, `function hinic_link_port_type`, `function hinic_get_link_ksettings`, `function hinic_ethtool_to_hw_speed_level`, `function hinic_is_support_speed`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.