chunk = hw->ram_size / (isdualport(hw) ? 4 : 2);
chunk = hw->ram_size / ((hw->ports + 1)*2);
static int skge_up(struct net_device *dev){	struct skge_port *skge = netdev_priv(dev);	struct skge_hw *hw = skge->hw;	int port = skge->port;	u32 chunk, ram_addr;	size_t rx_size, tx_size;	int err;	if (netif_msg_ifup(skge))		printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);	rx_size = skge->rx_ring.count * sizeof(struct skge_rx_desc);	tx_size = skge->tx_ring.count * sizeof(struct skge_tx_desc);	skge->mem_size = tx_size + rx_size;	skge->mem = pci_alloc_consistent(hw->pdev, skge->mem_size, &skge->dma);	if (!skge->mem)		return -ENOMEM;	memset(skge->mem, 0, skge->mem_size);	if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma)))		goto free_pci_mem;	if (skge_rx_fill(skge))		goto free_rx_ring;	if ((err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size,				   skge->dma + rx_size)))		goto free_rx_ring;	skge->tx_avail = skge->tx_ring.count - 1;	/* Initialze MAC */	if (hw->chip_id == CHIP_ID_GENESIS)		genesis_mac_init(hw, port);	else		yukon_mac_init(hw, port);	/* Configure RAMbuffers */	chunk = hw->ram_size / (isdualport(hw) ? 4 : 2);	ram_addr = hw->ram_offset + 2 * chunk * port;	skge_ramset(hw, rxqaddr[port], ram_addr, chunk);	skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);	BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean);	skge_ramset(hw, txqaddr[port], ram_addr+chunk, chunk);	skge_qset(skge, txqaddr[port], skge->tx_ring.to_use);	/* Start receiver BMU */	wmb();	skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);	pr_debug("skge_up completed\n");	return 0; free_rx_ring:	skge_rx_clean(skge);	kfree(skge->rx_ring.start); free_pci_mem:	pci_free_consistent(hw->pdev, skge->mem_size, skge->mem, skge->dma);	return err;}