Blame Esm/ib/include/if3.h

Packit 857059
/* BEGIN_ICS_COPYRIGHT2 ****************************************
Packit 857059
Packit 857059
Copyright (c) 2015-2017, Intel Corporation
Packit 857059
Packit 857059
Redistribution and use in source and binary forms, with or without
Packit 857059
modification, are permitted provided that the following conditions are met:
Packit 857059
Packit 857059
    * Redistributions of source code must retain the above copyright notice,
Packit 857059
      this list of conditions and the following disclaimer.
Packit 857059
    * Redistributions in binary form must reproduce the above copyright
Packit 857059
      notice, this list of conditions and the following disclaimer in the
Packit 857059
      documentation and/or other materials provided with the distribution.
Packit 857059
    * Neither the name of Intel Corporation nor the names of its contributors
Packit 857059
      may be used to endorse or promote products derived from this software
Packit 857059
      without specific prior written permission.
Packit 857059
Packit 857059
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 857059
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 857059
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 857059
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Packit 857059
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 857059
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Packit 857059
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Packit 857059
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Packit 857059
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 857059
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 857059
Packit 857059
 * ** END_ICS_COPYRIGHT2   ****************************************/
Packit 857059
Packit 857059
/************************************************************************/
Packit 857059
/*                                                                      */
Packit 857059
/* FILE NAME                                                            */
Packit 857059
/*    if3.h                                                             */
Packit 857059
/*                                                                      */
Packit 857059
/* DESCRIPTION                                                          */
Packit 857059
/*    Library calls for interface 3                                     */
Packit 857059
/*                                                                      */
Packit 857059
/*                                                                      */
Packit 857059
/* DEPENDENCIES                                                         */
Packit 857059
/*    ib_types.h                                                        */
Packit 857059
/*                                                                      */
Packit 857059
/*                                                                      */
Packit 857059
/************************************************************************/
Packit 857059
Packit 857059
Packit 857059
#ifndef __IF3___
Packit 857059
#define __IF3___
Packit 857059
Packit 857059
#include <mai_g.h>
Packit 857059
#include <iba/ib_generalServices.h>
Packit 857059
#include <iba/stl_rmpp.h>
Packit 857059
Packit 857059
/*
Packit 857059
 * Defines for service ID, service name and classes used by IF3
Packit 857059
 * and managers that it speaks to.
Packit 857059
 */
Packit 857059
Packit 857059
Packit 857059
#define FE_SERVICE_ID       (0x1100d03c34834444ull)
Packit 857059
#define FE_SERVICE_NAME     "Intel OmniPath Fabric Executive"
Packit 857059
Packit 857059
#define SM_SERVICE_ID       (0x1100d03c34822222ull)
Packit 857059
#define SM_SERVICE_ID_SEC   (0x1100d03c34822222ull)
Packit 857059
#define SM_SERVICE_NAME     "Primary Intel OmniPath Subnet Manager"
Packit 857059
#define SM_SERVICE_NAME_SEC "Secondary Intel OmniPath Subnet Manager"
Packit 857059
Packit 857059
Packit 857059
#define  IF3_REGFORCE_PORT      (1)      /* force the registration */
Packit 857059
#define  IF3_REGFORCE_FABRIC    (2)      /* force the registration */
Packit 857059
#define  IF3_REGTRY_PORT        (3)      /* only try to register   */
Packit 857059
#define  IF3_REGTRY_FABRIC      (4)      /* only try to register   */
Packit 857059
#define  IF3_CONTROL_CMD (0x0000)       /* by IF3 transport       */
Packit 857059
Packit 857059
// Intra manager reliable communication commands set in method field
Packit 857059
#define FE_MNGR_PROBE_CMD       (0x21)
Packit 857059
#define FE_MNGR_CLOSE_CMD       (0x22)
Packit 857059
#define FE_CMD_RESP             (0x25 | MAD_CM_REPLY)
Packit 857059
#define FM_CMD_SHUTDOWN         (0x40)
Packit 857059
Packit 857059
Packit 857059
#define	SM_KEY			0
Packit 857059
Packit 857059
#define SA_MAD_SET_HEADER(mad, smKey, mask) {\
Packit 857059
	(mad)->SaHdr.SmKey = smKey; \
Packit 857059
    (mad)->SaHdr.ComponentMask = mask; \
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
#define	SA_SRP_NAME_LEN		124
Packit 857059
Packit 857059
/*
Packit 857059
 * Function used to do call backs while manager is communicating over IF3.
Packit 857059
 */
