Commit | Line | Data |
---|---|---|
34e49164 C |
1 | // search for "paren missing" |
2 | ||
3 | static void yellowfin_init_ring(struct net_device *dev) | |
4 | { | |
5 | struct yellowfin_private *yp = netdev_priv(dev); | |
6 | int i; | |
7 | ||
8 | yp->tx_full = 0; | |
9 | yp->cur_rx = yp->cur_tx = 0; | |
10 | yp->dirty_tx = 0; | |
11 | ||
12 | yp->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); | |
13 | ||
14 | for (i = 0; i < RX_RING_SIZE; i++) { | |
15 | yp->rx_ring[i].dbdma_cmd = | |
16 | cpu_to_le32(CMD_RX_BUF | INTR_ALWAYS | yp->rx_buf_sz); | |
17 | yp->rx_ring[i].branch_addr = cpu_to_le32(yp->rx_ring_dma + | |
18 | ((i+1)%RX_RING_SIZE)*sizeof(struct yellowfin_desc)); | |
19 | } | |
20 | ||
21 | for (i = 0; i < RX_RING_SIZE; i++) { | |
22 | struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz); | |
23 | yp->rx_skbuff[i] = skb; | |
24 | if (skb == NULL) | |
25 | break; | |
26 | skb->dev = dev; /* Mark as being used by this device. */ | |
27 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | |
28 | yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, | |
29 | skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | |
30 | } | |
31 | yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); | |
32 | yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | |
33 | ||
34 | #define NO_TXSTATS | |
35 | #ifdef NO_TXSTATS | |
36 | /* In this mode the Tx ring needs only a single descriptor. */ | |
37 | for (i = 0; i < TX_RING_SIZE; i++) { | |
38 | yp->tx_skbuff[i] = NULL; | |
39 | yp->tx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); | |
40 | yp->tx_ring[i].branch_addr = cpu_to_le32(yp->tx_ring_dma + | |
41 | ((i+1)%TX_RING_SIZE)*sizeof(struct yellowfin_desc)); | |
42 | } | |
43 | /* Wrap ring */ | |
44 | yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS); | |
45 | #else | |
46 | { | |
47 | int j; | |
48 | ||
49 | /* Tx ring needs a pair of descriptors, the second for the status. */ | |
50 | for (i = 0; i < TX_RING_SIZE; i++) { | |
51 | j = 2*i; | |
52 | yp->tx_skbuff[i] = 0; | |
53 | /* Branch on Tx error. */ | |
54 | yp->tx_ring[j].dbdma_cmd = cpu_to_le32(CMD_STOP); | |
55 | yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma + | |
56 | (j+1)*sizeof(struct yellowfin_desc);//paren missing | |
57 | j++; | |
58 | if (yp->flags & FullTxStatus) { | |
59 | yp->tx_ring[j].dbdma_cmd = | |
60 | cpu_to_le32(CMD_TXSTATUS | sizeof(*yp->tx_status)); | |
61 | yp->tx_ring[j].request_cnt = sizeof(*yp->tx_status); | |
62 | yp->tx_ring[j].addr = cpu_to_le32(yp->tx_status_dma + | |
63 | i*sizeof(struct tx_status_words);//paren missing | |
64 | } else { | |
65 | /* Symbios chips write only tx_errs word. */ | |
66 | yp->tx_ring[j].dbdma_cmd = | |
67 | cpu_to_le32(CMD_TXSTATUS | INTR_ALWAYS | 2); | |
68 | yp->tx_ring[j].request_cnt = 2; | |
69 | /* Om pade ummmmm... */ | |
70 | yp->tx_ring[j].addr = cpu_to_le32(yp->tx_status_dma + | |
71 | i*sizeof(struct tx_status_words) + | |
72 | &(yp->tx_status[0].tx_errs) - | |
73 | &(yp->tx_status[0])); | |
74 | } | |
75 | yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma + | |
76 | ((j+1)%(2*TX_RING_SIZE))*sizeof(struct yellowfin_desc)); | |
77 | } | |
78 | /* Wrap ring */ | |
79 | yp->tx_ring[++j].dbdma_cmd |= cpu_to_le32(BRANCH_ALWAYS | INTR_ALWAYS); | |
80 | } | |
81 | #endif | |
82 | yp->tx_tail_desc = &yp->tx_status[0]; | |
83 | return; | |
84 | } | |
85 | ||
86 | int foo () | |
87 | { | |
88 | return; | |
89 | } |