1
1
openmpi/ompi/mca/btl/usnic/btl_usnic_ext.h
Jeff Squyres fbde50e7cd Fix ibv_port_query() usnic extension usage
* Older versions of libusnic_verbs actually return 0 when querying for
  an unknown port.  So also check for a magic ID in the returned data
  to *really* know if the usnic extensions are supported.
* Use a union (in the common_verbs area) and memcpy (in the btl) to
  avoid undefined C type aliasing behavior.
* Ensure to memset the function table to 0 if the usnic extensions
  are not supported.

Submitted by Jeff Squyres, reviewed by Dave Goodell.

cmr=v1.7.5:reviewer=ompi-rm1.7

This commit was SVN r30935.
2014-03-04 22:11:47 +00:00

63 строки
1.4 KiB
C

/*
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OMPI_BTL_USNIC_EXT_H
#define OMPI_BTL_USNIC_EXT_H
#include "ompi_config.h"
#include <infiniband/verbs.h>
#include "opal_stdint.h"
typedef void *(*ompi_btl_usnic_dlsym_fn_t)(const char *name);
typedef struct {
int lookup_version;
uint64_t magic;
ompi_btl_usnic_dlsym_fn_t lookup;
} ompi_btl_usnic_query_port_table_t;
#define USNIC_PORT_QUERY_MAGIC (0x43494e7375534355ULL)
/*
* Tells libusnic_verbs to enable UDP support.
*/
typedef int (*ompi_btl_usnic_enable_udp_fn_t)(struct ibv_context *context);
/*
* Find out what the UD header length is
*/
typedef int (*ompi_btl_usnic_get_ud_header_len_fn_t)(struct ibv_context *context,
uint8_t port_num);
/*
* Struct usnic extension function pointers
*/
typedef struct {
ompi_btl_usnic_query_port_table_t qpt;
ompi_btl_usnic_enable_udp_fn_t enable_udp;
ompi_btl_usnic_get_ud_header_len_fn_t get_ud_header_len;
} ompi_btl_usnic_ext_fns_t;
/*
* Global variable of usnic extension function pointers
*/
extern ompi_btl_usnic_ext_fns_t ompi_btl_usnic_ext;
/*
* Function to initialze the global variable of usnic extension
* function pointers
*/
void ompi_btl_usnic_ext_init(struct ibv_context *ctx);
#endif /* OMPI_BTL_USNIC_EXT_H */