drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c- Extension
.c- Size
- 12741 bytes
- Lines
- 491
- 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.
- 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.hbrcmu_utils.hbrcmu_wifi.hcore.hbus.hfwsignal.hdebug.htracepoint.hproto.hbcdc.h
Detected Declarations
struct brcmf_proto_bcdc_dcmdstruct brcmf_proto_bcdc_headerstruct brcmf_bcdcfunction brcmf_proto_bcdc_msgfunction brcmf_proto_bcdc_cmpltfunction brcmf_proto_bcdc_query_dcmdfunction brcmf_proto_bcdc_set_dcmdfunction brcmf_proto_bcdc_hdrpushfunction brcmf_proto_bcdc_hdrpullfunction brcmf_proto_bcdc_tx_queue_datafunction brcmf_proto_bcdc_txdatafunction brcmf_proto_bcdc_txflowblockfunction brcmf_proto_bcdc_txcompletefunction brcmf_proto_bcdc_configure_addr_modefunction brcmf_proto_bcdc_add_iffunction brcmf_proto_bcdc_del_iffunction brcmf_proto_bcdc_reset_iffunction brcmf_proto_bcdc_init_donefunction brcmf_proto_bcdc_debugfs_createfunction brcmf_proto_bcdc_attachfunction brcmf_proto_bcdc_detach
Annotated Snippet
struct brcmf_proto_bcdc_dcmd {
__le32 cmd; /* dongle command value */
__le32 len; /* lower 16: output buflen;
* upper 16: input buflen (excludes header) */
__le32 flags; /* flag defns given below */
__le32 status; /* status code returned from the device */
};
/* BCDC flag definitions */
#define BCDC_DCMD_ERROR 0x01 /* 1=cmd failed */
#define BCDC_DCMD_SET 0x02 /* 0=get, 1=set cmd */
#define BCDC_DCMD_IF_MASK 0xF000 /* I/F index */
#define BCDC_DCMD_IF_SHIFT 12
#define BCDC_DCMD_ID_MASK 0xFFFF0000 /* id an cmd pairing */
#define BCDC_DCMD_ID_SHIFT 16 /* ID Mask shift bits */
#define BCDC_DCMD_ID(flags) \
(((flags) & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT)
/*
* BCDC header - Broadcom specific extension of CDC.
* Used on data packets to convey priority across USB.
*/
#define BCDC_HEADER_LEN 4
#define BCDC_PROTO_VER 2 /* Protocol version */
#define BCDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */
#define BCDC_FLAG_VER_SHIFT 4 /* Protocol version shift */
#define BCDC_FLAG_SUM_GOOD 0x04 /* Good RX checksums */
#define BCDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */
#define BCDC_PRIORITY_MASK 0x7
#define BCDC_FLAG2_IF_MASK 0x0f /* packet rx interface in APSTA */
#define BCDC_FLAG2_IF_SHIFT 0
#define BCDC_GET_IF_IDX(hdr) \
((int)((((hdr)->flags2) & BCDC_FLAG2_IF_MASK) >> BCDC_FLAG2_IF_SHIFT))
#define BCDC_SET_IF_IDX(hdr, idx) \
((hdr)->flags2 = (((hdr)->flags2 & ~BCDC_FLAG2_IF_MASK) | \
((idx) << BCDC_FLAG2_IF_SHIFT)))
/**
* struct brcmf_proto_bcdc_header - BCDC header format
*
* @flags: flags contain protocol and checksum info.
* @priority: 802.1d priority and USB flow control info (bit 4:7).
* @flags2: additional flags containing dongle interface index.
* @data_offset: start of packet data. header is following by firmware signals.
*/
struct brcmf_proto_bcdc_header {
u8 flags;
u8 priority;
u8 flags2;
u8 data_offset;
};
/*
* maximum length of firmware signal data between
* the BCDC header and packet data in the tx path.
*/
#define BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES 12
#define RETRIES 2 /* # of retries to retrieve matching dcmd response */
#define BUS_HEADER_LEN (16+64) /* Must be atleast SDPCM_RESERVE
* (amount of header tha might be added)
* plus any space that might be needed
* for bus alignment padding.
*/
#define ROUND_UP_MARGIN 2048
struct brcmf_bcdc {
u16 reqid;
u8 bus_header[BUS_HEADER_LEN];
struct brcmf_proto_bcdc_dcmd msg;
unsigned char buf[BRCMF_DCMD_MAXLEN];
struct brcmf_fws_info *fws;
};
struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr)
{
struct brcmf_bcdc *bcdc = drvr->proto->pd;
return bcdc->fws;
}
static int
brcmf_proto_bcdc_msg(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
uint len, bool set)
{
struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd;
struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg;
u32 flags;
Annotation
- Immediate include surface: `linux/types.h`, `linux/netdevice.h`, `brcmu_utils.h`, `brcmu_wifi.h`, `core.h`, `bus.h`, `fwsignal.h`, `debug.h`.
- Detected declarations: `struct brcmf_proto_bcdc_dcmd`, `struct brcmf_proto_bcdc_header`, `struct brcmf_bcdc`, `function brcmf_proto_bcdc_msg`, `function brcmf_proto_bcdc_cmplt`, `function brcmf_proto_bcdc_query_dcmd`, `function brcmf_proto_bcdc_set_dcmd`, `function brcmf_proto_bcdc_hdrpush`, `function brcmf_proto_bcdc_hdrpull`, `function brcmf_proto_bcdc_tx_queue_data`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.