net/mac80211/tx.c
Source file repositories/reference/linux-study-clean/net/mac80211/tx.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/tx.c- Extension
.c- Size
- 180939 bytes
- Lines
- 6627
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- 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.
- 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/slab.hlinux/skbuff.hlinux/if_vlan.hlinux/etherdevice.hlinux/bitmap.hlinux/rcupdate.hlinux/export.hnet/net_namespace.hnet/ieee80211_radiotap.hnet/cfg80211.hnet/mac80211.hnet/codel.hnet/codel_impl.hlinux/unaligned.hnet/fq_impl.hnet/sock.hnet/gso.hieee80211_i.hdriver-ops.hled.hmesh.hwep.hwpa.hwme.hrate.h
Detected Declarations
enum ieee80211_encryptfunction Copyrightfunction ieee80211_tx_h_dynamic_psfunction ieee80211_tx_h_check_assocfunction ieee80211_vif_get_num_mcast_iffunction purge_old_ps_buffersfunction list_for_each_entry_rcufunction ieee80211_tx_h_multicast_ps_buffunction ieee80211_use_mfpfunction ieee80211_tx_h_unicast_ps_buffunction ieee80211_tx_h_ps_buffunction ieee80211_tx_h_check_control_port_protocolfunction ieee80211_select_link_keyfunction ieee80211_tx_h_select_keyfunction test_sta_flagfunction ieee80211_tx_h_rate_ctrlfunction ieee80211_tx_next_seqfunction ieee80211_tx_h_sequencefunction ieee80211_vif_is_mldfunction counterfunction ieee80211_fragmentfunction ieee80211_tx_h_fragmentfunction skb_queue_walkfunction ieee80211_tx_h_statsfunction skb_queue_walkfunction ieee80211_tx_h_encryptfunction ieee80211_tx_h_calculate_durationfunction skb_queue_walkfunction ieee80211_tx_prep_aggfunction ieee80211_aggr_checkfunction ERR_PTRfunction ieee80211_is_bufferable_mmpdufunction ieee80211_set_skb_enqueue_timefunction codel_skb_len_funcfunction codel_skb_time_funcfunction codel_drop_funcfunction fq_skb_free_funcfunction ieee80211_txq_enqueuefunction fq_vlan_filter_funcfunction ieee80211_txq_remove_vlanfunction ieee80211_txq_initfunction ieee80211_txq_purgefunction ieee80211_txq_set_paramsfunction ieee80211_txq_setup_flowsfunction ieee80211_txq_teardown_flowsfunction ieee80211_queue_skbfunction ieee80211_tx_fragsfunction skb_queue_walk_safe
Annotated Snippet
switch (sband->band) {
case NL80211_BAND_2GHZ:
case NL80211_BAND_LC:
if (tx->sdata->deflink.operating_11g_mode)
flag = IEEE80211_RATE_MANDATORY_G;
else
flag = IEEE80211_RATE_MANDATORY_B;
break;
case NL80211_BAND_5GHZ:
case NL80211_BAND_6GHZ:
flag = IEEE80211_RATE_MANDATORY_A;
break;
default:
flag = 0;
WARN_ON(1);
break;
}
if (r->flags & flag)
mrate = r->bitrate;
}
if (rate == -1) {
/* No matching basic rate found; use highest suitable mandatory
* PHY rate */
rate = mrate;
}
/* Don't calculate ACKs for QoS Frames with NoAck Policy set */
if (ieee80211_is_data_qos(hdr->frame_control) &&
*(ieee80211_get_qos_ctl(hdr)) & IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
dur = 0;
else
/* Time needed to transmit ACK
* (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
* to closest integer */
dur = ieee80211_frame_duration(sband->band, 10, rate, erp,
tx->sdata->vif.bss_conf.use_short_preamble);
if (next_frag_len) {
/* Frame is fragmented: duration increases with time needed to
* transmit next fragment plus ACK and 2 x SIFS. */
dur *= 2; /* ACK + SIFS */
/* next fragment */
dur += ieee80211_frame_duration(sband->band, next_frag_len,
txrate->bitrate, erp,
tx->sdata->vif.bss_conf.use_short_preamble);
}
return cpu_to_le16(dur);
}
/* tx handlers */
static ieee80211_tx_result debug_noinline
ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
{
struct ieee80211_local *local = tx->local;
struct ieee80211_if_managed *ifmgd;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
/* driver doesn't support power save */
if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS))
return TX_CONTINUE;
/* hardware does dynamic power save */
if (ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS))
return TX_CONTINUE;
/* dynamic power save disabled */
if (local->hw.conf.dynamic_ps_timeout <= 0)
return TX_CONTINUE;
/* we are scanning, don't enable power save */
if (local->scanning)
return TX_CONTINUE;
if (!local->ps_sdata)
return TX_CONTINUE;
/* No point if we're going to suspend */
if (local->quiescing)
return TX_CONTINUE;
/* dynamic ps is supported only in managed mode */
if (tx->sdata->vif.type != NL80211_IFTYPE_STATION)
return TX_CONTINUE;
if (unlikely(info->flags & IEEE80211_TX_INTFL_OFFCHAN_TX_OK))
return TX_CONTINUE;
ifmgd = &tx->sdata->u.mgd;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/skbuff.h`, `linux/if_vlan.h`, `linux/etherdevice.h`, `linux/bitmap.h`, `linux/rcupdate.h`, `linux/export.h`.
- Detected declarations: `enum ieee80211_encrypt`, `function Copyright`, `function ieee80211_tx_h_dynamic_ps`, `function ieee80211_tx_h_check_assoc`, `function ieee80211_vif_get_num_mcast_if`, `function purge_old_ps_buffers`, `function list_for_each_entry_rcu`, `function ieee80211_tx_h_multicast_ps_buf`, `function ieee80211_use_mfp`, `function ieee80211_tx_h_unicast_ps_buf`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.