static ClUint32T recvHashFunction(ClCntKeyHandleT key) { ClUint32T hashVal; CL_FUNC_ENTER(); if (key == 0) { RMD_DBG2((" RMD Invalid Key is passed\n")); CL_FUNC_EXIT(); return (CL_RMD_RC(CL_ERR_INVALID_PARAMETER)); } CL_FUNC_EXIT(); hashVal = ( ((ClRmdRecvKeyT *) key)->msgId & RMD_RECV_BUCKETS_MASK ); return (hashVal); }
static ClInt32T recvKeyCompare(ClCntKeyHandleT key1, ClCntKeyHandleT key2) { ClInt32T cmpResult = 0; CL_FUNC_ENTER(); if (key1 == 0 || key2 == 0) { RMD_DBG2((" RMD Invalid Key is passed\n")); CL_FUNC_EXIT(); return (CL_RMD_RC(CL_ERR_INVALID_PARAMETER)); } cmpResult = memcmp((void *) key1, (void *) key2, sizeof(ClRmdRecvKeyT)); CL_FUNC_EXIT(); return cmpResult; }
ClRcT rmdHandleAsyncRequest(ClEoExecutionObjT *pThis, ClRmdPktT *pReq, ClIocPhysicalAddressT *srcAddr, ClUint8T priority, ClUint8T protoType, ClBufferHandleT inMsgHdl) { ClRcT rc = CL_OK; ClRmdPktT replyPkt = {{ {0} }}; ClBufferHandleT replyMsg = 0; ClRmdRecordRecvT *recvRecord = NULL; ClRmdObjT *pRmdObject = (ClRmdObjT *) pThis->rmdObj; ClUint32T tmpFlags = pReq->ClRmdHdr.flags; ClBoolT recordActive = CL_FALSE; ClRmdResponeContextT responseContext = {0}; responseContext.ClRmdHdr = replyPkt.ClRmdHdr; responseContext.priority = priority; responseContext.srcAddr = *srcAddr; responseContext.pAtmostOnceRecord = recvRecord; responseContext.isInProgress = CL_FALSE; responseContext.replyType = CL_IOC_RMD_ASYNC_REPLY_PROTO; rc = clRmdPrivateDataSet((void *) &responseContext); if (CL_OK != rc) { RMD_DBG1(("%s: Unable to set RMD private data [0x%X] \r\n", __FUNCTION__, rc)); return rc; } RMD_STAT_INC(pRmdObject->rmdStats.nRmdRequests); /* * for async call and no reply needed, no retries are there so no need of * atmost once */ if ((tmpFlags & CL_RMD_CALL_NEED_REPLY) == 0) { ClUint32T clientID = pReq->ClRmdHdr.fnID >> CL_EO_CLIENT_BIT_SHIFT; clientID &= CL_EO_CLIENT_ID_MASK; RMD_DBG4((" RMD No Need to send the reply\n")); rc = clEoServiceValidate(pThis, pReq->ClRmdHdr.fnID); if (rc != CL_OK) { RMD_DBG2((" %s: Service Not Running RC : 0x%x\n", __FUNCTION__, (rc))); return rc; } if(!pThis->pServerTable || !clEoClientTableFilter(pThis->eoPort, clientID)) { rc = clEoWalk(pThis, pReq->ClRmdHdr.fnID, clRmdInvoke, inMsgHdl, 0); } else { ClVersionT version = {0}; memcpy(&version, &pReq->ClRmdHdr.clientVersion, sizeof(version)); rc = clEoWalkWithVersion(pThis, pReq->ClRmdHdr.fnID, &version, clRmdInvoke, inMsgHdl, 0); } return CL_OK; }
ClRcT clRmdParamSanityCheck(ClBufferHandleT inMsgHdl, /* Input * Message */ ClBufferHandleT outMsgHdl, /* Output * Message */ ClUint32T flags, /* Flags */ ClRmdOptionsT *pOptions, /* Optional Parameters * for RMD Call */ ClRmdAsyncOptionsT *pAsyncOptions) /* Optional * Async * Parameters * for RMD Call */ { ClRcT rc; ClUint32T size; ClUint32T inBufLen = 0; CL_FUNC_ENTER(); rc = clRmdMaxPayloadSizeGet(&size); if (rc != CL_OK) return rc; if (inMsgHdl) rc = clBufferLengthGet(inMsgHdl, &inBufLen); if (rc != CL_OK) { return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } if (inBufLen > size) return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); if (flags & ~(CL_RMD_CALL_ASYNC | CL_RMD_CALL_NEED_REPLY | CL_RMD_CALL_ATMOST_ONCE | RMD_CALL_MSG_ASYNC | CL_RMD_CALL_DO_NOT_OPTIMIZE | CL_RMD_CALL_NON_PERSISTENT | CL_RMD_CALL_IN_SESSION | CL_RMD_CALL_ORDERED )) { RMD_DBG2((" RMD INVALID FLAGS 1\n")); CL_FUNC_EXIT(); return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } if (inMsgHdl != 0) { if (inBufLen == 0) { RMD_DBG2((" RMD INVALID input buffer len 1 \n")); CL_FUNC_EXIT(); return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } } if (flags & CL_RMD_CALL_ASYNC) { if (pAsyncOptions == NULL) { if (flags & CL_RMD_CALL_NEED_REPLY) { RMD_DBG2((" RMD INVALID Outbuff parametrs for async 1\n")); CL_FUNC_EXIT(); return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } } else { if (pAsyncOptions->fpCallback == NULL) { if (flags & CL_RMD_CALL_NEED_REPLY) { RMD_DBG2((" RMD INVALID Outbuff parametrs for async 2\n")); CL_FUNC_EXIT(); return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } } } } else { if (pAsyncOptions) if (pAsyncOptions->fpCallback || pAsyncOptions->pCookie) { RMD_DBG2((" RMD INVALID Outbuff parametrs for sync 1\n")); CL_FUNC_EXIT(); return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } } if (pOptions && (pOptions->retries > _clRmdConfig.maxRetries)) { RMD_DBG2((" RMD INVALID Options retries2\n")); CL_FUNC_EXIT(); return ((CL_RMD_RC(CL_ERR_INVALID_PARAMETER))); } CL_FUNC_EXIT(); return CL_OK; }