if(ibmveth_alloc_buffer_pool(&adapter->rx_buff_pool[0]) || ibmveth_alloc_buffer_pool(&adapter->rx_buff_pool[1]) || ibmveth_alloc_buffer_pool(&adapter->rx_buff_pool[2])) { ibmveth_error_printk("unable to allocate buffer pools\n"); ibmveth_cleanup(adapter); return -ENOMEM; } 
/* call change_mtu to init the buffer pools based in initial mtu */ ibmveth_change_mtu(netdev, netdev->mtu); 
static int ibmveth_open(struct net_device *netdev){	struct ibmveth_adapter *adapter = netdev->priv;	u64 mac_address = 0;	int rxq_entries;	unsigned long lpar_rc;	int rc;	union ibmveth_buf_desc rxq_desc;	ibmveth_debug_printk("open starting\n");	rxq_entries =		adapter->rx_buff_pool[0].size +		adapter->rx_buff_pool[1].size +		adapter->rx_buff_pool[2].size + 1;    	adapter->buffer_list_addr = (void*) get_zeroed_page(GFP_KERNEL);	adapter->filter_list_addr = (void*) get_zeroed_page(GFP_KERNEL); 	if(!adapter->buffer_list_addr || !adapter->filter_list_addr) {		ibmveth_error_printk("unable to allocate filter or buffer list pages\n");		ibmveth_cleanup(adapter);		return -ENOMEM;	}	adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) * rxq_entries;	adapter->rx_queue.queue_addr = kmalloc(adapter->rx_queue.queue_len, GFP_KERNEL);	if(!adapter->rx_queue.queue_addr) {		ibmveth_error_printk("unable to allocate rx queue pages\n");		ibmveth_cleanup(adapter);		return -ENOMEM;	}	adapter->buffer_list_dma = dma_map_single(&adapter->vdev->dev,			adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL);	adapter->filter_list_dma = dma_map_single(&adapter->vdev->dev,			adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL);	adapter->rx_queue.queue_dma = dma_map_single(&adapter->vdev->dev,			adapter->rx_queue.queue_addr,			adapter->rx_queue.queue_len, DMA_BIDIRECTIONAL);	if((dma_mapping_error(adapter->buffer_list_dma) ) ||	   (dma_mapping_error(adapter->filter_list_dma)) ||	   (dma_mapping_error(adapter->rx_queue.queue_dma))) {		ibmveth_error_printk("unable to map filter or buffer list pages\n");		ibmveth_cleanup(adapter);		return -ENOMEM;	}	adapter->rx_queue.index = 0;	adapter->rx_queue.num_slots = rxq_entries;	adapter->rx_queue.toggle = 1;	if(ibmveth_alloc_buffer_pool(&adapter->rx_buff_pool[0]) ||	   ibmveth_alloc_buffer_pool(&adapter->rx_buff_pool[1]) ||	   ibmveth_alloc_buffer_pool(&adapter->rx_buff_pool[2]))	{		ibmveth_error_printk("unable to allocate buffer pools\n");		ibmveth_cleanup(adapter);		return -ENOMEM;	}	memcpy(&mac_address, netdev->dev_addr, netdev->addr_len);	mac_address = mac_address >> 16;	rxq_desc.desc = 0;	rxq_desc.fields.valid = 1;	rxq_desc.fields.length = adapter->rx_queue.queue_len;	rxq_desc.fields.address = adapter->rx_queue.queue_dma;	ibmveth_debug_printk("buffer list @ 0x%p\n", adapter->buffer_list_addr);	ibmveth_debug_printk("filter list @ 0x%p\n", adapter->filter_list_addr);	ibmveth_debug_printk("receive q   @ 0x%p\n", adapter->rx_queue.queue_addr);    	lpar_rc = h_register_logical_lan(adapter->vdev->unit_address,					 adapter->buffer_list_dma,					 rxq_desc.desc,					 adapter->filter_list_dma,					 mac_address);	if(lpar_rc != H_Success) {		ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc);		ibmveth_error_printk("buffer TCE:0x%x filter TCE:0x%x rxq desc:0x%lx MAC:0x%lx\n",				     adapter->buffer_list_dma,				     adapter->filter_list_dma,				     rxq_desc.desc,				     mac_address);		ibmveth_cleanup(adapter);		return -ENONET; 	}	ibmveth_debug_printk("registering irq 0x%x\n", netdev->irq);	if((rc = request_irq(netdev->irq, &ibmveth_interrupt, 0, netdev->name, netdev)) != 0) {		ibmveth_error_printk("unable to request irq 0x%x, rc %d\n", netdev->irq, rc);		do {			rc = h_free_logical_lan(adapter->vdev->unit_address);		} while (H_isLongBusy(rc) || (rc == H_Busy));		ibmveth_cleanup(adapter);		return rc;	}	netif_start_queue(netdev);	ibmveth_debug_printk("scheduling initial replenish cycle\n");	ibmveth_schedule_replenishing(adapter);	ibmveth_debug_printk("open complete\n");	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b6d35182fe62e57d368062adcc880ca35119d88e/ibmveth.c/clean/drivers/net/ibmveth.c