|
40 | 40 | #include <linux/netdevice.h>
|
41 | 41 |
|
42 | 42 | #include <rdma/ib_mad.h>
|
| 43 | +#include <rdma/ib_pma.h> |
43 | 44 |
|
44 | 45 | struct ib_port;
|
45 | 46 |
|
@@ -75,6 +76,7 @@ struct port_table_attribute {
|
75 | 76 | struct port_attribute attr;
|
76 | 77 | char name[8];
|
77 | 78 | int index;
|
| 79 | + int attr_id; |
78 | 80 | };
|
79 | 81 |
|
80 | 82 | 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,
|
395 | 397 | #define PORT_PMA_ATTR(_name, _counter, _width, _offset) \
|
396 | 398 | struct port_table_attribute port_pma_attr_##_name = { \
|
397 | 399 | .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 , \ |
399 | 402 | }
|
400 | 403 |
|
401 | 404 | /*
|
@@ -457,7 +460,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
|
457 | 460 | ssize_t ret;
|
458 | 461 | u8 data[8];
|
459 | 462 |
|
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, |
461 | 464 | 40 + offset / 8, sizeof(data));
|
462 | 465 | if (ret < 0)
|
463 | 466 | return sprintf(buf, "N/A (no PMA)\n");
|
|
0 commit comments