summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2015-12-21 17:20:28 +0300
committerDoug Ledford <dledford@redhat.com>2015-12-23 23:58:30 +0300
commitb2788ce575df94fb9b03e546980c4f916b24ef76 (patch)
tree10f915b10c75caa2455096a4b6d400c75fba6b92
parent35c4cbb178119bcacc720f54d32711da020805d5 (diff)
downloadlinux-b2788ce575df94fb9b03e546980c4f916b24ef76.tar.xz
IB/core: Specify attribute_id in port_table_attribute
Add the attr_id on port_table_attribute since we will have to add a different port_table_attribute for the extended attribute soon. Reviewed-by: Hal Rosenstock <hal@mellanox.com> Signed-off-by: Christoph Lameter <cl@linux.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/sysfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 3eeb24527cce..09cee09e5212 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -40,6 +40,7 @@
#include <linux/netdevice.h>
#include <rdma/ib_mad.h>
+#include <rdma/ib_pma.h>
struct ib_port;
@@ -75,6 +76,7 @@ struct port_table_attribute {
struct port_attribute attr;
char name[8];
int index;
+ int attr_id;
};
static ssize_t port_attr_show(struct kobject *kobj,
@@ -395,7 +397,8 @@ static ssize_t show_port_pkey(struct ib_port *p, struct port_attribute *attr,
#define PORT_PMA_ATTR(_name, _counter, _width, _offset) \
struct port_table_attribute port_pma_attr_##_name = { \
.attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \
- .index = (_offset) | ((_width) << 16) | ((_counter) << 24) \
+ .index = (_offset) | ((_width) << 16) | ((_counter) << 24), \
+ .attr_id = IB_PMA_PORT_COUNTERS , \
}
/*
@@ -457,7 +460,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
ssize_t ret;
u8 data[8];
- ret = get_perf_mad(p->ibdev, p->port_num, cpu_to_be16(0x12), &data,
+ ret = get_perf_mad(p->ibdev, p->port_num, tab_attr->attr_id, &data,
40 + offset / 8, sizeof(data));
if (ret < 0)
return sprintf(buf, "N/A (no PMA)\n");