35 #include <linux/slab.h>
40 #include <linux/export.h>
44 static struct dentry *ipoib_root;
50 for (n = 0, i = 0; i < 8; ++
i) {
63 iter = ipoib_mcast_iter_init(file->
private);
68 if (ipoib_mcast_iter_next(iter)) {
77 static void *ipoib_mcg_seq_next(
struct seq_file *file,
void *iter_ptr,
84 if (ipoib_mcast_iter_next(iter)) {
92 static void ipoib_mcg_seq_stop(
struct seq_file *file,
void *iter_ptr)
97 static int ipoib_mcg_seq_show(
struct seq_file *file,
void *iter_ptr)
100 char gid_buf[
sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
103 unsigned int queuelen,
complete, send_only;
108 ipoib_mcast_iter_read(iter, &mgid, &created, &queuelen,
109 &complete, &send_only);
111 format_gid(&mgid, gid_buf);
120 gid_buf, created, queuelen,
121 complete ?
"yes" :
"no",
122 send_only ?
"yes" :
"no");
128 .start = ipoib_mcg_seq_start,
129 .next = ipoib_mcg_seq_next,
130 .stop = ipoib_mcg_seq_stop,
131 .show = ipoib_mcg_seq_show,
134 static int ipoib_mcg_open(
struct inode *
inode,
struct file *file)
139 ret =
seq_open(file, &ipoib_mcg_seq_ops);
151 .open = ipoib_mcg_open,
157 static void *ipoib_path_seq_start(
struct seq_file *file, loff_t *pos)
162 iter = ipoib_path_iter_init(file->
private);
167 if (ipoib_path_iter_next(iter)) {
176 static void *ipoib_path_seq_next(
struct seq_file *file,
void *iter_ptr,
183 if (ipoib_path_iter_next(iter)) {
191 static void ipoib_path_seq_stop(
struct seq_file *file,
void *iter_ptr)
196 static int ipoib_path_seq_show(
struct seq_file *file,
void *iter_ptr)
199 char gid_buf[
sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
206 ipoib_path_iter_read(iter, &
path);
208 format_gid(&
path.pathrec.dgid, gid_buf);
213 gid_buf,
path.pathrec.dlid ?
"yes" :
"no");
215 if (
path.pathrec.dlid) {
221 " rate: %8d.%d Gb/sec\n",
224 rate / 1000, rate % 1000);
233 .start = ipoib_path_seq_start,
234 .next = ipoib_path_seq_next,
235 .stop = ipoib_path_seq_stop,
236 .show = ipoib_path_seq_show,
239 static int ipoib_path_open(
struct inode *inode,
struct file *file)
244 ret =
seq_open(file, &ipoib_path_seq_ops);
256 .open = ipoib_path_open,
269 ipoib_root, dev, &ipoib_mcg_fops);
270 if (!priv->mcg_dentry)
271 ipoib_warn(priv,
"failed to create mcg debug file\n");
275 ipoib_root, dev, &ipoib_path_fops);
276 if (!priv->path_dentry)
277 ipoib_warn(priv,
"failed to create path debug file\n");
284 if (priv->mcg_dentry)
286 if (priv->path_dentry)
293 return ipoib_root ? 0 : -
ENOMEM;