/*******************************************************************************
*
* Intel Ethernet Controller XL710 Family Linux Driver
* Copyright(c) 2013 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information:
* e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
******************************************************************************/
#ifdef CONFIG_DEBUG_FS
#include <linux/fs.h>
#include <linux/debugfs.h>
#include "i40e.h"
static struct dentry *i40e_dbg_root;
/**
* i40e_dbg_find_vsi - searches for the vsi with the given seid
* @pf - the pf structure to search for the vsi
* @seid - seid of the vsi it is searching for
**/
static struct i40e_vsi *i40e_dbg_find_vsi(struct i40e_pf *pf, int seid)
{
int i;
if (seid < 0)
dev_info(&pf->pdev->dev, "%d: bad seid\n", seid);
else
for (i = 0; i < pf->hw.func_caps.num_vsis; i++)
if (pf->vsi[i] && (pf->vsi[i]->seid == seid))
return pf->vsi[i];
return NULL;
}
/**
* i40e_dbg_find_veb - searches for the veb with the given seid
* @pf - the pf structure to search for the veb
* @seid - seid of the veb it is searching for
**/
static struct i40e_veb *i40e_dbg_find_veb(struct i40e_pf *pf, int seid)
{
int i;
if ((seid < I40E_BASE_VEB_SEID) ||
(seid > (I40E_BASE_VEB_SEID + I40E_MAX_VEB)))
dev_info(&pf->pdev->dev, "%d: bad seid\n", seid);
else
for (i = 0; i < I40E_MAX_VEB; i++)
if (pf->veb[i] && pf->veb[i]->seid == seid)
return pf->veb[i];
return NULL;
}
/**************************************************************
* dump
* The dump entry in debugfs is for getting a data snapshow of
* the driver's current configuration and runtime details.
* When the filesystem entry is written, a snapshot is taken.
* When the entry is read, the most recent snapshot data is dumped.
**************************************************************/
static char *i40e_dbg_dump_buf;
static ssize_t i40e_dbg_dump_data_len;
static ssize_t i40e_dbg_dump_buffer_len;
/**
* i40e_dbg_dump_read - read the dump data
* @filp: the opened file
* @buffer: where to write the data for the user to read
* @count: the size of the user's buffer
* @ppos: file position offset
**/
static ssize_t i40e_dbg_dump_read(struct file *filp, char __user *buffer,
size_t count, loff_t *ppos)
{
int bytes_not_copied;
int len;
/* is *ppos bigger than the available data? */
if (*ppos >= i40e_dbg_dump_data_len || !i40e_dbg_dump_buf)
return 0;
/* be sure to not read beyond the end of available data */
len = min_t(int, count, (i40e_dbg_dump_data_len - *ppos));
bytes_not_copied = copy_to_user(buffer, &i40e_dbg_dump_buf[*ppos], len);
if (bytes_not_copied < 0)
return bytes_not_copied;
*ppos += len;
return len;
}
/**
* i40e_dbg_prep_dump_buf
* @pf: the pf we're working with
* @buflen: the desired buffer length
*
* Return positive if success, 0 if failed
**/
static int i40e_dbg_prep_dump_buf(struct i40e_pf *pf, int buflen)
{
/* if not already big enough, prep for re alloc */
if (i40e_dbg_dump_buffer_len && i40e_dbg_dump_buffer_len < buflen) {
kfree(i40e_dbg_dump_buf);
i40e_dbg_dump_buffer_len = 0;
i40e_dbg_dump_buf = NULL;
}
/* get a new buffer if needed */
if (!i40e_dbg_dump_buf) {
i40e_dbg_dump_buf = kzalloc(buflen, GFP_KERNEL);
if (i40e_dbg_dump_buf != NULL)
i40e_dbg_dump_buffer_len = buflen;
}
return i40e_dbg_dump_buffer_len;
}
/**
* i40e_dbg_dump_write - trigger a datadump snapshot
* @filp: the opened file
* @buffer: where to find the user's data
* @count: the length of the user's data
* @ppos: file position offset
*
* Any write clears the stats
**/
static ssize_t i40e_dbg_dump_write(struct file *filp,
const char __user *buffer,
size_t count, loff_t *ppos)
{
struct i40e_pf *pf = filp->private_data;
bool seid_found = false;
long seid = -1;
int buflen = 0;
int i, ret;
int len;
u8 *p;
/* don't allow partial writes */
if (*ppos != 0)
return 0;
/* decode the SEID given to be dumped */
ret = kstrtol_from_user(buffer, count, 0, &seid);
if (ret) {
dev_info(&pf->pdev->dev, "bad seid value\n");
} else if (seid == 0) {
seid_found = true;
kfree(i40e_dbg_dump_buf);
i40e_dbg_dump_buffer_len = 0;
i40e_dbg_dump_data_len = 0;
i40e_dbg_dump_buf = NULL;
dev_info(&pf->pdev->dev, "debug buffer freed\n");
} else if (seid == pf->pf_seid || seid == 1) {
seid_found = true;
buflen = sizeof(struct i40e_pf);
buflen += (sizeof(struct i40e_aq_desc)
* (pf->hw.aq.num_arq_entries + pf->hw.aq.num_asq_entries));
if (i40e_dbg_prep_dump_buf(pf, buflen)) {
p = i40e_dbg_dump_buf;
len = sizeof(struct i40e_pf);
memcpy(p, pf, len);
p += len;
len = (sizeof(struct i40e_aq_desc)
* pf->hw.aq.num_asq_entries);
memcpy(p, pf->hw.aq.asq.desc, len);
p += len;
len = (sizeof(struct i40e_aq_desc)
* pf->hw.aq.num_arq_entries);
memcpy(p, pf->hw.aq.arq.desc, len);
p += len;
i40e_dbg_dump_data_len = buflen;
dev_info(&pf->pdev->dev,
"PF seid %ld dumped %d bytes\n",
seid, (int)i40e_dbg_dump_data_len);
}
} else if (seid >= I40E_BASE_VSI_SEID) {
struct i40e_vsi *vsi = NULL;
struct i40e_mac_filter *f;
int filter_count = 0;
mutex_lock(&pf->switch_mutex);
vsi = i40e_dbg_find_vsi(pf, seid);
if (!vsi) {
mutex_unlock(&pf->switch_mutex);
goto write_exit;
}
buflen = sizeof(struct i40e_vsi);
buflen += sizeof(struct i40e_q_vector) * vsi->num_q_vectors;
buflen += sizeof(struct i40e_ring) * 2 * vsi->num_queue_pairs;
buflen += sizeof(struct i40e_tx_buffer) * vsi->num_queue_pairs;
buflen += sizeof(struct i40e_rx_buffer) * vsi->num_queue_pairs;
list_for_each_entry(f, &vsi->mac_filter_list, list)
filter_count++;
buflen += sizeof(struct i40e_mac_filter) * filter_count;
if (i40e_dbg_prep_dump_buf(pf, buflen)) {
p = i40e_dbg_dump_buf;
seid_found = true;
len = sizeof(struct i40e_vsi);
memcpy(p, vsi, len);
p += len;
if (vsi->num_q_vectors) {
len = (sizeof(struct i40e_q_vector)
* vsi->num_q_vectors);
memcpy(p, vsi->q_vectors, len);
p += len;
}
if (vsi->num_queue_pairs) {
len = (sizeof(struct i40e_ring) *
vsi->num_queue_pairs);
memcpy(p, vsi->tx_rings, len);
p += len;
memcpy(p, vsi->rx_rings, len);
p += len;
}
if (vsi->tx_rings[0]) {
len = sizeof(struct i40e_tx_buffer);
for (i = 0; i < vsi->num_queue_pairs; i++) {
memcpy(p, vsi->tx_rings[i]->tx_bi, len);
p += len;
}
len = sizeof(struct i40e_rx_buffer);
for (i = 0; i < vsi->num_queue_pairs; i++) {
memcpy(p, vsi->rx_rings[i]->rx_bi, len);
p += len;
}
}
/* macvlan filter list */
len = sizeof(struct i40e_mac_filter);
list_for_each_entry(f, &vsi->mac_filter_list, list) {
memcpy(p, f, len);
p += len;
}
i40e_dbg_dump_data_len = buflen;
dev_info(&pf->pdev->dev,
"VSI seid %ld dumped %d bytes\n",
seid, (int)i40e_dbg_dump_data_len);
}
mutex_unlock(&pf->switch_mutex);
} else if (seid >= I40E_BASE_VEB_SEID) {
struct i40e_veb *veb = NULL;
mutex_lock(&pf->switch_mutex);
veb = i40e_dbg_find_veb(pf, seid);
if (!veb) {
i40e_debugfs.rar_family


2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
标题中的“i40e_debugfs.rar_family”表明这是一个与Intel Ethernet Controller XL710家族相关的调试文件系统(debugfs)的压缩包。这个驱动程序专为Linux操作系统设计,用于管理和优化Intel Ethernet Controller XL710系列网络接口控制器(NICs)的性能。 Intel Ethernet Controller XL710是一款高性能的以太网控制器,主要应用于数据中心和企业网络环境,提供10/40 Gigabit Ethernet(GbE)连接。其特点包括高带宽、低延迟以及硬件加速功能,如TCP/IP卸载、虚拟化支持和能源效率优化。 `i40e_debugfs.c`文件是C语言编写的源代码,它是实现debugfs组件的一部分。Debugfs是一个内核虚拟文件系统,允许内核模块创建和维护用于调试目的的文件。这些文件通常包含各种状态信息、统计数据或控制变量,使得开发者可以方便地查看和调整内核内部的状态,而无需重启系统或使用复杂的内核调试工具。 在`i40e_debugfs.c`中,我们可以预期找到以下内容: 1. **数据结构和定义**:文件会包含与XL710 NIC相关的数据结构定义,用于表示设备状态、网络缓冲区、接收和发送队列等。 2. **调试接口**:定义了一系列的函数,用于在debugfs中创建和管理调试文件,这些文件可能包含了NIC的状态信息,如注册表值、中断计数、错误日志等。 3. **读写操作**:实现read和write函数,使得用户空间程序可以通过读取debugfs文件获取设备状态,或者通过写入文件来修改某些设备设置(例如启用或禁用特定功能)。 4. **统计信息**:可能会有用于收集设备性能统计的函数,比如数据包传输速率、丢包率、错误计数等。 5. **调试控制**:可能包含用于控制调试级别的功能,这样开发者可以根据需要选择打印更多或更少的调试信息。 6. **内存管理**:处理内存分配和释放,确保内存资源的有效利用和避免内存泄漏。 7. **同步机制**:由于可能有多个线程同时访问debugfs文件,所以代码中可能包含了互斥锁或其他同步原语,以保证数据一致性。 8. **初始化和清理**:模块加载时初始化debugfs接口,模块卸载时清理相关资源。 理解并分析`i40e_debugfs.c`可以帮助开发者深入了解XL710 NIC在Linux环境下的工作原理,定位和解决问题,优化网络性能,或者为驱动程序添加新的特性。对于系统管理员来说,debugfs提供了一个实用的工具,让他们能够在不干扰生产环境的情况下监控和调试网络设备。

















- 1

- #完美解决问题
- #运行顺畅
- #内容详尽
- #全网独家
- #注释完整

- 粉丝: 115
- 资源: 1万+





我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- Tipszotero搜索引擎的设置,更好地抓取论文信息
- ,,MD500E源码和代码解析文档 代码包含了同步机FOC控制算法、电阻、电感、磁链、反电动势、死区补偿、过调制限制、弱磁等算法,支持无感和有感,亲自带电机运行过 ,关键词:MD500E源码; 代
- 基于 Java AIO 和 T-IO: 利用 Java 异步 I/O 和 T-IO 提供高效性能 支持常用的 Spring-Boot 注解,但不使用 Spring 的 IOC 和 AOP
- PyTorch开源机器学习库简介与入门教程-适用于AI开发
- Nova for mac 代码编辑工具
- ,,FOC 无感 混合磁链观测器 电机控制 代码 PMSM MiniDD(直驱)电机变频无感程序,包含偏心,重量,共振等感知算法,所有算法都不基于库函数,MCU底层配置完全手写 ,核心关键词:FO
- 5G+AI+物联网智慧医院信息化顶层设计解决方案 (1).ppt
- 大数据湖总体规划及一体化运营管理建设方案.ppt
- 大数据集群治理与数据治理解决方案.ppt
- ,,流水线贴膜机完成项目程序,包含PLC程序和触摸屏程序,程序内 包含上下气缸控制,夹紧气缸控制,输送带电机控制,贴膜伺服控制,旋转电机控制等类容,非常适合学习简单控制工艺及运动控制初学者学习,该程序
- Dynatrace资料视频,介绍如何使用Dynatrace
- 大数据平台应用功能蓝图、大数据平台数据治理解决方案.ppt
- 大数据平台数据治理体系与大数据架构技术方案.ppt
- 大数据平台应用功能蓝图与数据治理解决方案.ppt
- ,,国内新能源汽车巨头某车型电机控制器软件源代码 ,基于TI 28x平台,含核心算法,全部开源,注释详细,程序规范,包含永磁同步电机FOC矢量控制算法、坡起辅助 、怠速蠕行、刹车油门扭矩协调、缺相诊断
- 大数据治理平台总体架构、技术架构、功能架构及数据应用解决方案.ppt


