diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2008-03-16 18:23:24 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-25 23:16:03 -0400 |
commit | 6d8126f988556d593f13be32cbe60dacf19c2d2c (patch) | |
tree | ef007d4f9e33a9477427f7967b0264896e5824a2 /drivers | |
parent | 7deb07b1befc9f09dbdaed66c9613a3d08f1c061 (diff) |
igb trivial annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/igb/e1000_82575.h | 42 | ||||
-rw-r--r-- | drivers/net/igb/e1000_hw.h | 82 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 17 |
3 files changed, 72 insertions, 69 deletions
diff --git a/drivers/net/igb/e1000_82575.h b/drivers/net/igb/e1000_82575.h index 6604d96bd567..76ea846663db 100644 --- a/drivers/net/igb/e1000_82575.h +++ b/drivers/net/igb/e1000_82575.h | |||
@@ -61,28 +61,28 @@ | |||
61 | /* Receive Descriptor - Advanced */ | 61 | /* Receive Descriptor - Advanced */ |
62 | union e1000_adv_rx_desc { | 62 | union e1000_adv_rx_desc { |
63 | struct { | 63 | struct { |
64 | u64 pkt_addr; /* Packet buffer address */ | 64 | __le64 pkt_addr; /* Packet buffer address */ |
65 | u64 hdr_addr; /* Header buffer address */ | 65 | __le64 hdr_addr; /* Header buffer address */ |
66 | } read; | 66 | } read; |
67 | struct { | 67 | struct { |
68 | struct { | 68 | struct { |
69 | struct { | 69 | struct { |
70 | u16 pkt_info; /* RSS type, Packet type */ | 70 | __le16 pkt_info; /* RSS type, Packet type */ |
71 | u16 hdr_info; /* Split Header, | 71 | __le16 hdr_info; /* Split Header, |
72 | * header buffer length */ | 72 | * header buffer length */ |
73 | } lo_dword; | 73 | } lo_dword; |
74 | union { | 74 | union { |
75 | u32 rss; /* RSS Hash */ | 75 | __le32 rss; /* RSS Hash */ |
76 | struct { | 76 | struct { |
77 | u16 ip_id; /* IP id */ | 77 | __le16 ip_id; /* IP id */ |
78 | u16 csum; /* Packet Checksum */ | 78 | __le16 csum; /* Packet Checksum */ |
79 | } csum_ip; | 79 | } csum_ip; |
80 | } hi_dword; | 80 | } hi_dword; |
81 | } lower; | 81 | } lower; |
82 | struct { | 82 | struct { |
83 | u32 status_error; /* ext status/error */ | 83 | __le32 status_error; /* ext status/error */ |
84 | u16 length; /* Packet length */ | 84 | __le16 length; /* Packet length */ |
85 | u16 vlan; /* VLAN tag */ | 85 | __le16 vlan; /* VLAN tag */ |
86 | } upper; | 86 | } upper; |
87 | } wb; /* writeback */ | 87 | } wb; /* writeback */ |
88 | }; | 88 | }; |
@@ -97,14 +97,14 @@ union e1000_adv_rx_desc { | |||
97 | /* Transmit Descriptor - Advanced */ | 97 | /* Transmit Descriptor - Advanced */ |
98 | union e1000_adv_tx_desc { | 98 | union e1000_adv_tx_desc { |
99 | struct { | 99 | struct { |
100 | u64 buffer_addr; /* Address of descriptor's data buf */ | 100 | __le64 buffer_addr; /* Address of descriptor's data buf */ |
101 | u32 cmd_type_len; | 101 | __le32 cmd_type_len; |
102 | u32 olinfo_status; | 102 | __le32 olinfo_status; |
103 | } read; | 103 | } read; |
104 | struct { | 104 | struct { |
105 | u64 rsvd; /* Reserved */ | 105 | __le64 rsvd; /* Reserved */ |
106 | u32 nxtseq_seed; | 106 | __le32 nxtseq_seed; |
107 | u32 status; | 107 | __le32 status; |
108 | } wb; | 108 | } wb; |
109 | }; | 109 | }; |
110 | 110 | ||
@@ -119,10 +119,10 @@ union e1000_adv_tx_desc { | |||
119 | 119 | ||
120 | /* Context descriptors */ | 120 | /* Context descriptors */ |
121 | struct e1000_adv_tx_context_desc { | 121 | struct e1000_adv_tx_context_desc { |
122 | u32 vlan_macip_lens; | 122 | __le32 vlan_macip_lens; |
123 | u32 seqnum_seed; | 123 | __le32 seqnum_seed; |
124 | u32 type_tucmd_mlhl; | 124 | __le32 type_tucmd_mlhl; |
125 | u32 mss_l4len_idx; | 125 | __le32 mss_l4len_idx; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ | 128 | #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ |
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h index 161fb68764af..7b2c70a3b8cc 100644 --- a/drivers/net/igb/e1000_hw.h +++ b/drivers/net/igb/e1000_hw.h | |||
@@ -143,35 +143,35 @@ enum e1000_fc_type { | |||
143 | 143 | ||
144 | /* Receive Descriptor */ | 144 | /* Receive Descriptor */ |
145 | struct e1000_rx_desc { | 145 | struct e1000_rx_desc { |
146 | u64 buffer_addr; /* Address of the descriptor's data buffer */ | 146 | __le64 buffer_addr; /* Address of the descriptor's data buffer */ |
147 | u16 length; /* Length of data DMAed into data buffer */ | 147 | __le16 length; /* Length of data DMAed into data buffer */ |
148 | u16 csum; /* Packet checksum */ | 148 | __le16 csum; /* Packet checksum */ |
149 | u8 status; /* Descriptor status */ | 149 | u8 status; /* Descriptor status */ |
150 | u8 errors; /* Descriptor Errors */ | 150 | u8 errors; /* Descriptor Errors */ |
151 | u16 special; | 151 | __le16 special; |
152 | }; | 152 | }; |
153 | 153 | ||
154 | /* Receive Descriptor - Extended */ | 154 | /* Receive Descriptor - Extended */ |
155 | union e1000_rx_desc_extended { | 155 | union e1000_rx_desc_extended { |
156 | struct { | 156 | struct { |
157 | u64 buffer_addr; | 157 | __le64 buffer_addr; |
158 | u64 reserved; | 158 | __le64 reserved; |
159 | } read; | 159 | } read; |
160 | struct { | 160 | struct { |
161 | struct { | 161 | struct { |
162 | u32 mrq; /* Multiple Rx Queues */ | 162 | __le32 mrq; /* Multiple Rx Queues */ |
163 | union { | 163 | union { |
164 | u32 rss; /* RSS Hash */ | 164 | __le32 rss; /* RSS Hash */ |
165 | struct { | 165 | struct { |
166 | u16 ip_id; /* IP id */ | 166 | __le16 ip_id; /* IP id */ |
167 | u16 csum; /* Packet Checksum */ | 167 | __le16 csum; /* Packet Checksum */ |
168 | } csum_ip; | 168 | } csum_ip; |
169 | } hi_dword; | 169 | } hi_dword; |
170 | } lower; | 170 | } lower; |
171 | struct { | 171 | struct { |
172 | u32 status_error; /* ext status/error */ | 172 | __le32 status_error; /* ext status/error */ |
173 | u16 length; | 173 | __le16 length; |
174 | u16 vlan; /* VLAN tag */ | 174 | __le16 vlan; /* VLAN tag */ |
175 | } upper; | 175 | } upper; |
176 | } wb; /* writeback */ | 176 | } wb; /* writeback */ |
177 | }; | 177 | }; |
@@ -181,49 +181,49 @@ union e1000_rx_desc_extended { | |||
181 | union e1000_rx_desc_packet_split { | 181 | union e1000_rx_desc_packet_split { |
182 | struct { | 182 | struct { |
183 | /* one buffer for protocol header(s), three data buffers */ | 183 | /* one buffer for protocol header(s), three data buffers */ |
184 | u64 buffer_addr[MAX_PS_BUFFERS]; | 184 | __le64 buffer_addr[MAX_PS_BUFFERS]; |
185 | } read; | 185 | } read; |
186 | struct { | 186 | struct { |
187 | struct { | 187 | struct { |
188 | u32 mrq; /* Multiple Rx Queues */ | 188 | __le32 mrq; /* Multiple Rx Queues */ |
189 | union { | 189 | union { |
190 | u32 rss; /* RSS Hash */ | 190 | __le32 rss; /* RSS Hash */ |
191 | struct { | 191 | struct { |
192 | u16 ip_id; /* IP id */ | 192 | __le16 ip_id; /* IP id */ |
193 | u16 csum; /* Packet Checksum */ | 193 | __le16 csum; /* Packet Checksum */ |
194 | } csum_ip; | 194 | } csum_ip; |
195 | } hi_dword; | 195 | } hi_dword; |
196 | } lower; | 196 | } lower; |
197 | struct { | 197 | struct { |
198 | u32 status_error; /* ext status/error */ | 198 | __le32 status_error; /* ext status/error */ |
199 | u16 length0; /* length of buffer 0 */ | 199 | __le16 length0; /* length of buffer 0 */ |
200 | u16 vlan; /* VLAN tag */ | 200 | __le16 vlan; /* VLAN tag */ |
201 | } middle; | 201 | } middle; |
202 | struct { | 202 | struct { |
203 | u16 header_status; | 203 | __le16 header_status; |
204 | u16 length[3]; /* length of buffers 1-3 */ | 204 | __le16 length[3]; /* length of buffers 1-3 */ |
205 | } upper; | 205 | } upper; |
206 | u64 reserved; | 206 | __le64 reserved; |
207 | } wb; /* writeback */ | 207 | } wb; /* writeback */ |
208 | }; | 208 | }; |
209 | 209 | ||
210 | /* Transmit Descriptor */ | 210 | /* Transmit Descriptor */ |
211 | struct e1000_tx_desc { | 211 | struct e1000_tx_desc { |
212 | u64 buffer_addr; /* Address of the descriptor's data buffer */ | 212 | __le64 buffer_addr; /* Address of the descriptor's data buffer */ |
213 | union { | 213 | union { |
214 | u32 data; | 214 | __le32 data; |
215 | struct { | 215 | struct { |
216 | u16 length; /* Data buffer length */ | 216 | __le16 length; /* Data buffer length */ |
217 | u8 cso; /* Checksum offset */ | 217 | u8 cso; /* Checksum offset */ |
218 | u8 cmd; /* Descriptor control */ | 218 | u8 cmd; /* Descriptor control */ |
219 | } flags; | 219 | } flags; |
220 | } lower; | 220 | } lower; |
221 | union { | 221 | union { |
222 | u32 data; | 222 | __le32 data; |
223 | struct { | 223 | struct { |
224 | u8 status; /* Descriptor status */ | 224 | u8 status; /* Descriptor status */ |
225 | u8 css; /* Checksum start */ | 225 | u8 css; /* Checksum start */ |
226 | u16 special; | 226 | __le16 special; |
227 | } fields; | 227 | } fields; |
228 | } upper; | 228 | } upper; |
229 | }; | 229 | }; |
@@ -231,49 +231,49 @@ struct e1000_tx_desc { | |||
231 | /* Offload Context Descriptor */ | 231 | /* Offload Context Descriptor */ |
232 | struct e1000_context_desc { | 232 | struct e1000_context_desc { |
233 | union { | 233 | union { |
234 | u32 ip_config; | 234 | __le32 ip_config; |
235 | struct { | 235 | struct { |
236 | u8 ipcss; /* IP checksum start */ | 236 | u8 ipcss; /* IP checksum start */ |
237 | u8 ipcso; /* IP checksum offset */ | 237 | u8 ipcso; /* IP checksum offset */ |
238 | u16 ipcse; /* IP checksum end */ | 238 | __le16 ipcse; /* IP checksum end */ |
239 | } ip_fields; | 239 | } ip_fields; |
240 | } lower_setup; | 240 | } lower_setup; |
241 | union { | 241 | union { |
242 | u32 tcp_config; | 242 | __le32 tcp_config; |
243 | struct { | 243 | struct { |
244 | u8 tucss; /* TCP checksum start */ | 244 | u8 tucss; /* TCP checksum start */ |
245 | u8 tucso; /* TCP checksum offset */ | 245 | u8 tucso; /* TCP checksum offset */ |
246 | u16 tucse; /* TCP checksum end */ | 246 | __le16 tucse; /* TCP checksum end */ |
247 | } tcp_fields; | 247 | } tcp_fields; |
248 | } upper_setup; | 248 | } upper_setup; |
249 | u32 cmd_and_length; | 249 | __le32 cmd_and_length; |
250 | union { | 250 | union { |
251 | u32 data; | 251 | __le32 data; |
252 | struct { | 252 | struct { |
253 | u8 status; /* Descriptor status */ | 253 | u8 status; /* Descriptor status */ |
254 | u8 hdr_len; /* Header length */ | 254 | u8 hdr_len; /* Header length */ |
255 | u16 mss; /* Maximum segment size */ | 255 | __le16 mss; /* Maximum segment size */ |
256 | } fields; | 256 | } fields; |
257 | } tcp_seg_setup; | 257 | } tcp_seg_setup; |
258 | }; | 258 | }; |
259 | 259 | ||
260 | /* Offload data descriptor */ | 260 | /* Offload data descriptor */ |
261 | struct e1000_data_desc { | 261 | struct e1000_data_desc { |
262 | u64 buffer_addr; /* Address of the descriptor's buffer address */ | 262 | __le64 buffer_addr; /* Address of the descriptor's buffer address */ |
263 | union { | 263 | union { |
264 | u32 data; | 264 | __le32 data; |
265 | struct { | 265 | struct { |
266 | u16 length; /* Data buffer length */ | 266 | __le16 length; /* Data buffer length */ |
267 | u8 typ_len_ext; | 267 | u8 typ_len_ext; |
268 | u8 cmd; | 268 | u8 cmd; |
269 | } flags; | 269 | } flags; |
270 | } lower; | 270 | } lower; |
271 | union { | 271 | union { |
272 | u32 data; | 272 | __le32 data; |
273 | struct { | 273 | struct { |
274 | u8 status; /* Descriptor status */ | 274 | u8 status; /* Descriptor status */ |
275 | u8 popts; /* Packet Options */ | 275 | u8 popts; /* Packet Options */ |
276 | u16 special; | 276 | __le16 special; |
277 | } fields; | 277 | } fields; |
278 | } upper; | 278 | } upper; |
279 | }; | 279 | }; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 9f3168d6e239..aaee02e9e3f0 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -3254,6 +3254,13 @@ quit_polling: | |||
3254 | 3254 | ||
3255 | return 1; | 3255 | return 1; |
3256 | } | 3256 | } |
3257 | |||
3258 | static inline u32 get_head(struct igb_ring *tx_ring) | ||
3259 | { | ||
3260 | void *end = (struct e1000_tx_desc *)tx_ring->desc + tx_ring->count; | ||
3261 | return le32_to_cpu(*(volatile __le32 *)end); | ||
3262 | } | ||
3263 | |||
3257 | /** | 3264 | /** |
3258 | * igb_clean_tx_irq - Reclaim resources after transmit completes | 3265 | * igb_clean_tx_irq - Reclaim resources after transmit completes |
3259 | * @adapter: board private structure | 3266 | * @adapter: board private structure |
@@ -3275,9 +3282,7 @@ static bool igb_clean_tx_irq(struct igb_adapter *adapter, | |||
3275 | unsigned int total_bytes = 0, total_packets = 0; | 3282 | unsigned int total_bytes = 0, total_packets = 0; |
3276 | 3283 | ||
3277 | rmb(); | 3284 | rmb(); |
3278 | head = *(volatile u32 *)((struct e1000_tx_desc *)tx_ring->desc | 3285 | head = get_head(tx_ring); |
3279 | + tx_ring->count); | ||
3280 | head = le32_to_cpu(head); | ||
3281 | i = tx_ring->next_to_clean; | 3286 | i = tx_ring->next_to_clean; |
3282 | while (1) { | 3287 | while (1) { |
3283 | while (i != head) { | 3288 | while (i != head) { |
@@ -3312,9 +3317,7 @@ static bool igb_clean_tx_irq(struct igb_adapter *adapter, | |||
3312 | } | 3317 | } |
3313 | oldhead = head; | 3318 | oldhead = head; |
3314 | rmb(); | 3319 | rmb(); |
3315 | head = *(volatile u32 *)((struct e1000_tx_desc *)tx_ring->desc | 3320 | head = get_head(tx_ring); |
3316 | + tx_ring->count); | ||
3317 | head = le32_to_cpu(head); | ||
3318 | if (head == oldhead) | 3321 | if (head == oldhead) |
3319 | goto done_cleaning; | 3322 | goto done_cleaning; |
3320 | } /* while (1) */ | 3323 | } /* while (1) */ |
@@ -3388,7 +3391,7 @@ done_cleaning: | |||
3388 | * @vlan: descriptor vlan field as written by hardware (no le/be conversion) | 3391 | * @vlan: descriptor vlan field as written by hardware (no le/be conversion) |
3389 | * @skb: pointer to sk_buff to be indicated to stack | 3392 | * @skb: pointer to sk_buff to be indicated to stack |
3390 | **/ | 3393 | **/ |
3391 | static void igb_receive_skb(struct igb_adapter *adapter, u8 status, u16 vlan, | 3394 | static void igb_receive_skb(struct igb_adapter *adapter, u8 status, __le16 vlan, |
3392 | struct sk_buff *skb) | 3395 | struct sk_buff *skb) |
3393 | { | 3396 | { |
3394 | if (adapter->vlgrp && (status & E1000_RXD_STAT_VP)) | 3397 | if (adapter->vlgrp && (status & E1000_RXD_STAT_VP)) |