Allegato "r8101-1.007.00.hardy.diff.txt"
Scarica 1 diff -ruN ../r8101-1.007.00/src/r8101.h ./src/r8101.h
2 --- ../r8101-1.007.00/src/r8101.h 2008-03-31 09:57:16.000000000 +0200
3 +++ ./src/r8101.h 2008-06-27 15:20:21.000000000 +0200
4 @@ -932,6 +932,7 @@
5 void __iomem *mmio_addr; /* memory map physical address */
6 struct pci_dev *pci_dev; /* Index of PCI device */
7 struct net_device *dev;
8 + struct napi_struct napi;
9 struct net_device_stats stats; /* statistics of net device */
10 spinlock_t lock; /* spin lock flag */
11 spinlock_t phy_lock; /* spin lock flag for PHY */
12 diff -ruN ../r8101-1.007.00/src/r8101_n.c ./src/r8101_n.c
13 --- ../r8101-1.007.00/src/r8101_n.c 2008-03-31 09:53:47.000000000 +0200
14 +++ ./src/r8101_n.c 2008-06-27 15:20:21.000000000 +0200
15 @@ -176,7 +176,7 @@
16 static void rtl8101_tx_timeout(struct net_device *dev);
17 static struct net_device_stats *rtl8101_get_stats(struct net_device *dev);
18 static int rtl8101_rx_interrupt(struct net_device *, struct rtl8101_private *,
19 - void __iomem *);
20 + void __iomem *, u32 budget);
21 static int rtl8101_change_mtu(struct net_device *dev, int new_mtu);
22 static void rtl8101_down(struct net_device *dev);
23
24 @@ -187,7 +187,7 @@
25 static void rtl8101_phy_power_down (struct net_device *dev);
26
27 #ifdef CONFIG_R8101_NAPI
28 -static int rtl8101_poll(struct net_device *dev, int *budget);
29 +static int rtl8101_poll(struct napi_struct *napi, int budget);
30 #endif
31
32 static const u16 rtl8101_intr_mask =
33 @@ -2241,7 +2241,9 @@
34 goto err_out;
35 }
36
37 - SET_MODULE_OWNER(dev);
38 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) && defined(SET_MODULE_OWNER)
39 + SET_MODULE_OWNER(dev);
40 +#endif
41 SET_NETDEV_DEV(dev, &pdev->dev);
42 tp = netdev_priv(dev);
43 tp->dev = dev;
44 @@ -2640,8 +2642,9 @@
45 dev->do_ioctl = rtl8101_do_ioctl;
46
47 #ifdef CONFIG_R8101_NAPI
48 - dev->poll = rtl8101_poll;
49 - dev->weight = R8101_NAPI_WEIGHT;
50 + /*dev->poll = rtl8101_poll;*/
51 + /*dev->weight = R8101_NAPI_WEIGHT;*/
52 + netif_napi_add(dev, &tp->napi, rtl8101_poll, R8101_NAPI_WEIGHT);
53 #endif
54
55 #ifdef CONFIG_R8101_VLAN
56 @@ -2772,6 +2775,8 @@
57 INIT_DELAYED_WORK(&tp->task, NULL);
58 #endif
59
60 + napi_enable(&tp->napi);
61 +
62 rtl8101_hw_start(dev);
63
64 if (tp->esd_flag == 0) {
65 @@ -2997,9 +3002,11 @@
66 goto out;
67
68 #ifdef NAPI
69 - netif_poll_enable(dev);
70 + /*netif_poll_enable(dev); */
71 #endif
72 -
73 +
74 + napi_enable(&tp->napi);
75 +
76 rtl8101_hw_start(dev);
77
78 out:
79 @@ -3214,14 +3221,17 @@
80
81 /* Wait for any pending NAPI task to complete */
82 #ifdef NAPI
83 - netif_poll_disable(dev);
84 + /*netif_poll_disable(dev);*/
85 #endif
86
87 + napi_disable(&tp->napi);
88 +
89 rtl8101_irq_mask_and_ack(ioaddr);
90
91 #ifdef NAPI
92 - netif_poll_enable(dev);
93 + /*netif_poll_enable(dev);*/
94 #endif
95 + napi_enable(&tp->napi);
96 }
97
98 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
99 @@ -3277,7 +3287,7 @@
100
101 rtl8101_wait_for_quiescence(dev);
102
103 - rtl8101_rx_interrupt(dev, tp, tp->mmio_addr);
104 + rtl8101_rx_interrupt(dev, tp, tp->mmio_addr, ~(u32)0);
105 rtl8101_tx_clear(tp);
106
107 if (tp->dirty_rx == tp->cur_rx) {
108 @@ -3672,7 +3682,8 @@
109 static int
110 rtl8101_rx_interrupt(struct net_device *dev,
111 struct rtl8101_private *tp,
112 - void __iomem *ioaddr)
113 + void __iomem *ioaddr,
114 + u32 budget)
115 {
116 unsigned int cur_rx, rx_left;
117 unsigned int delta, count = 0;
118 @@ -3683,7 +3694,7 @@
119
120 cur_rx = tp->cur_rx;
121 rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx;
122 - rx_left = rtl8101_rx_quota(rx_left, (u32) dev->quota);
123 + rx_left = rtl8101_rx_quota(rx_left, budget);
124
125 if ((tp->RxDescArray == NULL) || (tp->Rx_skbuff == NULL)) {
126 goto rx_out;
127 @@ -3863,8 +3874,10 @@
128 RTL_W16(IntrMask, rtl8101_intr_mask & ~rtl8101_napi_event);
129 tp->intr_mask = ~rtl8101_napi_event;
130
131 - if (likely(netif_rx_schedule_prep(dev)))
132 - __netif_rx_schedule(dev);
133 +/* if (likely(netif_rx_schedule_prep(dev)))
134 + __netif_rx_schedule(dev); */
135 + if (likely(netif_rx_schedule_prep(dev, &tp->napi)))
136 + __netif_rx_schedule(dev, &tp->napi);
137 else if (netif_msg_intr(tp)) {
138 printk(KERN_INFO "%s: interrupt %04x taken in poll\n",
139 dev->name, status);
140 @@ -3873,7 +3886,7 @@
141 #else
142 /* Rx interrupt */
143 if (status & (RxOK | RxDescUnavail | RxFIFOOver)) {
144 - rtl8101_rx_interrupt(dev, tp, ioaddr);
145 + rtl8101_rx_interrupt(dev, tp, ioaddr, ~(u32)0);
146 }
147 /* Tx interrupt */
148 if (status & (TxOK | TxErr))
149 @@ -3907,21 +3920,25 @@
150 }
151
152 #ifdef CONFIG_R8101_NAPI
153 -static int rtl8101_poll(struct net_device *dev,
154 - int *budget)
155 +static int rtl8101_poll(struct napi_struct *napi,
156 + int budget)
157 {
158 - unsigned int work_done, work_to_do = min(*budget, dev->quota);
159 +/* unsigned int work_done, work_to_do = min(*budget, dev->quota);
160 struct rtl8101_private *tp = netdev_priv(dev);
161 +*/
162 + struct rtl8101_private *tp = container_of(napi, struct rtl8101_private, napi);
163 + struct net_device *dev = tp->dev;
164 void __iomem *ioaddr = tp->mmio_addr;
165 + int work_done;
166
167 - work_done = rtl8101_rx_interrupt(dev, tp, ioaddr);
168 + work_done = rtl8101_rx_interrupt(dev, tp, ioaddr, (u32) budget);
169 rtl8101_tx_interrupt(dev, tp, ioaddr);
170
171 - *budget -= work_done;
172 +/* *budget -= work_done;
173 dev->quota -= work_done;
174 -
175 - if (work_done < work_to_do) {
176 - netif_rx_complete(dev);
177 +*/
178 + if (work_done < budget) {
179 + netif_rx_complete(dev, napi);
180 tp->intr_mask = 0xffff;
181 /*
182 * 20040426: the barrier is not strictly required but the
183 @@ -3933,7 +3950,7 @@
184 RTL_W16(IntrMask, rtl8101_intr_mask);
185 }
186
187 - return (work_done >= work_to_do);
188 + return work_done;
189 }
190 #endif
191
192 @@ -3970,8 +3987,9 @@
193
194 if (!poll_locked) {
195 #ifdef NAPI
196 - netif_poll_disable(dev);
197 +/* netif_poll_disable(dev);*/
198 #endif
199 + napi_disable(&tp->napi);
200 poll_locked++;
201 }
202
203 @@ -4021,7 +4039,7 @@
204 free_irq(dev->irq, dev);
205
206 #ifdef NAPI
207 - netif_poll_enable(dev);
208 +/* netif_poll_enable(dev);*/
209 #endif
210
211 pci_free_consistent(pdev, R8101_RX_RING_BYTES, tp->RxDescArray,
Allegati
Per riferirsi agli allegati di una pagina, usare attachment:NOME_FILE, come mostrato qui sotto nell'elenco degli allegati. NON usare l'URL che si trova in corrispondenza del collegamento [scarica], potrebbe cambiare in futuro.Non รจ consentito inserire allegati su questa pagina.