C++ style coding does not compile
PATCH 1/1 C++ style coding does not compile
Move C++ in-stream var declarations to top of {} block as in C style; Var assignments left in place. MSFT compiler errors out with Missing ';' before 'type', 'Illegal use of this type osm_prefix_route_t as an expression'?
opensm/opensm/osm_sa_path_record.c +7 -5
@@ -1214,6 +1214,10 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,if (!ib_gid_is_multicast (&p_pr->dgid) &&ib_gid_get_subnet_prefix (&p_pr->dgid) != sa->p_subn->opt.subnet_prefix) { + +osm_prefix_route_t *route; +osm_prefix_route_t *r; + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "Non local DGID subnet prefix 0x%016" PRIx64 "\n",
@@ -1221,11 +1225,9 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,/* Find the router port that is configured to handle this prefix, if any */ -osm_prefix_route_t *route =NULL ; -osm_prefix_route_t *r = (osm_prefix_route_t *) -cl_qlist_head (&sa->p_subn-> - prefix_routes_list); - + route =NULL ; + r = (osm_prefix_route_t *)cl_qlist_head ( + &sa->p_subn->prefix_routes_list);while (r != (osm_prefix_route_t *)cl_qlist_end (&sa->p_subn-> prefix_routes_list)) {
Quoted 6 lines · Stan
Move C++ in-stream var declarations to top of {} block as in C style; Var assignments left in place. MSFT compiler errors out with Missing ';' before 'type', 'Illegal use of this type
osm_prefix_route_tas an expression'?Signed-off-by stan smith <[email protected]>
In this patch whitespace characters are mangled.
Applied by hands. Thanks.
Sasha
Quoted 32 lines
opensm/opensm/osm_sa_path_record.c +7
-5@@ -1214,6 +1214,10 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,if (!ib_gid_is_multicast (&p_pr->dgid) &&ib_gid_get_subnet_prefix (&p_pr->dgid) != sa->p_subn->opt.subnet_prefix) { + +osm_prefix_route_t *route; +osm_prefix_route_t *r; + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "Non local DGID subnet prefix 0x%016" PRIx64 "\n",@@ -1221,11 +1225,9 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,/* Find the router port that is configured to handle this prefix, if any */ -osm_prefix_route_t *route =NULL ; -osm_prefix_route_t *r = (osm_prefix_route_t *) -cl_qlist_head (&sa->p_subn-> - prefix_routes_list); - + route =NULL ; + r = (osm_prefix_route_t *)cl_qlist_head ( + &sa->p_subn->prefix_routes_list);while (r != (osm_prefix_route_t *)cl_qlist_end (&sa->p_subn-> prefix_routes_list)) {
A message that is not in the archive (sent off-list or not yet received): 3F6F638B8D880340AB536D29CD4C1E1912C86E8BA3-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org
PATCH 1/1 opensm/osm_sa_path_record.c: separate router guid resolution code
Move off subnet destination (router address) resolution code to separate function to improve readability.
--- opensm/opensm/osm_sa_path_record.c | 122 +++++++++++++++-------------------- 1 files changed, 52 insertions(+), 70 deletions(-)
opensm/opensm/osm_sa_path_record.c +52 -70
@@ -1115,6 +1115,39 @@ Exit:/********************************************************************** **********************************************************************/ +/* Find the router port that is configured to handle this prefix, if any */ +static ib_net64_t find_router (osm_sa_t *sa,ib_net64_t prefix) +{ +osm_prefix_route_t *route =NULL ; +osm_router_t *rtr; +cl_qlist_t *l = &sa->p_subn->prefix_routes_list; +cl_list_item_t *i; + +OSM_LOG (sa->p_log,OSM_LOG_VERBOSE ,"Non local DGID subnet prefix " +"0x%016" PRIx64"\n" ,cl_ntoh64 (prefix)); + +for (i =cl_qlist_head (l); i !=cl_qlist_end (l); i =cl_qlist_next (i)) { +osm_prefix_route_t *r = (osm_prefix_route_t *)i; +if (!r->prefix || r->prefix == prefix) { + route = r; +break ; + } + } +if (!route) +return 0 ; + +if (route->guid ==0 )/* first router */ + rtr = (osm_router_t *)cl_qmap_head (&sa->p_subn->rtr_guid_tbl); +else + rtr = (osm_router_t *)cl_qmap_get (&sa->p_subn->rtr_guid_tbl, + route->guid); + +if (rtr == (osm_router_t *)cl_qmap_end (&sa->p_subn->rtr_guid_tbl)) +return 0 ; + +return osm_port_get_guid (osm_router_get_port_ptr (rtr)); +} + static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, OUT const osm_port_t ** pp_src_port,
@@ -1127,8 +1160,6 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,ib_net64_t dest_guid;ib_api_status_t status;ib_net16_t sa_status =IB_SA_MAD_STATUS_SUCCESS ; -osm_router_t *p_rtr; -osm_port_t *p_rtr_port;OSM_LOG_ENTER (sa->p_log);
@@ -1209,75 +1240,23 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,memset (p_dgid,0 ,sizeof (*p_dgid));if (comp_mask &IB_PR_COMPMASK_DGID ) { - dest_guid = p_pr->dgid.unicast.interface_id; -if (!ib_gid_is_link_local (&p_pr->dgid)) { -if (!ib_gid_is_multicast (&p_pr->dgid) && -ib_gid_get_subnet_prefix (&p_pr->dgid) != - sa->p_subn->opt.subnet_prefix) { -/* Find the router port that is configured to -handle this prefix, if any */ -osm_prefix_route_t *route =NULL ; -osm_prefix_route_t *r = (osm_prefix_route_t *) -cl_qlist_head (&sa->p_subn-> - prefix_routes_list); - -OSM_LOG (sa->p_log,OSM_LOG_VERBOSE , -"Non local DGID subnet prefix 0x%016" - PRIx64"\n" , -cl_ntoh64 (p_pr->dgid.unicast.prefix)); - -while (r != (osm_prefix_route_t *) -cl_qlist_end (&sa->p_subn-> - prefix_routes_list)) { -if (r->prefix == - p_pr->dgid.unicast.prefix - || r->prefix ==0 ) { - route = r; -break ; - } - r = (osm_prefix_route_t *) -cl_qlist_next (&r->list_item); - } - -if (!route) { -/* -This 'error' is the client's fault (bad gid) so -don't enter it as an error in our own log. -Return an error response to the client. -*/ - sa_status = -IB_SA_MAD_STATUS_INVALID_GID ; - goto Exit; - }else if (route->guid ==0 ) { -/* first router */ - p_rtr = (osm_router_t *) -cl_qmap_head (&sa-> - p_subn->rtr_guid_tbl); - }else { - p_rtr = (osm_router_t *) -cl_qmap_get (&sa->p_subn-> - rtr_guid_tbl, - route->guid); - } - -if (p_rtr == - (osm_router_t *)cl_qmap_end (&sa->p_subn-> - rtr_guid_tbl)) - { -OSM_LOG (sa->p_log,OSM_LOG_ERROR , -"ERR 1F22: " -"Off subnet DGID but router not found\n" ); - sa_status = -IB_SA_MAD_STATUS_INVALID_GID ; - goto Exit; - } - - p_rtr_port =osm_router_get_port_ptr (p_rtr); - dest_guid =osm_port_get_guid (p_rtr_port); -if (p_dgid) - *p_dgid = p_pr->dgid; +if (!ib_gid_is_link_local (&p_pr->dgid) && + !ib_gid_is_multicast (&p_pr->dgid) && +ib_gid_get_subnet_prefix (&p_pr->dgid) != + sa->p_subn->opt.subnet_prefix) { + dest_guid =find_router (sa, p_pr->dgid.unicast.prefix); +if (!dest_guid) { +char gid_str[INET6_ADDRSTRLEN ]; +OSM_LOG (sa->p_log,OSM_LOG_ERROR ,"ERR 1F22: " +"Off subnet DGID %s, but router not " +"found\n" , +inet_ntop (AF_INET6 , p_pr->dgid.raw, + gid_str,sizeof (gid_str))); + sa_status =IB_SA_MAD_STATUS_INVALID_GID ; + goto Exit; } - } + }else + dest_guid = p_pr->dgid.unicast.interface_id; *pp_dest_port =osm_get_port_by_guid (sa->p_subn, dest_guid);if (!*pp_dest_port) {
@@ -1293,6 +1272,9 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa, sa_status =IB_SA_MAD_STATUS_INVALID_GID ; goto Exit; } + +if (p_dgid) + *p_dgid = p_pr->dgid; }else { *pp_dest_port =0 ;if (comp_mask &IB_PR_COMPMASK_DLID ) {
Signature · 6 lines
1.6.5.rc1 -- 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
Re: [PATCH] opensm/osm_sa_path_record.c: separate router guid resolution code
T24gU2F0LCBPY3QgMywgMjAwOSBhdCA4OjE5IFBNLCBTYXNoYSBLaGFweW9yc2t5IDxzYXNoYWtA dm9sdG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MKgIMKg IMKgaWYgKGNvbXBfbWFzayAmIElCX1BSX0NPTVBNQVNLX0RMSUQpIHsKPiAtLQo+IDEuNi41LnJj MQo+Cj4gLS0KPiBUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2VuZCB0aGUgbGluZSAi dW5zdWJzY3JpYmUgbGludXgtcmRtYSIgaW4KPiB0aGUgYm9keSBvZiBhIG1lc3NhZ2UgdG8gbWFq b3Jkb21vQHZnZXIua2VybmVsLm9yZwo+IE1vcmUgbWFqb3Jkb21vIGluZm8gYXQgwqBodHRwOi8v dmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0bWwKPgo=
--
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): f0e08f230910050643j63ce8e81s6d6c9bb35f2fcea5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH] opensm/osm_sa_path_record.c: separate router guid resolution code
Quoted 33 lines · Hal Rosenstock
Quoted 32 lines · Sasha Khapyorsky
Move off subnet destination (router address) resolution code to separate function to improve readability.
---
opensm/opensm/osm_sa_path_record.c | 122 +++++++++++++++--------------------1 files changed, 52 insertions(+), 70 deletions(-)opensm/opensm/osm_sa_path_record.c +15
-0@@ -1115,6 +1115,39 @@ Exit: /********************************************************************************************************************************************/ +/* Find the router port that is configured to handle this prefix, if any */ +static ib_net64_t find_router (osm_sa_t *sa,ib_net64_t prefix) +{ + osm_prefix_route_t *route = NULL; + osm_router_t *rtr; + cl_qlist_t *l = &sa->p_subn->prefix_routes_list; + cl_list_item_t *i; + + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "Non local DGID subnet prefix " + "0x%016" PRIx64 "\n", cl_ntoh64(prefix)); + + for (i = cl_qlist_head(l); i != cl_qlist_end(l); i = cl_qlist_next(i)) { + osm_prefix_route_t *r = (osm_prefix_route_t *)i; + if (!r->prefix || r->prefix == prefix) { + route = r;
Quoted 8 lines
opensm/opensm/osm_sa_path_record.c Exit: · line 1137
Quoted 5 lines
opensm/opensm/osm_sa_path_record.c +5
-0+ break; + } + } + if (!route) + return 0;This makes the client error (bad GID) log an error now. Do we want to preserve the original behavior ?
I agree that logging verbosity can be reduced to warning level for such client's error cases.
Sasha
--
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
PATCH v2 1/1 opensm/osm_sa_path_record.c: separate router guid resolution code
Move off subnet destination (router address) resolution code to separate function to improve readability.
---
v2 changes:
- log router guid resolution failure on VERBOSE level - it is client's failure
- make *sa parameter const for find_router() function
opensm/opensm/osm_sa_path_record.c | 120 +++++++++++++++--------------------- 1 files changed, 51 insertions(+), 69 deletions(-)
opensm/opensm/osm_sa_path_record.c +51 -69
@@ -1115,6 +1115,39 @@ Exit:/********************************************************************** **********************************************************************/ +/* Find the router port that is configured to handle this prefix, if any */ +static ib_net64_t find_router (const osm_sa_t *sa,ib_net64_t prefix) +{ +osm_prefix_route_t *route =NULL ; +osm_router_t *rtr; +cl_qlist_t *l = &sa->p_subn->prefix_routes_list; +cl_list_item_t *i; + +OSM_LOG (sa->p_log,OSM_LOG_VERBOSE ,"Non local DGID subnet prefix " +"0x%016" PRIx64"\n" ,cl_ntoh64 (prefix)); + +for (i =cl_qlist_head (l); i !=cl_qlist_end (l); i =cl_qlist_next (i)) { +osm_prefix_route_t *r = (osm_prefix_route_t *)i; +if (!r->prefix || r->prefix == prefix) { + route = r; +break ; + } + } +if (!route) +return 0 ; + +if (route->guid ==0 )/* first router */ + rtr = (osm_router_t *)cl_qmap_head (&sa->p_subn->rtr_guid_tbl); +else + rtr = (osm_router_t *)cl_qmap_get (&sa->p_subn->rtr_guid_tbl, + route->guid); + +if (rtr == (osm_router_t *)cl_qmap_end (&sa->p_subn->rtr_guid_tbl)) +return 0 ; + +return osm_port_get_guid (osm_router_get_port_ptr (rtr)); +} + static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, OUT const osm_port_t ** pp_src_port,
@@ -1127,8 +1160,6 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,ib_net64_t dest_guid;ib_api_status_t status;ib_net16_t sa_status =IB_SA_MAD_STATUS_SUCCESS ; -osm_router_t *p_rtr; -osm_port_t *p_rtr_port;OSM_LOG_ENTER (sa->p_log);
@@ -1209,75 +1240,23 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,memset (p_dgid,0 ,sizeof (*p_dgid));if (comp_mask &IB_PR_COMPMASK_DGID ) { - dest_guid = p_pr->dgid.unicast.interface_id; -if (!ib_gid_is_link_local (&p_pr->dgid)) { -if (!ib_gid_is_multicast (&p_pr->dgid) && -ib_gid_get_subnet_prefix (&p_pr->dgid) != - sa->p_subn->opt.subnet_prefix) { -/* Find the router port that is configured to -handle this prefix, if any */ -osm_prefix_route_t *route =NULL ; -osm_prefix_route_t *r = (osm_prefix_route_t *) -cl_qlist_head (&sa->p_subn-> - prefix_routes_list); - +if (!ib_gid_is_link_local (&p_pr->dgid) && + !ib_gid_is_multicast (&p_pr->dgid) && +ib_gid_get_subnet_prefix (&p_pr->dgid) != + sa->p_subn->opt.subnet_prefix) { + dest_guid =find_router (sa, p_pr->dgid.unicast.prefix); +if (!dest_guid) { +char gid_str[INET6_ADDRSTRLEN ];OSM_LOG (sa->p_log,OSM_LOG_VERBOSE , -"Non local DGID subnet prefix 0x%016" - PRIx64"\n" , -cl_ntoh64 (p_pr->dgid.unicast.prefix)); - -while (r != (osm_prefix_route_t *) -cl_qlist_end (&sa->p_subn-> - prefix_routes_list)) { -if (r->prefix == - p_pr->dgid.unicast.prefix - || r->prefix ==0 ) { - route = r; -break ; - } - r = (osm_prefix_route_t *) -cl_qlist_next (&r->list_item); - } - -if (!route) { -/* -This 'error' is the client's fault (bad gid) so -don't enter it as an error in our own log. -Return an error response to the client. -*/ - sa_status = -IB_SA_MAD_STATUS_INVALID_GID ; - goto Exit; - }else if (route->guid ==0 ) { -/* first router */ - p_rtr = (osm_router_t *) -cl_qmap_head (&sa-> - p_subn->rtr_guid_tbl); - }else { - p_rtr = (osm_router_t *) -cl_qmap_get (&sa->p_subn-> - rtr_guid_tbl, - route->guid); - } - -if (p_rtr == - (osm_router_t *)cl_qmap_end (&sa->p_subn-> - rtr_guid_tbl)) - { -OSM_LOG (sa->p_log,OSM_LOG_ERROR , -"ERR 1F22: " -"Off subnet DGID but router not found\n" ); - sa_status = -IB_SA_MAD_STATUS_INVALID_GID ; - goto Exit; - } - - p_rtr_port =osm_router_get_port_ptr (p_rtr); - dest_guid =osm_port_get_guid (p_rtr_port); -if (p_dgid) - *p_dgid = p_pr->dgid; +"Off subnet DGID %s, but router not " +"found\n" , +inet_ntop (AF_INET6 , p_pr->dgid.raw, + gid_str,sizeof (gid_str))); + sa_status =IB_SA_MAD_STATUS_INVALID_GID ; + goto Exit; } - } + }else + dest_guid = p_pr->dgid.unicast.interface_id; *pp_dest_port =osm_get_port_by_guid (sa->p_subn, dest_guid);if (!*pp_dest_port) {
@@ -1293,6 +1272,9 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa, sa_status =IB_SA_MAD_STATUS_INVALID_GID ; goto Exit; } + +if (p_dgid) + *p_dgid = p_pr->dgid; }else { *pp_dest_port =0 ;if (comp_mask &IB_PR_COMPMASK_DLID ) {
Signature · 6 lines
1.6.5 -- 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
Re: [PATCH] opensm/osm_sa_path_record.c: separate router guid resolution code
In reply to Sasha KhapyorskyQuoted 4 lines · Sasha Khapyorsky
Move off subnet destination (router address) resolution code to separate function to improve readability.
...
+staticib_net64_tfind_router(osm_sa_t *sa, ib_net64_t prefix)
Much better. The *sa argument to find_router() can even be const.
Rolf
--
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): 4ACA3D10.5010909-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [PATCH] opensm/osm_sa_path_record.c: separate router guid resolution code
Quoted 7 lines · Rolf Manderscheid
Quoted 4 lines · Sasha Khapyorsky
Move off subnet destination (router address) resolution code to separate function to improve readability.
...
+staticib_net64_tfind_router(osm_sa_t *sa, ib_net64_t prefix)Much better. The *sa argument to
find_router()can even be const.
Ok. This cannot hurt.
Sasha
--
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