drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c- Extension
.c- Size
- 11278 bytes
- Lines
- 502
- 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/types.hlinux/netdevice.hlinux/etherdevice.hbrcmu_utils.hcore.hdebug.hbus.hproto.hflowring.hmsgbuf.hcommon.h
Detected Declarations
function brcmf_flowring_is_tdls_macfunction brcmf_flowring_lookupfunction brcmf_flowring_createfunction brcmf_flowring_tidfunction brcmf_flowring_blockfunction brcmf_flowring_deletefunction brcmf_flowring_enqueuefunction brcmf_flowring_reinsertfunction brcmf_flowring_qlenfunction brcmf_flowring_openfunction brcmf_flowring_ifidx_getfunction brcmf_flowring_detachfunction brcmf_flowring_configure_addr_modefunction brcmf_flowring_delete_peerfunction brcmf_flowring_add_tdls_peer
Annotated Snippet
if ((flow->rings[i]) && (i != flowid)) {
ring = flow->rings[i];
if ((ring->status == RING_OPEN) &&
(brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
if (ring->blocked) {
currently_blocked = true;
break;
}
}
}
}
flow->rings[flowid]->blocked = blocked;
if (currently_blocked) {
spin_unlock_irqrestore(&flow->block_lock, flags);
return;
}
bus_if = dev_get_drvdata(flow->dev);
drvr = bus_if->drvr;
ifp = brcmf_get_ifp(drvr, ifidx);
brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
spin_unlock_irqrestore(&flow->block_lock, flags);
}
void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
{
struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
struct brcmf_flowring_ring *ring;
struct brcmf_if *ifp;
u16 hash_idx;
u8 ifidx;
struct sk_buff *skb;
ring = flow->rings[flowid];
if (!ring)
return;
ifidx = brcmf_flowring_ifidx_get(flow, flowid);
ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
brcmf_flowring_block(flow, flowid, false);
hash_idx = ring->hash_id;
flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;
eth_zero_addr(flow->hash[hash_idx].mac);
flow->rings[flowid] = NULL;
skb = skb_dequeue(&ring->skblist);
while (skb) {
brcmf_txfinalize(ifp, skb, false);
skb = skb_dequeue(&ring->skblist);
}
kfree(ring);
}
u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
struct sk_buff *skb)
{
struct brcmf_flowring_ring *ring;
ring = flow->rings[flowid];
skb_queue_tail(&ring->skblist, skb);
if (!ring->blocked &&
(skb_queue_len(&ring->skblist) > BRCMF_FLOWRING_HIGH)) {
brcmf_flowring_block(flow, flowid, true);
brcmf_dbg(MSGBUF, "Flowcontrol: BLOCK for ring %d\n", flowid);
/* To prevent (work around) possible race condition, check
* queue len again. It is also possible to use locking to
* protect, but that is undesirable for every enqueue and
* dequeue. This simple check will solve a possible race
* condition if it occurs.
*/
if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
brcmf_flowring_block(flow, flowid, false);
}
return skb_queue_len(&ring->skblist);
}
struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
{
struct brcmf_flowring_ring *ring;
struct sk_buff *skb;
ring = flow->rings[flowid];
Annotation
- Immediate include surface: `linux/types.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `brcmu_utils.h`, `core.h`, `debug.h`, `bus.h`, `proto.h`.
- Detected declarations: `function brcmf_flowring_is_tdls_mac`, `function brcmf_flowring_lookup`, `function brcmf_flowring_create`, `function brcmf_flowring_tid`, `function brcmf_flowring_block`, `function brcmf_flowring_delete`, `function brcmf_flowring_enqueue`, `function brcmf_flowring_reinsert`, `function brcmf_flowring_qlen`, `function brcmf_flowring_open`.
- 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.