/[packages]/cauldron/kernel/current/PATCHES/patches/0096-RDMA-core-Do-not-expose-unsupported-counters.patch
ViewVC logotype

Contents of /cauldron/kernel/current/PATCHES/patches/0096-RDMA-core-Do-not-expose-unsupported-counters.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1329221 - (show annotations) (download)
Fri Nov 9 22:05:45 2018 UTC (5 years, 9 months ago) by tmb
File size: 2903 byte(s)
add fixes from sashas autosel queue
1 From da20fa45a533cda114b7441f4f5ada5213e1d76f Mon Sep 17 00:00:00 2001
2 From: Parav Pandit <parav@mellanox.com>
3 Date: Sun, 7 Oct 2018 12:12:40 +0300
4 Subject: [PATCH 096/145] RDMA/core: Do not expose unsupported counters
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 [ Upstream commit 0f6ef65d1c6ec8deb5d0f11f86631ec4cfe8f22e ]
10
11 If the provider driver (such as rdma_rxe) doesn't support pma counters,
12 avoid exposing its directory similar to optional hw_counters directory.
13 If core fails to read the PMA counter, return an error so that user can
14 retry later if needed.
15
16 Fixes: 35c4cbb17811 ("IB/core: Create get_perf_mad function in sysfs.c")
17 Reported-by: Holger Hoffstätte <holger@applied-asynchrony.com>
18 Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
19 Signed-off-by: Parav Pandit <parav@mellanox.com>
20 Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
21 Signed-off-by: Doug Ledford <dledford@redhat.com>
22 Signed-off-by: Sasha Levin <sashal@kernel.org>
23 ---
24 drivers/infiniband/core/sysfs.c | 19 ++++++++++++-------
25 1 file changed, 12 insertions(+), 7 deletions(-)
26
27 diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
28 index 7fd14ead7b37..ace40bb98624 100644
29 --- a/drivers/infiniband/core/sysfs.c
30 +++ b/drivers/infiniband/core/sysfs.c
31 @@ -512,7 +512,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
32 ret = get_perf_mad(p->ibdev, p->port_num, tab_attr->attr_id, &data,
33 40 + offset / 8, sizeof(data));
34 if (ret < 0)
35 - return sprintf(buf, "N/A (no PMA)\n");
36 + return ret;
37
38 switch (width) {
39 case 4:
40 @@ -1057,10 +1057,12 @@ static int add_port(struct ib_device *device, int port_num,
41 goto err_put;
42 }
43
44 - p->pma_table = get_counter_table(device, port_num);
45 - ret = sysfs_create_group(&p->kobj, p->pma_table);
46 - if (ret)
47 - goto err_put_gid_attrs;
48 + if (device->process_mad) {
49 + p->pma_table = get_counter_table(device, port_num);
50 + ret = sysfs_create_group(&p->kobj, p->pma_table);
51 + if (ret)
52 + goto err_put_gid_attrs;
53 + }
54
55 p->gid_group.name = "gids";
56 p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len);
57 @@ -1173,7 +1175,8 @@ static int add_port(struct ib_device *device, int port_num,
58 p->gid_group.attrs = NULL;
59
60 err_remove_pma:
61 - sysfs_remove_group(&p->kobj, p->pma_table);
62 + if (p->pma_table)
63 + sysfs_remove_group(&p->kobj, p->pma_table);
64
65 err_put_gid_attrs:
66 kobject_put(&p->gid_attr_group->kobj);
67 @@ -1285,7 +1288,9 @@ static void free_port_list_attributes(struct ib_device *device)
68 kfree(port->hw_stats);
69 free_hsag(&port->kobj, port->hw_stats_ag);
70 }
71 - sysfs_remove_group(p, port->pma_table);
72 +
73 + if (port->pma_table)
74 + sysfs_remove_group(p, port->pma_table);
75 sysfs_remove_group(p, &port->pkey_group);
76 sysfs_remove_group(p, &port->gid_group);
77 sysfs_remove_group(&port->gid_attr_group->kobj,
78 --
79 2.19.1
80

  ViewVC Help
Powered by ViewVC 1.1.30