Packit 857059
typedef void  (*AsyncCallBack_t)(IBhandle_t fd , Mai_t *mad, void *context);
Packit 857059
Packit 857059
typedef struct {
Packit 857059
    uint8_t         flag;	/* flag indicating whether the entry is in use */
Packit 857059
Packit 857059
    STL_LID         slid;	/* this port lid */
Packit 857059
    STL_LID         dlid;	/* the managers port lid */
Packit 857059
    STL_LID         saLid;	/* where the sa lives */
Packit 857059
    uint8_t         lmc;	/* lmc of port */
Packit 857059
    uint64_t        SubnetTO;	/* Subnet Timeout */
Packit 857059
Packit 857059
    uint16_t        mclass;	/* manager's class */
Packit 857059
Packit 857059
    uint16_t        dev;	/* our device */
Packit 857059
    uint16_t        port;	/* our port */
Packit 857059
Packit 857059
    uint8_t         sl;		/* Service Level */
Packit 857059
Packit 857059
    uint16_t        pkey;	/* the pkey to use */
Packit 857059
    uint32_t        qkey;	/* the qkey; */
Packit 857059
    uint8_t         qp;		/* destination qp */
Packit 857059
Packit 857059
    IBhandle_t      fdr;	/* handle used for recv */
Packit 857059
    IBhandle_t      fds;	/* handle used for command sends. */
Packit 857059
Packit 857059
    uint8_t         cb_flag;	/* If call back set this is true. */
Packit 857059
    AsyncCallBack_t cb_func;	/* callback function for high priority data 
Packit 857059
				 * received while speaking to FE 
Packit 857059
				 */
Packit 857059
    IBhandle_t      cb_fd;	/* callback handle to listen on currently while 
Packit 857059
				 * doing recieve from FE
Packit 857059
				 */
Packit 857059
    void           *cb_ctx;	/* context to pass to call back function */
Packit 857059
Packit 857059
    uint8_t         guidIsValid;	/* true if the guid is valid */
Packit 857059
    int8_t          vfi_guid;	/* Guid being used by vfi  - set to -1 when not initialized */
Packit 857059
    GuidInfo_t      guid;	/* Guid for port */
Packit 857059
    uint64_t        gidPrefix;	/* GID prefix */
Packit 857059
    STL_CLASS_PORT_INFO cpi;
Packit 857059
    int             cpi_valid;	/* true if classPortInfo is valid */
Packit 857059
    uint8_t         isRegistered;	/* true if Manager service is
Packit 857059
					 * registered */
Packit 857059
    uint8_t         servName[SA_SRP_NAME_LEN];	/* name of service */
Packit 857059
    uint64_t        servID;	/* service ID regiseter */
Packit 857059
    uint32_t        retries;
Packit 857059
    uint64_t        timeout;
Packit 857059
    uint8_t         rmppCreateFilters;
Packit 857059
    Pool_t          *rmppPool;
Packit 857059
    uint32_t        rmppDataLength;
Packit 857059
    uint32_t        rmppMaxCntxt;
Packit 857059
    IBhandle_t      *rmppMngrfd;
Packit 857059
    IBhandle_t      rmppGetfd; 
Packit 857059
    IBhandle_t      rmppGetTablefd; 
Packit 857059
} ManagerInfo_t;
Packit 857059
Packit 857059
Status_t if3_timeout_retry(IBhandle_t fd, uint64_t timeout, uint32_t retry);
Packit 857059
/**/
Packit 857059
/* Data structure to pass back information to call back function*/
Packit 857059
/**/
Packit 857059
Packit 857059
typedef struct
Packit 857059
{
Packit 857059
  uint32_t        msize;        /*the total message size  being sent/expected*/
Packit 857059
  uint32_t        offset;       /*the byte offset of this payload relative to message*/
Packit 857059
  uint8_t         *data;        /*pointer to the  data being passed */
Packit 857059
  uint32_t        dlen;         /*amount of data being passed in  callback*/
Packit 857059
  uint8_t         dir;          /*direction: CB_TX_DIR,CB_RX_DIR*/
Packit 857059
}CBTxRxData_t;
Packit 857059
Packit 857059
/**/
Packit 857059
/* Return values from CBTxRxFunc_t supported */
Packit 857059
/* VSTATUS_OK   - continue to get data from SA*/
Packit 857059
/* VSTATUS_DROP - terminate data reception from SA*/
Packit 857059
/**/
Packit 857059
typedef uint32_t  (*CBTxRxFunc_t)(CBTxRxData_t *arg, void* context);
Packit 857059
Packit 857059
Packit 857059
Status_t if3_register_fe(uint32_t dev, uint32_t port, uint8_t *servName, uint64_t servID, uint32_t option, IBhandle_t *pfd);
Packit 857059
Status_t if3_deregister_fe(IBhandle_t fd);
Packit 857059
Status_t if3_lid_mngr_cnx(uint32_t dev,uint32_t port, uint8_t mclass, STL_LID lid, IBhandle_t *mhdl);
Packit 857059
Status_t if3_sid_mngr_cnx(uint32_t dev,uint32_t port, uint8_t *servName, uint64_t servID, uint8_t mclass, IBhandle_t *mhdl);
Packit 857059
Packit 857059
Status_t if3_local_mngr_cnx (uint32_t dev, uint32_t port, uint8_t mclass, IBhandle_t * mhdl);
Packit 857059
Status_t if3_close_mngr_cnx(IBhandle_t mhdl);
Packit 857059
Status_t if3_close_mngr_rmpp_cnx (IBhandle_t mhdl);
Packit 857059
void STL_BasicMadInit (Mai_t * madp, uint8_t mclass, uint8_t method, uint16_t aid, uint32_t amod, STL_LID slid, STL_LID dlid, uint8_t sl);
Packit 857059
Status_t if3_mad_init(IBhandle_t fd, Mai_t *madp, uint8_t    mclass, uint8_t method, uint16_t   aid, uint32_t   amod, STL_LID dlid);
Packit 857059
Status_t if3_cntrl_cmd_send(IBhandle_t fd, uint8_t cmd);
Packit 857059
Status_t if3_open(uint32_t dev, uint32_t port, uint8_t mclass, IBhandle_t * pfd);
Packit 857059
Status_t if3_close(IBhandle_t mhdl);
Packit 857059
Status_t if3_check_sa(IBhandle_t fd, int refresh, uint16_t *hasMoved);
Packit 857059
Status_t if3_set_dlid(IBhandle_t fd, STL_LID dlid);
Packit 857059
Packit 857059
Status_t if3_mngr_locate_minfo(IBhandle_t rcv, ManagerInfo_t ** pt);
Packit 857059
Packit 857059
Status_t if3_mngr_open_cnx_fe(uint32_t dev, uint32_t port, uint16_t mclass, IBhandle_t  *fhdl);
Packit 857059
Status_t if3_mngr_close_cnx_fe(IBhandle_t  fhdl, uint8_t complete);
Packit 857059
Status_t if3_mngr_rcv_fe_data(IBhandle_t fhdl, Mai_t *fimad, uint8_t *inbuff, uint32_t *inlen);
Packit 857059
Status_t if3_mngr_get_fe_cmd(Mai_t *mad, uint16_t *cmd);
Packit 857059
Status_t if3_mngr_send_mad(IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, uint8_t *buffer, uint32_t *bufferLength, uint32_t *madRc, CBTxRxFunc_t cb, void *context);
Packit 857059
Status_t if3_mngr_send_passthru_mad (IBhandle_t fd, SA_MAD *psa, uint32_t dataLength, Mai_t *maip, uint8_t *buffer, uint32_t *bufferLength, uint32_t *madRc, CBTxRxFunc_t cb, void *context);
Packit 857059
Status_t if3_dbsync_cmd_from_mngr(IBhandle_t fd, Mai_t *maip, uint8_t *buffer, uint32_t *bufferLength, uint32_t *madRc, CBTxRxFunc_t cb, void *context);
Packit 857059
Status_t if3_dbsync_reply_to_mngr(IBhandle_t fhdl, Mai_t *fmad, uint8_t *outbuff, uint32_t outlen, uint32_t resp_status);
Packit 857059
Status_t if3_dbsync_cmd_to_mngr(IBhandle_t mhdl, uint16_t cmd, uint32_t mod, uint8_t *outbuff, uint32_t outlen, uint8_t *inbuff, uint32_t *inlen, uint32_t *resp_status);
Packit 857059
Status_t if3_dbsync_close(IBhandle_t mhdl);
Packit 857059
Packit 857059
Status_t MngrWaitHandle(IBhandle_t *ha, uint32_t count, uint64_t timeout, uint32_t *pfirst, Mai_t *maip);
Packit 857059
Packit 857059
Status_t if3_ssl_init(Pool_t *pool);
Packit 857059
void * if3_ssl_srvr_open(const char *dir, const char *fmCertificate, const char *fmPrivateKey, const char *fmCaCertificate, uint32_t fmCertChainDepth, const char *fmDHParameters, uint32_t fmCaCrlEnabled, const char *fmCaCrl);
Packit 857059
void * if3_ssl_accept(void *context, int clientfd); 
Packit 857059
int if3_ssl_read(void *session, uint8_t *buffer, int bufferLength);
Packit 857059
int if3_ssl_write(void *session, uint8_t *buffer, int bufferLength);
Packit 857059
void if3_ssl_conn_close(void *context);
Packit 857059
void if3_ssl_sess_close(void *session);
Packit 857059
Packit 857059
Status_t vfi_GetPortGuid(ManagerInfo_t *fp, uint32_t gididx);
Packit 857059
Packit 857059
Packit 857059
#endif