drivers/net/wwan/t7xx/t7xx_port_trace.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/t7xx/t7xx_port_trace.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/t7xx/t7xx_port_trace.c- Extension
.c- Size
- 2933 bytes
- Lines
- 118
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/relay.hlinux/skbuff.hlinux/wwan.ht7xx_port.ht7xx_port_proxy.ht7xx_state_monitor.h
Detected Declarations
function Copyrightfunction t7xx_trace_remove_buf_file_handlerfunction t7xx_trace_subbuf_start_handlerfunction t7xx_trace_port_uninitfunction t7xx_trace_port_recv_skbfunction t7xx_port_trace_md_state_notify
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2022 Intel Corporation.
*/
#include <linux/debugfs.h>
#include <linux/relay.h>
#include <linux/skbuff.h>
#include <linux/wwan.h>
#include "t7xx_port.h"
#include "t7xx_port_proxy.h"
#include "t7xx_state_monitor.h"
#define T7XX_TRC_SUB_BUFF_SIZE 131072
#define T7XX_TRC_N_SUB_BUFF 32
static struct dentry *t7xx_trace_create_buf_file_handler(const char *filename,
struct dentry *parent,
umode_t mode,
struct rchan_buf *buf,
int *is_global)
{
*is_global = 1;
return debugfs_create_file(filename, mode, parent, buf,
&relay_file_operations);
}
static int t7xx_trace_remove_buf_file_handler(struct dentry *dentry)
{
debugfs_remove(dentry);
return 0;
}
static int t7xx_trace_subbuf_start_handler(struct rchan_buf *buf, void *subbuf,
void *prev_subbuf)
{
if (relay_buf_full(buf)) {
pr_err_ratelimited("Relay_buf full dropping traces");
return 0;
}
return 1;
}
static struct rchan_callbacks relay_callbacks = {
.subbuf_start = t7xx_trace_subbuf_start_handler,
.create_buf_file = t7xx_trace_create_buf_file_handler,
.remove_buf_file = t7xx_trace_remove_buf_file_handler,
};
static void t7xx_trace_port_uninit(struct t7xx_port *port)
{
struct dentry *debugfs_dir = port->t7xx_dev->debugfs_dir;
struct rchan *relaych = port->log.relaych;
if (!relaych)
return;
relay_close(relaych);
debugfs_remove_recursive(debugfs_dir);
port->log.relaych = NULL;
}
static int t7xx_trace_port_recv_skb(struct t7xx_port *port, struct sk_buff *skb)
{
struct rchan *relaych = port->log.relaych;
if (!relaych)
return -EINVAL;
relay_write(relaych, skb->data, skb->len);
dev_kfree_skb(skb);
return 0;
}
static void t7xx_port_trace_md_state_notify(struct t7xx_port *port, unsigned int state)
{
struct rchan *relaych = port->log.relaych;
struct dentry *debugfs_wwan_dir;
struct dentry *debugfs_dir;
if (state != MD_STATE_READY || relaych)
return;
debugfs_wwan_dir = wwan_get_debugfs_dir(port->dev);
if (IS_ERR(debugfs_wwan_dir))
return;
debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, debugfs_wwan_dir);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/relay.h`, `linux/skbuff.h`, `linux/wwan.h`, `t7xx_port.h`, `t7xx_port_proxy.h`, `t7xx_state_monitor.h`.
- Detected declarations: `function Copyright`, `function t7xx_trace_remove_buf_file_handler`, `function t7xx_trace_subbuf_start_handler`, `function t7xx_trace_port_uninit`, `function t7xx_trace_port_recv_skb`, `function t7xx_port_trace_md_state_notify`.
- 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.