static void
TranspTableInit(void)
{
   uint32 i;
   CommOS_SpinLock(&transpTableLock);
   for (i = 0; i < QP_MAX_QUEUE_PAIRS; i++) {
      CommOS_WriteAtomic(&transpTable[i].holds, -1);
      transpTable[i].transp = NULL;
   }
   CommOS_SpinUnlock(&transpTableLock);
}
static inline int32
TranspTableAdd(CommTransp transp)
{
	uint32 i;

	if (!transp)
		return -1;

	CommOS_SpinLock(&transpTableLock);
	for (i = 0; i < QP_MAX_QUEUE_PAIRS; i++) {
		if ((transpTable[i].transp) == NULL) {
			transpTable[i].transp = transp;
			CommOS_WriteAtomic(&transpTable[i].holds, 1);
			CommOS_WaitQueueInit(&transpTable[i].wq);
			transp->backRef = i;
			break;
		}
	}
	CommOS_SpinUnlock(&transpTableLock);

	return 0;
}
static inline void
TranspTablePut(CommTransp transp)
{
   int32 holds;
   int32 backRef;
   if (!transp) {
      return;
   }

   backRef = transp->backRef;
   BUG_ON(backRef >= QP_MAX_QUEUE_PAIRS);

   holds = CommOS_SubReturnAtomic(&transpTable[backRef].holds, 1);
   if (holds > 0) {
      return;
   }
   BUG_ON(holds < 0);

   CommOS_SpinLock(&transpTableLock);
   CommOS_WriteAtomic(&transpTable[backRef].holds, -1);
   transpTable[backRef].transp = NULL;
   CommOS_SpinUnlock(&transpTableLock);
   DestroyTransp(transp);
}