drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c- Extension
.c- Size
- 26202 bytes
- Lines
- 996
- 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.
- 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/etherdevice.hlinux/netdevice.hlinux/spinlock.hhnae.hhns_dsaf_mac.hhns_dsaf_main.hhns_dsaf_ppe.hhns_dsaf_rcb.h
Detected Declarations
function Copyrightfunction hns_ae_get_q_num_per_vffunction hns_ae_get_vf_num_per_portfunction hns_ae_put_handlefunction hns_ae_wait_flow_downfunction hns_ae_ring_enable_allfunction hns_ae_init_queuefunction hns_ae_fini_queuefunction hns_ae_set_mac_addressfunction hns_ae_add_uc_addressfunction hns_ae_rm_uc_addressfunction hns_ae_set_multicast_onefunction hns_ae_clr_multicastfunction hns_ae_set_mtufunction hns_ae_set_tso_statsfunction hns_ae_startfunction hns_ae_stopfunction hns_ae_resetfunction hns_ae_toggle_ring_irqfunction hns_aev2_toggle_ring_irqfunction hns_ae_get_link_statusfunction hns_ae_get_mac_infofunction hns_ae_need_adjust_linkfunction hns_ae_adjust_linkfunction hns_ae_get_ring_bdnum_limitfunction hns_ae_get_pauseparamfunction hns_ae_set_promisc_modefunction hns_ae_set_pauseparamfunction hns_ae_get_coalesce_usecsfunction hns_ae_get_max_coalesced_framesfunction hns_ae_set_coalesce_usecsfunction hns_ae_set_coalesce_framesfunction hns_ae_get_coalesce_rangefunction hns_ae_update_statsfunction hns_ae_get_statsfunction hns_ae_get_stringsfunction hns_ae_get_sset_countfunction hns_ae_config_loopbackfunction hns_ae_update_led_statusfunction hns_ae_cpld_set_led_idfunction hns_ae_get_regsfunction hns_ae_get_regs_lenfunction hns_ae_get_rss_key_sizefunction hns_ae_get_rss_indir_sizefunction hns_ae_get_rssfunction hns_ae_set_rssfunction hns_dsaf_ae_initfunction hns_dsaf_ae_uninit
Annotated Snippet
if (hns_ae_wait_flow_down(handle)) {
hns_mac_enable(mac_cb, MAC_COMM_MODE_RX);
break;
}
hns_mac_adjust_link(mac_cb, speed, duplex);
hns_mac_enable(mac_cb, MAC_COMM_MODE_RX);
break;
default:
break;
}
}
static void hns_ae_get_ring_bdnum_limit(struct hnae_queue *queue,
u32 *uplimit)
{
*uplimit = HNS_RCB_RING_MAX_PENDING_BD;
}
static void hns_ae_get_pauseparam(struct hnae_handle *handle,
u32 *auto_neg, u32 *rx_en, u32 *tx_en)
{
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
hns_mac_get_autoneg(mac_cb, auto_neg);
hns_mac_get_pauseparam(mac_cb, rx_en, tx_en);
/* Service port's pause feature is provided by DSAF, not mac */
if (handle->port_type == HNAE_PORT_SERVICE)
hns_dsaf_get_rx_mac_pause_en(dsaf_dev, mac_cb->mac_id, rx_en);
}
static void hns_ae_set_promisc_mode(struct hnae_handle *handle, u32 en)
{
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
hns_dsaf_set_promisc_mode(hns_ae_get_dsaf_dev(handle->dev), en);
hns_mac_set_promisc(mac_cb, (u8)!!en);
}
static int hns_ae_set_pauseparam(struct hnae_handle *handle,
u32 autoneg, u32 rx_en, u32 tx_en)
{
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
int ret;
ret = hns_mac_set_autoneg(mac_cb, autoneg);
if (ret)
return ret;
/* Service port's pause feature is provided by DSAF, not mac */
if (handle->port_type == HNAE_PORT_SERVICE) {
ret = hns_dsaf_set_rx_mac_pause_en(dsaf_dev,
mac_cb->mac_id, rx_en);
if (ret)
return ret;
rx_en = 0;
}
return hns_mac_set_pauseparam(mac_cb, rx_en, tx_en);
}
static void hns_ae_get_coalesce_usecs(struct hnae_handle *handle,
u32 *tx_usecs, u32 *rx_usecs)
{
struct ring_pair_cb *ring_pair =
container_of(handle->qs[0], struct ring_pair_cb, q);
*tx_usecs = hns_rcb_get_coalesce_usecs(ring_pair->rcb_common,
ring_pair->port_id_in_comm);
*rx_usecs = hns_rcb_get_coalesce_usecs(ring_pair->rcb_common,
ring_pair->port_id_in_comm);
}
static void hns_ae_get_max_coalesced_frames(struct hnae_handle *handle,
u32 *tx_frames, u32 *rx_frames)
{
struct ring_pair_cb *ring_pair =
container_of(handle->qs[0], struct ring_pair_cb, q);
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);
if (AE_IS_VER1(dsaf_dev->dsaf_ver) ||
handle->port_type == HNAE_PORT_DEBUG)
*tx_frames = hns_rcb_get_rx_coalesced_frames(
ring_pair->rcb_common, ring_pair->port_id_in_comm);
else
*tx_frames = hns_rcb_get_tx_coalesced_frames(
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/netdevice.h`, `linux/spinlock.h`, `hnae.h`, `hns_dsaf_mac.h`, `hns_dsaf_main.h`, `hns_dsaf_ppe.h`, `hns_dsaf_rcb.h`.
- Detected declarations: `function Copyright`, `function hns_ae_get_q_num_per_vf`, `function hns_ae_get_vf_num_per_port`, `function hns_ae_put_handle`, `function hns_ae_wait_flow_down`, `function hns_ae_ring_enable_all`, `function hns_ae_init_queue`, `function hns_ae_fini_queue`, `function hns_ae_set_mac_address`, `function hns_ae_add_uc_address`.
- 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.
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.