[DAPL2] DAPL Counters & 2.0.3 extensions to support counter retrieval.
[mirror/winof/.git] / ulp / dapl2 / dapl / ibal / dapl_ibal_name_service.c
1 /*\r
2  * Copyright (c) 2007-2008 Intel Corporation. All rights reserved.\r
3  * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
4  * \r
5  * This Software is licensed under one of the following licenses:\r
6  *\r
7  * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
8  *    in the file LICENSE.txt in the root directory. The license is also\r
9  *    available from the Open Source Initiative, see\r
10  *    http://www.opensource.org/licenses/cpl.php.\r
11  *\r
12  * 2) under the terms of the "The BSD License" a copy of which is in the file\r
13  *    LICENSE2.txt in the root directory. The license is also available from\r
14  *    the Open Source Initiative, see\r
15  *    http://www.opensource.org/licenses/bsd-license.php.\r
16  *\r
17  * 3) under the terms of the "GNU General Public License (GPL) Version 2" a \r
18  *    copy of which is in the file LICENSE3.txt in the root directory. The \r
19  *    license is also available from the Open Source Initiative, see\r
20  *    http://www.opensource.org/licenses/gpl-license.php.\r
21  *\r
22  * Licensee has the right to choose one of the above licenses.\r
23  *\r
24  * Redistributions of source code must retain the above copyright\r
25  * notice and one of the license notices.\r
26  *\r
27  * Redistributions in binary form must reproduce both the above copyright\r
28  * notice, one of the license notices in the documentation\r
29  * and/or other materials provided with the distribution.\r
30  */\r
31 \r
32 /**********************************************************************\r
33  * \r
34  * MODULE: dapl_ibal_name_service.c\r
35  *\r
36  * PURPOSE: IP Name service\r
37  *\r
38  * $Id$\r
39  *\r
40  **********************************************************************/\r
41 \r
42 #include "dapl.h"\r
43 #include "dapl_adapter_util.h"\r
44 #include "dapl_evd_util.h"\r
45 #include "dapl_cr_util.h"\r
46 #include "dapl_sp_util.h"\r
47 #include "dapl_ep_util.h"\r
48 #include "dapl_ia_util.h"\r
49 #include "dapl_ibal_util.h"\r
50 #include "dapl_name_service.h"\r
51 \r
52 #define IB_INFINITE_SERVICE_LEASE   0xFFFFFFFF\r
53 #define  DAPL_ATS_SERVICE_ID        ATS_SERVICE_ID //0x10000CE100415453\r
54 #define  DAPL_ATS_NAME              ATS_NAME\r
55 #define  HCA_IPV6_ADDRESS_LENGTH    16\r
56 \r
57 extern dapl_ibal_root_t        dapl_ibal_root;\r
58 \r
59 \r
60 char *\r
61 dapli_get_ip_addr_str(DAT_SOCK_ADDR6 *ipa, char *buf)\r
62 {\r
63     int rval;\r
64     static char lbuf[24];\r
65     char *str = (buf ? buf : lbuf);\r
66   \r
67     rval = ((struct sockaddr_in *)ipa)->sin_addr.s_addr;\r
68 \r
69     sprintf(str, "%d.%d.%d.%d",\r
70                       (rval >> 0) & 0xff,\r
71                       (rval >> 8) & 0xff,\r
72                       (rval >> 16) & 0xff,\r
73                       (rval >> 24) & 0xff);\r
74     return str;\r
75 }\r
76 \r
77 \r
78 \r
79 void AL_API\r
80 dapli_ib_sa_query_cb (IN ib_query_rec_t *p_query_rec )\r
81 {\r
82     ib_api_status_t ib_status;\r
83 \r
84     if (IB_SUCCESS != p_query_rec->status)\r
85     {\r
86         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"%s: SA query callback failed %s\n",\r
87                        __FUNCTION__, ib_get_err_str(p_query_rec->status));\r
88         return;\r
89     }\r
90 \r
91     if (!p_query_rec->p_result_mad)\r
92     {\r
93         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
94                        "%s: SA query callback [no mad] @line %d\n",\r
95                        __FUNCTION__, __LINE__);\r
96         return;\r
97     }\r
98 \r
99     switch (p_query_rec->query_type)\r
100     {\r
101         case IB_QUERY_PATH_REC_BY_GIDS:\r
102         {\r
103             ib_path_rec_t                *p_path_rec;\r
104 \r
105             p_path_rec = ib_get_query_path_rec (p_query_rec->p_result_mad, 0);\r
106             if (p_path_rec) \r
107             {\r
108                 dapl_os_memcpy ((void * __ptr64) p_query_rec->query_context, \r
109                                 (void *) p_path_rec,\r
110                                 sizeof (ib_path_rec_t));\r
111                 dapl_dbg_log (\r
112                        DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
113                        "sa_query_cb: path {slid: 0x%x, dlid: 0x%x}\n",\r
114                        p_path_rec->slid, p_path_rec->dlid);\r
115             }\r
116             else\r
117             {\r
118                 dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"%s: return NULL? @line %d\n",\r
119                                __FUNCTION__, __LINE__);\r
120                 return;\r
121             }\r
122             break;\r
123         }\r
124 \r
125         case IB_QUERY_SVC_REC_BY_ID:\r
126         {\r
127             ib_service_record_t          *p_svc_rec;\r
128 \r
129             p_svc_rec = ib_get_query_svc_rec (p_query_rec->p_result_mad, 0);\r
130             if (p_svc_rec) \r
131             {\r
132                 dapl_os_memcpy ((void * __ptr64) p_query_rec->query_context, \r
133                                 (void *) p_svc_rec,\r
134                                 sizeof (ib_service_record_t));\r
135                 dapl_dbg_log (\r
136                      DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
137                      "%s: SER{0x%I64x, 0x%I64x}\n", __FUNCTION__,\r
138                      cl_hton64 (p_svc_rec->service_gid.unicast.prefix),\r
139                      cl_hton64 (p_svc_rec->service_gid.unicast.interface_id));\r
140             }\r
141             else\r
142             {\r
143                 dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"%s: return NULL? @line %d\n",\r
144                                __FUNCTION__, __LINE__);\r
145                 return;\r
146             }\r
147             break;\r
148 \r
149         }\r
150 \r
151         case IB_QUERY_USER_DEFINED:\r
152         {\r
153             ib_user_query_t    *p_user_query;\r
154 \r
155             p_user_query=(ib_user_query_t * __ptr64) p_query_rec->query_context;\r
156 \r
157             if (p_user_query)\r
158             {\r
159                 switch (p_user_query->attr_id)\r
160                 {\r
161                     case IB_MAD_ATTR_SERVICE_RECORD:\r
162                     {\r
163                         ib_service_record_t          *p_svc_rec;\r
164 \r
165                         p_svc_rec = ib_get_query_svc_rec (\r
166                                                   p_query_rec->p_result_mad, 0);\r
167                         if (p_svc_rec) \r
168                         {\r
169                             dapl_os_memcpy ((void *) p_user_query->p_attr, \r
170                                             (void *) p_svc_rec,\r
171                                             sizeof (ib_service_record_t));\r
172                             dapl_dbg_log (\r
173                                DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
174                                "%s: GID{0x" F64x ", 0x" F64x "} record count %d\n",\r
175                               __FUNCTION__,\r
176                               cl_hton64(p_svc_rec->service_gid.unicast.prefix),\r
177                               cl_hton64(p_svc_rec->service_gid.unicast.interface_id),\r
178                               p_query_rec->result_cnt);\r
179                         }\r
180                         else\r
181                         {\r
182                             dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
183                                            "%s: return NULL? @line %d\n",\r
184                                            __FUNCTION__, __LINE__);\r
185                             return;\r
186                         }\r
187                         break;\r
188 \r
189                     }\r
190                     default:\r
191                     {\r
192                         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
193                                        "%s: USER_DEFINED %d\n",\r
194                                        p_user_query->attr_id );\r
195                         break;\r
196                     }\r
197                 }\r
198             }\r
199             else\r
200             {\r
201                 dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"%s: return NULL? @line %d\n",\r
202                                __FUNCTION__, __LINE__);\r
203                 return;\r
204             }\r
205             break;\r
206         }\r
207 \r
208         default:\r
209         {\r
210             dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"%s: unsupportedTYPE %d\n",\r
211                            __FUNCTION__, p_query_rec->query_type);\r
212             break;\r
213         }\r
214 \r
215     }\r
216 \r
217     if ((ib_status = ib_put_mad (p_query_rec->p_result_mad)) != IB_SUCCESS)\r
218     {\r
219         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"%s: can not free MAD %s\n", \r
220                        __FUNCTION__, ib_get_err_str(ib_status));\r
221     } \r
222 }\r
223 \r
224 \r
225 #ifndef NO_NAME_SERVICE\r
226 \r
227 DAT_RETURN\r
228 dapls_ib_ns_map_gid (\r
229         IN        DAPL_HCA                *hca_ptr,\r
230         IN        DAT_IA_ADDRESS_PTR      p_ia_address,\r
231         OUT       GID                     *p_gid)\r
232 {\r
233     ib_user_query_t     user_query;\r
234     dapl_ibal_ca_t      *p_ca;\r
235     dapl_ibal_port_t    *p_active_port;\r
236     ib_service_record_t service_rec;\r
237     ib_api_status_t     ib_status;\r
238     ib_query_req_t      query_req;\r
239     DAT_SOCK_ADDR6      ipv6_addr;\r
240 \r
241     p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
242 \r
243     if (NULL == p_ca)\r
244     {\r
245         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
246                        "--> DsNMG: There is no HCA = %d\n", __LINE__);\r
247         return (DAT_INVALID_HANDLE);\r
248     }\r
249 \r
250     /*\r
251      * We are using the first active port in the list for\r
252      * communication. We have to get back here when we decide to support\r
253      * fail-over and high-availability.\r
254      */\r
255     p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)hca_ptr->port_num );\r
256 \r
257     if (NULL == p_active_port)\r
258     {\r
259         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
260                        "--> DsNMG: Port %d is not available = %d\n",\r
261                        hca_ptr->port_num, __LINE__);\r
262         return (DAT_INVALID_STATE);\r
263     }\r
264 \r
265     if (p_active_port->p_attr->lid == 0) \r
266     {\r
267             dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsNMG: Port %d has no LID "\r
268                            "assigned; can not operate\n", \r
269                            p_active_port->p_attr->port_num);\r
270             return (DAT_INVALID_STATE);\r
271     }\r
272 \r
273     if (!dapl_os_memcmp (p_ia_address,\r
274                          &hca_ptr->hca_address,\r
275                          HCA_IPV6_ADDRESS_LENGTH))\r
276     {\r
277         /* We are operating in the LOOPBACK mode */\r
278         p_gid->guid =p_active_port->p_attr->p_gid_table[0].unicast.interface_id;\r
279         p_gid->gid_prefix =p_active_port->p_attr->p_gid_table[0].unicast.prefix;\r
280         return DAT_SUCCESS;\r
281     }\r
282 \r
283     if (p_active_port->p_attr->link_state != IB_LINK_ACTIVE)\r
284     {\r
285         /* \r
286          * Port is DOWN; can not send or recv messages\r
287          */\r
288         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
289                         "--> DsNMG: Port %d is DOWN; can not send to fabric\n", \r
290                         p_active_port->p_attr->port_num);\r
291         return (DAT_INVALID_STATE);\r
292     }\r
293 \r
294     dapl_os_memzero (&user_query, sizeof (ib_user_query_t));\r
295     dapl_os_memzero (&service_rec, sizeof (ib_service_record_t));\r
296     dapl_os_memzero (&query_req, sizeof (ib_query_req_t));\r
297     dapl_os_memzero (&ipv6_addr, sizeof (DAT_SOCK_ADDR6));\r
298 \r
299     if (p_ia_address->sa_family == AF_INET)\r
300     {\r
301         dapl_os_memcpy (&ipv6_addr.sin6_addr.s6_addr[12], \r
302                         &((struct sockaddr_in *)p_ia_address)->sin_addr.s_addr, \r
303                         4);\r
304 #if defined(DAPL_DBG) || 1 // XXX\r
305         {\r
306             char ipa[20];\r
307 \r
308             dapl_dbg_log (DAPL_DBG_TYPE_CM, "--> DsNMG: Remote ia_address %s\n",\r
309                           dapli_get_ip_addr_str(\r
310                                            (DAT_SOCK_ADDR6*)p_ia_address, ipa));\r
311         }\r
312 #endif\r
313 \r
314     }\r
315     else\r
316     {\r
317         /*\r
318          * Assume IPv6 address\r
319          */\r
320         dapl_os_assert (p_ia_address->sa_family == AF_INET6);\r
321         dapl_os_memcpy (ipv6_addr.sin6_addr.s6_addr,\r
322                         ((DAT_SOCK_ADDR6 *)p_ia_address)->sin6_addr.s6_addr, \r
323                         HCA_IPV6_ADDRESS_LENGTH);\r
324 #if defined(DAPL_DBG) || 1 // XXX\r
325         {\r
326             int i;\r
327             uint8_t *tmp = ipv6_addr.sin6_addr.s6_addr;\r
328 \r
329             dapl_dbg_log ( DAPL_DBG_TYPE_CM, \r
330                            "--> DsNMG: Remote ia_address -  ");\r
331 \r
332             for ( i = 1; i < HCA_IPV6_ADDRESS_LENGTH; i++)\r
333             {\r
334                 dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%x:", \r
335                                tmp[i-1] );\r
336             }\r
337             dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%x\n",\r
338                            tmp[i-1] );\r
339         }\r
340 #endif\r
341 \r
342     }\r
343 \r
344     /*\r
345      * query SA for GID\r
346      */\r
347     //service_rec.service_id    = CL_HTON64 (DAPL_ATS_SERVICE_ID);\r
348     dapl_os_memcpy ( service_rec.service_name,\r
349                      ATS_NAME,\r
350                      __min(sizeof(ATS_NAME),sizeof(ib_svc_name_t)) );\r
351     dapl_os_memcpy (&service_rec.service_data8[0], \r
352                     ipv6_addr.sin6_addr.s6_addr,\r
353                     HCA_IPV6_ADDRESS_LENGTH);\r
354     service_rec.service_lease = IB_INFINITE_SERVICE_LEASE;\r
355     service_rec.service_pkey  = IB_DEFAULT_PKEY;\r
356 \r
357     user_query.method         = IB_MAD_METHOD_GETTABLE;\r
358     user_query.attr_id        = IB_MAD_ATTR_SERVICE_RECORD;\r
359     user_query.comp_mask      = IB_SR_COMPMASK_SPKEY      |\r
360                                 IB_SR_COMPMASK_SLEASE     |\r
361                                 IB_SR_COMPMASK_SNAME      |\r
362                                 IB_SR_COMPMASK_SDATA8_0   |\r
363                                 IB_SR_COMPMASK_SDATA8_1   |\r
364                                 IB_SR_COMPMASK_SDATA8_2   |\r
365                                 IB_SR_COMPMASK_SDATA8_3   |\r
366                                 IB_SR_COMPMASK_SDATA8_4   |\r
367                                 IB_SR_COMPMASK_SDATA8_5   |\r
368                                 IB_SR_COMPMASK_SDATA8_6   |\r
369                                 IB_SR_COMPMASK_SDATA8_7   |\r
370                                 IB_SR_COMPMASK_SDATA8_8   |\r
371                                 IB_SR_COMPMASK_SDATA8_9   |\r
372                                 IB_SR_COMPMASK_SDATA8_10  |\r
373                                 IB_SR_COMPMASK_SDATA8_11  |\r
374                                 IB_SR_COMPMASK_SDATA8_12  |\r
375                                 IB_SR_COMPMASK_SDATA8_13  |\r
376                                 IB_SR_COMPMASK_SDATA8_14  |\r
377                                 IB_SR_COMPMASK_SDATA8_15;\r
378 \r
379     user_query.attr_size      = sizeof (ib_service_record_t);\r
380     user_query.p_attr         = (void *)&service_rec;\r
381 \r
382     query_req.query_type      = IB_QUERY_USER_DEFINED;\r
383     query_req.p_query_input   = (void *)&user_query;\r
384     query_req.flags           = IB_FLAGS_SYNC;  /* this is a blocking call */\r
385     query_req.timeout_ms      = 1 * 1000;       /* 1 second */\r
386     query_req.retry_cnt       = 5;\r
387     /* query SA using this port */\r
388     query_req.port_guid       = p_active_port->p_attr->port_guid;\r
389     query_req.query_context   = (void *) &user_query;\r
390     query_req.pfn_query_cb    = dapli_ib_sa_query_cb;\r
391         \r
392     ib_status = ib_query (dapl_ibal_root.h_al, &query_req, NULL);\r
393         \r
394     if (ib_status != IB_SUCCESS) \r
395     {\r
396         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"ns_map_gid: status %s @line = %d\n", \r
397                 ib_get_err_str(ib_status), __LINE__);\r
398         return (dapl_ib_status_convert (ib_status));\r
399     }\r
400     else if (service_rec.service_gid.unicast.interface_id == 0)\r
401     {\r
402         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
403                        "--> %s: query SA found no record\n",__FUNCTION__); \r
404         return DAT_INVALID_PARAMETER;\r
405     }\r
406   \r
407     /* \r
408      * return the GID\r
409      */ \r
410     p_gid->guid       = service_rec.service_gid.unicast.interface_id;\r
411     p_gid->gid_prefix = service_rec.service_gid.unicast.prefix;\r
412 \r
413     return DAT_SUCCESS;\r
414 }\r
415 \r
416 \r
417 \r
418 DAT_RETURN\r
419 dapls_ib_ns_map_ipaddr (\r
420         IN        DAPL_HCA                *hca_ptr,\r
421         IN        GID                     gid,\r
422         OUT       DAT_IA_ADDRESS_PTR      p_ia_address)\r
423 {\r
424     ib_user_query_t     user_query;\r
425     dapl_ibal_ca_t      *p_ca;\r
426     dapl_ibal_port_t    *p_active_port;\r
427     ib_service_record_t service_rec;\r
428     ib_api_status_t     ib_status;\r
429     ib_query_req_t        query_req;\r
430 \r
431     p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
432 \r
433     if (NULL == p_ca)\r
434     {\r
435         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
436                        "--> DsNMI: There is no HCA = %d\n", __LINE__);\r
437         return (DAT_INVALID_HANDLE);\r
438     }\r
439 \r
440     /*\r
441      * We are using the first active port in the list for\r
442      * communication. We have to get back here when we decide to support\r
443      * fail-over and high-availability.\r
444      */\r
445     p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)hca_ptr->port_num );\r
446 \r
447     if (NULL == p_active_port)\r
448     {\r
449         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
450                        "--> DsNMI: Port %d is not available = %d\n",\r
451                        hca_ptr->port_num, __LINE__);\r
452         return (DAT_INVALID_STATE);\r
453     }\r
454 \r
455     if (p_active_port->p_attr->lid == 0) \r
456     {\r
457             dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsNMI: Port %d has no LID "\r
458                            "assigned; can not operate\n", \r
459                            p_active_port->p_attr->port_num);\r
460             return (DAT_INVALID_STATE);\r
461     }\r
462     /*else \r
463     {\r
464         // \r
465          // We are operating in the LOOPBACK mode\r
466          //\r
467         if ((gid.gid_prefix ==\r
468              p_active_port->p_attr->p_gid_table[0].unicast.prefix) &&\r
469             (gid.guid  == \r
470              p_active_port->p_attr->p_gid_table[0].unicast.interface_id))\r
471         {\r
472             dapl_os_memcpy (((DAT_SOCK_ADDR6 *)p_ia_address)->sin6_addr.s6_addr, \r
473                             hca_ptr->hca_address.sin6_addr.s6_addr,\r
474                             HCA_IPV6_ADDRESS_LENGTH);\r
475             return DAT_SUCCESS;\r
476         }\r
477         \r
478     }*/\r
479 \r
480     if (p_active_port->p_attr->link_state != IB_LINK_ACTIVE)\r
481     {\r
482                 /* \r
483          * Port is DOWN; can not send or recv messages\r
484          */\r
485                 dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsNMI: Port %d is DOWN; "\r
486                                "can not send/recv to/from fabric\n", \r
487                                p_active_port->p_attr->port_num);\r
488         return (DAT_INVALID_STATE);\r
489     }\r
490 \r
491     dapl_os_memzero (&user_query, sizeof (ib_user_query_t));\r
492     dapl_os_memzero (&service_rec, sizeof (ib_service_record_t));\r
493     dapl_os_memzero (&query_req, sizeof (ib_query_req_t));\r
494 \r
495     /*\r
496      * query SA for IPAddress\r
497      */\r
498     //service_rec.service_id    = CL_HTON64 (DAPL_ATS_SERVICE_ID);\r
499         dapl_os_memcpy( service_rec.service_name,\r
500                         ATS_NAME,\r
501                         __min (sizeof(ATS_NAME), sizeof(ib_svc_name_t)));\r
502     service_rec.service_gid.unicast.interface_id = gid.guid;\r
503     service_rec.service_gid.unicast.prefix       = gid.gid_prefix;\r
504     service_rec.service_pkey                     = IB_DEFAULT_PKEY;\r
505     service_rec.service_lease                    = IB_INFINITE_SERVICE_LEASE;\r
506 \r
507     user_query.method                            = IB_MAD_METHOD_GETTABLE;\r
508     user_query.attr_id                           = IB_MAD_ATTR_SERVICE_RECORD;\r
509 \r
510     user_query.comp_mask      = IB_SR_COMPMASK_SGID      |\r
511                                 IB_SR_COMPMASK_SPKEY     |\r
512                                 IB_SR_COMPMASK_SLEASE    |      \r
513                                 IB_SR_COMPMASK_SNAME;\r
514 \r
515     user_query.attr_size      = sizeof (ib_service_record_t);\r
516     user_query.p_attr         = (void *)&service_rec;\r
517 \r
518     query_req.query_type      = IB_QUERY_USER_DEFINED;\r
519     query_req.p_query_input   = (void *)&user_query;\r
520     query_req.flags           = IB_FLAGS_SYNC;  /* this is a blocking call */\r
521     query_req.timeout_ms      = 1 * 1000;       /* 1 second */\r
522     query_req.retry_cnt       = 5;\r
523     /* query SA using this port */\r
524     query_req.port_guid       = p_active_port->p_attr->port_guid;\r
525     query_req.query_context   = (void *) &user_query;\r
526     query_req.pfn_query_cb    = dapli_ib_sa_query_cb;\r
527 \r
528     ib_status = ib_query (dapl_ibal_root.h_al, &query_req, NULL);\r
529 \r
530     if (ib_status != IB_SUCCESS)\r
531     {\r
532         dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
533                        "ns_map_ipaddr: exits status %s @line = %d\n", \r
534                        ib_get_err_str(ib_status), __LINE__);\r
535         return (dapl_ib_status_convert (ib_status));\r
536     }\r
537   \r
538     /* ***********************\r
539      * return the IP_address\r
540      *************************/ \r
541         dapl_os_memcpy (\r
542                  (void *) &((struct sockaddr_in *)p_ia_address)->sin_addr.s_net,\r
543                  (const void *)&service_rec.service_data8[ATS_IPV4_OFFSET], 4);\r
544                     //HCA_IPV6_ADDRESS_LENGTH);\r
545     ((DAT_SOCK_ADDR6 *)p_ia_address)->sin6_family = AF_INET;\r
546         \r
547     return (DAT_SUCCESS);\r
548 }\r
549 \r
550 \r
551 /*\r
552  * dapls_ib_ns_create_gid_map()\r
553  *\r
554  * Register a ServiceRecord containing uDAPL_svc_id, IP address and GID to SA\r
555  * Other nodes can look it up by quering the SA\r
556  *\r
557  * Input:\r
558  *        hca_ptr        HCA device pointer\r
559  *\r
560  * Output:\r
561  *         none\r
562  *\r
563  * Returns:\r
564  *         DAT_SUCCESS\r
565  *         DAT_INVALID_PARAMETER\r
566  */\r
567 DAT_RETURN\r
568 dapls_ib_ns_create_gid_map (\r
569         IN        DAPL_HCA       *hca_ptr)\r
570 {\r
571     UNUSED_PARAM( hca_ptr );\r
572     return (DAT_SUCCESS);\r
573 }\r
574 \r
575 \r
576 DAT_RETURN\r
577 dapls_ib_ns_remove_gid_map (\r
578         IN        DAPL_HCA       *hca_ptr)\r
579 {\r
580     UNUSED_PARAM( hca_ptr );\r
581     return (DAT_SUCCESS);\r
582 }\r
583 \r
584 #endif /* NO_NAME_SERVICE */\r