IB/core: sysfs.c: Fix PerfMgt ClassPortInfo handling
PATCH 1/1 IB/core: sysfs.c: Fix PerfMgt ClassPortInfo handling
Port number is not part of ClassPortInfo attribute but is still needed as a parameter when invoking process_mad.
To properly handle this attribute, port_num is added as a parameter to get_counter_table and get_perf_mad was changed not to store port_num in the attribute itself when it's querying the ClassPortInfo attribute.
This handles issue pointed out by Matan Barak <[email protected]>
---
drivers/infiniband/core/sysfs.c +6 -4
@@ -438,7 +438,8 @@ static int get_perf_mad(struct ib_device *dev, int port_num, int attr, in_mad->mad_hdr.method =IB_MGMT_METHOD_GET ; in_mad->mad_hdr.attr_id = attr; - in_mad->data[41 ] = port_num;/* PortSelect field */ +if (attr !=IB_PMA_CLASS_PORT_INFO ) + in_mad->data[41 ] = port_num;/* PortSelect field */ if ((dev->process_mad(dev, IB_MAD_IGNORE_MKEY, port_num, NULL, NULL,
@@ -714,11 +715,12 @@ err:* Figure out which counter table to use depending on * the device capabilities. */ -static struct attribute_group *get_counter_table (struct ib_device *dev) +static struct attribute_group *get_counter_table (struct ib_device *dev, +int port_num) {struct ib_class_port_info cpi; -if (get_perf_mad (dev,0 ,IB_PMA_CLASS_PORT_INFO , +if (get_perf_mad (dev, port_num,IB_PMA_CLASS_PORT_INFO , &cpi,40 ,sizeof (cpi)) >=0 ) {if (cpi.capability_mask &&IB_PMA_CLASS_CAP_EXT_WIDTH )
@@ -776,7 +778,7 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table =get_counter_table (device); + p->pma_table =get_counter_table (device, port_num); ret =sysfs_create_group (&p->kobj, p->pma_table);if (ret) goto err_put_gid_attrs;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 5681AF4E.8060604-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
ira.weiny
Reviewed-byQuoted 4 lines · Hal Rosenstock
Port number is not part of ClassPortInfo attribute but is still needed as a parameter when invoking
process_mad.
Quoted 8 lines
To properly handle this attribute,
port_numis added as a parameter toget_counter_tableandget_perf_madwas changed not to storeport_numin the attribute itself when it's querying the ClassPortInfo attribute.This handles issue pointed out by Matan Barak <[email protected]>
Quoted 32 lines
---
drivers/infiniband/core/sysfs.c +5
-3@@ -438,7 +438,8 @@ static int get_perf_mad(struct ib_device *dev, int port_num, int attr, in_mad->mad_hdr.method =IB_MGMT_METHOD_GET ; in_mad->mad_hdr.attr_id = attr; - in_mad->data[41 ] = port_num;/* PortSelect field */ +if (attr !=IB_PMA_CLASS_PORT_INFO ) + in_mad->data[41 ] = port_num;/* PortSelect field */ if ((dev->process_mad(dev, IB_MAD_IGNORE_MKEY, port_num, NULL, NULL,@@ -714,11 +715,12 @@ err:* Figure out which counter table to use depending on * the device capabilities. */ -static struct attribute_group *get_counter_table (struct ib_device *dev) +static struct attribute_group *get_counter_table (struct ib_device *dev, +int port_num) {struct ib_class_port_info cpi; -if (get_perf_mad (dev,0 ,IB_PMA_CLASS_PORT_INFO , +if (get_perf_mad (dev, port_num,IB_PMA_CLASS_PORT_INFO , &cpi,40 ,sizeof (cpi)) >=0 ) {if (cpi.capability_mask &&IB_PMA_CLASS_CAP_EXT_WIDTH )
drivers/infiniband/core/sysfs.c static int add_port(struct ib_device *device, int port_num, · line 784
Quoted 8 lines
drivers/infiniband/core/sysfs.c +1
-1@@ -776,7 +778,7 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table =get_counter_table (device); + p->pma_table =get_counter_table (device, port_num); ret =sysfs_create_group (&p->kobj, p->pma_table);if (ret) goto err_put_gid_attrs;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 53 lines · Hal Rosenstock
Port number is not part of ClassPortInfo attribute but is still needed as a parameter when invoking
process_mad.To properly handle this attribute,
port_numis added as a parameter toget_counter_tableandget_perf_madwas changed not to storeport_numin the attribute itself when it's querying the ClassPortInfo attribute.This handles issue pointed out by Matan Barak <[email protected]>
---
drivers/infiniband/core/sysfs.c +6
-5@@ -438,7 +438,8 @@ static int get_perf_mad(struct ib_device *dev, int port_num, int attr, in_mad->mad_hdr.method =IB_MGMT_METHOD_GET ; in_mad->mad_hdr.attr_id = attr; - in_mad->data[41 ] = port_num;/* PortSelect field */ +if (attr !=IB_PMA_CLASS_PORT_INFO ) + in_mad->data[41 ] = port_num;/* PortSelect field */ if ((dev->process_mad(dev, IB_MAD_IGNORE_MKEY, port_num, NULL, NULL,@@ -714,11 +715,12 @@ err:* Figure out which counter table to use depending on * the device capabilities. */ -static struct attribute_group *get_counter_table (struct ib_device *dev) +static struct attribute_group *get_counter_table (struct ib_device *dev, +int port_num) {struct ib_class_port_info cpi; -if (get_perf_mad (dev,0 ,IB_PMA_CLASS_PORT_INFO , +if (get_perf_mad (dev, port_num,IB_PMA_CLASS_PORT_INFO , &cpi,40 ,sizeof (cpi)) >=0 ) {if (cpi.capability_mask &&IB_PMA_CLASS_CAP_EXT_WIDTH )@@ -776,7 +778,7 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table =get_counter_table (device); + p->pma_table =get_counter_table (device, port_num); ret =sysfs_create_group (&p->kobj, p->pma_table);if (ret) goto err_put_gid_attrs; --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please just add:
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html