drivers/net/wireless/silabs/wfx/data_tx.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/silabs/wfx/data_tx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/silabs/wfx/data_tx.c- Extension
.c- Size
- 17979 bytes
- Lines
- 595
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/mac80211.hlinux/etherdevice.hdata_tx.hwfx.hbh.hsta.hqueue.hdebug.htraces.hhif_tx_mib.h
Detected Declarations
function Copyrightfunction wfx_tx_policy_buildfunction wfx_tx_policy_is_equalfunction wfx_tx_policy_findfunction wfx_tx_policy_usefunction wfx_tx_policy_releasefunction wfx_tx_policy_getfunction wfx_tx_policy_putfunction wfx_tx_policy_uploadfunction wfx_tx_policy_upload_workfunction wfx_tx_policy_initfunction wfx_is_action_backfunction wfx_tx_get_link_idfunction wfx_tx_fixup_ratesfunction wfx_tx_get_retry_policy_idfunction wfx_tx_get_frame_formatfunction wfx_tx_get_icv_lenfunction wfx_tx_innerfunction wfx_txfunction wfx_skb_dtorfunction wfx_tx_fill_ratesfunction wfx_tx_confirm_cbfunction wfx_flush_viffunction wfx_flush
Annotated Snippet
if (rate->idx > 7) {
WARN(1, "wrong rate->idx value: %d", rate->idx);
return -1;
}
return rate->idx + 14;
}
/* The device only support 2GHz, else band information should be retrieved from
* ieee80211_tx_info
*/
band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
if (rate->idx >= band->n_bitrates) {
WARN(1, "wrong rate->idx value: %d", rate->idx);
return -1;
}
return band->bitrates[rate->idx].hw_value;
}
/* TX policy cache implementation */
static void wfx_tx_policy_build(struct wfx_vif *wvif, struct wfx_tx_policy *policy,
struct ieee80211_tx_rate *rates)
{
struct wfx_dev *wdev = wvif->wdev;
int i, rateid;
u8 count;
WARN(rates[0].idx < 0, "invalid rate policy");
memset(policy, 0, sizeof(*policy));
for (i = 0; i < IEEE80211_TX_MAX_RATES; ++i) {
if (rates[i].idx < 0)
break;
WARN_ON(rates[i].count > 15);
rateid = wfx_get_hw_rate(wdev, &rates[i]);
/* Pack two values in each byte of policy->rates */
count = rates[i].count;
if (rateid % 2)
count <<= 4;
policy->rates[rateid / 2] |= count;
}
}
static bool wfx_tx_policy_is_equal(const struct wfx_tx_policy *a, const struct wfx_tx_policy *b)
{
return !memcmp(a->rates, b->rates, sizeof(a->rates));
}
static int wfx_tx_policy_find(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *wanted)
{
struct wfx_tx_policy *it;
list_for_each_entry(it, &cache->used, link)
if (wfx_tx_policy_is_equal(wanted, it))
return it - cache->cache;
list_for_each_entry(it, &cache->free, link)
if (wfx_tx_policy_is_equal(wanted, it))
return it - cache->cache;
return -1;
}
static void wfx_tx_policy_use(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *entry)
{
++entry->usage_count;
list_move(&entry->link, &cache->used);
}
static int wfx_tx_policy_release(struct wfx_tx_policy_cache *cache, struct wfx_tx_policy *entry)
{
int ret = --entry->usage_count;
if (!ret)
list_move(&entry->link, &cache->free);
return ret;
}
static int wfx_tx_policy_get(struct wfx_vif *wvif, struct ieee80211_tx_rate *rates, bool *renew)
{
int idx;
struct wfx_tx_policy_cache *cache = &wvif->tx_policy_cache;
struct wfx_tx_policy wanted;
struct wfx_tx_policy *entry;
wfx_tx_policy_build(wvif, &wanted, rates);
spin_lock_bh(&cache->lock);
if (list_empty(&cache->free)) {
WARN(1, "unable to get a valid Tx policy");
spin_unlock_bh(&cache->lock);
return HIF_TX_RETRY_POLICY_INVALID;
}
idx = wfx_tx_policy_find(cache, &wanted);
Annotation
- Immediate include surface: `net/mac80211.h`, `linux/etherdevice.h`, `data_tx.h`, `wfx.h`, `bh.h`, `sta.h`, `queue.h`, `debug.h`.
- Detected declarations: `function Copyright`, `function wfx_tx_policy_build`, `function wfx_tx_policy_is_equal`, `function wfx_tx_policy_find`, `function wfx_tx_policy_use`, `function wfx_tx_policy_release`, `function wfx_tx_policy_get`, `function wfx_tx_policy_put`, `function wfx_tx_policy_upload`, `function wfx_tx_policy_upload_work`.
- 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.