net/bluetooth/iso.c
Source file repositories/reference/linux-study-clean/net/bluetooth/iso.c
File Facts
- System
- Linux kernel
- Corpus path
net/bluetooth/iso.c- Extension
.c- Size
- 61141 bytes
- Lines
- 2788
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/debugfs.hlinux/seq_file.hlinux/sched/signal.hlinux/uio.hnet/bluetooth/bluetooth.hnet/bluetooth/hci_core.hnet/bluetooth/iso.heir.h
Detected Declarations
struct iso_connstruct iso_pinfofunction iso_conn_freefunction iso_conn_putfunction iso_sock_timeoutfunction iso_sock_set_timerfunction iso_sock_clear_timerfunction iso_chan_delfunction iso_conn_delfunction __iso_chan_addfunction iso_chan_addfunction le_addr_typefunction iso_connect_bisfunction iso_connect_cisfunction iso_send_framefunction iso_recv_framefunction sk_for_eachfunction sk_for_eachfunction bdaddrfunction sk_for_eachfunction sk_for_eachfunction iso_sock_destructfunction iso_sock_cleanup_listenfunction iso_sock_killfunction iso_sock_disconnfunction __iso_sock_closefunction iso_sock_closefunction iso_sock_initfunction iso_sock_createfunction iso_sock_bind_bcfunction iso_sock_rebind_bisfunction iso_sock_rebind_bcfunction iso_sock_bindfunction iso_sock_connectfunction iso_listen_bisfunction iso_listen_cisfunction iso_sock_listenfunction iso_sock_acceptfunction iso_sock_getnamefunction iso_sock_sendmsgfunction iso_conn_defer_acceptfunction iso_conn_big_syncfunction iso_sock_recvmsgfunction check_io_qosfunction check_ucast_qosfunction check_bcast_qosfunction iso_sock_setsockoptfunction iso_sock_getsockopt
Annotated Snippet
static const struct proto_ops iso_sock_ops;
static struct bt_sock_list iso_sk_list = {
.lock = __RW_LOCK_UNLOCKED(iso_sk_list.lock)
};
/* ---- ISO connections ---- */
struct iso_conn {
struct hci_conn *hcon;
/* @lock: spinlock protecting changes to iso_conn fields */
spinlock_t lock;
struct sock *sk;
struct delayed_work timeout_work;
struct sk_buff *rx_skb;
__u32 rx_len;
__u16 tx_sn;
struct kref ref;
};
#define iso_conn_lock(c) spin_lock(&(c)->lock)
#define iso_conn_unlock(c) spin_unlock(&(c)->lock)
static void iso_sock_close(struct sock *sk);
static void iso_sock_kill(struct sock *sk);
/* ----- ISO socket info ----- */
#define iso_pi(sk) ((struct iso_pinfo *)sk)
#define EIR_SERVICE_DATA_LENGTH 4
#define BASE_MAX_LENGTH (HCI_MAX_PER_AD_LENGTH - EIR_SERVICE_DATA_LENGTH)
#define EIR_BAA_SERVICE_UUID 0x1851
/* iso_pinfo flags values */
enum {
BT_SK_BIG_SYNC,
BT_SK_PA_SYNC,
};
struct iso_pinfo {
struct bt_sock bt;
bdaddr_t src;
__u8 src_type;
bdaddr_t dst;
__u8 dst_type;
__u8 bc_sid;
__u8 bc_num_bis;
__u8 bc_bis[ISO_MAX_NUM_BIS];
__u16 sync_handle;
unsigned long flags;
struct bt_iso_qos qos;
bool qos_user_set;
__u8 base_len;
__u8 base[BASE_MAX_LENGTH];
struct iso_conn *conn;
};
static struct bt_iso_qos default_qos;
static bool check_ucast_qos(struct bt_iso_qos *qos);
static bool check_bcast_qos(struct bt_iso_qos *qos);
static bool iso_match_sid(struct sock *sk, void *data);
static bool iso_match_sid_past(struct sock *sk, void *data);
static bool iso_match_sync_handle(struct sock *sk, void *data);
static bool iso_match_sync_handle_pa_report(struct sock *sk, void *data);
static void iso_sock_disconn(struct sock *sk);
typedef bool (*iso_sock_match_t)(struct sock *sk, void *data);
static struct sock *iso_get_sock(struct hci_dev *hdev, bdaddr_t *src,
bdaddr_t *dst, enum bt_sock_state state,
iso_sock_match_t match, void *data);
/* ---- ISO timers ---- */
#define ISO_CONN_TIMEOUT secs_to_jiffies(20)
#define ISO_DISCONN_TIMEOUT secs_to_jiffies(2)
static void iso_conn_free(struct kref *ref)
{
struct iso_conn *conn = container_of(ref, struct iso_conn, ref);
BT_DBG("conn %p", conn);
if (conn->sk)
iso_pi(conn->sk)->conn = NULL;
if (conn->hcon) {
conn->hcon->iso_data = NULL;
Annotation
- Immediate include surface: `linux/module.h`, `linux/debugfs.h`, `linux/seq_file.h`, `linux/sched/signal.h`, `linux/uio.h`, `net/bluetooth/bluetooth.h`, `net/bluetooth/hci_core.h`, `net/bluetooth/iso.h`.
- Detected declarations: `struct iso_conn`, `struct iso_pinfo`, `function iso_conn_free`, `function iso_conn_put`, `function iso_sock_timeout`, `function iso_sock_set_timer`, `function iso_sock_clear_timer`, `function iso_chan_del`, `function iso_conn_del`, `function __iso_chan_add`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern 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.