diff options
author | Dave Jiang <dave.jiang@intel.com> | 2015-07-13 08:07:09 -0400 |
---|---|---|
committer | Jon Mason <jdmason@kudzu.us> | 2015-08-09 16:32:21 -0400 |
commit | c8650fd03d320e9c39f44435a583933cacea5259 (patch) | |
tree | a1ccbc94df77a7f0d9cfd759a6fcbcd277f09eaa | |
parent | da2e5ae56164b86823c1bff5b4d28430ca4a7108 (diff) |
NTB: Fix transport stats for multiple devices
Currently the debugfs does not have files for all NTB transport queue
pairs. When there are multiple NTBs present in a system, the QP names
of the last transport clobber the names of previously added transport
QPs. Only the last added QPs can be observed via debugfs.
Create a directory per NTB transport to associate the QPs with that
transport. Name the directory the same as the PCI device.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
-rw-r--r-- | drivers/ntb/ntb_transport.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 98e58c765f2e..25e973ff64cf 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -212,6 +212,8 @@ struct ntb_transport_ctx { | |||
212 | bool link_is_up; | 212 | bool link_is_up; |
213 | struct delayed_work link_work; | 213 | struct delayed_work link_work; |
214 | struct work_struct link_cleanup; | 214 | struct work_struct link_cleanup; |
215 | |||
216 | struct dentry *debugfs_node_dir; | ||
215 | }; | 217 | }; |
216 | 218 | ||
217 | enum { | 219 | enum { |
@@ -945,12 +947,12 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, | |||
945 | qp->tx_max_frame = min(transport_mtu, tx_size / 2); | 947 | qp->tx_max_frame = min(transport_mtu, tx_size / 2); |
946 | qp->tx_max_entry = tx_size / qp->tx_max_frame; | 948 | qp->tx_max_entry = tx_size / qp->tx_max_frame; |
947 | 949 | ||
948 | if (nt_debugfs_dir) { | 950 | if (nt->debugfs_node_dir) { |
949 | char debugfs_name[4]; | 951 | char debugfs_name[4]; |
950 | 952 | ||
951 | snprintf(debugfs_name, 4, "qp%d", qp_num); | 953 | snprintf(debugfs_name, 4, "qp%d", qp_num); |
952 | qp->debugfs_dir = debugfs_create_dir(debugfs_name, | 954 | qp->debugfs_dir = debugfs_create_dir(debugfs_name, |
953 | nt_debugfs_dir); | 955 | nt->debugfs_node_dir); |
954 | 956 | ||
955 | qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR, | 957 | qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR, |
956 | qp->debugfs_dir, qp, | 958 | qp->debugfs_dir, qp, |
@@ -1053,6 +1055,12 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev) | |||
1053 | goto err2; | 1055 | goto err2; |
1054 | } | 1056 | } |
1055 | 1057 | ||
1058 | if (nt_debugfs_dir) { | ||
1059 | nt->debugfs_node_dir = | ||
1060 | debugfs_create_dir(pci_name(ndev->pdev), | ||
1061 | nt_debugfs_dir); | ||
1062 | } | ||
1063 | |||
1056 | for (i = 0; i < qp_count; i++) { | 1064 | for (i = 0; i < qp_count; i++) { |
1057 | rc = ntb_transport_init_queue(nt, i); | 1065 | rc = ntb_transport_init_queue(nt, i); |
1058 | if (rc) | 1066 | if (rc) |