25 #include <linux/netdevice.h>
28 #include <linux/device.h>
29 #include <linux/export.h>
33 #define D_SUBMODULE debugfs
37 int debugfs_netdev_queue_stopped_get(
void *
data,
u64 *
val)
40 *val = netif_queue_stopped(i2400m->
wimax_dev.net_dev);
44 debugfs_netdev_queue_stopped_get,
49 struct dentry *debugfs_create_netdev_queue_stopped(
53 &fops_netdev_queue_stopped);
65 size_t count, loff_t *ppos)
73 if (count <
sizeof(buf))
76 snprintf(buf,
sizeof(buf),
"%u %u %u %u %u %u %u\n",
81 spin_unlock_irqrestore(&i2400m->
rx_lock, flags);
88 ssize_t i2400m_rx_stats_write(
struct file *filp,
const char __user *buffer,
89 size_t count, loff_t *ppos)
102 spin_unlock_irqrestore(&i2400m->
rx_lock, flags);
110 .read = i2400m_rx_stats_read,
111 .write = i2400m_rx_stats_write,
118 ssize_t i2400m_tx_stats_read(
struct file *filp,
char __user *buffer,
119 size_t count, loff_t *ppos)
127 if (count <
sizeof(buf))
130 snprintf(buf,
sizeof(buf),
"%u %u %u %u %u %u %u\n",
135 spin_unlock_irqrestore(&i2400m->
tx_lock, flags);
141 ssize_t i2400m_tx_stats_write(
struct file *filp,
const char __user *buffer,
142 size_t count, loff_t *ppos)
155 spin_unlock_irqrestore(&i2400m->
tx_lock, flags);
163 .read = i2400m_tx_stats_read,
164 .write = i2400m_tx_stats_write,
171 int debugfs_i2400m_suspend_set(
void *
data,
u64 val)
174 struct i2400m *i2400m =
data;
181 NULL, debugfs_i2400m_suspend_set,
185 struct dentry *debugfs_create_i2400m_suspend(
186 const char *
name,
struct dentry *parent,
struct i2400m *i2400m)
189 &fops_i2400m_suspend);
200 int debugfs_i2400m_reset_set(
void *data,
u64 val)
203 struct i2400m *i2400m =
data;
218 NULL, debugfs_i2400m_reset_set,
222 struct dentry *debugfs_create_i2400m_reset(
223 const char *
name,
struct dentry *parent,
struct i2400m *i2400m)
230 #define __debugfs_register(prefix, name, parent) \
232 result = d_level_register_debugfs(prefix, name, parent); \
246 result = PTR_ERR(dentry);
247 if (IS_ERR(dentry)) {
264 result = PTR_ERR(fd);
265 if (IS_ERR(fd) && result != -
ENODEV) {
266 dev_err(dev,
"Can't create debugfs entry "
267 "tx_in: %d\n", result);
273 result = PTR_ERR(fd);
274 if (IS_ERR(fd) && result != -
ENODEV) {
275 dev_err(dev,
"Can't create debugfs entry "
276 "tx_out: %d\n", result);
282 result = PTR_ERR(fd);
283 if (IS_ERR(fd) && result != -
ENODEV) {
284 dev_err(dev,
"Can't create debugfs entry "
285 "state: %d\n", result);
313 result = PTR_ERR(fd);
314 if (IS_ERR(fd) && result != -
ENODEV) {
315 dev_err(dev,
"Can't create debugfs entry "
316 "trace_msg_from_user: %d\n", result);
320 fd = debugfs_create_netdev_queue_stopped(
"netdev_queue_stopped",
322 result = PTR_ERR(fd);
323 if (IS_ERR(fd) && result != -
ENODEV) {
324 dev_err(dev,
"Can't create debugfs entry "
325 "netdev_queue_stopped: %d\n", result);
330 &i2400m_rx_stats_fops);
331 result = PTR_ERR(fd);
332 if (IS_ERR(fd) && result != -
ENODEV) {
333 dev_err(dev,
"Can't create debugfs entry "
334 "rx_stats: %d\n", result);
339 &i2400m_tx_stats_fops);
340 result = PTR_ERR(fd);
341 if (IS_ERR(fd) && result != -
ENODEV) {
342 dev_err(dev,
"Can't create debugfs entry "
343 "tx_stats: %d\n", result);
347 fd = debugfs_create_i2400m_suspend(
"suspend", dentry, i2400m);
348 result = PTR_ERR(fd);
349 if (IS_ERR(fd) && result != -
ENODEV) {
350 dev_err(dev,
"Can't create debugfs entry suspend: %d\n",
355 fd = debugfs_create_i2400m_reset(
"reset", dentry, i2400m);
356 result = PTR_ERR(fd);
357 if (IS_ERR(fd) && result != -
ENODEV) {
358 dev_err(dev,
"Can't create debugfs entry reset: %d\n", result);