Skip to content

Commit b2788ce

Browse files
Christoph Lameterdledford
authored andcommitted
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 <[email protected]> Signed-off-by: Christoph Lameter <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 35c4cbb commit b2788ce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/infiniband/core/sysfs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <linux/netdevice.h>
4141

4242
#include <rdma/ib_mad.h>
43+
#include <rdma/ib_pma.h>
4344

4445
struct ib_port;
4546

@@ -75,6 +76,7 @@ struct port_table_attribute {
7576
struct port_attribute attr;
7677
char name[8];
7778
int index;
79+
int attr_id;
7880
};
7981

8082
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,
395397
#define PORT_PMA_ATTR(_name, _counter, _width, _offset) \
396398
struct port_table_attribute port_pma_attr_##_name = { \
397399
.attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \
398-
.index = (_offset) | ((_width) << 16) | ((_counter) << 24) \
400+
.index = (_offset) | ((_width) << 16) | ((_counter) << 24), \
401+
.attr_id = IB_PMA_PORT_COUNTERS , \
399402
}
400403

401404
/*
@@ -457,7 +460,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
457460
ssize_t ret;
458461
u8 data[8];
459462

460-
ret = get_perf_mad(p->ibdev, p->port_num, cpu_to_be16(0x12), &data,
463+
ret = get_perf_mad(p->ibdev, p->port_num, tab_attr->attr_id, &data,
461464
40 + offset / 8, sizeof(data));
462465
if (ret < 0)
463466
return sprintf(buf, "N/A (no PMA)\n");

0 commit comments

Comments
 (0)