// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */ #ifdef CONFIG_DEBUG_FS #include <linux/fs.h> #include <linux/debugfs.h> #include <linux/if_bridge.h> #include "i40e.h" #include "i40e_virtchnl_pf.h" static struct dentry *i40e_dbg_root; enum ring_type { … }; /** * 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) { … } /************************************************************** * command * The command entry in debugfs is for giving the driver commands * to be executed - these may be for changing the internal switch * setup, adding or removing filters, or other things. Many of * these will be useful for some forms of unit testing. **************************************************************/ static char i40e_dbg_command_buf[256] = …; /** * i40e_dbg_command_read - read for command datum * @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_command_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { … } static char *i40e_filter_state_string[] = …; /** * i40e_dbg_dump_vsi_seid - handles dump vsi seid write into command datum * @pf: the i40e_pf created in command write * @seid: the seid the user put in **/ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid) { … } /** * i40e_dbg_dump_aq_desc - handles dump aq_desc write into command datum * @pf: the i40e_pf created in command write **/ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf) { … } /** * i40e_dbg_dump_desc - handles dump desc write into command datum * @cnt: number of arguments that the user supplied * @vsi_seid: vsi id entered by user * @ring_id: ring id entered by user * @desc_n: descriptor number entered by user * @pf: the i40e_pf created in command write * @type: enum describing whether ring is RX, TX or XDP **/ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, struct i40e_pf *pf, enum ring_type type) { … } /** * i40e_dbg_dump_vsi_no_seid - handles dump vsi write into command datum * @pf: the i40e_pf created in command write **/ static void i40e_dbg_dump_vsi_no_seid(struct i40e_pf *pf) { … } /** * i40e_dbg_dump_eth_stats - handles dump stats write into command datum * @pf: the i40e_pf created in command write * @estats: the eth stats structure to be dumped **/ static void i40e_dbg_dump_eth_stats(struct i40e_pf *pf, struct i40e_eth_stats *estats) { … } /** * i40e_dbg_dump_veb_seid - handles dump stats of a single given veb * @pf: the i40e_pf created in command write * @seid: the seid the user put in **/ static void i40e_dbg_dump_veb_seid(struct i40e_pf *pf, int seid) { … } /** * i40e_dbg_dump_veb_all - dumps all known veb's stats * @pf: the i40e_pf created in command write **/ static void i40e_dbg_dump_veb_all(struct i40e_pf *pf) { … } /** * i40e_dbg_dump_vf - dump VF info * @pf: the i40e_pf created in command write * @vf_id: the vf_id from the user **/ static void i40e_dbg_dump_vf(struct i40e_pf *pf, int vf_id) { … } /** * i40e_dbg_dump_vf_all - dump VF info for all VFs * @pf: the i40e_pf created in command write **/ static void i40e_dbg_dump_vf_all(struct i40e_pf *pf) { … } /** * i40e_dbg_command_write - write into command datum * @filp: the opened file * @buffer: where to find the user's data * @count: the length of the user's data * @ppos: file position offset **/ static ssize_t i40e_dbg_command_write(struct file *filp, const char __user *buffer, size_t count, loff_t *ppos) { … } static const struct file_operations i40e_dbg_command_fops = …; /************************************************************** * netdev_ops * The netdev_ops entry in debugfs is for giving the driver commands * to be executed from the netdev operations. **************************************************************/ static char i40e_dbg_netdev_ops_buf[256] = …; /** * i40e_dbg_netdev_ops_read - read for netdev_ops datum * @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_netdev_ops_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { … } /** * i40e_dbg_netdev_ops_write - write into netdev_ops datum * @filp: the opened file * @buffer: where to find the user's data * @count: the length of the user's data * @ppos: file position offset **/ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp, const char __user *buffer, size_t count, loff_t *ppos) { … } static const struct file_operations i40e_dbg_netdev_ops_fops = …; /** * i40e_dbg_pf_init - setup the debugfs directory for the PF * @pf: the PF that is starting up **/ void i40e_dbg_pf_init(struct i40e_pf *pf) { … } /** * i40e_dbg_pf_exit - clear out the PF's debugfs entries * @pf: the PF that is stopping **/ void i40e_dbg_pf_exit(struct i40e_pf *pf) { … } /** * i40e_dbg_init - start up debugfs for the driver **/ void i40e_dbg_init(void) { … } /** * i40e_dbg_exit - clean out the driver's debugfs entries **/ void i40e_dbg_exit(void) { … } #endif /* CONFIG_DEBUG_FS */