示例#1
0
static void remove_from_rx_queue(struct r3964_info *pInfo,
                 struct r3964_block_header *pHeader)
{
   unsigned long flags;
   struct r3964_block_header *pFind;
   
   if(pHeader==NULL)
      return;

   TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d",
          (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue );
   TRACE_Q("remove_from_rx_queue: %x, length %d",
          (int)pHeader, (int)pHeader->length );

   save_flags(flags);
   cli();

   if(pInfo->rx_first == pHeader)
   {
      /* Remove the first block in the linked list: */
      pInfo->rx_first = pHeader->next;
      
      if(pInfo->rx_first==NULL)
      {
         pInfo->rx_last = NULL;
      }
      pInfo->blocks_in_rx_queue--;
   }
   else 
   {
      /* Find block to remove: */
      for(pFind=pInfo->rx_first; pFind; pFind=pFind->next)
      {
         if(pFind->next == pHeader) 
         {
            /* Got it. */
            pFind->next = pHeader->next;
            pInfo->blocks_in_rx_queue--;
            if(pFind->next==NULL)
            {
               /* Oh, removed the last one! */
               pInfo->rx_last = pFind;
            }
            break;
         }
      }
   }

   restore_flags(flags);

   kfree(pHeader);
   TRACE_M("remove_from_rx_queue - kfree %x",(int)pHeader);

   TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d",
          (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue );
}
static void remove_from_rx_queue(struct r3964_info *pInfo,
				 struct r3964_block_header *pHeader)
{
	unsigned long flags;
	struct r3964_block_header *pFind;

	if (pHeader == NULL)
		return;

	TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d",
		pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue);
	TRACE_Q("remove_from_rx_queue: %p, length %u",
		pHeader, pHeader->length);

	spin_lock_irqsave(&pInfo->lock, flags);

	if (pInfo->rx_first == pHeader) {
		
		pInfo->rx_first = pHeader->next;

		if (pInfo->rx_first == NULL) {
			pInfo->rx_last = NULL;
		}
		pInfo->blocks_in_rx_queue--;
	} else {
		
		for (pFind = pInfo->rx_first; pFind; pFind = pFind->next) {
			if (pFind->next == pHeader) {
				
				pFind->next = pHeader->next;
				pInfo->blocks_in_rx_queue--;
				if (pFind->next == NULL) {
					
					pInfo->rx_last = pFind;
				}
				break;
			}
		}
	}

	spin_unlock_irqrestore(&pInfo->lock, flags);

	kfree(pHeader);
	TRACE_M("remove_from_rx_queue - kfree %p", pHeader);

	TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d",
		pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue);
}
示例#3
0
static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader)
{
   unsigned long flags;
   
   save_flags(flags);
   cli();

   pHeader->next = NULL;

   if(pInfo->rx_last == NULL)
   {
      pInfo->rx_first = pInfo->rx_last = pHeader;
   }
   else
   {
      pInfo->rx_last->next = pHeader;
      pInfo->rx_last = pHeader;
   }
   pInfo->blocks_in_rx_queue++;
   
   restore_flags(flags);

   TRACE_Q("add_rx_queue: %x, length = %d, rx_first = %x, count = %d",
          (int)pHeader, pHeader->length,
          (int)pInfo->rx_first, pInfo->blocks_in_rx_queue);
}
static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader)
{
   unsigned long flags;
   
   spin_lock_irqsave(&pInfo->lock, flags);

   pHeader->next = NULL;

   if(pInfo->rx_last == NULL)
   {
      pInfo->rx_first = pInfo->rx_last = pHeader;
   }
   else
   {
      pInfo->rx_last->next = pHeader;
      pInfo->rx_last = pHeader;
   }
   pInfo->blocks_in_rx_queue++;
   
   spin_unlock_irqrestore(&pInfo->lock, flags);

   TRACE_Q("add_rx_queue: %p, length = %d, rx_first = %p, count = %d",
          pHeader, pHeader->length,
          pInfo->rx_first, pInfo->blocks_in_rx_queue);
}
示例#5
0
static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
{
   struct r3964_block_header *pHeader;
   unsigned long flags;
#ifdef DEBUG_QUEUE
   struct r3964_block_header *pDump;
#endif
   
   pHeader = pInfo->tx_first;

   if(pHeader==NULL)
      return;

#ifdef DEBUG_QUEUE
   printk("r3964: remove_from_tx_queue: %x, length %d - ",
          (int)pHeader, (int)pHeader->length );
   for(pDump=pHeader;pDump;pDump=pDump->next)
	 printk("%x ", (int)pDump);
   printk("\n");
#endif


   if(pHeader->owner)
   {
      if(error_code)
      {
          add_msg(pHeader->owner, R3964_MSG_ACK, 0, 
                  error_code, NULL);
      }
      else
      {
          add_msg(pHeader->owner, R3964_MSG_ACK, pHeader->length, 
                  error_code, NULL);
      }
      wake_up_interruptible (&pInfo->read_wait);
   }

   save_flags(flags);
   cli();

   pInfo->tx_first = pHeader->next;
   if(pInfo->tx_first==NULL)
   {
      pInfo->tx_last = NULL;
   }

   restore_flags(flags);

   kfree(pHeader);
   TRACE_M("remove_from_tx_queue - kfree %x",(int)pHeader);

   TRACE_Q("remove_from_tx_queue: tx_first = %x, tx_last = %x",
          (int)pInfo->tx_first, (int)pInfo->tx_last );
}
示例#6
0
static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
{
	struct r3964_block_header *pHeader;
	unsigned long flags;
#ifdef DEBUG_QUEUE
	struct r3964_block_header *pDump;
#endif

	pHeader = pInfo->tx_first;

	if (pHeader == NULL)
		return;

#ifdef DEBUG_QUEUE
//	printk("r3964: remove_from_tx_queue: %p, length %u - ",
;
	for (pDump = pHeader; pDump; pDump = pDump->next)
;
;
#endif

	if (pHeader->owner) {
		if (error_code) {
			add_msg(pHeader->owner, R3964_MSG_ACK, 0,
				error_code, NULL);
		} else {
			add_msg(pHeader->owner, R3964_MSG_ACK, pHeader->length,
				error_code, NULL);
		}
		wake_up_interruptible(&pInfo->read_wait);
	}

	spin_lock_irqsave(&pInfo->lock, flags);

	pInfo->tx_first = pHeader->next;
	if (pInfo->tx_first == NULL) {
		pInfo->tx_last = NULL;
	}

	spin_unlock_irqrestore(&pInfo->lock, flags);

	kfree(pHeader);
	TRACE_M("remove_from_tx_queue - kfree %p", pHeader);

	TRACE_Q("remove_from_tx_queue: tx_first = %p, tx_last = %p",
		pInfo->tx_first, pInfo->tx_last);
}
示例#7
0
static void add_tx_queue(struct r3964_info *pInfo,
			 struct r3964_block_header *pHeader)
{
	unsigned long flags;

	spin_lock_irqsave(&pInfo->lock, flags);

	pHeader->next = NULL;

	if (pInfo->tx_last == NULL) {
		pInfo->tx_first = pInfo->tx_last = pHeader;
	} else {
		pInfo->tx_last->next = pHeader;
		pInfo->tx_last = pHeader;
	}

	spin_unlock_irqrestore(&pInfo->lock, flags);

	TRACE_Q("add_tx_queue %p, length %d, tx_first = %p",
		pHeader, pHeader->length, pInfo->tx_first);
}
示例#8
0
static void add_tx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader)
{
   unsigned long flags;
   
   save_flags(flags);
   cli();

   pHeader->next = NULL;

   if(pInfo->tx_last == NULL)
   {
      pInfo->tx_first = pInfo->tx_last = pHeader;
   }
   else
   {
      pInfo->tx_last->next = pHeader;
      pInfo->tx_last = pHeader;
   }
   
   restore_flags(flags);

   TRACE_Q("add_tx_queue %x, length %d, tx_first = %x", 
          (int)pHeader, pHeader->length, (int)pInfo->tx_first );
}