drivers/net/wireless/realtek/rtlwifi/core.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/core.c- Extension
.c- Size
- 56028 bytes
- Lines
- 1959
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
wifi.hcore.hcam.hbase.hps.hpwrseqcmd.hbtcoexist/rtl_btc.hlinux/firmware.hlinux/export.hnet/cfg80211.h
Detected Declarations
function rtl_addr_delayfunction rtl_rfreg_delayfunction rtl_fw_do_workfunction rtl_fw_cbfunction rtl_wowlan_fw_cbfunction rtl_op_startfunction rtl_op_stopfunction rtl_op_txfunction rtl_op_add_interfacefunction rtl_op_remove_interfacefunction rtl_op_change_interfacefunction crc16_ccittfunction _calculate_wol_pattern_crcfunction _rtl_add_wowlan_patternsfunction rtl_op_suspendfunction rtl_op_resumefunction rtl_op_configfunction rtl_op_configure_filterfunction rtl_op_sta_addfunction rtl_op_sta_removefunction _rtl_get_hal_qnumfunction rtl_op_conf_txfunction send_beacon_framefunction rtl_update_beacon_work_callbackfunction rtl_op_bss_info_changedfunction rtl_op_get_tsffunction rtl_op_set_tsffunction rtl_op_reset_tsffunction rtl_op_sta_notifyfunction rtl_op_ampdu_actionfunction rtl_op_sw_scan_startfunction rtl_op_sw_scan_completefunction rtl_op_set_keyfunction rtl_op_rfkill_pollfunction rtl_op_flushfunction rtl_op_set_timfunction rtl_hal_pwrseqcmdparsingfunction rtl_cmd_send_packetfunction rtl_init_sw_ledsfunction rtl_btc_status_falsefunction rtl_dm_diginitexport channel5gexport channel5g_80mexport rtl_addr_delayexport rtl_rfreg_delayexport rtl_fw_cbexport rtl_wowlan_fw_cbexport rtl_update_beacon_work_callback
Annotated Snippet
if (rtlpriv->cfg->alt_fw_name) {
err = request_firmware(&firmware,
rtlpriv->cfg->alt_fw_name,
rtlpriv->io.dev);
pr_info("Loading alternative firmware %s\n",
rtlpriv->cfg->alt_fw_name);
if (!err)
goto found_alt;
}
pr_err("Selected firmware is not available\n");
rtlpriv->max_fw_size = 0;
goto exit;
}
found_alt:
if (firmware->size > rtlpriv->max_fw_size) {
pr_err("Firmware is too big!\n");
release_firmware(firmware);
goto exit;
}
if (!is_wow) {
memcpy(rtlpriv->rtlhal.pfirmware, firmware->data,
firmware->size);
rtlpriv->rtlhal.fwsize = firmware->size;
} else {
memcpy(rtlpriv->rtlhal.wowlan_firmware, firmware->data,
firmware->size);
rtlpriv->rtlhal.wowlan_fwsize = firmware->size;
}
release_firmware(firmware);
exit:
complete(&rtlpriv->firmware_loading_complete);
}
void rtl_fw_cb(const struct firmware *firmware, void *context)
{
rtl_fw_do_work(firmware, context, false);
}
EXPORT_SYMBOL(rtl_fw_cb);
void rtl_wowlan_fw_cb(const struct firmware *firmware, void *context)
{
rtl_fw_do_work(firmware, context, true);
}
EXPORT_SYMBOL(rtl_wowlan_fw_cb);
/*mutex for start & stop is must here. */
static int rtl_op_start(struct ieee80211_hw *hw)
{
int err = 0;
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
if (!is_hal_stop(rtlhal))
return 0;
if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
return 0;
mutex_lock(&rtlpriv->locks.conf_mutex);
err = rtlpriv->intf_ops->adapter_start(hw);
if (!err)
rtl_watch_dog_timer_callback(&rtlpriv->works.watchdog_timer);
mutex_unlock(&rtlpriv->locks.conf_mutex);
return err;
}
static void rtl_op_stop(struct ieee80211_hw *hw, bool suspend)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
bool support_remote_wakeup = false;
if (is_hal_stop(rtlhal))
return;
rtlpriv->cfg->ops->get_hw_reg(hw, HAL_DEF_WOWLAN,
(u8 *)(&support_remote_wakeup));
/* here is must, because adhoc do stop and start,
* but stop with RFOFF may cause something wrong,
* like adhoc TP
*/
if (unlikely(ppsc->rfpwr_state == ERFOFF))
rtl_ips_nic_on(hw);
mutex_lock(&rtlpriv->locks.conf_mutex);
/* if wowlan supported, DON'T clear connected info */
if (!(support_remote_wakeup &&
rtlhal->enter_pnp_sleep)) {
mac->link_state = MAC80211_NOLINK;
Annotation
- Immediate include surface: `wifi.h`, `core.h`, `cam.h`, `base.h`, `ps.h`, `pwrseqcmd.h`, `btcoexist/rtl_btc.h`, `linux/firmware.h`.
- Detected declarations: `function rtl_addr_delay`, `function rtl_rfreg_delay`, `function rtl_fw_do_work`, `function rtl_fw_cb`, `function rtl_wowlan_fw_cb`, `function rtl_op_start`, `function rtl_op_stop`, `function rtl_op_tx`, `function rtl_op_add_interface`, `function rtl_op_remove_interface`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.