ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
PATCH 1/1 ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling
Enhanced switch port 0 can support CC (indicated in CC ClassPortInfo:CapabilityMask.EnhancedPort0CC).
portnum 0 is a valid port number and offsets should be calculated based on port 0 rather than port 1.
Also, fix some error messages to indicate switch port congestion setting rather then switch congestion setting failure.
---
src/ibccconfig.c +5 -8
@@ -371,9 +371,6 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, intif ((errstr =parseint (argv[5 ], &cong_parm_marking_rate,0 )))return errstr; -if (!portnum) -return "invalid port number specified" ; -/* Figure out number of ports first */ if (!smp_query_via (data, dest,IB_ATTR_NODE_INFO ,0 ,0 , srcport))return "node info config failed" ;
@@ -389,10 +386,10 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int/* We are modifying only 1 port, so get the current config */ if (!cc_query_status_via (payload, dest,IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING , - (portnum -1 ) /32 ,0 ,NULL , srcport, cckey)) -return "switch congestion setting query failed" ; + portnum /32 ,0 ,NULL , srcport, cckey)) +return "switch port congestion setting query failed" ; - ptr = payload + (((portnum %32 -1 ) *4 )); + ptr = payload + (((portnum %32 ) *4 )); mad_encode_field(ptr, IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F,
@@ -415,8 +412,8 @@ 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 -1 ) /32 ,0 ,NULL , srcport, cckey)) -return "switch congestion setting config failed" ; + portnum /32 ,0 ,NULL , srcport, cckey)) +return "switch port congestion setting config failed" ;return NULL ; }
--
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
[off-list]
This replaces the first one?
Quoted 61 lines
-----Original Message-----
From: Hal Rosenstock [mailto:[email protected]]
Sent: Friday, January 09, 2015 7:18 AM
To: Weiny, Ira
Cc: linux-rdma ([email protected]); Chu, Al
Subject: [PATCH infiniband-diags]ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handlingEnhanced switch port 0 can support CC (indicated in CC ClassPortInfo:CapabilityMask.EnhancedPort0CC).
portnum 0 is a valid port number and offsets should be calculated based on port 0 rather than port 1.
Also, fix some error messages to indicate switch port congestion setting rather then switch congestion setting failure.
---
src/ibccconfig.c +0
-3@@ -371,9 +371,6 @@ static char *switch_port_congestion_setting (ib_portid_t * dest, char **argv,int if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) return errstr; - if (!portnum) - return "invalid port number specified"; - /* Figure out number of ports first */ if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))src/ibccconfig.c +3
-3return "node info config failed" ;@@ -389,10 +386,10 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int /* We are modifying only 1 port, so get the current config */ if (!cc_query_status_via(payload, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, - (portnum - 1) / 32, 0, NULL, srcport, cckey)) - return "switch congestion setting query failed"; + portnum / 32, 0, NULL, srcport, cckey)) + return "switch port congestion setting query failed"; - ptr = payload + (((portnum % 32 - 1) * 4)); + ptr = payload + (((portnum % 32) * 4));mad_encode_field(ptr,
IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F,src/ibccconfig.c +2
-2@@ -415,8 +412,8 @@ 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 -1 ) /32 ,0 ,NULL , srcport, cckey)) -return "switch congestion setting config failed" ; + portnum /32 ,0 ,NULL , srcport, cckey)) +return "switch port congestion setting config failed" ;
Quoted 2 lines
return NULL;
}
--
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 3 lines · Ira
[off-list]
This replaces the first one?
This is ibccconfig. Other was for ibccquery. Similar subjects but separated by tool rather than one patch for both.
Quoted 62 lines
Quoted 62 lines
-----Original Message-----
From: Hal Rosenstock [mailto:[email protected]]
Sent: Friday, January 09, 2015 7:18 AM
To: Weiny, Ira
Cc: linux-rdma ([email protected]); Chu, Al
Subject: [PATCH infiniband-diags]ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handlingEnhanced switch port 0 can support CC (indicated in CC ClassPortInfo:CapabilityMask.EnhancedPort0CC).
portnum 0 is a valid port number and offsets should be calculated based on port 0 rather than port 1.
Also, fix some error messages to indicate switch port congestion setting rather then switch congestion setting failure.
---
src/ibccconfig.c +0
-3@@ -371,9 +371,6 @@ static char *switch_port_congestion_setting (ib_portid_t * dest, char **argv,int if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) return errstr; - if (!portnum) - return "invalid port number specified"; - /* Figure out number of ports first */ if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))src/ibccconfig.c +3
-3return "node info config failed" ;@@ -389,10 +386,10 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int /* We are modifying only 1 port, so get the current config */ if (!cc_query_status_via(payload, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, - (portnum - 1) / 32, 0, NULL, srcport, cckey)) - return "switch congestion setting query failed"; + portnum / 32, 0, NULL, srcport, cckey)) + return "switch port congestion setting query failed"; - ptr = payload + (((portnum % 32 - 1) * 4)); + ptr = payload + (((portnum % 32) * 4));mad_encode_field(ptr,
IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F,src/ibccconfig.c +2
-2@@ -415,8 +412,8 @@ 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 -1 ) /32 ,0 ,NULL , srcport, cckey)) -return "switch congestion setting config failed" ; + portnum /32 ,0 ,NULL , srcport, cckey)) +return "switch port congestion setting config failed" ;
Quoted 3 lines
Quoted 2 lines
return NULL;
}
--
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
Weiny, Ira
AppliedQuoted 11 lines
Enhanced switch port 0 can support CC (indicated in CC ClassPortInfo:CapabilityMask.EnhancedPort0CC).
portnum 0 is a valid port number and offsets should be calculated based on port 0 rather than port 1.
Also, fix some error messages to indicate switch port congestion setting rather then switch congestion setting failure.
Thanks applied.
Ira
Quoted 43 lines
---
src/ibccconfig.c +0
-3@@ -371,9 +371,6 @@ static char *switch_port_congestion_setting (ib_portid_t * dest, char **argv,int if ((errstr = parseint(argv[5], &cong_parm_marking_rate, 0))) return errstr; - if (!portnum) - return "invalid port number specified"; - /* Figure out number of ports first */ if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))src/ibccconfig.c +3
-3return "node info config failed" ;@@ -389,10 +386,10 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int /* We are modifying only 1 port, so get the current config */ if (!cc_query_status_via(payload, dest, IB_CC_ATTR_SWITCH_PORT_CONGESTION_SETTING, - (portnum - 1) / 32, 0, NULL, srcport, cckey)) - return "switch congestion setting query failed"; + portnum / 32, 0, NULL, srcport, cckey)) + return "switch port congestion setting query failed"; - ptr = payload + (((portnum % 32 - 1) * 4)); + ptr = payload + (((portnum % 32) * 4));mad_encode_field(ptr,
IB_CC_SWITCH_PORT_CONGESTION_SETTING_ELEMENT_VALID_F,src/ibccconfig.c +2
-2@@ -415,8 +412,8 @@ 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 -1 ) /32 ,0 ,NULL , srcport, cckey)) -return "switch congestion setting config failed" ; + portnum /32 ,0 ,NULL , srcport, cckey)) +return "switch port congestion setting config failed" ;
Quoted 2 lines
return NULL;
}
--
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