public void dispatchCqEvent(IbvWC wc) throws IOException { if (wc.getStatus() == 5){ //flush return; } else if (wc.getStatus() != 0){ throw new IOException("Faulty operation! wc.status " + wc.getStatus()); } if (wc.getOpcode() == 128){ //receiving a message int index = (int) wc.getWr_id(); ByteBuffer recvBuffer = recvBufs[index]; int ticket = recvBuffer.getInt(0); recvBuffer.position(4); dispatchReceive(recvBuffer, ticket, index); } else if (wc.getOpcode() == 0) { //send completion int index = (int) wc.getWr_id(); ByteBuffer sendBuffer = sendBufs[index]; int ticket = sendBuffer.getInt(0); dispatchSend(ticket); } else { throw new IOException("Unkown opcode " + wc.getOpcode()); } }
private void awaitSends() throws IOException { while (sendPending > 0) { int res = poll.execute().getPolls(); if (res > 0){ for (int i = 0; i < res; i++){ if (wcList[i].getOpcode() == 128){ // System.out.println("recv from wrid " + wcList[i].getWr_id()); recvBudget++; recvPending--; } else { sendBudget++; sendPending--; } } } } }
private void awaitRecvs() throws IOException { while (recvPending > 0) { int res = poll.execute().getPolls(); if (res > 0){ for (int i = 0; i < res; i++){ if (wcList[i].getOpcode() == 128){ // System.out.println("recv from wrid " + wcList[i].getWr_id()); recvBudget++; recvPending--; } else { sendBudget++; sendPending--; } } } } }
private void awaitRecvs() throws IOException { while (recvPending > 0) { int res = poll.execute().getPolls(); if (res > 0){ for (int i = 0; i < res; i++){ if (wcList[i].getOpcode() == 128){ // System.out.println("recv from wrid " + wcList[i].getWr_id()); recvBudget++; recvPending--; } else { sendBudget++; sendPending--; } } } } }
private void awaitSends() throws IOException { while (sendPending > 0) { int res = poll.execute().getPolls(); if (res > 0){ for (int i = 0; i < res; i++){ if (wcList[i].getOpcode() == 128){ // System.out.println("recv from wrid " + wcList[i].getWr_id()); recvBudget++; recvPending--; } else { sendBudget++; sendPending--; } } } } }
private int pollRecvs() throws IOException { if (recvPending == 0){ return 0; } int recvCount = 0; while (recvCount == 0){ int res = 0; while (res == 0) { res = poll.execute().getPolls(); } for (int i = 0; i < res; i++){ if (wcList[i].getOpcode() == 128){ // System.out.println("recv from wrid " + wcList[i].getWr_id()); recvCount++; recvBudget++; recvPending--; } else { sendBudget++; sendPending--; } } } return recvCount; }
private int pollRecvs() throws IOException { if (recvPending == 0){ return 0; } int recvCount = 0; while (recvCount == 0){ int res = 0; while (res == 0) { res = poll.execute().getPolls(); } for (int i = 0; i < res; i++){ if (wcList[i].getOpcode() == 128){ // System.out.println("recv from wrid " + wcList[i].getWr_id()); recvCount++; recvBudget++; recvPending--; } else { sendBudget++; sendPending--; } } } return recvCount; }