/** * Post a receive operation on this endpoint. * * @param recvList list of receive requests. * @return a stateful verb call (SVC) ready to execute the receive operations. * @throws Exception on failure. */ public SVCPostRecv postRecv(List<IbvRecvWR> recvList) throws IOException { return qp.postRecv(recvList, null); }
/** * Post a send operation on this endpoint. * * @param sendList list of send requests. * @return a stateful verb call (SVC) ready to execute the send operations. * @throws Exception on failure. */ public SVCPostSend postSend(List<IbvSendWR> sendList) throws IOException { return qp.postSend(sendList, null); }
public IbvQP modifyQP(IbvQP qp, IbvQpAttr attr) throws IOException { NatIbvQP natQP = (NatIbvQP) qp; if (!qp.isOpen()) { throw new IOException("Trying to modify closed QP"); } int ret = nativeDispatcher._modifyQP(natQP.getObjId(), (long) 0); logger.info("modifyQP, qpnum " + qp.getQp_num()); if (ret >= 0){ return qp; } return null; }
public int destroyQP(RdmaCmId id) throws IOException { logger.info("destroyQP, id " + id.getPs()); NatCmaIdPrivate idImpl = (NatCmaIdPrivate) id; if (!idImpl.isOpen()) { throw new IOException("Trying to destroy QP with closed ID."); } if (!idImpl.getQp().isOpen()) { throw new IOException("Trying to destroy an already destroyed QP."); } idImpl.getQp().close(); int ret = nativeDispatcher._destroyQP(idImpl.getObjId()); return ret; }
@Override public void open(DaRPCServerEndpoint<DaRPCNameNodeRequest, DaRPCNameNodeResponse> endpoint) { try { LOG.info("RPC connection, qpnum " + endpoint.getQp().getQp_num()); } catch(IOException e) { LOG.info("RPC connection, cannot get qpnum, because QP is not open.\n"); } }
private SVCPostRecv getPostRecvCall(LinkedList<IbvRecvWR> wrList) throws Exception{ if (!CachingON || postRecvCall == null || !postRecvCall.isValid()) { postRecvCall = qp.postRecv(wrList, null); } return postRecvCall; }
private SVCPostSend getPostSendCall(LinkedList<IbvSendWR> wrList) throws Exception{ if (!CachingON || this.postSendCall == null || !postSendCall.isValid()) { this.postSendCall = qp.postSend(wrList, null); } return postSendCall; }
@Override public void close(DaRPCServerEndpoint<DaRPCNameNodeRequest, DaRPCNameNodeResponse> endpoint) { try { LOG.info("disconnecting RPC connection, qpnum " + endpoint.getQp().getQp_num()); endpoint.close(); } catch(Exception e){ } } }
@Override public void run() { try { InetSocketAddress addr = CrailUtils.getNameNodeAddress(); namenodeServerEp.bind(addr, DaRPCConstants.NAMENODE_DARPC_BACKLOG); LOG.info("opened server at " + addr); while (true) { DaRPCServerEndpoint<DaRPCNameNodeRequest, DaRPCNameNodeResponse> clientEndpoint = namenodeServerEp.accept(); LOG.info("accepting RPC connection, qpnum " + clientEndpoint.getQp().getQp_num()); } } catch(Exception e){ e.printStackTrace(); LOG.error(e.getMessage()); } }
private DaRPCFuture<DaRPCNameNodeRequest, DaRPCNameNodeResponse> issueRPC(DaRPCNameNodeRequest request, DaRPCNameNodeResponse response) throws IOException{ try { DaRPCFuture<DaRPCNameNodeRequest, DaRPCNameNodeResponse> future = stream.request(request, response, false); return future; } catch(IOException e){ LOG.info("ERROR: RPC failed, messagesSend " + rpcEndpoint.getMessagesSent() + ", messagesReceived " + rpcEndpoint.getMessagesReceived() + ", isConnected " + rpcEndpoint.isConnected() + ", qpNum " + rpcEndpoint.getQp().getQp_num()); throw e; } }
public IbvQP createQpProvider(DaRPCServerEndpoint<R,T> endpoint) throws IOException{ logger.info("setting up QP"); DaRPCCluster<R,T> cqProcessor = this.lookupCqProcessor(endpoint); IbvCQ cq = cqProcessor.getCQ(); IbvQP qp = this.createQP(endpoint.getIdPriv(), endpoint.getPd(), cq); cqProcessor.registerQP(qp.getQp_num(), endpoint); return qp; }
@Override public void dispatchCqEvent(IbvWC wc) throws IOException { if (wc.getStatus() == 0){ RdmaActiveFuture future = futureMap.remove(wc.getWr_id()); if (future != null){ future.signal(); if (future.isWrite()){ sendQueueAvailable.release(2); } else { sendQueueAvailable.release(); } } else { throw new IOException("cannot find future object for wrid " + wc.getWr_id() + ", status " + wc.getStatus() + ", opcount " + opcount + ", wc.qpnum " + wc.getQp_num() + ", this.qp.num " + this.qp.getQp_num() + ", connstate " + this.getConnState() + ", futureMap.size " + futureMap.size()); } } else if (wc.getStatus() == 5){ } else { throw new IOException("error in wc, status " + wc.getStatus()); } }
private void dispatchCqEvent(IbvWC wc) throws IOException { if (wc.getStatus() == 5){ // logger.info("flush wc"); } else if (wc.getStatus() != 0){ LOG.info("faulty request, status " + wc.getStatus()); } else { RdmaPassiveFuture future = futureMap.remove(wc.getWr_id()); if (future != null){ future.signal(wc.getStatus()); if (future.isWrite()){ sendQueueAvailable.release(2); } else { sendQueueAvailable.release(); } } else { throw new IOException("cannot find future object for wrid " + wc.getWr_id() + ", status " + wc.getStatus() + ", opcount " + opcount + ", ep " + this.getEndpointId() + ", wc.qpnum " + wc.getQp_num() + ", this.qp.num " + this.qp.getQp_num() + ", connstate " + this.getConnState() + ", futureMap.size " + futureMap.size()); } } }
public IbvQP createQpProvider(C endpoint) throws IOException{ IbvContext context = endpoint.getIdPriv().getVerbs(); RdmaActiveCqProcessor<C> cqProcessor = cqMap.get(context.getCmd_fd()); IbvCQ cq = cqProcessor.getCQ(); IbvQPInitAttr attr = new IbvQPInitAttr(); attr.cap().setMax_recv_sge(maxSge); attr.cap().setMax_recv_wr(maxWR); attr.cap().setMax_send_sge(maxSge); attr.cap().setMax_send_wr(maxWR); attr.setQp_type(IbvQP.IBV_QPT_RC); attr.setRecv_cq(cq); attr.setSend_cq(cq); IbvQP qp = endpoint.getIdPriv().createQP(endpoint.getPd(), attr); logger.info("registering endpoint with cq"); cqProcessor.registerQP(qp.getQp_num(), endpoint); return qp; }