drivers/net/ipa/ipa_table.c
Source file repositories/reference/linux-study-clean/drivers/net/ipa/ipa_table.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ipa/ipa_table.c- Extension
.c- Size
- 24233 bytes
- Lines
- 776
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/build_bug.hlinux/device.hlinux/dma-mapping.hlinux/io.hlinux/types.hgsi.hgsi_trans.hipa.hipa_cmd.hipa_endpoint.hipa_mem.hipa_reg.hipa_table.hipa_version.h
Detected Declarations
function Copyrightfunction ipa_table_memfunction ipa_table_hash_supportfunction ipa_filtered_validfunction ipa_table_addrfunction ipa_table_reset_addfunction ipa_filter_reset_tablefunction ipa_filter_resetfunction ipa_route_resetfunction ipa_table_resetfunction ipa_table_hash_flushfunction ipa_table_init_addfunction ipa_table_setupfunction ipa_filter_tuple_zerofunction ipa_filter_configfunction ipa_route_id_modemfunction ipa_route_tuple_zerofunction ipa_route_configfunction ipa_table_configfunction ipa_table_mem_validfunction ipa_table_initfunction ipa_table_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (C) 2018-2024 Linaro Ltd.
*/
#include <linux/bitops.h>
#include <linux/build_bug.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/types.h>
#include "gsi.h"
#include "gsi_trans.h"
#include "ipa.h"
#include "ipa_cmd.h"
#include "ipa_endpoint.h"
#include "ipa_mem.h"
#include "ipa_reg.h"
#include "ipa_table.h"
#include "ipa_version.h"
/**
* DOC: IPA Filter and Route Tables
*
* The IPA has tables defined in its local (IPA-resident) memory that define
* filter and routing rules. An entry in either of these tables is a little
* endian 64-bit "slot" that holds the address of a rule definition. (The
* size of these slots is 64 bits regardless of the host DMA address size.)
*
* Separate tables (both filter and route) are used for IPv4 and IPv6. There
* is normally another set of "hashed" filter and route tables, which are
* used with a hash of message metadata. Hashed operation is not supported
* by all IPA hardware (IPA v4.2 doesn't support hashed tables).
*
* Rules can be in local memory or in DRAM (system memory). The offset of
* an object (such as a route or filter table) in IPA-resident memory must
* 128-byte aligned. An object in system memory (such as a route or filter
* rule) must be at an 8-byte aligned address. We currently only place
* route or filter rules in system memory.
*
* A rule consists of a contiguous block of 32-bit values terminated with
* 32 zero bits. A special "zero entry" rule consisting of 64 zero bits
* represents "no filtering" or "no routing," and is the reset value for
* filter or route table rules.
*
* Each filter rule is associated with an AP or modem TX endpoint, though
* not all TX endpoints support filtering. The first 64-bit slot in a
* filter table is a bitmap indicating which endpoints have entries in
* the table. Each set bit in this bitmap indicates the presence of the
* address of a filter rule in the memory following the bitmap. Until IPA
* v5.0, the low-order bit (bit 0) in this bitmap represents a special
* global filter, which applies to all traffic. Otherwise the position of
* each set bit represents an endpoint for which a filter rule is defined.
*
* The global rule is not used in current code, and support for it is
* removed starting at IPA v5.0. For IPA v5.0+, the endpoint bitmap
* position defines the endpoint ID--i.e. if bit 1 is set in the endpoint
* bitmap, endpoint 1 has a filter rule. Older versions of IPA represent
* the presence of a filter rule for endpoint X by bit (X + 1) being set.
* I.e., bit 1 set indicates the presence of a filter rule for endpoint 0,
* and bit 3 set means there is a filter rule present for endpoint 2.
*
* Each filter table entry has the address of a set of equations that
* implement a filter rule. So following the endpoint bitmap there
* will be such an address/entry for each endpoint with a set bit in
* the bitmap.
*
* The AP initializes all entries in a filter table to refer to a "zero"
* rule. Once initialized, the modem and AP update the entries for
* endpoints they "own" directly. Currently the AP does not use the IPA
* filtering functionality.
*
* This diagram shows an example of a filter table with an endpoint
* bitmap as defined prior to IPA v5.0.
*
* IPA Filter Table
* ----------------------
* endpoint bitmap | 0x0000000000000048 | Bits 3 and 6 set (endpoints 2 and 5)
* |--------------------|
* 1st endpoint | 0x000123456789abc0 | DMA address for modem endpoint 2 rule
* |--------------------|
* 2nd endpoint | 0x000123456789abf0 | DMA address for AP endpoint 5 rule
* |--------------------|
* (unused) | | (Unused space in filter table)
* |--------------------|
* . . .
* |--------------------|
* (unused) | | (Unused space in filter table)
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/build_bug.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/io.h`, `linux/types.h`, `gsi.h`, `gsi_trans.h`.
- Detected declarations: `function Copyright`, `function ipa_table_mem`, `function ipa_table_hash_support`, `function ipa_filtered_valid`, `function ipa_table_addr`, `function ipa_table_reset_add`, `function ipa_filter_reset_table`, `function ipa_filter_reset`, `function ipa_route_reset`, `function ipa_table_reset`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.