+
+ /* successful received packet */
+
+ /* first try to allocate new skb. If this fails
+ we drop the packet and leave the old skb there.*/
+ new_skb = netdev_alloc_skb(dev, MAX_BUF_SIZE);
+ if (!new_skb) {
+ dev->stats.rx_dropped++;
+ goto next_descr;
+ }
+ skb_ptr = descptr->skb_ptr;
+ skb_ptr->dev = priv->dev;
+ /* Do not count the CRC */
+ skb_put(skb_ptr, descptr->len - 4);
+ pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
+ MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev);
+
+ dbg(DBG_RX_DATA, "rx len x%x: %s...\n",
+ descptr->len,
+ hex2str(skb_ptr->data, obuf, sizeof(obuf)/2, '\0'));
+
+ /* Send to upper layer */
+ netif_receive_skb(skb_ptr);
+ dev->last_rx = jiffies;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += (descptr->len-4);
+
+ /* put new skb into descriptor */
+ descptr->skb_ptr = new_skb;
+ descptr->buf = cpu_to_le32(pci_map_single(priv->pdev,
+ descptr->skb_ptr->data,
+ MAX_BUF_SIZE, PCI_DMA_FROMDEVICE));
+
+next_descr:
+ /* put the descriptor back to the MAC */
+ descptr->status = DESC_STATUS_OWNER_MAC;
+ descptr = descptr->vndescp;
+ count++; /* shall we count errors and dropped packets as well? */
+ } /* while (limit && !(descptr->status & DESC_STATUS_OWNER_MAC)) */
+
+ /* remember next descriptor to check for rx */
+ priv->rx_remove_ptr = descptr;