skb = dev_alloc_skb(pkt_len + 2); if (skb == NULL) { printk ("%s: Memory squeeze, dropping packet.\n", dev->name); 
new_skb = dev_alloc_skb(SONIC_RBSIZE + 2); if (new_skb == NULL) { printk(KERN_ERR "%s: Memory squeeze, dropping packet.\n", dev->name); 
static void sonic_rx(struct net_device *dev){	unsigned int base_addr = dev->base_addr;	struct sonic_local *lp = (struct sonic_local *) dev->priv;	sonic_rd_t *rd = &lp->rda[lp->cur_rx & SONIC_RDS_MASK];	int status;	while (rd->in_use == 0) {		struct sk_buff *skb;		int pkt_len;		unsigned char *pkt_ptr;		status = rd->rx_status;		if (sonic_debug > 3)			printk("status %x, cur_rx %d, cur_rra %x\n",			       status, lp->cur_rx, lp->cur_rra);		if (status & SONIC_RCR_PRX) {			pkt_len = rd->rx_pktlen;			pkt_ptr =			    (char *)			    sonic_chiptomem((rd->rx_pktptr_h << 16) +					    rd->rx_pktptr_l);			if (sonic_debug > 3)				printk				    ("pktptr %p (rba %p) h:%x l:%x, bsize h:%x l:%x\n",				     pkt_ptr, lp->rba, rd->rx_pktptr_h,				     rd->rx_pktptr_l,				     SONIC_READ(SONIC_RBWC1),				     SONIC_READ(SONIC_RBWC0));			/* Malloc up new buffer. */			skb = dev_alloc_skb(pkt_len + 2);			if (skb == NULL) {				printk				    ("%s: Memory squeeze, dropping packet.\n",				     dev->name);				lp->stats.rx_dropped++;				break;			}			skb->dev = dev;			skb_reserve(skb, 2);	/* 16 byte align */			skb_put(skb, pkt_len);	/* Make room */			eth_copy_and_sum(skb, pkt_ptr, pkt_len, 0);			skb->protocol = eth_type_trans(skb, dev);			netif_rx(skb);	/* pass the packet to upper layers */			dev->last_rx = jiffies;			lp->stats.rx_packets++;			lp->stats.rx_bytes += pkt_len;		} else {			/* This should only happen, if we enable accepting broken packets. */			lp->stats.rx_errors++;			if (status & SONIC_RCR_FAER)				lp->stats.rx_frame_errors++;			if (status & SONIC_RCR_CRCR)				lp->stats.rx_crc_errors++;		}		rd->in_use = 1;		rd = &lp->rda[(++lp->cur_rx) & SONIC_RDS_MASK];		/* now give back the buffer to the receive buffer area */		if (status & SONIC_RCR_LPKT) {			/*			 * this was the last packet out of the current receice buffer			 * give the buffer back to the SONIC			 */			lp->cur_rra += sizeof(sonic_rr_t);			if (lp->cur_rra >			    (lp->rra_laddr +			     (SONIC_NUM_RRS -			      1) * sizeof(sonic_rr_t))) lp->cur_rra =				    lp->rra_laddr;			SONIC_WRITE(SONIC_RWP, lp->cur_rra & 0xffff);		} else			printk			    ("%s: rx desc without RCR_LPKT. Shouldn't happen !?\n",			     dev->name);	}	/*	 * If any worth-while packets have been received, dev_rint()	 * has done a mark_bh(NET_BH) for us and will work on them	 * when we get to the bottom-half routine.	 */}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/efcce839360fb3a7b6dedeacaec80f68b0f2d052/sonic.c/buggy/drivers/net/sonic.c