drivers/net/wireless/microchip/wilc1000/hif.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/microchip/wilc1000/hif.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/microchip/wilc1000/hif.c- Extension
.c- Size
- 49848 bytes
- Lines
- 2022
- 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
netdev.h
Detected Declarations
struct wilc_rcvd_mac_infostruct wilc_set_multicaststruct host_if_wowlan_triggerstruct wilc_del_all_stastruct host_if_msgfunction wilc_alloc_workfunction wilc_enqueue_workfunction wilc_get_vif_idxfunction wilc_for_each_viffunction handle_scan_donefunction wilc_scanfunction wilc_send_connect_widfunction handle_connect_timeoutfunction wilc_parse_join_bss_paramfunction handle_rcvd_ntwrk_infofunction host_int_get_assoc_res_infofunction wilc_parse_assoc_resp_infofunction host_int_parse_assoc_resp_infofunction wilc_handle_disconnectfunction handle_rcvd_gnrl_async_infofunction wilc_disconnectfunction wilc_get_statisticsfunction handle_get_statisticsfunction wilc_hif_pack_sta_paramfunction handle_remain_on_chanfunction wilc_handle_roc_expiredfunction wilc_handle_listen_state_expiredfunction listen_timer_cbfunction handle_set_mcast_filterfunction wilc_set_wowlan_triggerfunction wilc_set_external_auth_paramfunction handle_scan_timerfunction handle_scan_completefunction timer_scan_cbfunction timer_connect_cbfunction wilc_add_ptkfunction wilc_add_igtkfunction wilc_add_rx_gtkfunction wilc_set_pmkid_infofunction wilc_get_mac_addressfunction wilc_set_mac_addressfunction wilc_set_join_reqfunction wilc_set_mac_chnl_numfunction wilc_set_operation_modefunction wilc_get_inactive_timefunction wilc_get_rssifunction wilc_get_stats_asyncfunction wilc_hif_set_cfg
Annotated Snippet
struct wilc_rcvd_mac_info {
u8 status;
};
struct wilc_set_multicast {
u32 enabled;
u32 cnt;
u8 *mc_list;
};
struct host_if_wowlan_trigger {
u8 wowlan_trigger;
};
struct wilc_del_all_sta {
u8 assoc_sta;
u8 mac[WILC_MAX_NUM_STA][ETH_ALEN];
};
union wilc_message_body {
struct wilc_rcvd_net_info net_info;
struct wilc_rcvd_mac_info mac_info;
struct wilc_set_multicast mc_info;
struct wilc_remain_ch remain_on_ch;
char *data;
struct host_if_wowlan_trigger wow_trigger;
};
struct host_if_msg {
union wilc_message_body body;
struct wilc_vif *vif;
struct work_struct work;
void (*fn)(struct work_struct *ws);
struct completion work_comp;
bool is_sync;
};
/* 'msg' should be free by the caller for syc */
static struct host_if_msg*
wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *),
bool is_sync)
{
struct host_if_msg *msg;
if (!work_fun)
return ERR_PTR(-EINVAL);
msg = kzalloc_obj(*msg, GFP_ATOMIC);
if (!msg)
return ERR_PTR(-ENOMEM);
msg->fn = work_fun;
msg->vif = vif;
msg->is_sync = is_sync;
if (is_sync)
init_completion(&msg->work_comp);
return msg;
}
static int wilc_enqueue_work(struct host_if_msg *msg)
{
INIT_WORK(&msg->work, msg->fn);
if (!msg->vif || !msg->vif->wilc || !msg->vif->wilc->hif_workqueue)
return -EINVAL;
if (!queue_work(msg->vif->wilc->hif_workqueue, &msg->work))
return -EINVAL;
return 0;
}
/* The idx starts from 0 to (NUM_CONCURRENT_IFC - 1), but 0 index used as
* special purpose in wilc device, so we add 1 to the index to starts from 1.
* As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
*/
int wilc_get_vif_idx(struct wilc_vif *vif)
{
return vif->idx + 1;
}
/* We need to minus 1 from idx which is from wilc device to get real index
* of wilc->vif[], because we add 1 when pass to wilc device in the function
* wilc_get_vif_idx.
* As a result, the index should be between 0 and (NUM_CONCURRENT_IFC - 1).
*/
static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
{
int index = idx - 1;
struct wilc_vif *vif;
Annotation
- Immediate include surface: `netdev.h`.
- Detected declarations: `struct wilc_rcvd_mac_info`, `struct wilc_set_multicast`, `struct host_if_wowlan_trigger`, `struct wilc_del_all_sta`, `struct host_if_msg`, `function wilc_alloc_work`, `function wilc_enqueue_work`, `function wilc_get_vif_idx`, `function wilc_for_each_vif`, `function handle_scan_done`.
- 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.