Last active
August 29, 2015 14:26
-
-
Save libratiger/eafc40b5e337bf667d17 to your computer and use it in GitHub Desktop.
The origin code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NativePostReceiveMethod extends PostReceiveMethod { | |
//.... | |
private boolean success = false; | |
public NativePostReceiveMethod(NativeRdmaJVerbs paramNativeRdmaJVerbs, MemoryBufferPool paramMemoryBufferPool, QueuePair paramQueuePair, List<ReceiveWorkRequest> paramList) throws IOException { | |
this.verbsImpl = paramNativeRdmaJVerbs; | |
this.memAlloc = paramMemoryBufferPool; | |
this.wrNatList = new LinkedList(); | |
this.sgeNatList = new LinkedList(); | |
this.qpNum = paramQueuePair.getQueuePairNum(); | |
QueuePairLimit localQueuePairLimit = paramQueuePair.getQueuePairLimit(); | |
int i = 0; | |
int j = paramList.size(); | |
if (j > localQueuePairLimit.getMaxReceiveWorkRequest()) { | |
throw new IOException("QueuePair Limit exceeded for work request"); | |
} | |
this.wrNatList.clear(); | |
this.sgeNatList.clear(); | |
int k = 0; | |
long l1 = j * NativeSizeConstants.IBV_RECV_WR_SIZE; | |
long l2 = NativeSizeConstants.IBV_RECV_WR_SIZE; | |
for (Iterator localIterator = paramList.iterator(); localIterator.hasNext(); ) { | |
localObject = (ReceiveWorkRequest) localIterator.next(); | |
NativeReceiveWorkRequest localNativeReceiveWorkRequest = new NativeReceiveWorkRequest((ReceiveWorkRequest) localObject); | |
localNativeReceiveWorkRequest.setPtr_sge_list(l1); | |
localNativeReceiveWorkRequest.setNext(l2); | |
this.wrNatList.add(localNativeReceiveWorkRequest); | |
this.sgeNatList.addAll(((ReceiveWorkRequest) localObject).getSgeList()); | |
int m = ((ReceiveWorkRequest) localObject).getSgeList().size(); | |
k += NativeSizeConstants.IBV_RECV_WR_SIZE; | |
k += m * NativeSizeConstants.IBV_SGE_SIZE; | |
l2 += NativeSizeConstants.IBV_RECV_WR_SIZE; | |
l1 += m * NativeSizeConstants.IBV_SGE_SIZE; | |
i += m; | |
} | |
Object localObject; | |
if (i > localQueuePairLimit.getMaxReceiveSge()) { | |
throw new IOException("QueuePair Limit exceeded for number of sge"); | |
} | |
this.cmd = paramMemoryBufferPool.allocate(k, MemoryBufferPool.MemType.DIRECT); | |
//... | |
this.valid = true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NativePostSendMethod extends PostSendMethod { | |
//... | |
private boolean success = false; | |
public NativePostSendMethod(NativeRdmaJVerbs paramNativeRdmaJVerbs, MemoryBufferPool paramMemoryBufferPool, QueuePair paramQueuePair, List<SendWorkRequest> paramList) throws IOException { | |
this.verbsImpl = paramNativeRdmaJVerbs; | |
this.memAlloc = paramMemoryBufferPool; | |
this.cmd = null; | |
this.wrNatList = new ArrayList(); | |
this.sgeNatList = new ArrayList(); | |
this.qpNum = paramQueuePair.getQueuePairNum(); | |
QueuePairLimit localQueuePairLimit = paramQueuePair.getQueuePairLimit(); | |
int i = 0; | |
int j = paramList.size(); | |
if (j > localQueuePairLimit.getMaxSendWorkRequest()) { | |
throw new IOException("QueuePair Limit exceeded for work request"); | |
} | |
this.wrNatList.clear(); | |
this.sgeNatList.clear(); | |
int k = 0; | |
long l1 = j * NativeSizeConstants.IBV_SEND_WR_SIZE; | |
long l2 = NativeSizeConstants.IBV_SEND_WR_SIZE; | |
for (Iterator localIterator = paramList.iterator(); localIterator.hasNext(); ) { | |
localObject1 = (SendWorkRequest) localIterator.next(); | |
LinkedList localLinkedList = new LinkedList(); | |
for (Object localObject2 = ((SendWorkRequest) localObject1).getSgeList().iterator(); ((Iterator) localObject2).hasNext(); ) { | |
ScatterGatherElement localScatterGatherElement = (ScatterGatherElement) ((Iterator) localObject2).next(); | |
NativeScatterGatherElement localNativeScatterGatherElement = new NativeScatterGatherElement(this, localScatterGatherElement); | |
localLinkedList.add(localNativeScatterGatherElement); | |
this.sgeNatList.add(localNativeScatterGatherElement); | |
} | |
localObject2 = new NativeSendWorkRequest(this, (SendWorkRequest) localObject1, localLinkedList); | |
((NativeSendWorkRequest) localObject2).setPtr_sge_list(l1); | |
((NativeSendWorkRequest) localObject2).setNext(l2); | |
this.wrNatList.add(localObject2); | |
int m = ((SendWorkRequest) localObject1).getSgeList().size();//the size of sgeList number in a SendWorkRequest | |
k += NativeSizeConstants.IBV_SEND_WR_SIZE; | |
k += m * NativeSizeConstants.IBV_SGE_SIZE; | |
l2 += NativeSizeConstants.IBV_SEND_WR_SIZE; | |
l1 += m * NativeSizeConstants.IBV_SGE_SIZE; | |
i += m; | |
} | |
Object localObject1; | |
if (i > localQueuePairLimit.getMaxSendSge()) { | |
throw new IOException("QueuePair Limit exceeded for number of sge"); | |
} | |
this.cmd = paramMemoryBufferPool.allocate(k, MemoryBufferPool.MemType.DIRECT); | |
//... | |
this.valid = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment