net/mac80211/ocb.c
Source file repositories/reference/linux-study-clean/net/mac80211/ocb.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/ocb.c- Extension
.c- Size
- 6968 bytes
- Lines
- 249
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source 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.
- 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
linux/delay.hlinux/if_ether.hlinux/skbuff.hlinux/if_arp.hlinux/etherdevice.hlinux/rtnetlink.hnet/mac80211.hlinux/unaligned.hieee80211_i.hdriver-ops.hrate.h
Detected Declarations
enum ocb_deferred_task_flagsfunction ieee80211_ocb_rx_no_stafunction ieee80211_ocb_housekeepingfunction ieee80211_ocb_workfunction ieee80211_ocb_housekeeping_timerfunction ieee80211_ocb_setup_sdatafunction ieee80211_ocb_joinfunction ieee80211_ocb_leave
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* OCB mode implementation
*
* Copyright: (c) 2014 Czech Technical University in Prague
* (c) 2014 Volkswagen Group Research
* Copyright (C) 2022 - 2024, 2026 Intel Corporation
* Author: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
* Funded by: Volkswagen Group Research
*/
#include <linux/delay.h>
#include <linux/if_ether.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>
#include <net/mac80211.h>
#include <linux/unaligned.h>
#include "ieee80211_i.h"
#include "driver-ops.h"
#include "rate.h"
#define IEEE80211_OCB_HOUSEKEEPING_INTERVAL (60 * HZ)
#define IEEE80211_OCB_PEER_INACTIVITY_LIMIT (240 * HZ)
#define IEEE80211_OCB_MAX_STA_ENTRIES 128
/**
* enum ocb_deferred_task_flags - mac80211 OCB deferred tasks
* @OCB_WORK_HOUSEKEEPING: run the periodic OCB housekeeping tasks
*
* These flags are used in @wrkq_flags field of &struct ieee80211_if_ocb
*/
enum ocb_deferred_task_flags {
OCB_WORK_HOUSEKEEPING,
};
void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
const u8 *bssid, const u8 *addr,
u32 supp_rates)
{
struct ieee80211_if_ocb *ifocb = &sdata->u.ocb;
struct ieee80211_local *local = sdata->local;
struct ieee80211_chanctx_conf *chanctx_conf;
struct ieee80211_supported_band *sband;
struct sta_info *sta;
int band;
if (!ifocb->joined)
return;
/* XXX: Consider removing the least recently used entry and
* allow new one to be added.
*/
if (local->num_sta >= IEEE80211_OCB_MAX_STA_ENTRIES) {
net_info_ratelimited("%s: No room for a new OCB STA entry %pM\n",
sdata->name, addr);
return;
}
ocb_dbg(sdata, "Adding new OCB station %pM\n", addr);
rcu_read_lock();
chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
if (WARN_ON_ONCE(!chanctx_conf)) {
rcu_read_unlock();
return;
}
band = chanctx_conf->def.chan->band;
rcu_read_unlock();
sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
if (!sta)
return;
/* Add only mandatory rates for now */
sband = local->hw.wiphy->bands[band];
sta->sta.deflink.supp_rates[band] = ieee80211_mandatory_rates(sband);
spin_lock(&ifocb->incomplete_lock);
list_add(&sta->list, &ifocb->incomplete_stations);
spin_unlock(&ifocb->incomplete_lock);
wiphy_work_queue(local->hw.wiphy, &sdata->work);
}
static struct sta_info *ieee80211_ocb_finish_sta(struct sta_info *sta)
__acquires(RCU)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/if_ether.h`, `linux/skbuff.h`, `linux/if_arp.h`, `linux/etherdevice.h`, `linux/rtnetlink.h`, `net/mac80211.h`, `linux/unaligned.h`.
- Detected declarations: `enum ocb_deferred_task_flags`, `function ieee80211_ocb_rx_no_sta`, `function ieee80211_ocb_housekeeping`, `function ieee80211_ocb_work`, `function ieee80211_ocb_housekeeping_timer`, `function ieee80211_ocb_setup_sdata`, `function ieee80211_ocb_join`, `function ieee80211_ocb_leave`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.