diff mbox

[PATCHv2,infiniband-diags] ibcc[config query].c: Make SwitchPortCongestionSetting IBA 1.3 compliant

Message ID 284e8cb0-ed96-3bb7-75f1-3b852c169b2d@dev.mellanox.co.il (mailing list archive)
State Not Applicable
Headers show

Commit Message

Hal Rosenstock Aug. 4, 2017, 12:06 p.m. UTC
IBA 1.3 supports 48 ports rather than 32 ports as at IBA 1.2.1
for SwitchPortCongestionSetting attribute.

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
Change since v1:
Updated description to indicate SwitchPortCongestionSetting rather than SwitchCongestionSetting attribute.

 src/ibccconfig.c |  2 +-
 src/ibccquery.c  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Ira Weiny Sept. 30, 2017, 1:38 a.m. UTC | #1
VGhhbmtzIGFjY2VwdGVkLg0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206
IEhhbCBSb3NlbnN0b2NrIFttYWlsdG86aGFsQGRldi5tZWxsYW5veC5jby5pbF0NCj4gU2VudDog
RnJpZGF5LCBBdWd1c3QgMDQsIDIwMTcgNTowNyBBTQ0KPiBUbzogV2VpbnksIElyYSA8aXJhLndl
aW55QGludGVsLmNvbT4NCj4gQ2M6IGxpbnV4LXJkbWFAdmdlci5rZXJuZWwub3JnDQo+IFN1Ympl
Y3Q6IFtQQVRDSHYyIGluZmluaWJhbmQtZGlhZ3NdIGliY2NbY29uZmlnIHF1ZXJ5XS5jOiBNYWtl
DQo+IFN3aXRjaFBvcnRDb25nZXN0aW9uU2V0dGluZyBJQkEgMS4zIGNvbXBsaWFudA0KPiANCj4g
DQo+IElCQSAxLjMgc3VwcG9ydHMgNDggcG9ydHMgcmF0aGVyIHRoYW4gMzIgcG9ydHMgYXMgYXQg
SUJBIDEuMi4xIGZvcg0KPiBTd2l0Y2hQb3J0Q29uZ2VzdGlvblNldHRpbmcgYXR0cmlidXRlLg0K
PiANCj4gU2lnbmVkLW9mZi1ieTogSGFsI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KyspIHsNCj4gKwkJCXByaW50ZigiUG9ydDouLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uJXVcbiIsIGkgKiA0OCArIGopOw0KPiANCj4gCW1hZF9kdW1wX2Nj
X3N3aXRjaHBvcnRjb25nZXN0aW9uc2V0dGluZ2VsZW1lbnQoYnVmLCBzaXplb2YgYnVmLA0KPiAg
CQkJCQkJCQkgICAgICAgZGF0YSArIGogKg0KPiA0LA0KPiAgCQkJCQkJCQkgICAgICAgNCk7DQo+
IC0tDQo+IDEuOC4yLjMNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/ibccconfig.c b/src/ibccconfig.c
index 22b16db..64aa804 100644
--- a/src/ibccconfig.c
+++ b/src/ibccconfig.c
@@ -412,7 +412,7 @@  static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 			 &cong_parm_marking_rate);
 
 	if (!cc_config_status_via(payload, rcv, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING,
-				  portnum / 32, 0, NULL, srcport, cckey))
+				  portnum / 48, 0, NULL, srcport, cckey))
 		return "switch port congestion setting config failed";
 
 	return NULL;
diff --git a/src/ibccquery.c b/src/ibccquery.c
index 39e45b7..95e553d 100644
--- a/src/ibccquery.c
+++ b/src/ibccquery.c
@@ -224,11 +224,11 @@  static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 
 		memset(data, '\0', sizeof data);
 		if (!cc_query_status_via(data, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING,
-					 portnum / 32, 0, NULL, srcport, cckey))
+					 portnum / 48, 0, NULL, srcport, cckey))
 			return "switch port congestion setting query failed";
 
 		mad_dump_cc_switchportcongestionsettingelement(buf, sizeof buf,
-							       data + ((portnum % 32) * 4),
+							       data + ((portnum % 48) * 4),
 							       4);
 		printf("%s", buf);
 		return NULL;
@@ -236,7 +236,7 @@  static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 
 	/* else get all port info */
 
-	maxblocks = numports / 32 + 1;
+	maxblocks = numports / 48 + 1;
 
 	for (i = 0; i < maxblocks; i++) {
 		memset(data, '\0', sizeof data);
@@ -244,8 +244,8 @@  static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 					 i, 0, NULL, srcport, cckey))
 			return "switch port congestion setting query failed";
 
-		for (j = 0; j < 32 && outputcount <= numports; j++) {
-			printf("Port:............................%u\n", i * 32 + j);
+		for (j = 0; j < 48 && outputcount <= numports; j++) {
+			printf("Port:............................%u\n", i * 48 + j);
 			mad_dump_cc_switchportcongestionsettingelement(buf, sizeof buf,
 								       data + j * 4,
 								       4);